How It Works
VIZOCHOK signs each webhook request using these steps:- Get the current Unix timestamp (seconds)
- Construct the signed payload:
{timestamp}.{request_body} - Compute HMAC-SHA256 of the signed payload using your webhook secret
- Send the signature and timestamp in request headers
Verification Steps
Extract headers
Read the
X-VIZOCHOK-Signature and X-VIZOCHOK-Timestamp headers from the incoming request.The signature header has the format sha256={hex_digest}.Check timestamp (replay protection)
Parse the timestamp and verify it is within 5 minutes of the current time. Reject requests with timestamps outside this window.
Compute expected signature
Calculate HMAC-SHA256 of the signed payload using your webhook secret as the key:
Code Examples
Replay Protection
The timestamp-based replay protection works as follows:- VIZOCHOK includes the current Unix timestamp in the
X-VIZOCHOK-Timestampheader - The timestamp is incorporated into the signed payload (
{timestamp}.{body}), so it cannot be forged independently of the signature - Your server rejects requests where the timestamp is more than 5 minutes old
Requests are accepted if the timestamp is within 5 minutes of the current time (before or after). A request from 2 minutes ago is accepted; a request from 10 minutes ago is rejected.
The 5-minute window accounts for clock drift between VIZOCHOK’s servers and yours. If your server’s clock is significantly skewed, consider using NTP to synchronize it.
Troubleshooting
Signature always fails
Signature always fails
Common causes:
- Re-serialized body: Make sure you verify against the raw request bytes, not a re-serialized version of the parsed JSON
- Wrong secret: Double-check that you are using the correct webhook secret from your VIZOCHOK admin panel
- Middleware interference: Some frameworks modify the request body before your handler sees it. Capture the raw bytes before JSON parsing
Timestamp always expired
Timestamp always expired
- Check that your server’s clock is accurate (use NTP)
- The tolerance is 5 minutes — if your server clock is off by more than that, timestamps will fail
- In development, you can temporarily increase the tolerance for testing
Signature verification optional in development
Signature verification optional in development
During development, you can skip signature verification by not setting a webhook secret in your VIZOCHOK tenant config. However, always verify signatures in production.