password-blacklist
Version:
Check passwords against a blacklist
33 lines (21 loc) • 1.22 kB
Markdown
[](https://travis-ci.org/jonathanong/password-blacklist)
[](https://codecov.io/gh/jonathanong/password-blacklist)
[](https://greenkeeper.io/)
Checks a password against lists of passwords found at https://github.com/danielmiessler/SecLists.
The async version is better for memory management because it scans the file for the filter, but it is slower. Use this if you are worried about memory usage.
```js
const isPasswordBlacklisted = require('password-blacklist')
isPasswordBlacklisted('123456').then((blacklisted) => {
if (blacklisted) console.error('this password is blacklisted')
})
```
The synchronous version stores the entire list of passwords in memory and is faster.
```js
const isPasswordBlacklisted = require('password-blacklist/in-memory')
const blacklisted = isPasswordBlacklisted('123456')
if (blacklisted) console.error('this password is blacklisted')
```