The TOTP & HOTP implement for Node.JS.
- HOTP (HMAC-based One-Time Password) algorithm implementation.
- TOTP (Time-based One-Time Password) algorithm implementation.
- OTP URL encoding and decoding.
- Command line tool:
- Generating OTP codes.
- Generating OTP URLs.
- Inspecting OTP URLs.
- Customization:
- Digits length from 4 - 10
- TOTP time-step (period)
- Digest algorithms including SHA-1, SHA-256, and SHA-512
- TypeScript v3.1.x (Or newer)
npm i @litert/otp --save
See examples:
Click here for a quick start guide.
You can use this library as a command line tool to do OTP operations.
There are two ways to use the CLI:
-
Use
npx
to run the CLI without installing it manually.npx @litert/otp -k 'raw:1234567890' # Check the help message npx @litert/otp --help
-
Install it globally or locally in your project.
npm i -g @litert/otp # or install in local project only npm i @litert/otp # -D # if only used in dev environment
Then you can use the
otp
command directly:npx otp -k 'raw:1234567890'
Click here for more details about the CLI usage.
This library is published under Apache-2.0 license.