Socket
Socket
Sign inDemoInstall

ts-password-check

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-password-check

Check the strength of the password inputed and returns what needs to be updated in the password for that to be more strong.


Version published
Maintainers
1
Created
Source

Strong Password Check

A Node.js module that checks the strength of a password based on configurable criteria.

Installation

To install the package, run the following command:

npm i strong-password-check --save

Usage

const getPasswordStrength = require('strong-password-check');

const password = 'myPassword123#';

const config = {
    lowercase: true,
    uppercase: true,
    digits: true,
    specialChars: true,
    minLength: 8,
};

const result = getPasswordStrength(password, config);

console.log(result);
// { messages: [], strength: 'Strong' }
The package exports a single function, getPasswordStrength, which takes two arguments:
  • password: A string representing the password to check.
  • config: An object containing the configuration options for the password strength checker. The following options are available:
valueTypeDefault ValueDescription
uppercaseBooleantrueWhether the password must contain at least one uppercase letter.
lowercaseBooleantrueWhether the password must contain at least one lowercase letter.
digitsBooleantrueBoolean. Whether the password must contain at least one number.
specialCharsBooleantrueWhether the password must contain at least one special charecter.
minLengthNumber8Number. The minimum length of the password.
The getPasswordStrength function returns an object with two properties:
  • messages: An array of strings containing messages for each criterion that the password does not meet.
  • strength: A string indicating the strength of the password. Possible values are "Weak", "Moderate", and "Strong".

Contributing

Contributions are welcome! If you find a bug or would like to add a feature, please open an issue or pull request on GitHub.

Author

  • @nihalavulan

Keywords

FAQs

Package last updated on 08 Jun 2023

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