hb_verify_webhook_signature
Verify or compute a Hub webhook signature by validating the HMAC-SHA256 of timestamp and raw body, and reject deliveries outside the 300-second replay window.
Instructions
Pure local helper (no network): verify or compute a Hub webhook signature. The signature is "sha256=" plus the hex HMAC-SHA256 of "{timestamp}.{raw body}" with the endpoint secret; deliveries older or newer than 300 seconds are rejected. Pass the raw body byte-for-byte. The secret is read from HB_WEBHOOK_SECRET unless passed (prefer a sandbox secret if you pass it in chat). Omit signature to just compute it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| body | Yes | The raw request body exactly as received. | |
| secret | No | Endpoint signing secret. Defaults to env HB_WEBHOOK_SECRET. | |
| signature | No | The X-Hub-Signature header. Omit to compute the expected signature. | |
| timestamp | Yes | The X-Hub-Timestamp header (epoch seconds). | |
| now_epoch_seconds | No | Override the current time (for testing recorded deliveries). | |
| tolerance_seconds | No | Replay window; default 300. |