makeEncKey to use UInt8Array
This commit is contained in:
parent
8947cafa4e
commit
3ee9b1bba1
|
@ -44,19 +44,19 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
function registerPromise(key, masterPassword, email, hint) {
|
function registerPromise(key, masterPassword, email, hint) {
|
||||||
return $q(function (resolve, reject) {
|
var deferred = $q.defer();
|
||||||
cryptoService.makeEncKey(key).then(function (encKey) {
|
cryptoService.makeEncKey(key).then(function (encKey) {
|
||||||
cryptoService.hashPassword(masterPassword, key, function (hashedPassword) {
|
cryptoService.hashPassword(masterPassword, key, function (hashedPassword) {
|
||||||
var request = new RegisterRequest(email, hashedPassword, hint, encKey.encryptedString);
|
var request = new RegisterRequest(email, hashedPassword, hint, encKey.encryptedString);
|
||||||
apiService.postRegister(request,
|
apiService.postRegister(request,
|
||||||
function () {
|
function () {
|
||||||
resolve();
|
deferred.resolve();
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
reject(error);
|
deferred.reject(error);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -399,7 +399,8 @@ function initCryptoService(constantsService) {
|
||||||
};
|
};
|
||||||
|
|
||||||
CryptoService.prototype.makeEncKey = function (key) {
|
CryptoService.prototype.makeEncKey = function (key) {
|
||||||
var bytes = forge.random.getBytesSync(512 / 8);
|
var bytes = new Uint8Array(512 / 8);
|
||||||
|
_crypto.getRandomValues(bytes);
|
||||||
return this.encrypt(bytes, key, 'raw');
|
return this.encrypt(bytes, key, 'raw');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue