@rbard/otp

1.0.1 • Public • Published

otp-js

Functions to calculate HMAC-based One Time Password (HOTP) and Time-based One Time Password (TOTP)

Example Usage

const otp = require('@rbard/otp')

const key = {key: '5RAFOILIBQPR3LOW333VF6DSIQU6M5EN', encoding: 'base32'}

const {token, secondsLeft} = otp.totp(key)
const otp = require('@rbard/otp')

const key = {key: '5RAFOILIBQPR3LOW333VF6DSIQU6M5EN', encoding: 'base32'}

const counter = Buffer.alloc(8, 0)
counter.writeUInt32BE(55226733, 4)
const token = otp.hotp(key, counter)

Readme

Keywords

Package Sidebar

Install

npm i @rbard/otp

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

22.3 kB

Total Files

9

Last publish

Collaborators

  • rbard