Skip to main content
Every webhook request from VIZOCHOK includes an HMAC-SHA256 signature that you should verify to ensure the request is authentic and has not been tampered with.

How It Works

VIZOCHOK signs each webhook request using these steps:
  1. Get the current Unix timestamp (seconds)
  2. Construct the signed payload: {timestamp}.{request_body}
  3. Compute HMAC-SHA256 of the signed payload using your webhook secret
  4. Send the signature and timestamp in request headers

Verification Steps

1

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}.
2

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.
3

Construct the signed payload

Concatenate the timestamp, a dot, and the raw request body:
Use the raw request body bytes, not a re-serialized version. JSON serialization is not guaranteed to be deterministic, so re-serializing the parsed body may produce a different byte sequence.
4

Compute expected signature

Calculate HMAC-SHA256 of the signed payload using your webhook secret as the key:
5

Compare signatures

Use a constant-time comparison function to compare the expected signature with the one from the header. This prevents timing attacks.

Code Examples


Replay Protection

The timestamp-based replay protection works as follows:
  1. VIZOCHOK includes the current Unix timestamp in the X-VIZOCHOK-Timestamp header
  2. The timestamp is incorporated into the signed payload ({timestamp}.{body}), so it cannot be forged independently of the signature
  3. Your server rejects requests where the timestamp is more than 5 minutes old
This prevents an attacker from capturing a valid webhook request and replaying it later.
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

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
  • 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
During development, you can skip signature verification by not setting a webhook secret in your VIZOCHOK tenant config. However, always verify signatures in production.