Webhook
Last updated
Last updated
const headerSignature = req.headers[HEADER_SIGNATURE_NAME];
const hmac = crypto.createHmac(
SIGNATURE_ALGORITHM,
"my-secret-signature",
);
const signature = hmac.update(JSON.stringify(req.body)).digest('hex');
if (headerSignature !== signature) {
// Throw an error
throw new Error('Invalid Signature');
}
// The signature is correct