dchttpsig

package
v0.0.0-...-01615c8 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestTarget = "(request-target)"
	Created       = "(created)"
	Expires       = "(expires)"

	HS2019 = "hs2019" // Special algorithm value

	DefaultExpiryTime = 60 // seconds
)

Variables

View Source
var (
	ErrInvalidSignatureAlgorithm = errors.New("invalid signature algorithm")
	ErrUnsupportedHashAlgorithm  = errors.New("unsupported hash algorithm")
	ErrUnsupportedKeyFormat      = errors.New("unsupported key format")
	ErrSignatureExpired          = errors.New("signature expired")
	ErrVerification              = errors.New("verification error")
	ErrMissingSharedSecret       = errors.New("missing shared secret for HMAC")
	ErrMissingPrivateKey         = errors.New("missing private key")
	ErrMissingPublicKey          = errors.New("missing public key")
	ErrAlgorithmMismatch         = errors.New("algorithm mismatch for the given key")
	ErrInvalidCreationTime       = errors.New("signature creation time is outside allowed clock skew")
	ErrRequiredHeaderMissing     = errors.New("required header not listed in signature parameters")
)
View Source
var (
	DefaultRequestHeaderNames  = []string{RequestTarget, "date", "digest", "host"}
	DefaultResponseHeaderNames = []string{"date", "digest"}
)

Functions

func NewRequestVerifier

func NewRequestVerifier(req *http.Request, signatureParametersString string) (*verifier, error)

func NewResponseVerifier

func NewResponseVerifier(res *http.Response, signatureParametersString string) (*verifier, error)

func SignRequest

func SignRequest(req *http.Request, signOptions *SignOptions) error

func SignResponse

func SignResponse(res *http.Response, signOptions *SignOptions) error

Types

type SignOptions

type SignOptions = common.SignOptions

type VerifyOptions

type VerifyOptions = common.VerifyOptions

Jump to

Keyboard shortcuts

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