Verify Hooktier webhooks
Hooktier signs webhooks with Standard Webhooks signatures. This page describes the signature scheme and the existing verification tests.
Headers and signed content
Section titled “Headers and signed content”| Header | Content |
|---|---|
webhook-id |
The message’s replay identity. |
webhook-timestamp |
The attempt’s signing time in Unix seconds. |
webhook-signature |
One or more v1,<base64> signatures, separated by spaces. |
The signed content is id.timestamp.body: the header ID, a period, the timestamp, a period, and the raw body bytes.
Each signature contains the base64 HMAC-SHA256 digest. The signing secret has the format whsec_<base64>.
Under the rotation contract, Hooktier sends both signatures during the overlap.
The rotation operation specifies a 24-hour overlap. TestHeaders checks the headers and one signature per supplied secret.
Receivers must accept any matching v1 signature, whatever its position in the header.
TestHeaders does not test the rotation lifecycle or its duration.
Receiver verification
Section titled “Receiver verification”Hooktier signatures follow Standard Webhooks, so receivers can verify with any Standard Webhooks library. Pass the original body bytes and all three headers to the library. A parsed and serialized body can change the signed content. Check the timestamp against the receiver’s clock with a configured tolerance to limit replay of old signed requests.
For manual verification:
- Remove the
whsec_prefix and base64-decode the remaining text to get the HMAC key. - Compute HMAC-SHA256 over
id.timestamp.bodyusing that key and the original body bytes. - Base64-decode each
v1signature and compare it with the digest in constant time, assign.godoes withhmac.Equal. - Accept the request if any
v1signature matches and the timestamp passes the configured tolerance.
TestSign checks a known signature vector, whole Unix seconds, and time-zone independence.
TestVerify checks altered bodies, IDs and timestamps, incorrect secrets, missing or malformed headers, and matching signatures during overlap.
For example, TestVerify uses a five-minute tolerance and checks its past and future boundaries.
This example is a test setting, not a required receiver tolerance.