sigbase

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	Values map[string]string

	// Header is an HTTP header with
	// key/value pairs that have been added to the base.
	//
	// Header is intended for use in HTTP request middleware
	// rather than for signature verification.
	//
	// The header values are copied as-is from the input request
	// and whitespace trimming / obsolete line folding is not
	// performed on these.
	Header http.Header
}

The signature base is used to derive the canonicalized HTTP message components covered by the signature.

See: https://www.rfc-editor.org/rfc/rfc9421.html#name-creating-the-signature-base

func Derive

func Derive(params sigparams.Params, w http.ResponseWriter, req *http.Request, digester contentdigest.Digester) (*Base, error)

Derive a signature base.

When using this in the client context, 'w' may be set to nil.

func New

func New() *Base

func (Base) BodyIsCovered

func (b Base) BodyIsCovered() bool

BodyIsCovered is true if the base has 'content-length' and 'content-digest'.

func (Base) CanonicalString

func (b Base) CanonicalString(params sigparams.Params) (string, error)

CanonicalString returns the canonical signing string based on the signature parameters.

params.CoveredComponents is used to determine the order which covered components are printed to the canonical string.

type Hasher

type Hasher interface {
	io.Writer
	Sum() []byte
}

Jump to

Keyboard shortcuts

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