mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
refactor crypto service to use crypto functions
This commit is contained in:
@@ -40,7 +40,7 @@ export class ExportComponent {
|
||||
}
|
||||
|
||||
const email = await this.userService.getEmail();
|
||||
const key = this.cryptoService.makeKey(this.masterPassword, email);
|
||||
const key = await this.cryptoService.makeKey(this.masterPassword, email);
|
||||
const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key);
|
||||
const storedKeyHash = await this.cryptoService.getKeyHash();
|
||||
|
||||
@@ -67,7 +67,7 @@ export class ExportComponent {
|
||||
|
||||
private async checkPassword() {
|
||||
const email = await this.userService.getEmail();
|
||||
const key = this.cryptoService.makeKey(this.masterPassword, email);
|
||||
const key = await this.cryptoService.makeKey(this.masterPassword, email);
|
||||
const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key);
|
||||
const storedKeyHash = await this.cryptoService.getKeyHash();
|
||||
if (storedKeyHash == null || keyHash == null || storedKeyHash !== keyHash) {
|
||||
|
||||
@@ -28,7 +28,7 @@ export class LockComponent {
|
||||
}
|
||||
|
||||
const email = await this.userService.getEmail();
|
||||
const key = this.cryptoService.makeKey(this.masterPassword, email);
|
||||
const key = await this.cryptoService.makeKey(this.masterPassword, email);
|
||||
const keyHash = await this.cryptoService.hashPassword(this.masterPassword, key);
|
||||
const storedKeyHash = await this.cryptoService.getKeyHash();
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ export class RegisterComponent {
|
||||
|
||||
private async register() {
|
||||
this.email = this.email.toLowerCase();
|
||||
const key = this.cryptoService.makeKey(this.masterPassword, this.email);
|
||||
const key = await this.cryptoService.makeKey(this.masterPassword, this.email);
|
||||
const encKey = await this.cryptoService.makeEncKey(key);
|
||||
const hashedPassword = await this.cryptoService.hashPassword(this.masterPassword, key);
|
||||
const request = new RegisterRequest(this.email, hashedPassword, this.hint, encKey.encryptedString);
|
||||
|
||||
Reference in New Issue
Block a user