From 22381472db0ffc66d4a3450282e4342dc97d16db Mon Sep 17 00:00:00 2001 From: Ilan Kushnir Date: Sun, 24 Nov 2024 12:29:12 +0200 Subject: [PATCH 1/2] chore: fix package json for release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d841a73..af924ab 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/PayU/zxcvbn-custom-matchers.git" + "url": "git+https://github.com/PayU/zxcvbn-custom-matchers.git" }, "keywords": [ "zxcvbn" From 32f4c8eec5cc153fdb36d4d90d7cd01f16c5199a Mon Sep 17 00:00:00 2001 From: Ilan Kushnir Date: Sun, 24 Nov 2024 12:29:19 +0200 Subject: [PATCH 2/2] 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.