1.1.1 • Published 6 months ago

quickotp v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
6 months ago

QuickOTP

NPM NPM Downloads License

Simplified, Quickly OTP Generate, Verify on Node.js! OTP, Generated by this module supports Google Authenticator and similar applications.

Support platforms

The quickotp module works with Node.js v12.x and later version too.

Installation

$ npm install quickotp

or

$ yarn add quickotp

Usage

// If you want to use the TOTP...
import { TOTP } from 'quickotp';
// If you want to use the HOTP...
import { HOTP } from 'quickotp';

let uri = TOTP.create('key', 'label'); // Create TOTP! (May return the URL with "otpauth" schema)
let uri = HOTP.create('key', 'label'); // or Create HOTP! (May return the URL with "otpauth" schema)

// Create OTPAuth URL QRCode (have two ways, but both are the same way.)
// First Way (using TOTP...)
try {
    let qrcode = await TOTP.qrcode(uri); // return a URL that has been encoded QRCode in Base64. (Content-Type: image/png)
} catch(err) {
    console.error(err);
}

// Second Way (using HOTP...)
try {
    let qrocde = await HOTP.qrcode(uri); // return a URL that has been encoded QRCode in Base64. (Content-Type: image/png)
} catch(err) {
    console.error(err);
}

let verify = TOTP.verify('key', 'token'); // TOTP Token (OTP Number) Valid check (If valid : return to 'true', invalid : return to false)
let verify = HOTP.verify('key', 'token', 'counter') // HOTP Token (OTP Number) Valid check (If valid : return to 'true', invalid : return to false)

Author: Dongin Lee

1.1.1

6 months ago

1.1.0

6 months ago

2.0.0

6 months ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

0.0.1

10 years ago

1.0.0

10 years ago