1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

fixes during crypto service testing

This commit is contained in:
Kyle Spearrin 2017-11-02 09:17:53 -04:00
parent c3704c3dfd
commit fbba9b673d
6 changed files with 13 additions and 8 deletions

View File

@ -6,7 +6,6 @@
<script type="text/javascript" src="lib/forge/forge.js"></script>
<script type="text/javascript" src="models/api/requestModels.js"></script>
<script type="text/javascript" src="models/domainModels.js"></script>
<script type="text/javascript" src="services/cryptoService.js"></script>
<script type="text/javascript" src="services/tokenService.js"></script>
<script type="text/javascript" src="services/apiService.js"></script>
<script type="text/javascript" src="services/userService.js"></script>

View File

@ -265,7 +265,7 @@ angular
});
})
.run(function ($trace, $transitions, userService, $state, constantsService, stateService) {
$trace.enable('TRANSITION');
//$trace.enable('TRANSITION');
stateService.init();

View File

@ -26,7 +26,9 @@ angular
$scope.submit = function () {
userService.getEmail(function (email) {
var key = cryptoService.makeKey($scope.masterPassword, email);
cryptoService.hashPassword($scope.masterPassword, key).then(function (keyHash) {
var keyHash;
cryptoService.hashPassword($scope.masterPassword, key).then(function (theKeyHash) {
keyHash = theKeyHash;
return cryptoService.getKeyHash();
}).then(function (storedKeyHash) {
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {

View File

@ -9,12 +9,14 @@ angular
email = email.toLowerCase();
var key = cryptoService.makeKey(masterPassword, email),
deferred = $q.defer(),
deviceRequest = null;
deviceRequest = null,
twoFactorRememberedToken;
appIdService.getAppId().then(function (appId) {
deviceRequest = new DeviceRequest(appId, utilsService);
return tokenService.getTwoFactorToken(email);
}).then(function (twoFactorRememberedToken) {
}).then(function (theTwoFactorRememberedToken) {
twoFactorRememberedToken = theTwoFactorRememberedToken;
return cryptoService.hashPassword(masterPassword, key);
}).then(function (hashedPassword) {
var request;

View File

@ -24,7 +24,9 @@ angular
userService.getEmail(function (email) {
var key = cryptoService.makeKey($scope.masterPassword, email);
cryptoService.hashPassword($scope.masterPassword, key).then(function (keyHash) {
var keyHash;
cryptoService.hashPassword($scope.masterPassword, key).then(function (theKeyHash) {
keyHash = theKeyHash;
return cryptoService.getKeyHash();
}).then(function (storedKeyHash) {
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {

View File

@ -76,7 +76,7 @@ export default class CryptoService {
async getKey(): Promise<SymmetricCryptoKey> {
if (this.key != null) {
return;
return this.key;
}
const option = await this.utilsService.getObjFromStorage<number>(ConstantsService.lockOptionKey);
@ -126,7 +126,7 @@ export default class CryptoService {
async getPrivateKey(): Promise<ArrayBuffer> {
if (this.privateKey != null) {
return Promise.resolve(this.privateKey);
return this.privateKey;
}
const encPrivateKey = await this.utilsService.getObjFromStorage<string>(Keys.encPrivateKey);