Webhook signature verification helps your application check that a message was signed with the expected secret and that the signed data has not changed. Implement the exact signing format documented by the sending service.
Confirm the signing contract
Check the documented signature header, digest encoding, signed message format, timestamp rules, and secret rotation process. Some services sign a timestamp and body together; others use a different format. Do not invent a header name or assume examples from another provider apply.
Preserve the signed bytes
When the contract signs the raw request body, capture those bytes before JSON parsing or middleware changes them. Re-serializing parsed JSON can change whitespace or key order and produce a different digest.
Compute and compare the signature
For a service that specifies HMAC-SHA256, calculate the HMAC over the documented message with the webhook secret. Decode the received signature using the required encoding and reject malformed input. Use a suitable constant-time comparison for equal-length byte sequences. In Node.js, createHmac and timingSafeEqual are available in node:crypto; surrounding validation must also be designed carefully.
Handle replays and repeated delivery
Apply timestamp checks when the provider includes a signed timestamp. Store event identifiers or another documented idempotency key so repeated delivery does not apply the same business change twice. Authenticate the event before trusting its fields.
Test before production
Test a valid event, an altered body, a missing or malformed signature, a wrong secret, and duplicate delivery. Keep secrets out of source code and logs. Consult the Worthy API reference for the supported integration contract.






