Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/badavis/strict-password-generator
Generate a random password with specific requirements
https://github.com/badavis/strict-password-generator
cryptography javascript npm npm-package password password-generator random random-number-generators
Last synced: 23 days ago
JSON representation
Generate a random password with specific requirements
- Host: GitHub
- URL: https://github.com/badavis/strict-password-generator
- Owner: badavis
- License: mit
- Created: 2016-08-23T18:45:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T10:36:07.000Z (over 1 year ago)
- Last Synced: 2024-11-28T19:43:29.048Z (about 1 month ago)
- Topics: cryptography, javascript, npm, npm-package, password, password-generator, random, random-number-generators
- Language: JavaScript
- Size: 278 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# strict-password-generator
Generate a random password with strict requirements### Install
```bash
$ npm install strict-password-generator --save
```### Usage
```javascript
const PasswordGenerator = require('strict-password-generator').default;const passwordGenerator = new PasswordGenerator();
// return value is a unique randomly generated password string
let password = passwordGenerator.generatePassword();
```### Options
Pass options object to passwordGenerator.generatePassword()Possible special characters : ['!', '@', '#', '$', '%', '^', '*', '+', '_', '-', '=', ':', ';', '?']
| Name | Type | Default Value |
|--------------------------|---------------------------------------------|---------------|
| upperCaseAlpha | Bool | true |
| lowerCaseAlpha | Bool | true |
| number | Bool | true |
| specialCharacter | Bool | true |
| minimumLength | Int (Must be >= 4) | 8 |
| maximumLength | Int |minimumLength + 4|
| exactLength | Int | none |### Examples
```javascript
const PasswordGenerator = require('strict-password-generator').default;const passwordGenerator = new PasswordGenerator();
const options = {
upperCaseAlpha : false,
lowerCaseAlpha : true,
number : true,
specialCharacter : false,
minimumLength : 10,
maximumLength : 12
}let password = passwordGenerator.generatePassword(options);
console.log(password); // example string : qa5859qoz8
```
---
```javascript
const PasswordGenerator = require('strict-password-generator').default;const passwordGenerator = new PasswordGenerator();
// exactLength will always override minimumLength and maximumLength
const options = {
minimumLength : 10,
maximumLength : 12,
exactLength : 15
}let password = passwordGenerator.generatePassword(options);
console.log(password); // example string : 5eT1c^n9,`35C5}
```