hashTokenFactory

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type H added in v0.1.2

type H struct {
	// contains filtered or unexported fields
}

H is the struct for the hashTokenFactory that can be used to validate that a hash given matches the hash of the request body using the secret from the SecretGetter.

func New

func New(hashType string, newHashFunc func() hash.Hash, secretGetter SecretGetter) (H, error)

New returns the hash token factory to be used to validate a request.

func (H) ParseAndValidate added in v0.1.2

func (htf H) ParseAndValidate(ctx context.Context, req *http.Request, _ bascule.Authorization, value string) (bascule.Token, error)

ParseAndValidate takes the hash given and validates that it matches the body hashed with the expected secret.

type SecretGetter

type SecretGetter interface {
	GetSecret() (string, error)
}

SecretGetter gets the secret to use when hashing. If getting the secret is unsuccessful, an error can be returned.

Jump to

Keyboard shortcuts

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