Versions in this module Expand all Collapse all v2 v2.1.0 May 2, 2026 Changes in this version + var ErrInvalidSignature = errors.New("invalid webhook signature") + var ErrMissingSignature = errors.New("missing webhook signature") + func BuildSignedRequest[T any](ctx context.Context, event OutgoingEvent[T], config SignedRequestConfig) (*http.Request, error) + func DecodeJSON[T any](body []byte) (T, error) + func WriteProblem(w http.ResponseWriter, status int, problem httpx.Problem) + type Event struct + Payload T + RawBody []byte + Request *http.Request + type HMACConfig struct + Encoding SignatureEncoding + HeaderName string + Prefix string + Secret []byte + type HMACSignerConfig struct + Encoding SignatureEncoding + Prefix string + Secret []byte + type OutgoingEvent struct + ID string + Payload T + Type string + type Receiver struct + Config ReceiverConfig[T] + func (receiver Receiver[T]) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ReceiverConfig struct + Decode func([]byte) (T, error) + ErrorWriter func(http.ResponseWriter, int, httpx.Problem) + Handle func(context.Context, Event[T]) error + MaxBodyBytes int64 + Verifier Verifier + type SignatureEncoding int + const SignatureEncodingBase64 + const SignatureEncodingBase64URL + const SignatureEncodingHex + type SignedRequestConfig struct + ContentType string + EventID string + EventIDHeader string + Headers http.Header + Method string + SignatureHeader string + Signer Signer + Timestamp time.Time + TimestampHeader string + URL string + type Signer interface + SignWebhook func(ctx context.Context, body []byte) (string, error) + func NewHMACSHA256Signer(config HMACSignerConfig) (Signer, error) + type SignerFunc func(context.Context, []byte) (string, error) + func (f SignerFunc) SignWebhook(ctx context.Context, body []byte) (string, error) + type Verifier interface + VerifyWebhook func(ctx context.Context, r *http.Request, body []byte) error + func NewHMACSHA256Verifier(config HMACConfig) (Verifier, error) + type VerifierFunc func(context.Context, *http.Request, []byte) error + func (f VerifierFunc) VerifyWebhook(ctx context.Context, r *http.Request, body []byte) error