mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
hashpassword with callback
This commit is contained in:
parent
8f0a24b1b9
commit
cc67d12c57
@ -6,7 +6,8 @@
|
||||
|
||||
_service.logIn = function (email, masterPassword) {
|
||||
var key = cryptoService.makeKey(masterPassword, email);
|
||||
var request = new TokenRequest(email, cryptoService.hashPassword(masterPassword, key));
|
||||
cryptoService.hashPassword(masterPassword, key, function (hashedPassword) {
|
||||
var request = new TokenRequest(email, hashedPassword);
|
||||
|
||||
var deferred = $q.defer();
|
||||
apiService.postToken(request, function (response) {
|
||||
@ -26,6 +27,7 @@
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
});
|
||||
};
|
||||
|
||||
_service.logInTwoFactor = function (code, provider) {
|
||||
|
@ -67,9 +67,10 @@ function initCryptoService() {
|
||||
return key;
|
||||
};
|
||||
|
||||
CryptoService.prototype.hashPassword = function (password, key) {
|
||||
CryptoService.prototype.hashPassword = function (password, key, callback) {
|
||||
this.getKey(false, function (storedKey) {
|
||||
if (!key) {
|
||||
key = this.getKey();
|
||||
key = storedKey;
|
||||
}
|
||||
|
||||
if (!password || !key) {
|
||||
@ -77,7 +78,8 @@ function initCryptoService() {
|
||||
}
|
||||
|
||||
var hashBits = sjcl.misc.pbkdf2(key, password, 1, 256, null);
|
||||
return sjcl.codec.base64.fromBits(hashBits);
|
||||
callback(sjcl.codec.base64.fromBits(hashBits));
|
||||
});
|
||||
};
|
||||
|
||||
CryptoService.prototype.getAes = function (callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user