Skip to content

rajithaeyee/otp-gen

Repository files navigation

OTP Generator

test workflow

Generate secure one-time passwords (OTP) for your applications with ease using this OTP generator package. Whether you need numeric, alphabetic, or special character OTPs, this package has you everything you need. and offers various customization options to generate flexible one-time passwords.

Installation

Install the package via npm:

npm install otp-gen-next

Features

Generate numeric, alphabetic, or alphanumeric OTPs Include uppercase alphabetic characters and special characters if needed Exclude similar characters like '1' and 'l', '0' and 'O' for enhanced security Exclude ambiguous characters like '{}' or '[]' that can be confused Add custom characters to the OTP generation process Flexible and easy-to-use API

Playground

Go to Playground otp-gen-next

Usage

commonJS

const { generateOTP } = require('otp-gen-next')
generateOTP(); //generates a otp with default options with the length of 4
generateOTP(6, { upperCaseAlphabets: false, specialChars: false });

TypeScript

import { generateOTP } from 'otp-gen-next';

// Generate a 6-character OTP with custom options
const otp = generateOTP(6, { 
    numeric: true, 
    alphabetic: true, 
    upperCaseAlphabets: true, 
    specialChars: false, 
    excludeSimilarCharacters: true,
    excludeAmbiguousCharacters: true,
    customChars: ''
});

console.log('Generated OTP:', otp);

About

A lightweight package to generate secure OTP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published