You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
733 B
Go
30 lines
733 B
Go
package yaml
|
|
|
|
import "errors"
|
|
|
|
type (
|
|
// Signature is a resource that provides an hmac
|
|
// signature of combined resources. This signature
|
|
// can be used to validate authenticity and prevent
|
|
// tampering.
|
|
Signature struct {
|
|
Version string `json:"version,omitempty"`
|
|
Kind string `json:"kind"`
|
|
Hmac string `json:"hmac"`
|
|
}
|
|
)
|
|
|
|
// GetVersion returns the resource version.
|
|
func (s *Signature) GetVersion() string { return s.Version }
|
|
|
|
// GetKind returns the resource kind.
|
|
func (s *Signature) GetKind() string { return s.Kind }
|
|
|
|
// Validate returns an error if the signature is invalid.
|
|
func (s Signature) Validate() error {
|
|
if s.Hmac == "" {
|
|
return errors.New("yaml: invalid signature. missing hash")
|
|
}
|
|
return nil
|
|
}
|