whsec_...) before you process the event.
Your application API secret (
sk_test_... or sk_live_...) is a different credential. Never use it to verify webhook signatures.Request headers
How the signature is computed
Thev1 digest is HMAC-SHA256 over timestamp + "." + raw_body, keyed with the complete whsec_... secret as UTF-8. During a 24-hour rotation overlap the header can contain several v1 values; a match against either active secret is enough.
Verify a request
- Read the raw request bytes. Verify before JSON parsing, reserialization or any application processing; rebuilding JSON changes the bytes.
- Reject a missing or malformed
Prava-Signature, or one with duplicate timestamps. - Reject timestamps more than five minutes in the past or future. Keep your receiver’s clock synchronized.
- Compute the expected digest with each active secret and compare it to every
v1value in constant time. - Only then parse the body, and check that the environment and account are the ones you expect.
Example in JavaScript
Pass the exact request bytes from your HTTP framework asrawBody.
Handle the verified request
- Put a unique database constraint on the event ID.
- Process slow business logic asynchronously, after you respond.
- A receiver timeout is an unknown outcome, so Prava may send the same event again.
Rotate your signing secret
Administrators can rotate an endpoint’s secret.- Rotate, then save the new secret when it’s shown. You can’t retrieve it later, and an idempotent retry returns the completion status without showing it again.
- Prava signs with both the old and new secrets for 24 hours. Deploy verification with the new secret during that overlap.
- Retire the old secret.
Next steps
- For a runnable starting point, use the Node.js or Python receiver examples. Their runtime and storage requirements apply only to those examples; you can implement the same verification and delivery handling in your existing application.
- See Test your integration to verify your destination, send test events, and check retries and secret rotation.