Webhook Security
For security, each webhook request sent contain its own signature in the header. A public key obtained from the portal or our support team can be used to validate the signature to ensure the authenticity of the request.
Important: Make sure your server accept POST requests, as all our webhook notifications are sent via POST.
Setting up your webhook URL
iglooworks dashboard
Add your webhook URL on our iglooworks dashboard portal in the Webhooks section.
Contents
Signature Process
Parts of the webhook request is passed through HMAC, where the resulting digest is signed using our RSA private key.
Webhook Request Validation
Assuming you received the following HTTPS request:
The webhook request signature is indicated by the header "x-igloocompany-sha256" and its contents are encoded in base64.
Signed Data construction
You first construct the signed data using the following information extracted from the request in order:
- Method (all uppercase)
- Host
- URL Path
- Content Type
- Date
- Body
Each item must be concatenated and delimited using the bar ("|") character.
The following example shows the final concatenated payload:
HMAC Process
The constructed signed data can then be hashed using HMAC with the SHA-256 hashing algorithm, giving you the HMAC digest.
Signature Validation
Upon acquiring the HMAC digest of the signed data, you may proceed with validating its signature extracted from the header and decoded. The hash algorithm used in the signature validation is SHA-256.
Public key
Public key properties:
- Length: 2048
- Cipher: RSA
- Format: DER
- Type: PKCS1
Note: Contact our support dev+support@igloocompany.co for acquiring public key. Public key acquired is encoded in base64.
Working Example
Here is a source code in Node.js that performs signature validation of an example payload with a sample public key using the crypto library ("v16.X LTS" at the time of writing).