3.0.4 • Published 8 months ago

@zxcvbn-ts/matcher-pwned v3.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@zxcvbn-ts/matcher-pwned

The pwned matcher is an async matcher that will make a k-anonymity password request to the have i been pwned api.

Installation

npm:

npm install @zxcvbn-ts/core @zxcvbn-ts/matcher-pwned --save

yarn:

yarn add @zxcvbn-ts/core @zxcvbn-ts/matcher-pwned

Setup

import { zxcvbn, zxcvbnOptions } from '@zxcvbn-ts/core'
import { matcherPwnedFactory } from '@zxcvbn-ts/matcher-pwned'

const password = 'somePassword'

const matcherPwned = matcherPwnedFactory(fetch, zxcvbnOptions)
zxcvbnOptions.addMatcher('pwned', matcherPwned)

// @zxcvbn-ts/matcher-pwned is async so zxcvbn will return a promise
zxcvbn(password).then((result) => {
  
})

Options

fetch

This needs to be some fetch function either the default browser fetch or a fetch package from nodejs

url

This is the url to the haveibeenpwned api. By default, it is set to https://api.pwnedpasswords.com/range/. This option can be used if you don't trust haveibeenpwned and download their list to host your own instance of pwnedpasswords

Can't resolve 'crypto' Error

If you get this error in node browser builds you can fix this by adding this to your package.json

"browser": {
"crypto": false
}
3.0.4

8 months ago

3.0.3

10 months ago

3.0.2

11 months ago

3.0.1

12 months ago

3.0.0

1 year ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago