POST to your webhook URL. Hammock signs every delivery with the endpoint’s
secret so you can tell the real ones apart.
The signature header
Ignore any parts you don’t recognize. New schemes may be added alongside
v1.
Verify a delivery
1
Read the raw body
Use the exact bytes Hammock sent. Parsing the JSON and serializing it again changes the bytes
and breaks the signature.
2
Build the signed payload
Join the timestamp, a period and the raw body:
{t}.{body}.3
Compute the expected signature
Take the HMAC-SHA256 of the signed payload, keyed with the endpoint’s
whsec_ secret, and
hex-encode it.4
Compare
Compare your result with each
v1 value using a constant-time comparison. The delivery is
valid if any of them matches.5
Check the timestamp
Reject deliveries whose
t is more than five minutes from your clock. This stops a captured
delivery from being replayed later.Node.js
Roll a secret
Roll a secret on a schedule, or whenever it may have been exposed.v1 signatures, one per secret. Deploy the new secret within the
24 hours and no delivery fails verification.