@rbard/otp
v1.0.1
Published
Functions to calculate HMAC-based One Time Password (HOTP) and Time-based One Time Password (TOTP)
Downloads
10
Readme
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)