Versions in this module Expand all Collapse all v4 v4.0.0 Jul 11, 2026 Changes in this version + const EventIDHeader + const TimestampHeader + 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 DeliveryProblem(status int, detail string) httpx.Problem + func WriteProblem(w http.ResponseWriter, status int, problem httpx.Problem) + type DeliveryAttempt struct + Attempt int + EventID string + Timestamp time.Time + URL string + type DeliveryContract struct + AcceptedStatus int + MaxAttempts int + RetryAfter time.Duration + type DeliveryResult struct + Accepted bool + Problem *httpx.Problem + StatusCode int + 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 + Replay ReplayConfig + VerificationErrorDetail func(error) string + Verifier Verifier + type ReplayConfig struct + EventIDHeader string + Now func() time.Time + RequireEventID bool + TimestampHeader string + Tolerance time.Duration + type ReplayDecision struct + Allowed bool + EventID string + Reason string + Timestamp time.Time + func CheckReplayWindow(r *http.Request, config ReplayConfig) ReplayDecision + 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 Other modules containing this package github.com/aatuh/api-toolkit/v2 github.com/aatuh/api-toolkit/v3