lambda-github-webhook-validator
v1.0.0
Published
Helper function validate github webhook signature
Downloads
6
Readme
Github request validator for AWS Lambda
Validates a github webhook event is correct. It will check the signature and all releveants headers that should exist.
Development
Install dependecies
yarn install
Tests
yarn test
How to use
The validator will call the lambda callback a response and return false if it fails to verify at any point the github request.
The responses are listed below:
- 401 - No github signature found on request
- 401 - Github signature does not match
- 422 - Not a valid github event
const GithubWebhookValidator = require('lambda-github-webhook-validator');
const validator = GithubWebhookValidator({ secret: aSecret });
module.exports.handler = function(event, context, callback) => {
if (validator.isSignatureValid(event, callback) {
// Do work
}
}