1.1.1 • Published 2 years ago

@multiotp/genotp v1.1.1

Weekly downloads
-
License
LGPL-3.0-or-later
Repository
github
Last release
2 years ago

genOTP

NPMV

Generic 2FA OTP generator (OATH/HOTP, OATH/TOTP, mOTP)

Features


Installation

yarn add @multiotp/genotp

or

npm install --save @multiotp/genotp

Examples

const OTP = require('./genotp')

let options = {
  algorithm: 'sha1', //sha1 (sha256|sha512 will be implemented later)
  bias:      0,      // for TOTP and mOTP only, time bias, in seconds
  counter:   0,      // HOTP counter
  digits:    6,      // 6|8   (number of digits)
  period:    30,     // 30|60 (for TOTP only, in seconds)
  pincode:   '',     // for mOTP only
  secret:    '3132333435363738393031323334353637383930',
  seedtype:  'hex',  // hex|base32|bin (secret seed format)
  type:      'hotp', // totp|hotp|motp (otp type)
  values:    1,      // number of values to return
}

const otp = new OTP(options);

console.log(otp.generate());
const OTP = require('./genotp')

const otp = new OTP();
console.log(otp.generate({type: 'hotp',
                          secret: '12345678901234567890',
                          seedtype: 'bin',
                        });
const OTP = require('./genotp')

const otp = new OTP();
console.log(otp.generate({type: 'motp',
                          secret: '1234567890abcdef',
                          pincode: '1234',
                        });
1.1.1

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

0.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago