Overview
Each webhook includes the signature in thefinventi-signature-N HTTP header, where N represents the version of the signature. The current version is 1 (finventi-signature-1). When public keys are rotated, new header versions are issued, ensuring backward compatibility for clients until their code is updated.
The signature is verified using the RSASSA-PKCS1-v1.5 algorithm and the appropriate public key.
HTTP Headers
Each webhook includes the following HTTP headers that must be used during the signature verification process:string
required
The webhook signature (where N is the version number, currently
1)string
required
A UNIX timestamp (UTC) indicating when the webhook was sent
string
required
The tenant ID for the webhook recipient
Public Key for Webhook Verification
Use the following public keys to verify webhook signatures:- Sandbox
- Production
Version - 1 (current)
Signature Verification Process
To verify the authenticity of the webhook, follow these steps:1
Concatenate the verification data
Concatenate the following components in the specified order, separated by periods (
.):- The request body (raw JSON)
- The tenant ID from
finventi-receiver-tenant-idheader - The timestamp from
finventi-signature-timestampheader
2
Hash the concatenated string
Hash the concatenated string using the SHA-256 algorithm.
3
Decode the signature
Base64 decode the received
finventi-signature-1 header to obtain the signature bytes.4
Verify the signature
Verify the signature using RSASSA-PKCS1-v1_5 with:
- The hashed data from step 2
- The decoded signature from step 3
- The public key provided above
Code Example (Node.js)
Here’s a complete example of webhook signature verification in Node.js:Express.js Middleware Example
Here’s how to implement webhook verification as Express.js middleware:Security Best Practices
- Store the public key securely - Keep the public key in your configuration management system
- Verify timestamps - Check that the timestamp is recent to prevent replay attacks
- Use HTTPS - Always expose your webhook endpoints over HTTPS
- Log verification failures - Monitor and log all signature verification failures
- Handle version rotation - Be prepared to support multiple signature versions during key rotation periods