Documentation
¶
Overview ¶
Package webhook verifies signed incoming webhooks (HMAC-SHA256 over the raw body), the scheme used by GitHub, Shopify, Resend/Svix-style providers and your own integrations.
r.Post("/webhooks/github", handle).Use(webhook.Middleware("X-Hub-Signature-256", secret, 1<<20))
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSignature = &errs.HTTPError{Status: http.StatusUnauthorized, Message: "Invalid webhook signature."}
ErrSignature is the 401 answered for missing or wrong signatures.
Functions ¶
func Middleware ¶
Middleware verifies the signature in header against the raw body (at most maxBody bytes) and restores the body for the handler. Failures get 401 and a "webhook.signature_invalid" security event.
func VerifyHMAC ¶
VerifyHMAC reports whether signature is the HMAC-SHA256 of payload with secret. The signature may be hex or base64 and may carry a "sha256=" prefix. The comparison is constant time.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.