Overview
Every Daya Coins webhook includes anX-Webhook-Signature header carrying an HMAC-SHA256 signature of the raw request body with a sha256= prefix. Always verify this signature to confirm the request came from Daya.
Signature Header
Additional Headers
Daya sends these headers with every delivery:Verification Algorithm
1
Read the raw body
Capture the request body as raw bytes, before any JSON parsing.
2
Compute the HMAC
Compute HMAC-SHA256 over the raw body using your webhook secret, and hex-encode the result.
3
Strip the prefix
Remove the
sha256= prefix from the X-Webhook-Signature header.4
Compare in constant time
Compare your computed signature with the header value using a timing-safe comparison.
Implementation Examples
Important Notes
Use the raw request body
Use the raw request body
Compute the HMAC over the exact bytes Daya sent. Re-serializing parsed JSON changes whitespace and key order, which breaks the signature.
Use timing-safe comparison
Use timing-safe comparison
Plain string comparison leaks timing information. Use a constant-time comparison:
crypto.timingSafeEqual() (Node.js), hmac.compare_digest() (Python), or hmac.Equal() (Go).Rotate secrets safely
Rotate secrets safely
Rotation takes effect immediately and the new secret is shown only after rotation. Pause the webhook in the Dashboard, rotate and copy the secret, update your secret store and receiver, then re-enable delivery. Reconcile API state for the paused interval.
Keep secrets out of source control
Keep secrets out of source control
Store the secret in an environment variable or secret manager. Use a different secret per environment.
Next Steps
Webhooks Overview
Events, delivery, and retries
Rotate a Secret
Rotate signing secrets from your workspace’s Webhooks page.