dropbox / dropbox/zxcvbn

API suggestion for v4

Open
#90 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
16.1k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

It may be worthwhile in v4 to create an async interface, which has an option for either a callback or promise... For that matter, the existing zxcvbn could be placed into npm/cdnjs as, for example zxcvbn-data.js, and zxcvbn can be a thin wrapper that will async load in browser/browserify, or require in as a dependency in node.

This could also be a step towards supporting worker implementations where the actual work is done out of band in the browser and in node, sparing the main event loop.

I suggest the promise implementation expressly _not_ define a global `Promise`, and simply throw if it's called without a callback if `Promise` is undefined...

Alternatively, a wrapper that works this way could be created, that uses `zxcvbn` as-is. Something like `asdfgh` might be a good name for an async wrapper.

``` js
//default data source will be common cdn (cdnjs), with option to override
var zxcvbn = require('zxcvbn').setClientDataUrl('//foocdn/zxcvbn-data.js');
...
//error first callback style.
zxcvbn('password', function(err, result){
...
});
...
//ES6 Promise Implementation
zxcvbn('password')
.then(function(result){
...
})
.catch(function(err){
...
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the existing zxcvbn interface and its browser and Node loading paths. Before implementation, the project needs to choose between an integrated async API and a separate wrapper, then define callback, Promise, data-loading, and worker behavior as the completion criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.