1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

[refactor(Account Switching)] Implement StateService (#424)

This commit is contained in:
Addison Beck
2021-12-28 15:38:51 -05:00
committed by GitHub
parent eb122532bd
commit 179f1dfe5d
16 changed files with 144 additions and 118 deletions

View File

@@ -4,7 +4,7 @@ import * as inquirer from "inquirer";
import { ApiService } from "jslib-common/abstractions/api.service";
import { CryptoService } from "jslib-common/abstractions/crypto.service";
import { CryptoFunctionService } from "jslib-common/abstractions/cryptoFunction.service";
import { UserService } from "jslib-common/abstractions/user.service";
import { StateService } from "jslib-common/abstractions/state.service";
import { Response } from "jslib-node/cli/models/response";
import { MessageResponse } from "jslib-node/cli/models/response/messageResponse";
@@ -20,7 +20,7 @@ import { ConsoleLogService } from "jslib-common/services/consoleLog.service";
export class UnlockCommand {
constructor(
private cryptoService: CryptoService,
private userService: UserService,
private stateService: StateService,
private cryptoFunctionService: CryptoFunctionService,
private apiService: ApiService,
private logService: ConsoleLogService
@@ -59,9 +59,9 @@ export class UnlockCommand {
}
this.setNewSessionKey();
const email = await this.userService.getEmail();
const kdf = await this.userService.getKdf();
const kdfIterations = await this.userService.getKdfIterations();
const email = await this.stateService.getEmail();
const kdf = await this.stateService.getKdfType();
const kdfIterations = await this.stateService.getKdfIterations();
const key = await this.cryptoService.makeKey(password, email, kdf, kdfIterations);
const storedKeyHash = await this.cryptoService.getKeyHash();