koa-hawk

1.1.1 • Public • Published

koa-hawk

Koa hawk authentication middleware

npm version Build Status

Installation

$ npm install koa-hawk

Usage

var koa = require('koa');
var hawk = require('koa-hawk');
 
var app = koa();
 
var getCredentials = function (id, callback) {
    var credentials = {
        key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn',
        algorithm: 'sha256',
        user: 'Steve'
    };
    return callback(null, credentials);
};
 
app.use(hawk(getCredentials));
 
app.use(function* (next){
    if (this.hawk.authorized === true) this.response.body = 'Welcome!';
});
 
app.listen(3000);

Readme

Keywords

Package Sidebar

Install

npm i koa-hawk

Weekly Downloads

1

Version

1.1.1

License

ISC

Last publish

Collaborators

  • brooksn