To ensure that the webhook notifications you receive are sent by CHIP and have not been tampered with, you should validate the signature included in each request.Documentation Index
Fetch the complete documentation index at: https://docs.chip-in.asia/llms.txt
Use this file to discover all available pages before exploring further.
Signature Header
Each webhook delivery request includes anX-Signature header field. This field contains a base64-encoded RSA PKCS#1 v1.5 signature of the SHA512 digest of the request body buffer.
Obtaining the Public Key
Unlike CHIP Collect, CHIP Send provides a dedicated public key for each webhook. You can obtain the public key by retrieving the webhook details via the Retrieve a Webhook API. Thepublic_key field in the response contains the PEM-encoded RSA public key.
Verification Steps
- Retrieve the Payload: Get the raw request body (buffer) of the webhook notification.
- Get the Signature: Extract the value of the
X-Signatureheader and base64-decode it. - Verify: Use the RSA public key to verify the signature against the SHA512 digest of the raw request body.
Code Examples
Ruby
PHP
The provider is not responsible for any financial losses incurred due to not implementing payload signature verification.