httpsig

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signer

type Signer struct {
	SignerConfig
}

Signer signs HTTP requests.

func NewSigner

func NewSigner(cfg SignerConfig) *Signer

NewSigner returns a new signer.

func (*Signer) SignRequest

func (s *Signer) SignRequest(pKey crypto.PrivateKey, pubKeyID string, req *http.Request, body []byte) error

SignRequest signs an HTTP request.

type SignerConfig

type SignerConfig struct {
	Algorithms      []httpsig.Algorithm
	DigestAlgorithm httpsig.DigestAlgorithm
	Headers         []string
	Expiration      time.Duration
}

SignerConfig contains the configuration for signing HTTP requests.

func DefaultGetSignerConfig

func DefaultGetSignerConfig() SignerConfig

DefaultGetSignerConfig returns the default configuration for signing HTTP GET requests.

func DefaultPostSignerConfig

func DefaultPostSignerConfig() SignerConfig

DefaultPostSignerConfig returns the default configuration for signing HTTP POST requests.

type Verifier

type Verifier struct {
	VerifierConfig
	// contains filtered or unexported fields
}

Verifier verifies signatures of HTTP requests.

func NewVerifier

func NewVerifier(cfg VerifierConfig, retriever actorRetriever) *Verifier

NewVerifier returns a new HTTP signature verifier.

func (*Verifier) VerifyRequest

func (v *Verifier) VerifyRequest(req *http.Request) (*url.URL, error)

VerifyRequest verifies the HTTP signature on the request and returns the IRI of the actor for the key ID in the request header. The actor IRI may then be used to verify that it matches the actor in a posted activity.

type VerifierConfig

type VerifierConfig struct {
	Algorithms []httpsig.Algorithm
}

VerifierConfig contains the configuration for verifying HTTP requests.

func DefaultVerifierConfig

func DefaultVerifierConfig() VerifierConfig

DefaultVerifierConfig returns the default configuration for verifying HTTP requests.

Jump to

Keyboard shortcuts

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