From 432d5730499988178d846a0722e8422065e903e6 Mon Sep 17 00:00:00 2001 From: Ilan Kushnir Date: Sun, 24 Nov 2024 12:29:19 +0200 Subject: [PATCH] chore: update readme --- README.md | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 27e6049..e8e21e4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # @payu/zxcvbn-custom-matchers +The package is adding custom matchers to the zxcvbn-ts package. The matchers enforce specific character requirements in passwords and provide feedback and scoring. + ## Installation ```sh npm install @payu/zxcvbn-custom-matchers @@ -8,11 +10,18 @@ npm install @payu/zxcvbn-custom-matchers ### Usage ```ts import { zxcvbnOptions } from '@zxcvbn-ts/core'; -import { firstMatcher, secondMatcher } from '@payu/my-package'; +import { + lowercaseMatcher, + numberMatcher, + specialMatcher, + uppercaseMatcher +} from '@payu/zxcvbn-custom-matchers'; // Add the matchers -zxcvbnOptions.addMatcher('first', firstMatcher); -zxcvbnOptions.addMatcher('second', secondMatcher); +zxcvbnOptions.addMatcher('lowercaseMatcher', lowercaseMatcher); +zxcvbnOptions.addMatcher('numberMatcher', numberMatcher); +zxcvbnOptions.addMatcher('specialMatcher', specialMatcher); +zxcvbnOptions.addMatcher('uppercaseMatcher', uppercaseMatcher); // Use zxcvbn as usual import { zxcvbn } from '@zxcvbn-ts/core'; @@ -20,3 +29,30 @@ const result = zxcvbn('password123'); console.log(result); ``` +## Matchers Description + +This project includes several matchers that enforce specific character requirements in passwords. Each matcher checks for a particular type of character and provides feedback and scoring. + +### Uppercase Matcher + +- **Purpose**: Ensures the password contains at least one uppercase letter. +- **Feedback**: Suggests including at least one uppercase letter if missing. +- **Scoring**: Returns a score of `-100` if missing uppercase letters. + +### Lowercase Matcher + +- **Purpose**: Ensures the password contains at least one lowercase letter. +- **Feedback**: Suggests including at least one lowercase letter if missing. +- **Scoring**: Returns a score of `-100` if missing lowercase letters. + +### Number Matcher + +- **Purpose**: Ensures the password contains at least one number. +- **Feedback**: Suggests including at least one number if missing. +- **Scoring**: Returns a score of `-100` if missing numbers. + +### Special Character Matcher + +- **Purpose**: Ensures the password contains at least one special character (e.g., !, @, #, $, etc.). +- **Feedback**: Suggests including at least one special character if missing. +- **Scoring**: Returns a score of `-100` if missing special characters.