svix-id: the unique message identifier for the webhook message. This identifier is unique across all messages, but will be the same when the same webhook is being resent (for example, due to a previous failure).svix-timestamp: timestamp in seconds since epoch.svix-signature: the Base64 encoded list of signatures, separated by spaces.
1. Using the Svix library
First, install the Svix library for your language. Then, use the following code to verify the request (example in JavaScript):payload is the raw string body of the request, and the headers are the headers passed in the request.
2. Manually verifying the signature
Constructing the signed content
The content to sign is composed by concatenating the ID, timestamp, and payload, separated by the full-stop character (.). In code, it looks like this:
Determining the expected signature
RNTOR uses an HMAC with SHA-256 to sign its webhooks. To calculate the expected signature, HMAC thesignedContent from above using the Base64 portion of your signing secret—the part after the whsec_ prefix—as the key.
For example, given the secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw, use MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
This is how you can calculate the signature in Node.js:
svix-signature header. The header contains a space-delimited list of signatures and their corresponding version identifiers. The signature list most commonly contains one signature, though it can contain any number of signatures.