Socket
Socket
Sign inDemoInstall

asdfgh

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    asdfgh

Asynchronous wrapper around zxcvbn


Version published
Weekly downloads
431
increased by23.14%
Maintainers
1
Install size
6.90 kB
Created
Weekly downloads
 

Readme

Source

asdfgh

npm version

Lightweight, asynchronous wrapper for zxcvbn. asdfgh is about 616 bytes min+gzip, 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';

async function checkPassphrase(pwd) {
  try {
    // check passphrase
    var result = await asdfgh(pwd);

    // do something with the results
    ...
  } catch(err) {
    ...
  }
}

// must call before any password check
function changeAsdfghOptions() {
  // default values used

  // url to load zxcvbn from
  const url = "https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js";

  // integrity parameter for script element
  const integritySRI = "sha256-Znf8FdJF85f1LV0JmPOob5qudSrns8pLPZ6qkd/+F0o=";

  // max time to wait for zxcvbn before timing out
  const timeout = 5000;

  asdfgh.setDefaults(url, integritySRI, timeoutMS);
}

Interface

  • asdfgh(passphrase, user_inputs) - exports a function which is a promisified wrapper for zxcvbn

  • asdfgh.setDefaults(url, integritySRI, timeoutMS)

    • Must be called before any passphrase checks are started
    • default:
    • url (default cloudflare/cdnjs) is the location of the zxcvbn.js to load
    • integritySRI [optional] integrity SRI for script element
    • timeoutMS [optional] milliseconds to wait for zxcvbn to load before timing out

    License

    MIT License

Keywords

FAQs

Last updated on 31 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc