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

password-checker

v0.2.4

Published

Check passwords against different rules and word lists

Downloads

89

Readme

password-checker

How it works

The checker works out of the box, but will accept any password.

You need to enable rules and change the words lists, if you don't want to use the defaults.

The API

Initialize

var Checker = require('password-checker');
var checker = new Checker();

Checks that can be enabled

Minimum and maximum lengths

// Change minimum length required
// Default is: 0, which is effectively disabling of the check
checker.min_length = 8;

// Change maximum length required
// Default is: 0, which is effectively disabling of the check
checker.min_length = 20;

Require letters, numbers and symbols

checker.requireLetters(true);
checker.requireNumbers(true);
checker.requireSymbols(true);

Require letters + numbers and/or symbols

checker.requireLetters(true);
checker.requireNumbersOrSymbols(true);

Require ONLY the letters, numbers and symbols set in the allowed_x lists

checker.checkLetters(true);
checker.checkNumbers(true);
checker.checkSymbols(true);

Disallow passwords containing words that are found in disallow list(s)

Names, words and passwords checks works the same way. They can tak up to 3 parameters.

// Disallow passwords that matches a full name
checker.disallowNames(true);

// Disallow passwords that contains word(s) found in the words list
checker.disallowWords(true, true);

// Disallow passwords that contains password(s) found in the passwords list
// But limit it to passwords with 3 or more characters
checker.disallowPasswords(true, true, 3);

Lists that can be modified

Letters, numbers and symbols

// Change the letters that are allowed
// Default is: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
checker.allowed_letters = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghkmnpqrstuvwxyz';

// Default is: 0123456789
checker.allowed_numbers = '23456789';

// Default is: _- !\"?$%^&*()+={}[]:;@'~#|<>,.?\\/
checker.allowed_symbols = '_-';

Lists of words, names and passwords

The words will always be changed to lowercase and so will the actual passwords checked.

checker.disallowed_words = ['some', 'Others'];
checker.disallowed_names = ['Dan', 'joe'];
checker.disallowed_passwords = ['ABCDEF', 'hijklm'];

How to check and what can be gathered

Each check will return true or false.

The checker will then hold a list of errors that occurred.

A list of rules and whether they failed will also be accessible.

A check without errors

checker.min_length = 10;
console.log(checker.check('Should work'));
// Prints:
// true

console.log(checker.errors);
// Prints:
// []

console.log(checker.rules);
// Prints:
// { min_length:
//    { name: 'min_length',
//      method: [Function],
//      error_message: null,
//      failed: false } }

A check with errors

checker.min_length = 100;
console.log(checker.check('Should not work'));
// Prints:
// false

console.log(checker.errors);
// Prints:
// [ [Error: The password is too short] ]

console.log(checker.rules);
// Prints:
// { min_length:
//    { name: 'min_length',
//      method: [Function],
//      error_message: 'The password is too short',
//      failed: true } }

The word lists

Words

The words list is the first 10.000 words found in a list of 1/3 million words list.

The 1/3 million list is create by Peter Norvig who is Director of Research @ Google.

The entire list can be found here: Natural Language Corpus Data: Beautiful Data - the file is called count_1w.txt

Thank you Peter Norvig!

Names

The names list is a mashup of different sources and contains 17956 common international names:

US Names from the US Social Security

"Given names" extracted from WikiPedia

International names extracted from Baby Name Wizard

Thank you US Social Security, WikiPedia and Baby Name Wizard!

Passwords

Passwords is a list of the 10.000 most used passwords according to Mark Burnett from xato.net.

You can find the list (+1 with frequency) in this blog post by Mark Burnett.

Thank you Mark Burnett!