Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrorCodeSigningError errors.GoCode = "signing.signature.error" ErrorCodeBadSignature errors.GoCode = "signing.signature.bad" ErrorCodeSignatureMisMatch errors.GoCode = "signing.signature.mismatch" ErrorCodeSignatureExpired errors.GoCode = "signing.signature.expired" ErrorSignerAlgorithm errors.GoCode = "signing.signer.algorithm" )
Variables ¶
View Source
var ( ErrSigning = errors.New( ErrorCodeSigningError, "error signing data", ) ErrBadSignature = errors.New( ErrorCodeBadSignature, "bad signature", ErrSigning, ) ErrSignatureMismatch = errors.New( ErrorCodeSignatureMisMatch, "signature mismatch", ErrBadSignature, ) ErrSignatureExpired = errors.New( ErrorCodeSignatureExpired, "signature expired", ErrBadSignature, ) ErrUnknownSignatureAlgorithm = errors.New( ErrorSignerAlgorithm, "unknown signature algorithm", ErrSigning, ) )
Functions ¶
func DecodeString ¶
func EncodeToString ¶
func RegisterSignatureAlgos ¶
func RegisterSignatureAlgos(algo ...Algorithm)
Types ¶
type Algorithm ¶
type Algorithm interface {
Name() string
Signature(ctx context.Context, data, salt, key []byte) ([]byte, error)
Verify(ctx context.Context, data, signature, salt, key []byte) error
}
func GetSignatureAlgo ¶
type SignatureAlgorithm ¶
type SignatureAlgorithm struct {
Algorithm string
SignatureFn func(ctx context.Context, data, salt, key []byte) ([]byte, error)
VerifyFn func(ctx context.Context, data, signature []byte, salt, key []byte) error
}
func (*SignatureAlgorithm) Name ¶
func (s *SignatureAlgorithm) Name() string
Click to show internal directories.
Click to hide internal directories.