0.0.3 • Published 6 years ago

hapi-slack-signature v0.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

hapi-slack-signature

pipeline status coverage report

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/.

0.0.3

6 years ago

0.0.2

6 years ago