1.1.0 • Published 7 years ago

github-express-webhook-verifying v1.1.0

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

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