1.4.2 • Published 6 years ago

egg-otp v1.4.2

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

egg-otp

NPM version build status npm download FOSSA Status

One time password plugin for eggjs.

Install

$ npm i egg-otp --save

Usage

// {app_root}/config/plugin.js
exports.otp = {
  enable: true,
  package: 'egg-otp',
};
// {app_root}/controller/home.js
const key = ctx.otp.generateOtpKey();
const token = ctx.otp.hotp.gen(key, {counter: 0});
ctx.otp.hotp.verify(token, key, {counter: 0, window: 10});

you can see lib/hotp.js AND lib/totp.js for more option.

Configuration

see config/config.default.js for more detail.

License

MIT

FOSSA Status

1.4.2

6 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago