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

shield-key

v1.0.2

Published

A simple password strength checker npm package

Downloads

11

Readme

ShieldKey - Password Strength Checker

ShieldKey is a powerful and easy-to-use npm package for assessing the strength of passwords. It provides a comprehensive solution to enhance the security of user passwords by evaluating their complexity and adherence to recommended security practices.

Features

  • Simple integration: Easily incorporate ShieldKey into your Node.js projects to assess password strength.
  • Customizable policies: Tailor password strength requirements to suit your application's security needs.
  • Lightweight and efficient: ShieldKey is designed for minimal impact on performance while delivering robust password evaluations.

Installation

To install ShieldKey, use npm:

npm install shield-key

Usage

Basic Password Strength Check

By default , length is 8 and


const ShieldKey = require('shield-key');

const password = 'SecureP@ss123';
const strength = ShieldKey.checkPasswordStrength(password, options);

console.log(strength)
// weak , medium , strong

The checkPasswordStrength function evaluates the strength of a password based on predefined criteria, including the presence of uppercase and lowercase letters, numbers, special characters, and a minimum length of 8 characters.

Custom Password Verification

const PasswordStrengthChecker = require('password-strength-checker');

// Example usage with custom criteria
const password = 'SecureP@ss123';
//default values are false for all except trimmed (which is true by default) . default length is 8
const verificationOptions = {
  uppercase: true,
  lowercase: true,
  number: true,
  special: true,
  length: 8,
  trimmed: true,
};

const isValidPassword = PasswordStrengthChecker.customPasswordVerification(password, verificationOptions);
//returns true or false based on provided values
console.log(`Is password valid? ${isValidPassword ? 'Yes' : 'No'}`);

Custom Policies

You can customize password strength policies to align with your application's security requirements. Here's an example:

const customPolicies = {
  uppercase: /[A-Z]/,
  lowercase: /[a-z]/,
  number: /[0-9]/,
  special: /[!@#$%^&*()_+=-\[\]{};:,./<>?]/,
  length: /\S{12,}/  // Custom length requirement of at least 12 characters
};

const customStrength = ShieldKey.checkPasswordStrength('CustomP@ssw0rd', customPolicies);

console.log(`Custom password strength: ${customStrength}`);

The customPasswordVerification function allows you to perform custom password verification based on specified criteria. You can customize criteria such as requiring uppercase letters, lowercase letters, numbers, special characters, a minimum length, and whether to trim the input password.

Contributing

We welcome contributions from the community! If you find a bug, have a feature request, or want to contribute code, please check out our contribution guidelines.

License

ShieldKey is licensed under the MIT License - see the LICENSE file for details.

Support

For any questions or issues, please open an issue on GitHub.

Acknowledgments

Special thanks to contributors and the open-source community for making ShieldKey better with each release.