asdfgh
Lightweight, asynchronous wrapper for zxcvbn. asdfgh is about 900 bytes zipped, it will only load zxcvbn (~200kb) when it's actually used.
Made for use in a browser either directly, or via a Node-style bundler such as Browserify or Webpack.
Installation
npm i asdfgh
Usage
import asdfgh from 'asdfgh'
// by default loads from cdnjs
// override with optional setting
//
// asdfgh.setDefaults(url, integritySRI, timeoutMS)
async function checkPassphrase(pwd) {
try {
var result = await asdfgh(pwd);
...
} catch(err) {
...
}
}
Interface
-
asdfgh(passphrase, user_inputs)
- exports a function which is a promisified wrapper for zxcvbn
-
asdfgh.setDefaults(url, integritySRI, timeoutMS)
- Must be callsed before any passphrase checks are started
- default:
url
(default cloudflare/cdnjs) is the location of the zxcvbn.js to loadintegritySRI
[optional] integrity SRI for script elementtimeoutMS
[optional] milliseconds to wait for zxcvbn to load before timing out
License
MIT License