MCPcopy Create free account
hub / github.com/github/gh-aw / getRepoPublicKey

Function getRepoPublicKey

pkg/cli/secret_set_command.go:231–241  ·  view source on GitHub ↗
(client *api.RESTClient, owner, repo string)

Source from the content-addressed store, hash-verified

229}
230
231func getRepoPublicKey(client *api.RESTClient, owner, repo string) (*repoPublicKey, error) {
232 var key repoPublicKey
233 path := fmt.Sprintf("repos/%s/%s/actions/secrets/public-key", owner, repo)
234 if err := client.Get(path, &key); err != nil {
235 return nil, fmt.Errorf("get public key: %w", err)
236 }
237 if key.ID == "" || key.Key == "" {
238 return nil, errors.New("public key response missing key_id or key")
239 }
240 return &key, nil
241}
242
243// encryptWithPublicKey encrypts plaintext using NaCl's sealed box construction
244// (Curve25519 + XSalsa20 + Poly1305) as required by GitHub's Actions Secrets API.

Callers 1

setRepoSecretFunction · 0.85

Calls 2

GetMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected