Verify against the raw request body bytes, before any JSON parsing, and reject deliveries older than 300 seconds.
1
Store your webhook secret
Rotate a secret in the dashboard under Webhooks, then keep it in an environment variable such as
IDTO_WEBHOOK_SECRET. Until you rotate one, deliveries fail.2
Add the verifier
3
Call it from your handler
Pass the raw body,
X-Idto-Timestamp, X-Idto-Signature and your secret. Return 401 when it is false, and 2xx quickly when it is true, then process the event.In Express, read the raw body with express.raw({ type: "application/json" }). In Flask use request.get_data(), in PHP file_get_contents('php://input').Tested behaviour
Each verifier above was run against signatures produced by the idto signer:Good to know
- A delivery that does not get a
2xxis attempted up to 5 times in total, with backoff that grows to at most one hour. - After you rotate, the previous secret is kept as
previous, so verify against both while you roll the change out. - See Webhooks for the event payloads.