hapi-slack-signature
v0.0.3
Published
Hapi authentication schema to authenticate requests from the Slack Event API
Downloads
4
Readme
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-signature
Usage
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/
.