validation

package
v0.0.0-...-97c5a11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 an 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 SecretKeyNotAvailableError

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

SecretKeyNotAvailableError represents an error that causes a secret key to not be available.

func NewSecretKeyNotAvailableError

func NewSecretKeyNotAvailableError(keyID string) *SecretKeyNotAvailableError

NewSecretKeyNotAvailableError creates a SecretKeyNotAvailableError with the given keyID

func (SecretKeyNotAvailableError) Error

func (ske SecretKeyNotAvailableError) Error() string

Error implements the error interface

func (SecretKeyNotAvailableError) KeyID

func (ske SecretKeyNotAvailableError) KeyID() string

KeyID returns the keyID which produced the error

type SecretKeyStore

type SecretKeyStore interface {
	// GetSecretKey returns the secretKey for the given keyID
	//
	// Can return any of the following errors:
	// SecretKeyNotAvailableError if there is no secretKey with 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