1.0.0 • Published 6 years ago

lambda-github-webhook-validator v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

NPM version Build status Coverage Status

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
  }
}
1.0.0

6 years ago

0.0.1

6 years ago