@hosterai/passwords
v1.1.0
Published
Generate passwords
Readme
Password Generator
This project is a simple password generator written in TypeScript.
Usage
Import the Password class from main.js:
import { Password } from './main';Create a new instance of the Password class:
let password = new Password();You can then generate a password using the generate method:
let pwd = password.generate(10);This will generate a 10-character password.
Customization
You can customize the length of the different character types in the password:
let pwd = password
.lowercaseLength(2)
.uppercaseLength(2)
.symbolsLength(2)
.numbersLength(2)
.generate(10);his will generate a 10-character password with 2 lowercase letters, 2 uppercase letters, 2 symbols, and 2 numbers.
Testing
Tests are located in the main.spec.ts file. They can be run using your test runner of choice.
The tests cover the following scenarios:
The generate method returns a password of the correct length.
The generate method returns a password containing only lowercase letters when only the lowercaseLength is set.
The generate method returns a password containing only uppercase letters when only the uppercaseLength is set.
The generate method returns a password containing only numbers when only the numbersLength is set.
