github-express-webhook-verifying
v1.1.0
Published
Validating payloads with Express from GitHub
Downloads
6
Maintainers
Readme
github-express-webhook-verifying
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