hmac

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSignatureHeaderButNoSecret = errors.New("secret not configured for validating webhook signature")
	ErrSecretButNoSignatureHeader = errors.New("secret configured but no signature header found in request")
	ErrMultipleSignatureHeaders   = errors.New("multiple signature headers found")
	ErrInvalidSignature           = errors.New("invalid signature in request")
)

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	Secret     config.SecretSource `json:"secret"`
	HeaderName string              `json:"headerName"`

	CustomValidator func(bodyData []byte, secret, expectedSignature string) bool `json:"-"`
}

func (Authentication) CheckSignature

func (a Authentication) CheckSignature(req webhook.ValidatingRequest) error

CheckSignature will read the webhook signature header and the given secret for validating the webhook payload. It will fail if there is a mismatch in the signatures

func (Authentication) Validate

func (a Authentication) Validate() error

Validate checks if the HMAC configuration is valid. It requires that both secret and headerName are set

Jump to

Keyboard shortcuts

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