httpsign

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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

func RequiredFields() lib.Fields

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.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL