Skip to content

Commit

Permalink
doc: refactor comments
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin Li <[email protected]>
  • Loading branch information
binbin-li committed Aug 19, 2022
1 parent c05f579 commit a845b8b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions signature/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ type Envelope interface {
// NewEnvelopeFunc defines a function to create a new Envelope.
type NewEnvelopeFunc func() Envelope

// ParseEnvelopeFunc defines a function to create a new Envelope by given
// envelope bytes.
// ParseEnvelopeFunc defines a function that takes envelope bytes to create
// an Envelope.
type ParseEnvelopeFunc func([]byte) (Envelope, error)

// envelopeFunc wraps functions to create new envelopes
// envelopeFunc wraps functions to create and parsenew envelopes.
type envelopeFunc struct {
newFunc NewEnvelopeFunc
parseFunc ParseEnvelopeFunc
}

// envelopeFuncs maps envelope media type to corresponding constructors
// envelopeFuncs maps envelope media type to corresponding constructors and
// parsers.
var envelopeFuncs = make(map[string]envelopeFunc)

// RegisterEnvelopeType registers newFunc and parseFunc for the given mediaType.
Expand Down
6 changes: 3 additions & 3 deletions signature/internal/base/envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (e *Envelope) Sign(req *signature.SignRequest) ([]byte, error) {
//
// Reference: https://github.com/notaryproject/notaryproject/blob/main/trust-store-trust-policy-specification.md#steps
func (e *Envelope) Verify() (*signature.Payload, *signature.SignerInfo, error) {
// validation before the core verify process
// validation before the core verify process.
if len(e.Raw) == 0 {
return nil, nil, &signature.MalformedSignatureError{}
}
Expand All @@ -51,13 +51,13 @@ func (e *Envelope) Verify() (*signature.Payload, *signature.SignerInfo, error) {
return nil, nil, err
}

// core verify process
// core verify process.
payload, signerInfo, err := e.Envelope.Verify()
if err != nil {
return nil, nil, err
}

// validation after the core verify process
// validation after the core verify process.
if err = validatePayload(payload); err != nil {
return nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion signature/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type SignedAttributes struct {
// Reference: https://github.com/notaryproject/notaryproject/blob/main/signature-specification.md#unsigned-attributes
type UnsignedAttributes struct {
// SigningAgent provides the identifier of the software (e.g. Notation) that
// produced the signature on behalf of the user.
// produces the signature on behalf of the user.
SigningAgent string
}

Expand Down

0 comments on commit a845b8b

Please sign in to comment.