Skip to content

Instantly share code, notes, and snippets.

View tobyurff's full-sized avatar
😀
Happy-go-lucky every day!

Toby Urff tobyurff

😀
Happy-go-lucky every day!
View GitHub Profile
const crypto = require('crypto');
const hmac = crypto.createHmac('SHA256', 'my-webhook-secret');
hmac.update('{ ... }'); // request body
const correctHash = hmac.digest().toString('hex');
const receivedHash = '...'; // e.g. req.get('x-impala-signature');
/*
* It's important to perform a constant time equality comparison of the