egg-otp
TypeScript icon, indicating that this package has built-in type declarations

1.4.2 • Public • Published

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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.4.21latest

Version History

VersionDownloads (Last 7 Days)Published
1.4.21
1.3.20
1.3.10
1.3.00
1.1.00
1.0.30
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i egg-otp

Weekly Downloads

1

Version

1.4.2

License

MIT

Unpacked Size

13.9 kB

Total Files

14

Last publish

Collaborators

  • duncup
  • thonatos