github-express-webhook-verifying

1.1.0 • Public • Published

github-express-webhook-verifying npm version

Validating payloads from GitHub

Install:

npm install github-express-webhook-verifying --save

How to use:

Basic

 
// You also need to use body-parser in express
app.use(bodyParser.json())
 
const verifyGithubWebhook = require('github-express-webhook-verifying')
const secret = 'MySecret!'
 
router.get('/', verifyGithubWebhook(secret), (req, res) => {
  // Webhook is verifyed here!
})
 

With config

 
// You also need to use body-parser in express
app.use(bodyParser.json())
 
const verifyGithubWebhook = require('github-express-webhook-verifying')
const secret = 'MySecret!'
const config = {
  xHubSignatureNotFound: {
    status: 400,
    errorMessage: 'My custom message',
  },
  verifyingSignatureFailed: {
    status: 403,
    errorMessage: 'My other custom message',
  },
}
 
router.get('/', verifyGithubWebhook(secret, config), (req, res) => {
  // Webhook is verifyed here!
})
 

TODO

  • Tests

Package Sidebar

Install

npm i github-express-webhook-verifying

Weekly Downloads

2

Version

1.1.0

License

ISC

Last publish

Collaborators

  • richie_south