πŸ”‘ Password Validator

Validate a password given a security policy.

Do you want to protect yourself against SQL injection and other code injections?

Use our input sanitizer tool.

Easily validate different types of data.

Usage

import DymoAPI from "dymo-api";

const dymo = new DymoAPI();

console.log(await dymo.isValidPwd({ 
  email: "[email protected]",
  password: "PASSWORD_REQ",
  bannedWords: [
      "CompanyName",
      "UserName"
  ],
  min: 16,
  max: 42
}));

Response

All values in details are Strings.

{
    valid: false,
    password: "PASSWORD_REQ",
    // All possible mistakes.
    details: [
        {
            validation: "spaces",
            message: "The password cannot contain spaces."
        },
        {
            validation: "bannedWords",
            message: "The password cannot contain the word \"foundWord\".",
            word: "foundWord"
        },
        {
            validation: "hasSql",
            message: "Password injections are not allowed."
        },
        {
            validation: "blacklist",
            message: "The password is too common."
        },
        {
            validation: "min",
            message: "The password must be at least 8 characters long."
        },
        {
            validation: "max",
            message: "The password must be no longer than 100 characters."
        },
        {
            validation: "digits",
            message: "The password must have at least 2 digits."
        },
        {
            validation: "letters",
            message: "The password must have upper and lower case letters."
        },
        {
            validation: "symbols",
            message: "The password must contain at least one special symbol/character."
        },
        {   
            validation: "email",
            message: "The email user and password cannot match."
        },
        {   
            validation: "userEmail",
            message: "The email user and password cannot match."
        }
    ]
}

Parameters

ParameterTypeRequiredDescription
passwordStringβœ…Refers to the password to be validated
emailString❌Refers to the email address linked to the password to be validated
bannedWords | banned_wordsString[] (0-10)❌Refers to the forbidden words in the password
minInteger (8 - 32)❌Refers to the minimum length of the password
maxInteger (32- 100)❌Refers to the maximum length of the password