Skip to content

Commit

Permalink
chore: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilan Kushnir committed Nov 24, 2024
1 parent f24cd30 commit 432d573
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,15 +10,49 @@ 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';
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.

0 comments on commit 432d573

Please sign in to comment.