1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-06 18:57:56 +01:00

rename retrieveUserKeyFromStorage

This commit is contained in:
Jacob Fink 2023-06-27 09:16:16 -04:00
parent 1e8dde81b7
commit 0bbba9c6f7
No known key found for this signature in database
GPG Key ID: C2F7ACF05859D008
3 changed files with 7 additions and 9 deletions

View File

@ -7,9 +7,7 @@ import {
import { CryptoService } from "@bitwarden/common/platform/services/crypto.service";
export class BrowserCryptoService extends CryptoService {
protected override async retrieveUserKeyFromStorage(
keySuffix: KeySuffixOptions
): Promise<UserKey> {
protected override async getKeyFromStorage(keySuffix: KeySuffixOptions): Promise<UserKey> {
if (keySuffix === KeySuffixOptions.Biometric) {
await this.platformUtilService.authenticateBiometric();
const userKey = await this.getUserKeyFromMemory();
@ -18,6 +16,6 @@ export class BrowserCryptoService extends CryptoService {
}
}
return await super.retrieveUserKeyFromStorage(keySuffix);
return await super.getKeyFromStorage(keySuffix);
}
}

View File

@ -38,7 +38,7 @@ export class ElectronCryptoService extends CryptoService {
}
}
protected override async retrieveUserKeyFromStorage(
protected override async getKeyFromStorage(
keySuffix: KeySuffixOptions,
userId?: string
): Promise<UserKey> {
@ -47,7 +47,7 @@ export class ElectronCryptoService extends CryptoService {
const userKey = await this.stateService.getUserKeyBiometric({ userId: userId });
return new SymmetricCryptoKey(Utils.fromB64ToArray(userKey).buffer) as UserKey;
}
return await super.retrieveUserKeyFromStorage(keySuffix, userId);
return await super.getKeyFromStorage(keySuffix, userId);
}
protected async storeBiometricKey(key: UserKey, userId?: string): Promise<void> {

View File

@ -73,7 +73,7 @@ export class CryptoService implements CryptoServiceAbstraction {
keySuffix: KeySuffixOptions.Auto | KeySuffixOptions.Biometric,
userId?: string
): Promise<UserKey> {
const userKey = await this.retrieveUserKeyFromStorage(keySuffix, userId);
const userKey = await this.getKeyFromStorage(keySuffix, userId);
if (userKey != null) {
if (!(await this.validateUserKey(userKey))) {
this.logService.warning("Wrong key, throwing away stored key");
@ -106,7 +106,7 @@ export class CryptoService implements CryptoServiceAbstraction {
const oldKey = await this.stateService.hasCryptoMasterKeyBiometric({ userId: userId });
return oldKey || (await this.stateService.hasUserKeyBiometric({ userId: userId }));
}
return (await this.retrieveUserKeyFromStorage(keySuffix, userId)) != null;
return (await this.getKeyFromStorage(keySuffix, userId)) != null;
}
async makeUserKey(masterKey: MasterKey): Promise<[UserKey, EncString]> {
@ -757,7 +757,7 @@ export class CryptoService implements CryptoServiceAbstraction {
return shouldStoreKey;
}
protected async retrieveUserKeyFromStorage(
protected async getKeyFromStorage(
keySuffix: KeySuffixOptions,
userId?: string
): Promise<UserKey> {