npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@edgeguideab/password-check

v1.3.0

Published

Evaluate and score passwords in the browser and on the server

Downloads

131

Readme

Install via NPM

npm install @edgeguideab/password-check

In the browser

You will need to require the module and then package your scripts using a bundler like webpack or browserify.

Usage

evaluate passwords

const pwCheck = require('@edgeguideab/password-check');
let result = pwCheck.evaluate('mynicepassword123!');

console.log(result);
// { valid: true }

add options to your evaluation

const pwCheck = require('@edgeguideab/password-check');
let result = pwCheck.evaluate('mynicepassword123!', {
  length: 16,
  allowCommon: false,
  strict: true,
  numeric: 4,
  nonAlphaNumeric: 2,
  minScore: 12
});

console.log(result);
//{ valid: false, reason: 'CONTAINS_COMMON_PATTERNS' }

Options

| Name | Type | Description | | ------------------- | ------- | ------------------------------------------------------------------------------------------- | | length | Number | The minimum length a password has to be to be valid | | allowCommon | Boolean | Invalidates all passwords matching one of the most common 1500 passwords | | strict | Boolean | Invalidates all passwords containing (as a substring) one of the most common 1500 passwords | | upperCase / capital | Number | The minimum number of capital characters needed for a password to be valid | | lowerCase / small | Number | The minimum number of small characters needed for a password to be valid | | numeric | Number | The minimum number of numeric characters for a password to be valid | | nonAlphanumeric | Number | The minimum number of non-alphanumeric characters for a password to be valid | | minScore | Number | The minimum score the password needs to yield for it to be accepted |

Errors

These errors are reported back from the evaluate function. They are pretty self explanatory, but here goes. | Name | Description | |-----------------|-----------------------------------------------------------------| | TOO_COMMON | The password was found among the 1500 most common passwords | | TOO_FEW_CAPITAL_LETTERS | The password contained too few capital characters | | TOO_FEW_SMALL_LETTERS | The password contained too few small characters | | CONTAINS_COMMON_PATTERNS | A part of the password was found among the 1500 most common | | TOO_FEW_NUMERIC_CHARACTERS | The password contained too few numeric characters (only with the numeric option) | | TOO_FEW_NON_ALPHANUMERIC_CHARACTERS | The password contained too few alphanumeric characters (only with the alphanumeric option) | | SCORE_TOO_LOW | The password scored too low | | TOO_SHORT | The password was too short |

score passwords

const pwCheck = require('@edgeguideab/password-check');
let score = pwCheck.score('mynicepassword123!');
console.log(score);
// 16.2

score with options

const pwCheck = require('@edgeguideab/password-check');
let score = pwCheck.score('mynicepassword123!', {
  checkForCommon: true
});
console.log(score);
// 8.1

The scoring function will impose a penalty for passwords containing words from the 1500 most commonly used passwords if the checkForCommon flag is set to true. The default is false.

Acknowledgements

All passwords in the top 1500 most common list were taken from the list provided by Koshevoy Dmitry at passwordrandom.com

Author

EdgeGuide AB