Verify Webhook Receipt Payload
When the Consent Manager sends a webhook notification, the payload includes a cryptographically signed receipt.
To ensure authenticity and integrity, you must verify:
- Signature (JWS verification)
- Payload integrity (hash validation)
๐ Why Verification is Requiredโ
Webhook payloads are signed to ensure:
- The data is issued by Consent Manager
- The payload is not tampered with
- The consent receipt is authentic and trustworthy
๐ Verification Flowโ
- Fetch JWKS (public keys) from Consent Manager
- Extract
kid(Key ID) from JWS header - Find the matching public key
- Verify the JWS signature
- Validate payload hash
๐ Step 1: Fetch Public Keys (JWKS)โ
Consent Manager exposes public keys via JWKS endpoint:
- Staging:
https://staging.indiaconsent.com/.well-known/jwks.json - Production:
https://www.indiaconsent.com/.well-known/jwks.json
These keys are used to verify webhook signatures.
๐งพ Step 2: Extract Signature from Webhookโ
The webhook response contains a Signature, present at:
webhook response -> receipt -> receiptPayload -> signature
You will use this to extract:
- Algorithm (signature -> alg)
- JWS Compact String (signature -> jwsCompact)
- Key ID (signature -> kid)
- Payload Hash (signature -> payloadHash)