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 headerstring
Your API key (used as the HMAC secret). If not provided, uses the API key from
the SDK configuration.
Returns
Returnstrue if the signature is valid, false otherwise.
Examples
Express.js Integration
- TypeScript
- JavaScript
Next.js API Route
Hono Integration
How Signature Verification Works
Security Best Practices
Always use raw body
Always use raw body
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.
Use timing-safe comparison
Use timing-safe comparison
The SDK uses
crypto.timingSafeEqual() internally to prevent timing attacks. Never implement your own signature comparison with ===.Handle failures gracefully
Handle failures gracefully
If signature verification fails:
- Return 401 immediately
- Log the failure for monitoring
- Do not process the event
Protect your API key
Protect your API key
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:Related Methods
Create Webhook
Register webhook endpoints
List Webhooks
View all webhooks