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:
parent
c3704c3dfd
commit
fbba9b673d
@ -6,7 +6,6 @@
|
|||||||
<script type="text/javascript" src="lib/forge/forge.js"></script>
|
<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/api/requestModels.js"></script>
|
||||||
<script type="text/javascript" src="models/domainModels.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/tokenService.js"></script>
|
||||||
<script type="text/javascript" src="services/apiService.js"></script>
|
<script type="text/javascript" src="services/apiService.js"></script>
|
||||||
<script type="text/javascript" src="services/userService.js"></script>
|
<script type="text/javascript" src="services/userService.js"></script>
|
||||||
|
@ -265,7 +265,7 @@ angular
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.run(function ($trace, $transitions, userService, $state, constantsService, stateService) {
|
.run(function ($trace, $transitions, userService, $state, constantsService, stateService) {
|
||||||
$trace.enable('TRANSITION');
|
//$trace.enable('TRANSITION');
|
||||||
|
|
||||||
stateService.init();
|
stateService.init();
|
||||||
|
|
||||||
|
@ -26,7 +26,9 @@ angular
|
|||||||
$scope.submit = function () {
|
$scope.submit = function () {
|
||||||
userService.getEmail(function (email) {
|
userService.getEmail(function (email) {
|
||||||
var key = cryptoService.makeKey($scope.masterPassword, 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();
|
return cryptoService.getKeyHash();
|
||||||
}).then(function (storedKeyHash) {
|
}).then(function (storedKeyHash) {
|
||||||
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {
|
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {
|
||||||
|
@ -9,12 +9,14 @@ angular
|
|||||||
email = email.toLowerCase();
|
email = email.toLowerCase();
|
||||||
var key = cryptoService.makeKey(masterPassword, email),
|
var key = cryptoService.makeKey(masterPassword, email),
|
||||||
deferred = $q.defer(),
|
deferred = $q.defer(),
|
||||||
deviceRequest = null;
|
deviceRequest = null,
|
||||||
|
twoFactorRememberedToken;
|
||||||
|
|
||||||
appIdService.getAppId().then(function (appId) {
|
appIdService.getAppId().then(function (appId) {
|
||||||
deviceRequest = new DeviceRequest(appId, utilsService);
|
deviceRequest = new DeviceRequest(appId, utilsService);
|
||||||
return tokenService.getTwoFactorToken(email);
|
return tokenService.getTwoFactorToken(email);
|
||||||
}).then(function (twoFactorRememberedToken) {
|
}).then(function (theTwoFactorRememberedToken) {
|
||||||
|
twoFactorRememberedToken = theTwoFactorRememberedToken;
|
||||||
return cryptoService.hashPassword(masterPassword, key);
|
return cryptoService.hashPassword(masterPassword, key);
|
||||||
}).then(function (hashedPassword) {
|
}).then(function (hashedPassword) {
|
||||||
var request;
|
var request;
|
||||||
|
@ -24,7 +24,9 @@ angular
|
|||||||
|
|
||||||
userService.getEmail(function (email) {
|
userService.getEmail(function (email) {
|
||||||
var key = cryptoService.makeKey($scope.masterPassword, 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();
|
return cryptoService.getKeyHash();
|
||||||
}).then(function (storedKeyHash) {
|
}).then(function (storedKeyHash) {
|
||||||
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {
|
if (storedKeyHash && keyHash && storedKeyHash === keyHash) {
|
||||||
|
@ -76,7 +76,7 @@ export default class CryptoService {
|
|||||||
|
|
||||||
async getKey(): Promise<SymmetricCryptoKey> {
|
async getKey(): Promise<SymmetricCryptoKey> {
|
||||||
if (this.key != null) {
|
if (this.key != null) {
|
||||||
return;
|
return this.key;
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = await this.utilsService.getObjFromStorage<number>(ConstantsService.lockOptionKey);
|
const option = await this.utilsService.getObjFromStorage<number>(ConstantsService.lockOptionKey);
|
||||||
@ -126,7 +126,7 @@ export default class CryptoService {
|
|||||||
|
|
||||||
async getPrivateKey(): Promise<ArrayBuffer> {
|
async getPrivateKey(): Promise<ArrayBuffer> {
|
||||||
if (this.privateKey != null) {
|
if (this.privateKey != null) {
|
||||||
return Promise.resolve(this.privateKey);
|
return this.privateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
const encPrivateKey = await this.utilsService.getObjFromStorage<string>(Keys.encPrivateKey);
|
const encPrivateKey = await this.utilsService.getObjFromStorage<string>(Keys.encPrivateKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user