1const FB_APP_SECRET = 'your facebook app secret';
2
3// requires
4const crypto = require('crypto');
5
6const verifyXHubSignature = req => {
7 const digest = crypto
8 .createHmac('sha1', FB_APP_SECRET)
9 .update(req.rawBody)
10 .digest('hex');
11 return req.headers['x-hub-signature'] === `sha1=${digest}`;
12};