Documentation ¶
Overview ¶
An implementation of HTTP Signatures
Index ¶
- func DecodeKey(s string) (pri PrivateKey, pub PublicKey, err error)
- func EncodeKey(i interface{}) (string, error)
- func SignRequest(keyname string, key PrivateKey, req *http.Request, content []byte)
- func VerifyRequest(req *http.Request, content []byte, ...) (string, error)
- type KeyType
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeKey ¶
func DecodeKey(s string) (pri PrivateKey, pub PublicKey, err error)
Unmarshall an ASCII string into (optional) private and public keys
func SignRequest ¶
func SignRequest(keyname string, key PrivateKey, req *http.Request, content []byte)
Sign a request and add Signature header
func VerifyRequest ¶
func VerifyRequest(req *http.Request, content []byte, lookupPubkey func(string) (PublicKey, error)) (string, error)
Verify the Signature header for a request is valid. The request body should be provided separately. The lookupPubkey function takes a keyname and returns a public key. Returns keyname if known, and/or error.
Types ¶
type PrivateKey ¶
type PrivateKey struct { Type KeyType Key interface{} }
func (PrivateKey) Sign ¶
func (privkey PrivateKey) Sign(msg []byte) []byte
Click to show internal directories.
Click to hide internal directories.