Signature Verification
Verify that webhook payloads are genuinely from Slatis using HMAC-SHA256 signatures.
How it works
Every delivery includes an X-Slatis-Signature header containing an HMAC-SHA256 signature of the raw request body, signed with your webhook's secret:
The secret is AES-256-GCM encrypted at rest — it is only returned in plaintext on webhook create and secret rotation.
Verify the signature
Always use the raw body bytes for HMAC computation. Never parse, re-serialize, or modify the payload before computing the hash — any whitespace difference will invalidate the signature.
Next.js route handler example
Important notes
- Use
crypto.timingSafeEqual(or equivalent) to prevent timing attacks — never use===for signature comparison. - The secret is returned only on
POST /v1/webhooks(create) andPOST /v1/webhooks/{id}/rotate-secret. It is AES-256-GCM encrypted at rest and never re-exposed otherwise. - After rotating the secret, update your verification code before rotating — not after — to avoid a gap where deliveries fail.