New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pwdkit

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pwdkit

A lightweight utility to evaluate password strength and generate password suggestions.

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

pwdkit

pwdkit is a lightweight password toolkit that lets you:

  • Analyze password strength (Inspired: passwordmeter)
  • Get multiple password suggestions with scoring based on customizable rules
  • Check if the password matches with the policy that is set

Installation

npm install pwdkit

Sample Usage

const { PasswordToolkit } = require("pwdkit");

const pwd_instance = new PasswordToolkit({
  minimum_characters: 10,
  containsUpperCase: true,
  containsLowerCase: true,
  containsNumbers: true,
  containsSpecialCharacters: true,
  allowedSpecialCharacters: ["*", "^", "#", "@"],
});

console.log(pwd_instance.analyse("yzmk1W1Q^v"));
// Output: { score: 92 }

console.log(pwd_instance.isPolicySatisfied("yzmk1W1Qv"));
// Output: false

console.log(pwd_instance.getPolicy());
// Output:
{
  minimum_characters: 10,
  containsUpperCase: true,
  containsLowerCase: true,
  containsNumbers: true,
  containsSpecialCharacters: true,
  allowedSpecialCharacters: ["*", "^", "#", "@"],
}

console.log(pwd_instance.getSuggestions(3));
// Example Output:
[
  { password: 'W@q@GJm43t', score: 100 },
  { password: 'g5KxFjh^2V', score: 96 },
  { password: 'U9Y*Q#^4@n', score: 100 }
]

ES Modules (TypeScript or modern bundlers)

import { PasswordToolkit } from "pwdkit";

const toolkit = new PasswordToolkit({
  minimum_characters: 12,
  allowedSpecialCharacters: ["!", "%", "#"]
});

const result = toolkit.analyse("MyS3cur3#Pass");
console.log(result); // { score: ... }

const is_pwd_matches_policy = toolkit.isPolicySatisfied("MyS3cur3#Pass"));
// Output: true

console.log(toolkit.getPolicy());
// Output:
{
  minimum_characters: 12,
  containsUpperCase: true,
  containsLowerCase: true,
  containsNumbers: true,
  containsSpecialCharacters: true,
  allowedSpecialCharacters: ["!", "%", "#"],
}

const suggestions = toolkit.getSuggestions(5);
console.log(suggestions);

Options / Policy

Options that can be passed to PasswordToolkit

OptionTypeDefaultDescription
minimum_charactersnumber8Minimum password length
containsUpperCasebooleantrueRequire uppercase letters
containsLowerCasebooleantrueRequire lowercase letters
containsNumbersbooleantrueRequire digits
containsSpecialCharactersbooleantrueRequire special characters
allowedSpecialCharactersstring[]Default set (!@#$%^&*()_+[]{} etc.)Custom special characters

All the above keys are optional. if not provided it uses the default one.

Keywords

password

FAQs

Package last updated on 29 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts