Skip to content

PearPass is an open-source, privacy-first password manager with peer-to-peer syncing and end-to-end encryption. This repository contains shared core components used across the PearPass apps.

License

Notifications You must be signed in to change notification settings

tetherto/pearpass-utils-password-check

Repository files navigation

pearpass-utils-password-check

A utility library to check the strength of passwords and passphrases based on configurable rules.

Table of Contents

Features

This utility provides functions to check the strength of passwords and passphrases based on configurable rules:

Password Validation:

  • Minimum length requirements
  • Uppercase and lowercase character inclusion
  • Number inclusion
  • Special character inclusion

Passphrase Validation:

  • Minimum word count
  • Unique words verification
  • Capital letter inclusion
  • Symbol inclusion
  • Number inclusion

Installation

npm install pearpass-utils-password-check

Usage Examples

Checking Password Strength

import { checkPasswordStrength } from 'pearpass-utils-password-check';

// With default rules
const result = checkPasswordStrength('Test123!');
console.log(result.strengthType); // safe

// With custom rules
const customResult = checkPasswordStrength('Test1234', {
    length: 8,
    includeSpecialChars: false,
    lowerCase: true,
    upperCase: true,
    numbers: true
});
console.log(customResult.strengthType); // safe
console.log(customResult.rules); // Detailed rules assessment

Checking Passphrase Strength

import { checkPassphraseStrength } from 'pearpass-utils-password-check';

// With default rules
const words = ['Test1!', 'Word2@', 'Example3#', 'Unique', 'Safe', 'Pass', 'Phrase', 'Another4$'];
const result = checkPassphraseStrength(words);
console.log(result.strength); // safe

// With custom rules
const customResult = checkPassphraseStrength(words, {
    capitalLetters: true,
    symbols: true,
    numbers: true,
    words: 6
});
console.log(customResult.strengthType); // safe
console.log(customResult.rules); // Detailed rules assessment

Dependencies

This package has no runtime dependencies.

Related Projects

License

This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.

About

PearPass is an open-source, privacy-first password manager with peer-to-peer syncing and end-to-end encryption. This repository contains shared core components used across the PearPass apps.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5