Skip to main content
Always verify webhook signatures in production! Failing to do so exposes your application to forged webhook attacks.

Method Signature

Parameters

string
required
The raw request body as a string. Must be the exact bytes received, before any JSON parsing.
string
required
The signature from the x-hmac-signature header
string
Your API key (used as the HMAC secret). If not provided, uses the API key from the SDK configuration.

Returns

Returns true if the signature is valid, false otherwise.

Examples

Express.js Integration

Next.js API Route

Hono Integration

How Signature Verification Works

Security Best Practices

You must use the raw request body exactly as received. Parsing the JSON first and re-stringifying it may change the byte order, causing verification to fail.
The SDK uses crypto.timingSafeEqual() internally to prevent timing attacks. Never implement your own signature comparison with ===.
If signature verification fails:
  1. Return 401 immediately
  2. Log the failure for monitoring
  3. Do not process the event
Your API key is used as the HMAC secret. Keep it secure:
  • Store in environment variables
  • Never commit to version control
  • Rotate if compromised

Testing Webhook Signatures

For testing, you can generate signatures manually:

Create Webhook

Register webhook endpoints

List Webhooks

View all webhooks