Skip to content

Commit

Permalink
documentation verbiage
Browse files Browse the repository at this point in the history
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
  • Loading branch information
ramonpetgrave64 committed Apr 10, 2024
1 parent 720c0ec commit dfc1274
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions verifiers/internal/gha/npm_sigstore_tuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type sigstoreTufClient interface {
GetTarget(target string) ([]byte, error)
}

// newSigstoreTufClient Get a Sigstore TUF client, which itself is a wrapper around the official TUF client.
// newSigstoreTufClient gets a Sigstore TUF client, which itself is a wrapper around the official TUF client.
func newSigstoreTufClient() (*sigstoreTuf.Client, error) {
opts := sigstoreTuf.DefaultOptions()
client, err := sigstoreTuf.New(opts)
Expand All @@ -53,7 +53,7 @@ func newSigstoreTufClient() (*sigstoreTuf.Client, error) {
return client, nil
}

// getNpmjsKeysTarget Fetch and parse the keys.json file in Sigstore's root for npmjs
// getNpmjsKeysTarget will fetch and parse the keys.json file in Sigstore's root for npmjs
// The inner TUF client will verify this "blob" is signed with correct delegate TUF roles
// https://github.com/sigstore/root-signing/blob/5fd11f7ec0a993b0f20c335b33e53cfffb986b2e/repository/repository/targets/registry.npmjs.org/7a8ec9678ad824cdccaa7a6dc0961caf8f8df61bc7274189122c123446248426.keys.json#L4
func getNpmjsKeysTarget(client sigstoreTufClient, targetPath string) (*npmjsKeysTarget, error) {
Expand All @@ -68,7 +68,7 @@ func getNpmjsKeysTarget(client sigstoreTufClient, targetPath string) (*npmjsKeys
return &keys, nil
}

// getKeyDataWithNpmjsKeysTarget Given our set of keys, return the target key's material.
// getKeyDataWithNpmjsKeysTarget returns the target key's material, given our set of keys, return the target key's material.
// We may also want to check the existing ValidFor.Start (and a potential future ValidFor.End).
func getKeyDataWithNpmjsKeysTarget(keys *npmjsKeysTarget, keyID, keyUsage string) (string, error) {
for _, key := range keys.Keys {
Expand All @@ -79,8 +79,7 @@ func getKeyDataWithNpmjsKeysTarget(keys *npmjsKeysTarget, keyID, keyUsage string
return "", fmt.Errorf("%w: 'keyId': %s, 'keyUsage':%s", errorMissingNpmjsKeyIDKeyUsage, keyID, keyUsage)
}

// getKeyDataFromSigstoreTuf given a keyid and keyusage, retriive the keyfile from sigstore's TUF root,
// parse the file and return the specific key material.
// getKeyDataFromSigstoreTuf retrieves the keyfile from sigstore's TUF root, parses the file and returns the target key's material.
// See documentation for getNpmjsKeysTarget
//
// example params:
Expand Down

0 comments on commit dfc1274

Please sign in to comment.