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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@flexthecoder/keygen

v1.0.2

Published

A cryptographically secure password generator with multiple presets and customizable options

Readme

Secure Password Generator

A cryptographically secure password generator with multiple presets and customizable options.

Installation

npm install @flexthecoder/keygen

Features

  • ✅ Multiple pre-built functions for different use cases
  • ✅ Fully customizable options
  • ✅ No external dependencies
  • ✅ TypeScript-friendly
  • ✅ ES Module support
  • ✅ Lightweight and fast

Usage

Simple Example

import { generatePassword, generateDefaultPassword } from '@flexthecoder/keygen'

// Default password (12 characters, all character types)
const password = generateDefaultPassword()
console.log(password) // e.g. "aB3!xK9@mP2q"

Custom Password

import { generatePassword } from '@flexthecoder/keygen'

const customPassword = generatePassword({
  length: 16,
  includeUppercase: true,
  includeLowercase: true,
  includeNumbers: true,
  includeSymbols: false
})
console.log(customPassword) // e.g. "aBcDeF123456GhIj"

Simple Password (without symbols)

import { generateSimplePassword } from '@flexthecoder/keygen'

const simplePassword = generateSimplePassword(10)
console.log(simplePassword) // e.g. "Abc123XyZ9"

Generate PIN Code

import { generatePIN } from '@flexthecoder/keygen'

const pin = generatePIN(6)
console.log(pin) // e.g. "847293"

Highly Secure Password

import { generateSecurePassword } from '@flexthecoder/keygen'

const securePassword = generateSecurePassword(32)
console.log(securePassword) // e.g. "aB3!xK9@mP2q#L5$nR8%sT1^vW4&"

API

generatePassword(options)

Generates a secure random password based on the specified options.

Parameters:

  • options (Object, optional): Configuration options
    • length (number): Length of the password (default: 12)
    • includeUppercase (boolean): Include uppercase letters A-Z (default: true)
    • includeLowercase (boolean): Include lowercase letters a-z (default: true)
    • includeNumbers (boolean): Include numbers 0-9 (default: true)
    • includeSymbols (boolean): Include special characters (default: true)

Returns: string - The generated password

Throws: Error if no character sets are selected

Example:

const password = generatePassword({
  length: 20,
  includeUppercase: true,
  includeLowercase: true,
  includeNumbers: true,
  includeSymbols: true
})

generateDefaultPassword()

Generates a password with default settings (all character types, length 12).

Returns: string - The generated password

Example:

const password = generateDefaultPassword()

generateSimplePassword(length)

Generates a simple password (letters and numbers only, no symbols).

Parameters:

  • length (number, optional): Length of the password (default: 12)

Returns: string - The generated password

Example:

const password = generateSimplePassword(15)

generatePIN(length)

Generates a PIN code (numbers only).

Parameters:

  • length (number, optional): Length of the PIN (default: 6)

Returns: string - The generated PIN

Example:

const pin = generatePIN(4)

generateSecurePassword(length)

Generates a highly secure password with all character types.

Parameters:

  • length (number, optional): Length of the password (default: 24)

Returns: string - The generated password

Example:

const password = generateSecurePassword(32)

Character Sets Used

  • Lowercase letters: a-z (26 characters)
  • Uppercase letters: A-Z (26 characters)
  • Numbers: 0-9 (10 characters)
  • Symbols: !@#$%^&*()_+-=[]{}|;:,.<>? (30 characters)

Security Notes

This library uses Math.random() for password generation. For production applications with the highest security requirements, you should consider using crypto.getRandomValues() (Browser) or crypto.randomBytes() (Node.js).

License

MIT

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

Support

For questions or problems, please open an issue on GitHub: https://github.com/flexthecoder/keygen/issues