Verifying webhook signatures
Every webhook Quillstack sends includes a signature header. Verify it before you trust the payload, so that an attacker cannot send fake events to your endpoint.
How signing works
Quillstack signs the raw request body with HMAC-SHA256, using your endpoint's signing secret as the key. The result is sent in the Quillstack-Signature header, together with a Unix timestamp.
The header looks like this:
Quillstack-Signature: t=1767225600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
Verify a signature
- Read the raw request body as bytes, before any JSON parsing.
- Split the header on commas and read the
tandv1values. - Build the signed string by joining the timestamp, a full stop, and the raw body.
- Compute HMAC-SHA256 of that string with your signing secret and compare it to
v1using a constant-time comparison.
import hmac, hashlib
def verify(raw_body: bytes, header: str, secret: str) -> bool:
parts = dict(item.split("=", 1) for item in header.split(","))
signed = parts["t"].encode() + b"." + raw_body
expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])
Note: Reject any event whose timestamp is more than 300 seconds old. This blocks replay attacks even if a signed payload leaks.
Signing secret rotation
You can rotate a secret from the dashboard at any time. During rotation both the old and new secrets stay valid for 24 hours, and Quillstack sends one v1 value for each.
| Header value | Meaning | Required |
|---|---|---|
| t | Unix timestamp when the event was signed | Yes |
| v1 | HMAC-SHA256 signature, hex encoded | Yes |
| v0 | Legacy SHA1 signature, sent only to endpoints created before 2024 | No |
Troubleshooting
- Signatures never match: make sure your framework is not re-serialising the JSON body.
- Signatures match locally but not in production: check that a proxy is not changing line endings.
- Still stuck: see Testing webhooks locally.
Edit this page on GitHub · Last updated on 2 November 2026