API & Webhook Security

Webhook HMAC Signature Debugger

Compute and verify HMAC-SHA256 or HMAC-SHA1 signatures in Hex and Base64 using your browser's native Web Crypto API—your signing secrets never leave your machine.

Payload & Signing Key
Uses window.crypto.subtle locally • Zero network calls

Debugging Webhook Signature Mismatches in Laravel

Webhook providers such as Stripe, GitHub, Twilio, and SignalWire sign outbound HTTP requests using a shared secret and an HMAC (Hash-based Message Authentication Code) digest. When signature verification fails in production with a 401 Unauthorized or 403 Forbidden, the culprit is almost always whitespace or encoding drift between the raw HTTP body and a re-serialized JSON object.

3 Common Causes of Invalid Webhook Signatures

  • Hashing json_encode($request->all()) instead of raw bytes: PHP's json_encode() escapes forward slashes (/ → \/) by default and strips original whitespace, producing a completely different HMAC digest. Always hash $request->getContent() in Laravel.
  • Hex vs. Base64 encoding mismatch: GitHub and Stripe encode HMAC-SHA256 digests as lowercase hexadecimal strings (often prefixed with sha256=), whereas Twilio and standard AWS/Svix signatures use Base64 encoding.
  • Signed timestamp prefixes: Several providers concatenate a Unix timestamp and a dot (1732100000.{raw_body}) before hashing to prevent replay attacks.

Frequently Asked Questions

Why should I use hash_equals() in PHP instead of ===?

Standard string comparison (===) exits on the first mismatched byte, leaking timing side-channel information. Always compare signatures using hash_equals($expected,$computed) in Laravel middleware.

Are my webhook secrets safe in this tool?

Yes. All cryptographic operations execute directly inside your browser via the W3C Web Crypto API (crypto.subtle.sign). Neither your payload nor your secret key is ever transmitted over the network.