Verify a webhook signature offline
verify_webhookVerify GitHub, Stripe, or generic HMAC webhook signatures offline from a raw body file and an env-var secret, then explain mismatches such as bad formatting, expired Stripe timestamps, or wrong secret.
Instructions
Verifies a GitHub, Stripe or generic HMAC webhook signature locally and explains why a mismatch happened. The signing secret is read ONLY from the environment variable named in secret_env; there is no parameter for a plaintext secret and one is rejected if supplied. The body is read as raw bytes from body_path. Returns match / no match plus diagnostics: whether the signature header is well-formed, whether the Stripe timestamp is outside the tolerance, whether the body looks reformatted (trailing newline, CRLF, re-serialized or pretty-printed JSON) and common secret mistakes (whitespace, wrong key type). It sends nothing over the network and never returns the secret or a computed signature.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| provider | Yes | github: X-Hub-Signature-256 (sha256=<hex>). stripe: Stripe-Signature header (t=...,v1=...). generic: plain HMAC over the body, hex (or base64) signature. | |
| algorithm | No | HMAC hash for provider "generic" (default sha256). Not used by github or stripe. | |
| body_path | Yes | Path to a file holding the RAW request body exactly as received (not re-serialized). Read as bytes, up to 10 MiB. | |
| signature | Yes | The signature header value as received. It is not a secret. | |
| secret_env | Yes | NAME of the environment variable that holds the signing secret (for example GITHUB_WEBHOOK_SECRET). Never the secret itself. | |
| tolerance_seconds | No | Stripe only: maximum allowed age of the signed timestamp in seconds (default 300). |