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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ts-secure-password-generator

v0.0.2

Published

Generates secure passwords based on user-provided words.

Downloads

147

Readme

Secure Password Generator

secure-password-generator is a TypeScript library and CLI tool that generates secure passwords based on user-provided words. The package is focused on security and flexibility, adding symbols, numbers, and special characters to create complex and strong passwords.

Features

  • Library Usage: Integrate password generation into your TypeScript or JavaScript projects.
  • CLI Application: Generate passwords directly from the command line.
  • Cryptographically Secure: Uses cryptographically secure random numbers for password generation.
  • Customization: Allows you to customize the base word and password length.
  • Cross-Environment: Works seamlessly in both server-side (Node.js) and client-side (browser) environments.

Installation

As a Library

To install it as a library in your project, use npm:

npm install secure-password-generator

As a CLI Tool

To install the package globally and use it as a CLI tool, run:

npm install -g secure-password-generator

Usage

Library

Import the Package

First, import the package into your project:

import { PasswordService } from 'secure-password-generator';

const userWord = "apple";
const passwordLength = 12;

const password = PasswordService.generatePassword(userWord, passwordLength);
console.log(`Generated password: ${password}`);

Functions

  • generatePassword(word: string, length: number): string: Generates a secure password based on the provided word and desired length. It randomly mixes character cases, adds special symbols and numbers, and shuffles the result to increase security.

CLI

After installing the package globally, you can use the secure-passgen command to generate passwords.

Basic Usage

secure-passgen

Interactive Prompt

The CLI tool will prompt you to enter a base word and the desired password length:

$ secure-passgen
Secure Password Generator CLI
==============================

Enter a base word: apple
Enter desired password length: 12

Generated Password: App1e!23xYz

Currently, the CLI operates interactively, but future versions may include command-line options for non-interactive usage.

Password Generation Rules

  • User Word Transformation: The user's base word is randomly transformed with mixed character cases (uppercase and lowercase).
  • Character Addition: Symbols, numbers, and additional letters (uppercase and lowercase) are added to the word to meet the desired password length.
  • Cryptographically Secure: The password is generated using cryptographically secure random numbers for improved security.
  • Shuffling: The generated password is shuffled to increase complexity and randomness.

Testing

The project uses Jest for testing. To run the tests, use the following command:

npm test

License

MIT License.