npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@hixbe/otp-pass-kit

v2.0.2

Published

A secure, cryptographically-strong OTP and password generator for Node.js with CLI support. Generate customizable one-time passwords and strong passwords with TypeScript support.

Readme

OTP & Password Generator Kit

npm version License: MIT TypeScript Node.js npm downloads

A secure, cryptographically-strong OTP (One-Time Password) and password generator for Node.js and TypeScript projects. Generate customizable authentication codes and strong passwords with CLI support.

✨ Features

  • 🔐 Cryptographically Secure: Uses Node.js crypto.randomInt() for secure random generation
  • 🎯 Customizable: Configure character sets, length, and complexity requirements
  • 🖥️ CLI Support: Command-line interface for quick generation
  • 📦 TypeScript: Full TypeScript support with type definitions
  • 🚀 Fast: Optimized performance with minimal dependencies
  • 🔒 Security-First: Designed for authentication and security use cases
  • 🎨 Flexible: Supports OTP generation and complex password creation

📦 Installation

npm install @hixbe/otp-pass-kit

🚀 Quick Start

Programmatic Usage

import { generateOtp, generatePass } from "@hixbe/otp-pass-kit";

// Generate a secure 6-digit OTP
const otp = generateOtp();
console.log(otp); // "482739"

// Generate a strong 12-character password
const password = generatePass(12, { ensureEachType: true });
console.log(password); // "rT8#mNpL2&k"

Command Line Interface

# Generate OTP
npx otp-pass-kit otp

# Generate password
npx otp-pass-kit pass -l 12 --ensure-each-type

# Install globally for easier access
npm install -g @hixbe/otp-pass-kit
otp-pass-kit otp -l 8 -u -d

CLI Usage

Usage: otp-pass-kit <command> [options]

Commands:
  otp     Generate an OTP (One-Time Password)
  pass    Generate a password

Options:
  -l, --length <number>     Length of the generated string (default: 6 for otp, 8 for pass)
  -d, --digits              Include digits (default: true for otp, true for pass)
  -u, --uppercase           Include uppercase letters (default: false for otp, true for pass)
  -w, --lowercase           Include lowercase letters (default: false for otp, true for pass)
  -s, --special             Include special characters (default: false for otp, true for pass)
  -e, --ensure-each-type    Ensure at least one character from each enabled set
  -h, --help                Show this help message

Examples:
  otp-pass-kit otp
  otp-pass-kit otp -l 8 -u -d
  otp-pass-kit pass
  otp-pass-kit pass -l 12 --ensure-each-type
  otp-pass-kit pass -l 10 -u -w -d --no-special

OTP Generator

Function Signature

function generateOtp(length?: number, options?: OtpOptions): string;

Options

| Option | Type | Default | Description | |--------------------|--------|---------|-------------------------------------| | upperCaseAlphabets | boolean | false (OTP), true (Pass) | Include uppercase letters | | lowerCaseAlphabets | boolean | false (OTP), true (Pass) | Include lowercase letters | | specialChars | boolean | false (OTP), true (Pass) | Include special characters | | digits | boolean | true | Include digits | | ensureEachType | boolean | false | Ensure at least one character from each enabled set is included (requires length >= number of enabled sets) |

Example Usage

import { generateOtp } from "@hixbe/otp-pass-kit";

const otp1 = generateOtp(); // Default 6-digit numeric OTP
console.log(otp1);

const otp2 = generateOtp(8, { upperCaseAlphabets: true, digits: true }); // 8-character OTP with digits and uppercase letters
console.log(otp2);

Password Generator

Function Signature

function generatePass(length?: number, options?: PassOptions): string;

Options

| Option | Type | Default | Description | |--------------------|--------|---------|-------------------------------------| | upperCaseAlphabets | boolean | true | Include uppercase letters | | lowerCaseAlphabets | boolean | true | Include lowercase letters | | specialChars | boolean | true | Include special characters | | digits | boolean | true | Include digits |

Example Usage

import { generatePass } from "@hixbe/otp-pass-kit";

const password1 = generatePass(); // Default 8-character password with all character sets
console.log(password1);

const password2 = generatePass(12, { lowerCaseAlphabets: true, digits: true }); // 12-character password with lowercase letters and digits
console.log(password2);

const password3 = generatePass(12, { ensureEachType: true }); // 12-character password with at least one of each type
console.log(password3);

🛡️ Security & Trust

  • Cryptographically Secure: Uses Node.js crypto.randomInt() for secure random generation
  • Provenance: Published with npm provenance for supply chain security
  • TypeScript: Full type safety and modern JavaScript features
  • Zero Dependencies: Lightweight with no external runtime dependencies

Provenance & Build Security

This package is published with npm provenance, providing cryptographic proof that the package was built from this source repository. You can verify the build provenance on the npm package page.

Build Information:

📖 API Reference

generateOtp(length?, options?)

Generates a secure One-Time Password (OTP) for authentication purposes.

function generateOtp(length?: number, options?: OtpOptions): string

Parameters:

  • length (optional): Length of OTP (default: 6, max: 1000)
  • options (optional): Configuration object for character sets

Returns: A string containing the generated OTP

generatePass(length?, options?)

Generates a strong, customizable password with various character set options.

function generatePass(length?: number, options?: PassOptions): string

Parameters:

  • length (optional): Length of password (default: 8, max: 1000)
  • options (optional): Configuration object for character sets and security options

Returns: A string containing the generated password

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | digits | boolean | true | Include numeric digits (0-9) | | lowerCaseAlphabets | boolean | true (pass), false (otp) | Include lowercase letters (a-z) | | upperCaseAlphabets | boolean | true (pass), false (otp) | Include uppercase letters (A-Z) | | specialChars | boolean | true (pass), false (otp) | Include special characters (!@#$%^&*()_+-=[]{}|;:,.<>?) | | ensureEachType | boolean | false | Guarantee at least one character from each enabled set |

💻 CLI Usage

The package includes a powerful command-line interface for generating secure passwords and OTPs directly from your terminal.

Installation

# Use with npx (no installation required)
npx otp-pass-kit otp

# Or install globally
npm install -g @hixbe/otp-pass-kit

CLI Commands

# Generate default 6-digit OTP
otp-pass-kit otp

# Generate 8-character OTP with uppercase and digits
otp-pass-kit otp -l 8 -u -d

# Generate default 8-character password
otp-pass-kit pass

# Generate 12-character password ensuring all character types
otp-pass-kit pass -l 12 --ensure-each-type

# Generate password with custom character sets
otp-pass-kit pass -l 16 -u -w -d --no-special

# Show help
otp-pass-kit --help

CLI Options

  • -l, --length <number>: Set password/OTP length
  • -d, --digits: Include digits
  • --no-digits: Exclude digits
  • -u, --uppercase: Include uppercase letters
  • --no-uppercase: Exclude uppercase letters
  • -w, --lowercase: Include lowercase letters
  • --no-lowercase: Exclude lowercase letters
  • -s, --special: Include special characters
  • --no-special: Exclude special characters
  • -e, --ensure-each-type: Ensure each character type is represented
  • -h, --help: Show help information

🎯 Use Cases

  • Authentication Systems: Generate secure OTPs for 2FA/MFA
  • Password Management: Create strong, random passwords
  • Security Tools: Build password generators and security utilities
  • Development: Generate test data and temporary credentials
  • CLI Tools: Quick password generation in scripts and automation

🚀 Publishing & Distribution

This package is published under the @hixbe organization scope on npm with the following security features:

  • Automated Publishing: Published via GitHub Actions on every push to main branch with automatic version bumping
  • Manual Publishing: Available through GitHub Actions workflow dispatch for controlled releases
  • Provenance: Cryptographically signed builds with npm provenance
  • Org Scope: Published under @hixbe/ namespace for organization management

Build & Publish Process

  1. Automated: Commits to main trigger automatic publishing with version determination based on commit messages
  2. Manual: Use GitHub Actions "Manual Publish" workflow for controlled releases with specific version bumps
  3. Validation: Pre-publish checks ensure package integrity and org scope
  4. Verification: Post-publish verification confirms successful deployment and creates GitHub releases

Automated Version Management

The package uses automated versioning based on conventional commit messages:

  • fix: commits trigger patch version bumps (1.0.0 → 1.0.1)
  • feat: commits trigger minor version bumps (1.0.0 → 1.1.0)
  • BREAKING CHANGE: commits trigger major version bumps (1.0.0 → 2.0.0)

Repository: github.com/hixbe/otp-pass-kit Package: npmjs.com/package/@hixbe/otp-pass-kit

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions welcome! Please feel free to submit issues and pull requests.

📞 Support


Keywords: otp generator, password generator, secure random, cryptography, authentication, typescript, cli, security, random string, npm package, nodejs