Webhook Security
Each webhook request carries its own signature in the header. Requests are signed with an RSA key pair unique to your account, created when you add your first webhook URL. Validate the signature with your account's public key to confirm the request is authentic.
Your server must accept POST requests — all webhook notifications are sent via POST.
Setting Up Your Webhook URL
igloohome API Partners
Add your webhook URL on the igloohome API portal, in the Webhooks section.
iglooconnect Partners
Email dev+support@igloohome.co to get your webhook URL set up — we'll add it right away. An iglooconnect portal for self-service webhook URL management is planned.
Signature Process
Part of the webhook request is passed through HMAC, and the resulting digest is signed with your account's RSA private key.
Webhook Request Validation
Given the following HTTPS request:
The webhook request signature is carried in the x-igloocompany-sha256 header, base64-encoded.
The body above is shortened. A real body is a JSON event wrapped in payload, as shown on Bridge Events and iglooKey Events.
Signed Data Construction
Construct the signed data from the following fields, extracted from the request, in order:
- Method (all uppercase)
- Host (hostname only, without port)
- URL Path (without query string)
- Content Type (always
application/json) - Date
- Body
Host and URL Path come from your registered webhook URL, which is stored in lowercase.
Concatenate each item, delimited by the bar (|) character. For the request above, the final concatenated payload is:
HMAC Process
Hash the constructed signed data using HMAC with the SHA-256 hashing algorithm to get the HMAC digest. Use the decoded public key (see Public Key) as the HMAC key.
Signature Validation
Decode the signature from the header and verify it against the HMAC digest with your public key. The signature is RSA PKCS#1 v1.5 with SHA-256.
Public Key
| Property | Value |
|---|---|
| Length | 2048 |
| Cipher | RSA |
| Format | DER |
| Type | PKCS1 |
Contact dev+support@igloohome.co to request your account's public key. The key you receive is base64-encoded.
Working Example
The following Node.js example (crypto library, v16.x LTS) validates the signature of an example payload with a sample public key: