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

joi-password-complexity

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi-password-complexity

Joi validation for password complexity requirements.

  • 5.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.2K
increased by4.59%
Maintainers
1
Weekly downloads
 
Created
Source

Joi Password Complexity

Creates a Joi object that validates password complexity.

Requirements

  • Joi v17 or higher

Installation

npm install joi-password-complexity

Examples

No options specified

const passwordComplexity = require("joi-password-complexity");
passwordComplexity().validate("aPassword123!");

When no options are specified, the following are used:

{
  min: 8,
  max: 26,
  lowerCase: 1,
  upperCase: 1,
  numeric: 1,
  symbol: 1,
  requirementCount: 4,
}

Options specified

const passwordComplexity = require("joi-password-complexity");

const complexityOptions = {
  min: 10,
  max: 30,
  lowerCase: 1,
  upperCase: 1,
  numeric: 1,
  symbol: 1,
  requirementCount: 2,
};

passwordComplexity(complexityOptions).validate("aPassword123!");

Error Label (optional) Specified

const label = "Password"

const passwordComplexity = require("joi-password-complexity");
  • For default options:
passwordComplexity(undefined, label).validate("aPassword123!");
  • For specified options:
passwordComplexity(complexityOptions, label).validate("aPassword123!");

The resulting error message: 'Password should be at least 8 characters long'

License

MIT

Keywords

FAQs

Package last updated on 11 Jul 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