Skip to main content
Every webhook request from Kyren Pay includes a cryptographic signature that you should verify to ensure the request is authentic and hasn’t been tampered with.

Signature Algorithm

Kyren Pay uses HMAC-SHA256 to sign webhook payloads:
The signature and timestamp are sent in HTTP headers:

Verification Steps

1

Extract headers

Read X-Kyren-Signature and X-Kyren-Timestamp from the request headers.
2

Check timestamp

Verify the timestamp is within 5 minutes (300000 milliseconds) of the current time. This prevents replay attacks.
3

Compute expected signature

Concatenate timestamp + "." + raw_request_body, then compute HMAC-SHA256 using your webhook secret.
4

Compare signatures

Compare the computed signature with the one in the header. Use constant-time comparison to prevent timing attacks.

Code Examples

Node.js

Python

Go

Important security considerations:
  • Always verify signatures before processing events
  • Use constant-time comparison functions to prevent timing attacks
  • Reject requests with timestamps older than 5 minutes (300000 ms) to prevent replay attacks
  • Use the raw request body for signature verification (before JSON parsing)