Skip to content
/ otp Public

A one time password generator. Supports MFA Authenticator, TOTP, and HOTP

Notifications You must be signed in to change notification settings

DJSdev/otp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

This is an One-Time-Password library that can be used to generate OTP/MFA codes in both a browser and nodejs.

✨ Usage

// MFA Authenticator
const auth = new Authenticator('RWMA7T7LRRIYFFHYMKWR2ITQJK346XI2KE4SLKHV7HIW5JXBYFWHX3NCBNO75TOH')
console.log(await auth.generate())
> Output: 267634

// TOTP
const t = new Totp('RWMA7T7LRRIYFFHYMKWR2ITQJK346XI2KE4SLKHV7HIW5JXBYFWHX3NCBNO75TOH')
console.log(await t.generate());
> Output: 324278

// HOTP
const h = new Hotp('RWMA7T7LRRIYFFHYMKWR2ITQJK346XI2KE4SLKHV7HIW5JXBYFWHX3NCBNO75TOH')
console.log(await h.generate());
> Output: 690691

🏦 Building

npm run build

🧪 Testing

npm test

About

A one time password generator. Supports MFA Authenticator, TOTP, and HOTP

Resources

Stars

Watchers

Forks

Releases

No releases published