- Data integrity: Confirms the webhook payload hasn’t been tampered with
- Authenticity: Verifies the webhook genuinely comes from Yuno
- Protection: Guards against man-in-the-middle attacks and replay attacks
- Compliance: Meets security requirements for handling sensitive payment data
How HMAC signatures work
When Yuno sends a webhook to your server:- Signature generation: Yuno creates an HMAC signature by hashing the webhook payload with your client secret key using the SHA-256 algorithm
- Header inclusion: The signature is included in the
x-hmac-signatureHTTP header - Verification: Your server extracts the signature from the header, recreates it using the same payload and secret key, then compares
- Validation: If the signatures match, the webhook is authentic and unaltered
Configuration
To enable HMAC signature verification, check Use HMAC Authentication when creating or editing a webhook in the Yuno dashboard. See Configure Webhooks for step-by-step instructions on accessing the webhook configuration panel.What changes with HMAC
When HMAC signature verification is enabled, Yuno webhooks include an additionalx-hmac-signature HTTP header. The webhook JSON payload remains unchanged.
Example webhook request with HMAC
Verification code example
Verify thex-hmac-signature header using the raw request body (before parsing JSON) and the same secret configured for the webhook in the Yuno dashboard.
Node.js (Express): use a body parser that keeps the raw body for the webhook route (e.g. express.raw() for that path), then:
x-hmac-signature header: