Wondering what’s next for npm?Check out our public roadmap! »

    passport-hawk

    4.0.0 • Public • Published

    Passport.js stategy for the Hawk authentication scheme.

    Build Status

    This module allows you to use Hawk as an authentication strategy with passport.

    Installation

    npm install passport-hawk
    

    Usage

    var HawkStrategy = require('passport-hawk');
     
    passport.use('my-hawk-strategy', new HawkStrategy(function (id, done) {
      Users.findById(id, function (err, user){
        if(err) return done(err);
        done(null, {
          key:   user.secret,
          algorithm: 'sha256', // sha1 or sha256
          user:  user
        });
      });
    }));

    then you can set my-hawk-strategy as a middlware in any route. For instance:

      myExpressApp.use('/api', 
       passport.authenticate('my-hawk-strategy', { session: false }));

    Bewit support

    passport-hawk can be used to validate bewit:

    var HawkStrategy = require('passport-hawk');
     
    passport.use('my-hawk-strategy', new HawkStrategy({ bewit: true }, function (id, done) {
      //..same as previous section
    });

    License

    MIT

    Keywords

    Install

    npm i passport-hawk

    DownloadsWeekly Downloads

    2

    Version

    4.0.0

    License

    MIT

    Unpacked Size

    9.96 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar