Documentation
Outgoing webhooks
Signed notifications to your system about publications and changes.
On Pro and Chain plans Sidro can notify your system: publication.created, publication.failed, anchor.changed, validation.issues.
Body: { "id", "type", "created_at", "data" }. Headers: Sidro-Event and Sidro-Signature: t=<unix>,v1=<hex>, where v1 is HMAC-SHA256 with your secret over "<t>.<body>". Reject requests older than 5 minutes.
import crypto from 'node:crypto';
export function verify(body, header, secret) {
const { t, v1 } = Object.fromEntries(header.split(',').map((p) => p.split('=')));
const expected = crypto.createHmac('sha256', secret).update(`${t}.${body}`).digest('hex');
return Math.abs(Date.now() / 1000 - Number(t)) < 300 && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected));
}