validation

package
v0.0.0-...-1f8cd32 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-3-Clause, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilSecretKeyStore occurs when the provided secretKeyStore is nil
	ErrNilSecretKeyStore = errors.New("nil secretKeyStore")
)

Functions

This section is empty.

Types

type APIVersionMismatchError

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

APIVersionMismatchError represents an error because a webhooks event has an API version that this version of the SDK does not support.

func NewAPIVersionMismatchError

func NewAPIVersionMismatchError(eventAPIVersion, sdkAPIVersion string) *APIVersionMismatchError

NewAPIVersionMismatchError creates a APIVersionMismatchError with the given eventAPIVersion and sdkAPIVersion

func (*APIVersionMismatchError) Error

func (ame *APIVersionMismatchError) Error() string

Error implements the error interface

func (*APIVersionMismatchError) EventAPIVersion

func (ame *APIVersionMismatchError) EventAPIVersion() string

EventAPIVersion represents the APIVersion found in the event

func (*APIVersionMismatchError) SDKAPIVersion

func (ame *APIVersionMismatchError) SDKAPIVersion() string

SDKAPIVersion represents the APIVersion found in the SDK

type SecretKeyStore

type SecretKeyStore interface {
	// GetSecretKey returns the secretKey for the given keyID
	GetSecretKey(string) (string, error)
}

SecretKeyStore represents a store of secret keys. Implementations could store secret keys in a database, on disk, etc. Thread-safe.

type SignatureValidationError

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

SignatureValidationError represents an error while validating webhooks signatures.

func NewSignatureValidationError

func NewSignatureValidationError(message string) *SignatureValidationError

NewSignatureValidationError creates a SignatureValidationError with the given message

func (*SignatureValidationError) Error

func (sve *SignatureValidationError) Error() string

Error implements the Error interface

type SignatureValidator

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

SignatureValidator is a validator for webhooks signatures. Immutable and thread-safe.

func NewSignatureValidator

func NewSignatureValidator(secretKeyStore SecretKeyStore) (*SignatureValidator, error)

NewSignatureValidator creates a signature validator with the given secretKeyStore

func (*SignatureValidator) SecretKeyStore

func (v *SignatureValidator) SecretKeyStore() SecretKeyStore

SecretKeyStore returns the configured secret key store

func (*SignatureValidator) Validate

func (v *SignatureValidator) Validate(body string, requestHeaders []communication.Header) error

Validate validates the given body using the given request headers

Jump to

Keyboard shortcuts

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