Documentation
¶
Index ¶
- Constants
- Variables
- func Client(privateKey ed25519.PrivateKey, keyID string) *http.Client
- func ParsePrivateKeyPEM(pemBytes []byte) (ed25519.PrivateKey, error)
- func RequiredFields() lib.Fields
- func SignRequest(req *http.Request, privateKey ed25519.PrivateKey, keyID string, nonce string) error
- type Transport
Constants ¶
View Source
const SignatureName = "sig1"
SignatureName is the preferred Signature / Signature-Input dictionary label.
Variables ¶
View Source
var RequiredComponents = []string{"@method", "@path", "@query", "content-digest"}
RequiredComponents are the covered components the gateway requires.
Functions ¶
func Client ¶
func Client(privateKey ed25519.PrivateKey, keyID string) *http.Client
Client returns an *http.Client that signs outbound requests.
func ParsePrivateKeyPEM ¶
func ParsePrivateKeyPEM(pemBytes []byte) (ed25519.PrivateKey, error)
ParsePrivateKeyPEM parses a PKCS#8 or PKIX Ed25519 private key PEM.
func RequiredFields ¶
RequiredFields returns the httpsign Fields list used for signing and verifying.
func SignRequest ¶
func SignRequest(req *http.Request, privateKey ed25519.PrivateKey, keyID string, nonce string) error
SignRequest adds Content-Digest, Signature-Input, and Signature headers to req. The request body is read (if present), digested, restored, and signed. nonce may be empty to generate a random nonce.
Types ¶
type Transport ¶
type Transport struct {
Base http.RoundTripper
PrivateKey ed25519.PrivateKey
KeyID string
}
Transport is an http.RoundTripper that signs each request before forwarding.
Click to show internal directories.
Click to hide internal directories.