Webhooks

Receive HTTP notifications when crawl events fire

Loading webhooks...

Verifying signatures

If you set a secret, every delivery includes X-Webhook-Signature: sha256=<hex>. Recompute it and compare in constant time.

const crypto = require('crypto');

function verify(secret, rawBody, sigHeader) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(rawBody)
    .digest('hex');
  // Constant-time compare
  const a = Buffer.from(expected);
  const b = Buffer.from(sigHeader || '');
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}