A simple module for calculating the entropy of a given password. There are a few configurable options to make it work for your use case as well.
npm i pw-entropy
props- Object that can contain the following keys:
minLength- Minimum password length as integer (defaults to 8)
maxLength- Maximum password length as integer (defaults to 64)
disallowRepeated- Boolean for whether passwords should disallow repeated characters (e.g.
aa). (defaults to false)
badWords- Array of words that should be disallowed. Defaults to an array pulled from this link
password- The password to test
- The number of bits of entropy (floored to nearest integer). Higher is better. 0 is returned when either a too-common password, or a password that violates one of the boundaries set through options.
"use strict";const PasswordEntropy = ;const validator = ;const password = "Testing,A,Password";if validator < 50console;elseconsole;