Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const crypto = require('crypto');
const hmac = crypto.createHmac('sha1', process.env.SECRET_KEY);
let hubHeader = event.headers['X-Hub-Signature'];
hmac.update(event.body);
let secretCompare = 'sha1=' + hmac.digest('hex');
console.log(secretCompare + ' == ' + hubHeader, secretCompare == hubHeader);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment