Webhook Verification
const crypto = require('crypto');
function verifySignature(payload, signature, appSecret) {
const computedSignature = crypto
.createHmac("sha256", appSecret)
.update(JSON.stringify(payload.webhookId))
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(computedSignature)
);
}
Last updated