Signature Verification

All ATHENA webhooks are signed using HMAC-SHA256. Always verify signatures to prevent spoofed events.

Signature Header

Every webhook includes a signature header:

X-Athena-Signature: t=1703505600,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd

Components:

  • t — Unix timestamp when signature was generated

  • v1 — HMAC-SHA256 signature

Verification Steps

1. Extract Components

const header = req.headers['x-athena-signature'];
const [timestampPart, signaturePart] = header.split(',');
const timestamp = parseInt(timestampPart.split('=')[1]);
const signature = signaturePart.split('=')[1];

2. Check Timestamp

Reject events older than 5 minutes (prevents replay attacks):

3. Compute Expected Signature

4. Compare Signatures

Use constant-time comparison to prevent timing attacks:

Complete Examples

JavaScript (Express)

Python (Flask)

Python (FastAPI)

Using the SDK

Both SDKs include built-in verification:

JavaScript

Python

Troubleshooting

Error
Cause
Solution

Timestamp too old

Clock skew or replay attack

Sync server clock, check NTP

Invalid signature

Wrong secret or tampered payload

Verify secret matches webhook

Missing header

Spoofed request

Reject requests without signature

Secret Rotation

When rotating secrets, both old and new secrets are valid for 24 hours:

During the grace period, try verifying with both secrets:


Next: Compliance Guides

Last updated