X-Webhook-Signature header. Use your API key (e.g. process.env.PEERPOP_API_KEY) as the webhook secret.
One-line verify
Use the raw body (exact string or buffer as received) and the signature header:verify() throws. Catch and return 400:
err.code set to PEERPOP_WEBHOOK_INVALID or PEERPOP_WEBHOOK_EXPIRED.
Express middleware
Verification must run on the raw body. Useexpress.raw() for the webhook route so the body is not parsed as JSON before verification:
API
peerpop.webhook.verify(rawBody, signatureHeader, secret)
Returns the parsed payload object, or throws if the signature is invalid or expired. Use when you have the raw body string (or buffer converted to string).
peerpop.webhook.middleware(secret)
Express middleware that verifies the request and sets req.webhookPayload. Use with express.raw({ type: "application/json" }) on that route.
Signature format
PeerPop sendsX-Webhook-Signature: t=,v1= . The HMAC is over timestamp + "." + rawBody with your webhook secret. Signatures older than 5 minutes are rejected (replay protection).