webhooks

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizeHeaders

func CanonicalizeHeaders(h http.Header) (canonicalJSON []byte, canonical map[string][]string, err error)

func ComputeWebhookHashes

func ComputeWebhookHashes(method, path string, headersCanonicalJSON []byte, rawBody []byte) (rawBodySHA, headersSHA, requestSHA string)

Types

type VerificationResult

type VerificationResult struct {
	Valid           bool           `json:"valid"`
	Scheme          string         `json:"scheme"`
	Details         map[string]any `json:"details"`
	ProviderEventID string         `json:"provider_event_id,omitempty"`
	EventType       string         `json:"event_type,omitempty"`
}

type Verifier

type Verifier interface {
	Provider() string
	Verify(headers http.Header, rawBody []byte, receivedAt time.Time, secret string) (VerificationResult, error)
}

func NewGenericHMACVerifier

func NewGenericHMACVerifier(provider string) Verifier

func NewStripeV1Verifier

func NewStripeV1Verifier(provider string) Verifier

func NewStripeV1VerifierWithTolerance

func NewStripeV1VerifierWithTolerance(provider string, toleranceSeconds int) Verifier

Jump to

Keyboard shortcuts

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