# @cityssm/simple-password-generator

> Makes generating simple or complex, appropriate passwords a breeze.

Latest version **2.1.2** (published 2022-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @cityssm/simple-password-generator
pnpm add @cityssm/simple-password-generator
yarn add @cityssm/simple-password-generator
bun add @cityssm/simple-password-generator
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2022-05-19 |
| First published | 2020-07-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 5 |
| Unpacked size | 16.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | The Corporation of the City of Sault Ste. Marie |
| Maintainers | dgowans |
| Keywords | generator, password, password-generator, safe, security, unleet, zxcvbn |

## Links

- npm: https://www.npmjs.com/package/@cityssm/simple-password-generator
- Repository: https://github.com/cityssm/simple-password-generator
- Homepage: https://github.com/cityssm/simple-password-generator#readme
- Issues: https://github.com/cityssm/simple-password-generator/issues
- npm.io page: https://npm.io/package/@cityssm/simple-password-generator

## Dependencies (5)

- [badwords](https://npm.io/package/badwords.md) ^1.0.0
- [random-item](https://npm.io/package/random-item.md) ^4.0.1
- [@cityssm/unleet](https://npm.io/package/@cityssm/unleet.md) ^2.4.0
- [zxcvbn-typescript](https://npm.io/package/zxcvbn-typescript.md) ^5.0.1
- [@cityssm/random-words](https://npm.io/package/@cityssm/random-words.md) ^1.2.1

## Recent versions

- 2.1.2 (latest) — 2022-05-19
- 2.1.1 — 2022-02-07
- 2.1.0 — 2021-07-06
- 2.0.2 — 2021-05-25
- 2.0.1 — 2021-04-19
- 2.0.0 — 2021-04-19
- 1.1.6 — 2021-02-23
- 1.1.5 — 2021-02-23
- 1.1.4 — 2021-02-23
- 1.1.3 — 2021-02-18
- 1.1.2 — 2021-01-13
- 1.1.1 — 2020-10-30
- 1.1.0 — 2020-10-23
- 1.0.1 — 2020-10-23
- 1.0.0 — 2020-10-06
- … 15 more at https://npm.io/package/@cityssm/simple-password-generator/versions

## README

# simple-password-generator

[![npm](https://img.shields.io/npm/v/@cityssm/simple-password-generator)](https://www.npmjs.com/package/@cityssm/simple-password-generator)
[![Codacy Badge](https://img.shields.io/codacy/grade/af55a93d353f4881ad2fdee1c582e495)](https://app.codacy.com/gh/cityssm/simple-password-generator)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/cityssm/simple-password-generator)](https://codeclimate.com/github/cityssm/simple-password-generator/maintainability)
[![Test Coverage](https://img.shields.io/codeclimate/coverage/cityssm/simple-password-generator)](https://codeclimate.com/github/cityssm/simple-password-generator/test_coverage)
[![AppVeyor](https://img.shields.io/appveyor/build/dangowans/simple-password-generator)](https://ci.appveyor.com/project/dangowans/simple-password-generator)
[![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/cityssm/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            | @       |

---
_Source: https://npm.io/package/@cityssm/simple-password-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
