Skip to content

Minimalistic package to validate the integrity of incoming GitHub webhooks with zero dependencies.

Notifications You must be signed in to change notification settings

TransitoryBliss/node-github-digest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Validate GitHub webhook signatures

Minimalistic package to validate the integrity of incoming GitHub webhooks with zero dependencies.

Usage

// initialize with the secret
const secret = process.env.GITHUB_SECRET;
const { validate, sign } = require('github-digest')(secret);

// Validating:
if (!validate(req)) {
  res.status(400);
  return res.json({ message: 'Unauthorized' });
}

// You can also sign your own requests (useful for integration testing)
const payload = { body: { hello: 'world' } };
assert.ok(validate(sign(payload))); // => ok

Tests

$ npm run test

About

Minimalistic package to validate the integrity of incoming GitHub webhooks with zero dependencies.

Resources

Stars

Watchers

Forks

Packages

No packages published