Node.js One-Time Password library
- Zero Dependency
- TypeScript Definitions
- RFC4226 (HMAC One-Time Password)
- RFC6238 (Time-Based One-Time Password)
yarn add node-otp
or
npm install --save node-otp
const { hotp } = require('node-otp')
hotp({
secret: '12345678901234567890',
})
const { totp } = require('node-otp')
totp({
secret: '12345678901234567890',
})
Default value of movingFactor
is 0
Default value of codeDigits
is 6
Default value of addChecksum
is false
Default value of truncationOffset
is -1
Default value of hmacAlgorithm
is sha1
Default value of step
is 30
Default value of time
is 6
Default value of initialTime
is 0
Default value of codeDigits
is 6
Default value of hmacAlgorithm
is sha256