UNPKG

password-blacklist

Version:
33 lines (21 loc) 1.22 kB
# Password Blacklist [![Build Status](https://travis-ci.org/jonathanong/password-blacklist.svg?branch=master)](https://travis-ci.org/jonathanong/password-blacklist) [![codecov](https://codecov.io/gh/jonathanong/password-blacklist/branch/master/graph/badge.svg)](https://codecov.io/gh/jonathanong/password-blacklist) [![Greenkeeper badge](https://badges.greenkeeper.io/jonathanong/password-blacklist.svg)](https://greenkeeper.io/) Checks a password against lists of passwords found at https://github.com/danielmiessler/SecLists. ## API ### Async Version 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') }) ``` ### Synchronous Version 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') ```