1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-18 01:41:27 +01:00

move biometric check to electron crypto service

This commit is contained in:
Jacob Fink 2023-06-26 15:27:44 -04:00
parent 71ebb17a56
commit 3f496f8fb0
No known key found for this signature in database
GPG Key ID: C2F7ACF05859D008
2 changed files with 8 additions and 5 deletions

View File

@ -61,6 +61,14 @@ export class ElectronCryptoService extends CryptoService {
);
}
protected async shouldStoreKey(keySuffix: KeySuffixOptions, userId?: string): Promise<boolean> {
if (keySuffix === KeySuffixOptions.Biometric) {
const biometricUnlock = await this.stateService.getBiometricUnlock({ userId: userId });
return biometricUnlock && this.platformUtilService.supportsSecureStorage();
}
return await super.shouldStoreKey(keySuffix, userId);
}
private async getBiometricEncryptionClientKeyHalf(userId?: string): Promise<CsprngString | null> {
try {
let biometricKey = await this.stateService

View File

@ -734,11 +734,6 @@ export class CryptoService implements CryptoServiceAbstraction {
shouldStoreKey = vaultTimeout == null;
break;
}
case KeySuffixOptions.Biometric: {
const biometricUnlock = await this.stateService.getBiometricUnlock({ userId: userId });
shouldStoreKey = biometricUnlock && this.platformUtilService.supportsSecureStorage();
break;
}
case KeySuffixOptions.Pin: {
const protectedPin = await this.stateService.getProtectedPin({ userId: userId });
// This could cause a possible timing issue. Need to make sure the ephemeral key is set before