https://github.com/cityssm/simple-password-generator
Makes generating simple or complex, appropriate passwords a breeze.
https://github.com/cityssm/simple-password-generator
generator hacktoberfest password password-generator safe security unleet zxcvbn
Last synced: 11 months ago
JSON representation
Makes generating simple or complex, appropriate passwords a breeze.
- Host: GitHub
- URL: https://github.com/cityssm/simple-password-generator
- Owner: cityssm
- License: mit
- Created: 2020-07-29T18:17:24.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T20:57:23.000Z (over 3 years ago)
- Last Synced: 2024-11-08T11:55:59.930Z (over 1 year ago)
- Topics: generator, hacktoberfest, password, password-generator, safe, security, unleet, zxcvbn
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@cityssm/simple-password-generator
- Size: 445 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-password-generator
[](https://www.npmjs.com/package/@cityssm/simple-password-generator)
[](https://app.codacy.com/gh/cityssm/simple-password-generator)
[](https://codeclimate.com/github/cityssm/simple-password-generator/maintainability)
[](https://codeclimate.com/github/cityssm/simple-password-generator/test_coverage)
[](https://ci.appveyor.com/project/dangowans/simple-password-generator)
[](https://app.snyk.io/org/cityssm/project/6f305273-35f2-4834-93e3-14c13a413055)
Makes generating simple or complex, _appropriate_ passwords a breeze.
- Passwords can have a minimum or maximum length.
- Passwords can include words, letters, numbers, and symbols.
- Passwords are scanned with [zxcvbn-typescript](https://github.com/trichards57/zxcvbn)
to reduce their guessability.
- Passwords are translated with [unleet](https://github.com/cityssm/unleet),
and scanned using [badwords](https://github.com/MauriceButler/badwords) to
make sure they are appropriate.
## Installation
```bash
npm install @cityssm/simple-password-generator
```
## Usage
```javascript
import { generatePassword } from "@cityssm/simple-password-generator";
generatePassword();
= "carPoetDRIVING%38"
generatePassword({ minLength: 15, pattern: "wnWnX" });
= "curious6COMPOSITION7B"
generatePassword({ pattern: 'xxxXXXnnns', doShufflePattern: true });
= "c0O4WG@od9"
```
### Options
| Option | Description | Default |
| ---------------- | ------------------------------------------------------------------------------------------------------- | -------- |
| minLength | The minimum password length. | `8` |
| maxLength | The maximum password length. | `50` |
| pattern | The format the password should use. | `"wCnn"` |
| doShufflePattern | Whether the pattern should be ordered randomly or not. | `false` |
| minScore | The minimum allowable zxcvbn guessability score, where 0 is "too guessable" and 4 is "very unguessable" | `2` |
| retries | The number of times the generator should try to generate a password before failing and returning null. | `20` |
Note that if your `pattern` cannot generate a password
within your set `minLength` and `maxLength`,
the `generatePassword()` function may return a `null` value.
### Pattern Options
| Pattern Character | Description | Example |
| ----------------- | ----------------- | ------- |
| w | Lower case word | word |
| W | Upper case word | WORD |
| C | Capitalized word | Word |
| x | Lower case letter | a |
| X | Upper case letter | A |
| n | Number | 9 |
| s | Symbol | @ |