Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strict-password-generator

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strict-password-generator

Generate a random password with strict requirements

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-0.19%
Maintainers
1
Weekly downloads
 
Created
Source

strict-password-generator

Generate a random password with strict requirements

Install

$ npm install strict-password-generator --save

Usage

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 : ['!', '@', '#', '$', '%', '^', '*', '+', '_', '-', '=', ':', ';', '?']

NameTypeDefault Value
upperCaseAlphaBooltrue
lowerCaseAlphaBooltrue
numberBooltrue
specialCharacterBooltrue
minimumLengthInt (Must be >= 4)8
maximumLengthIntminimumLength + 4
exactLengthIntnone

Examples

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

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}

Keywords

FAQs

Package last updated on 07 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc