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

secure-keyz

v3.0.0

Published

A flexible and useful tool for creating the securest passwords.🔑

Downloads

192

Readme

Secure Keyz 🔐

secure-keyz is a simple yet powerful tool for generating secure and customizable passwords.


🚀 Features

  • Easily generate strong and secure passwords.
  • Customizable options for password complexity.
  • Simple command-line interface with flexible flags.
  • Use as a module in your apps or projects for seamless integration.

📦 Installation

To get started, install the package globally:

$ npm install -g secure-keyz

After installation, you can use the command-line interface globally with the craft-key command.


🖥️ Usage

Run the command as follows:

$ craft-key [options]

Generate a 16-character password with numbers and symbols:

$ craft-key --length 16 --numbers --symbols

🏆 Options

When you type -h or --help, the following options will appear:

Usage: Secure Keyz [options]

A simple and secure command-line tool for generating strong, customizable passwords.

Options:
  -V, --version           output the version number
  -l , --length <number>  Set password length (default: 12)
  -c , --lowcase          Include lowercase letters (default: false)
  -a , --uppcase          Include uppercase letters (default: false)
  -n , --numbers          Include numbers (default: false)
  -s , --symbols          Include symbols (default: false)
  -h, --help              display help for command

Aliases

You can use the following short aliases as shorthand for options:

| Flag | Alias | Description | |----------------------|---------|--------------------------------------------------| | --lowcase | -c | Includes lowercase letters in the password. | | --uppcase | -a | Includes uppercase letters in the password. | | --numbers | -n | Includes numbers in the generated password. | | --symbols | -s | Includes symbols (e.g., !@#$%^&*()_+<>?{}-=~) in the password. |


🛠️ Flags & Options

Below is a table describing the purpose of each flag.

| Flag | Description | |----------------------|--------------------------------------------------| | -V, --version | Displays the current version of the CLI tool. | | -l, --length <number> | Specifies the length of the generated password. Default is 12. | | -c, --lowcase | Includes lowercase letters in the password. | | -a, --uppcase | Includes uppercase letters in the password. | | -n, --numbers | Includes numbers in the generated password. | | -s, --symbols | Includes symbols (e.g., !@#$%^&*()_+<>?{}-=~) in the password. | | -h, --help | Displays help information about available options. |


🎯 Examples

Here are a few examples of how to use the tool:

1️⃣ Default Usage

Generate a default 12-character password including lowercase:

$ craft-key -c

2️⃣ Set Password Length

Generate a password with a custom length (e.g., 20 characters):

$ craft-key -l 20

3️⃣ Include Numbers

Generate a password that only includes numbers:

$ craft-key --numbers

OR

$ craft-key -n

4️⃣ Include Symbols

Generate a password that only includes symbols:

$ craft-key --symbols

OR

$ craft-key -s

5️⃣ Include Uppercase Letters

Generate a password with only uppercase letters:

$ craft-key --uppcase

OR

$ craft-key -a

6️⃣ Include Lowercase Letters

Generate a password with only lowercase letters:

$ craft-key --lowcase

OR

$ craft-key -c

7️⃣ Combine Multiple Options

Generate a 16-character password with numbers, symbols, lowercase, and uppercase letters:

$ craft-key --length 16 --numbers --symbols --uppcase --lowcase

OR

$ craft-key -l 16 -n -s -a -c

8️⃣ Display Help Menu

View all available options and their descriptions:

$ craft-key -h

OR

$ craft-key --help

9️⃣ Check the Version

View the current version of the tool:

$ craft-key -V

🧠 Import the Logic for Programmatic Usage

You can import and use the password generation logic directly in your own project. This allows you to use the password generator as part of custom applications.

Installation

First, ensure the package is installed as a dependency using:

$ npm install secure-keyz

Import Example

import generatePassword from 'secure-keyz';

Example Usage

Generate a 12-character password with uppercase letters, numbers, and symbols:

import generatePassword from 'secure-keyz';

const options = {
  length: 12,
  includeLowercase: false,
  includeUppercase: true,
  includeNumbers: true,
  includeSymbols: true,
};

try {
  const password = generatePassword(
    options.length,
    options.includeLowercase,
    options.includeUppercase,
    options.includeNumbers,
    options.includeSymbols
  );
  console.log("Generated Password:", password);
} catch (error) {
  console.error("Error generating password:", error.message);
}

Output Example

The output would look something like this (or may differ):

Generated Password: 3P!4&9K2$#2@

TEST

import { checkPassword } from "regex-validify";
import generatePassword from "secure-keyz";

const complexPassword = generatePassword(16, true, true, true, true)
const mediumPassword = generatePassword(12, true, true, false, true)
const simplePassword = generatePassword(12, true, true,false, false)

console.log(`Generated password: ${mediumPassword}`)
console.log(`isSecure: ${checkPassword(mediumPassword, "medium")}\n`)

console.log(`Generated password: ${simplePassword}`)
console.log(`isSecure: ${checkPassword(simplePassword, "simple")}\n`)

console.log(`Generated password: ${complexPassword}`)
console.log(`isSecure: ${checkPassword(complexPassword, "complex")}`)

Example 1

> [email protected] test
> tsc && node dist/test/test.js

Generated password: *gRv^NpIfhAD
isSecure: true

Generated password: TbRkFDXXKjwb
isSecure: true

Generated password: O9}EsqEW}F}+>BTI
isSecure: false

Example 2

> [email protected] test
> tsc && node dist/test/test.js

Generated password: uCy&ZyLi$S*h
isSecure: true

Generated password: yGLvcuVstdrc
isSecure: true

Generated password: ErbI1jUP?@#G96zA
isSecure: true

📜 License

This project is licensed under the ISC License.


Safe for every purpose and every use! Whether for playing with the CLI or using in big projects.