Webhook Signatures
Verify webhook payloads with HMAC signatures.
Updated
On this page
Overview
Every webhook request is signed with HMAC-SHA256. Always verify signatures to prevent spoofed requests. See Verifying Signatures for implementation details.
Verification Flow
- Read the raw request body
- Read the
x-dash4devs-signatureheader - Compute HMAC-SHA256 of the body using your webhook secret
- Compare using constant-time comparison
import crypto from "crypto"
const expected = crypto.createHmac("sha256", WEBHOOK_SECRET).update(body).digest("hex")
const valid = crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
Next Steps
- Verifying Signatures — Full implementation
- Webhook Overview — Setting up webhooks