Skip to content

Instantly share code, notes, and snippets.

View jorgemartins-uon's full-sized avatar

Jorge Martins jorgemartins-uon

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jorgemartins-uon on github.
  • I am jooorge (https://keybase.io/jooorge) on keybase.
  • I have a public key ASDgu1olf43gtQKxanxq__TksABoZKJDDiNr62m-7e7XTwo

To claim this, I am signing this object:

@jorgemartins-uon
jorgemartins-uon / storyblok-hook.js
Created October 16, 2020 00:41
Verify Storyblok webhook signature header within a Lambda function with Node.js.
const crypto = require('crypto');
const verifySignature = (secret, signature, payload) => {
const hmac = crypto.createHmac('sha1', secret);
const digest = Buffer.from(hmac.update(payload).digest('hex'));
const checksum = Buffer.from(signature);
return crypto.timingSafeEqual(digest, checksum);
};
const response = (statusCode, msg) => {