@haul/github-digest
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

@haul/github-digest ·

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

Readme

Keywords

none

Package Sidebar

Install

npm i @haul/github-digest

Weekly Downloads

0

Version

0.2.1

License

UNLICENSED

Unpacked Size

3.84 kB

Total Files

4

Last publish

Collaborators

  • robertstenbom