0.0.3 • Published 7 years ago
hapi-slack-signature v0.0.3
hapi-slack-signature
This HapiJS authentication scheme verifies requests from the Slack Event API. It has a peer dependency on HapiJS >=17.x.x.
To learn more about request verification, see the Slack documentation.
Installation
$ npm install --save hapi-slack-signatureUsage
const server = Hapi.server({ port: 8080 });
server.auth.scheme('HapiSlackSignature', HapiSlackSignature);
server.auth.strategy('slack', 'HapiSlackSignature', { signingSecret: 'secret_from_slack' });
server.route({
path: '/slack',
method: 'POST',
options: {
auth: {
strategy: 'slack',
mode: 'required,
payload: 'required'
},
payload: {
parse: false,
allow: 'application/x-www-form-urlencoded'
}
},
handler: (request, h) => {
return { message: 'ok };
}
});Test
To run the tests and get coverage, run npm install and then npm test.
Build
To build this package run npm install and then npm run build. The artifacts can be found in build/.