0.1.0 • Published 3 years ago
ootp v0.1.0
OOTP
OOTP (Open One-time Password) is a supports multiple programming languages. The generated one-time passwords are fully compliant with HOTP (HMAC-based One-time Password) and TOTP (Time-based One-time Password). 🚀It's easy to use!
Introduction
The OOTP for Node.js module is a TypeScript implementation of the OOTP library.
Features
- Generate OOTP passwords for multiple programming languages
- 100% Open source
- HOTP
- TOTP
- RFC 4226 compliant
- RFC 6238 compliant
Installation
Usage
You can use the library in your TypeScript or JavaScript projects.
💡Tips: You need to install implementation Base32 module for you project.
Example use thirty-two module.
import base32 from 'thirty-two';
import { TOTP } from 'ootp';
const base32_encoded_secret = "MU2TSNRZG5TGKMBYGAZDCMJTMM3GIMJVMZRTINDFGI3WGZRVMQ4Q";
const base32_decoded_secret = base32.decode(base32_encooded_secret);
/// Create a TOTP
const totp = new TOTP({ secret: base32_decoded_secret });
/// Make a OTP code.
const otp = totp.make();
/// Dispaly the OTP code.
console.log(otp);
Examples
Documentation
TOTP
classmake
- Generate OTP codecheck
- Check OTP code
HOTP
classmake
- Generate OTP codecheck
- Check OTP code
License
The OOTP is licensed under the MIT license.