Documentation ¶
Index ¶
- Variables
- func CreateSignature(d interface{}, key *rsa.PrivateKey) (string, error)
- func JSONAddSpaces(src []byte) []byte
- func Marshal(d interface{}) ([]byte, error)
- func MarshalWithoutSpaces(d interface{}) ([]byte, error)
- func SignatureVerifierMiddleware(keys []*rsa.PublicKey) func(h http.Handler) http.Handler
- func VerifySignature(d interface{}, signature string, keys []*rsa.PublicKey) error
- func VerifySignatureFromRequest(r *http.Request, keys []*rsa.PublicKey) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoBody is returned when there's no body provided to the signature function ErrNoBody = errors.New("No body") // ErrInvalidSignature is returned when the signatures don't match ErrInvalidSignature = errors.New("Invalid signature") // ErrNoSecret is returned when there's no secret provided ErrNoSecret = errors.New("No secret provided") // ErrNoSignature is returned when there's no signature found in the request headers ErrNoSignature = errors.New("No signature provided") )
Functions ¶
func CreateSignature ¶
func CreateSignature(d interface{}, key *rsa.PrivateKey) (string, error)
CreateSignature creates a pot signature with the given secret
func JSONAddSpaces ¶
JSONAddSpaces ands spaces after the value declarations in json
func MarshalWithoutSpaces ¶
MarshalWithoutSpaces marshals json without the POT separators added.
func SignatureVerifierMiddleware ¶
SignatureVerifierMiddleware creates a middleware with the provided secret to verify the signatures in the incoming requests
func VerifySignature ¶
VerifySignature verifies the signature with the provided public key
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.