medhira-otp-utils
v0.0.1
Published
OTP generation utility with customizable options - Powered by MEDHIRA
Maintainers
Readme
medhira-otp-utils
medhira-otp-utils is a powerful and flexible OTP (One-Time Password) generation utility designed to ensure uniqueness in every OTP generated. It guarantees that no repeated OTPs are produced, providing enhanced security. The package offers extensive customization options, allowing you to tailor OTP length, character sets, and expiration times to suit your specific needs.
Why MEDHIRA?
Security is critical. MEDHIRA OTP Utils provides:
- Unique OTPs - Guaranteed uniqueness in every generation
- Customizable - Length, character types configurable
- Fast - Lightweight with zero dependencies
- TypeScript Support - Full type definitions
Installation
# NPM
npm install --save medhira-otp-utils
# Yarn
yarn add medhira-otp-utilsParameters
| Parameter | Type | Optional | Default | Description |
|-----------|------|----------|---------|-------------|
| length | number | Yes | 10 | Length of the OTP |
| digits | boolean | Yes | true | Include digits |
| lowerCaseAlphabets | boolean | Yes | true | Include lowercase |
| upperCaseAlphabets | boolean | Yes | true | Include uppercase |
| specialChars | boolean | Yes | true | Include special chars |
Usage
import { generateOtp } from 'medhira-otp-utils';
// Default OTP (10 chars)
console.log(generateOtp()); // abkdkdfjkj
// Custom length
console.log(generateOtp(4)); // jbkd
// Digits only
console.log(generateOtp(4, { digits: true })); // 8654
// Alphabets only
console.log(generateOtp(6, { digits: false })); // AbKdEfContributing
Contributions are welcome!
Sponsor & Support
To keep this library maintained, consider sponsoring on GitHub.
Or reach out: [email protected]
About MEDHIRA
MEDHIRA - Engineering Intelligence Across Everything
- Website: https://medhira.readthedocs.io/en/latest/
- GitHub: https://github.com/HELLOMEDHIRA
- Email: [email protected]
License
Apache-2.0
Made with passion by MEDHIRA
