secure-keyz
v3.0.0
Published
A flexible and useful tool for creating the securest passwords.🔑
Downloads
192
Maintainers
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.