Skip to content

Signatures

Verify X-Evoriqa-Signature as an HMAC-SHA256 over the raw request body, with constant-time comparison — in Node and Python — and rotate a secret over the API.

Your endpoint URL is reachable by anyone who learns it. The signature is what tells a genuine delivery from a forged one, so verify every request before acting on it.

How the signature is computed

The secret is the whsec_… value shown once when you created the endpoint (or last rotated its secret). Each feature group's endpoint has its own secret — verify with the secret of the group the event belongs to.

Danger:

Verify against the raw bytes of the request body, exactly as received. If your framework parses the JSON and you re-serialise it to verify, key order and whitespace can differ from what was signed and every verification fails — or, worse, appears to work in testing and fails on one unusual payload. Capture the raw body before parsing.

Compare with a constant-time comparison. A plain === leaks timing information that can be used to forge a signature byte by byte.

Verifying

A checklist

  • [ ] Read the raw body before any JSON parsing.
  • [ ] Recompute the HMAC with the endpoint's own secret.
  • [ ] Compare in constant time.
  • [ ] Reject with 401 on a mismatch — do not process the payload.
  • [ ] Only then parse and act.

Rotating a secret

A secret is per endpoint (one per feature group). Rotate it in place:

rotate-secret.sh

The response carries the new secret — once, never again. Deliveries sign with the endpoint's current secret at send time, so deploy the new secret to your handler promptly: anything delivered after the rotation verifies only against the new value. If you cannot deploy instantly, accept either secret for the switchover window.

Where to go next

Last updated