src/zxcvbn.js
/*
   * Checks a password against HaveIBeenPwned and if the password is not
   * leaked, calls zxcvbn. Async.
   * 
   * See https://github.com/dropbox/zxcvbn/blob/master/README.md for more
   * information
   *
   * A new score value was added: -1, indicating HaveIBeenPwned reports the
   * password has leaked in a public database. It's then considered dangerous
   * to use and reported as such.
   *
   * @param {string} aPassword - the password to check
   * @rapam {Array} aSanitizedInputs - an extra array of strings as disctionary
   */
Checks a password against HaveIBeenPwned and if the password is not
leaked, calls zxcvbn. Async.



A new score value was added: -1, indicating HaveIBeenPwned reports the
password has leaked in a public database. It's then considered dangerous
to use and reported as such.

@param {string} aPassword - the password to check
@rapam {Array} aSanitizedInputs - an extra array of strings as disctionary
Checks a password against HaveIBeenPwned and if the password is not leaked calls zxcvbn . Async . A new score value was added : - 1 indicating HaveIBeenPwned reports the password has leaked in a public database . It ' s then considered dangerous to use and reported as such . @param { string } aPassword - the password to check @rapam { Array } aSanitizedInputs - an extra array of strings as disctionary
async evaluate(aPassword, aSanitizedInputs) {
    let rv = this.HaveIBeenPwned
             ? await this.HaveIBeenPwned.check(aPassword)
             : null;
    if (!rv) {
      const start = this.getTime();
      const sanitizedInputs = aSanitizedInputs || [];
      this.matching.setUserInputDictionary(sanitizedInputs);
      const matches = this.matching.omnimatch(aPassword);
      rv = this.scoring.mostGuessableMatchSequence(aPassword, matches);
      rv.execTime = this.getTime() - start;
      const attackTimes = this.timeEstimates.estimateAttackTimes(rv.guesses);
      for (let prop in attackTimes) {
        rv[prop] = attackTimes[prop];
      }
      rv.feedback = this.feedback.getFeedback(rv.score, rv.sequence);
    }
    rv.feedback.warning = this.L10N.localize(rv.feedback.warning);
    for (let i = 0; i < rv.feedback.suggestions.length; i++)
      rv.feedback.suggestions[i] = this.L10N.localize(rv.feedback.suggestions[i]);
    return rv;
  }
async evaluate ( aPassword , aSanitizedInputs ) { let rv = this . HaveIBeenPwned ? await this . HaveIBeenPwned . check ( aPassword ) : null ; if ( ! rv ) { const start = this . getTime ( ) ; const sanitizedInputs = aSanitizedInputs || [ ] ; this . matching . setUserInputDictionary ( sanitizedInputs ) ; const matches = this . matching . omnimatch ( aPassword ) ; rv = this . scoring . mostGuessableMatchSequence ( aPassword , matches ) ; rv . execTime = this . getTime ( ) - start ; const attackTimes = this . timeEstimates . estimateAttackTimes ( rv . guesses ) ; for ( let prop in attackTimes ) { rv [ prop ] = attackTimes [ prop ] ; } rv . feedback = this . feedback . getFeedback ( rv . score , rv . sequence ) ; } rv . feedback . warning = this . L10N . localize ( rv . feedback . warning ) ; for ( let i = 0 ; i < rv . feedback . suggestions . length ; i ++ ) rv . feedback . suggestions [ i ] = this . L10N . localize ( rv . feedback . suggestions [ i ] ) ; return rv ; }
Checks a password against HaveIBeenPwned and if the password is not
 leaked, calls zxcvbn.
Checks a password against HaveIBeenPwned and if the password is not leaked calls zxcvbn .
// check against HaveIBennPwned password API // check against zxcvbn only if not leaked // we need time estimates // set extra dicts if any // call zxcvbn matching // then scoring // compute attack times // gather feedback // localize warning and suggestions