ERSION + name + ":" + email); }, setup(emailInput, passwordInput, options = {}) { return new Promise(resolve => { log.debug("setup credentials for " + emailInput); let hkdfSalt = options.hkdfSalt || HKDF_SALT; let hkdfLength = options.hkdfLength || HKDF_LENGTH; let stretchedPWLength = options.stretchedPassLength || STRETCHED_PW_LENGTH_BYTES; let pbkdf2Rounds = options.pbkdf2Rounds || PBKDF2_ROUNDS; let result = {}; let password = CommonUtils.encodeUTF8(passwordInput); let salt = this.keyWordExtended("quickStretch", emailInput); let runnable = async () => { let start = Date.now(); let quickStretchedPW = await CryptoUtils.pbkdf2Generate( password, salt, pbkdf2Rounds, stretchedPWLength ); result.quickStretchedPW = quickStretchedPW; result.authPW = await CryptoUtils.hkdfLegacy( quickStretchedPW, hkdfSalt, this.keyWord("authPW"), hkdfLength ); result.unwrapBKey = await CryptoUtils.hkdfLegacy( quickStretchedPW, hkdfSalt, this.keyWord("unwrapBkey"), hkdfLength ); log.debug("Credentials set up after " + (Date.now() - start) + " ms"); resolve(result); }; Services.tm.dispatchToMainThread(runnable); log.debug("Dispatched thread for credentials setup crypto work"); }); }, }); PK