From c4388dad66e6fa2c7b217f4fd3dfe35829a6c4a1 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Wed, 13 Jan 2021 23:31:44 +0100 Subject: [PATCH] SystemService, Store if fingerprints have been validated or not (#1528) --- src/background/nativeMessaging.background.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/background/nativeMessaging.background.ts b/src/background/nativeMessaging.background.ts index ddd9317da8..b83397e647 100644 --- a/src/background/nativeMessaging.background.ts +++ b/src/background/nativeMessaging.background.ts @@ -28,14 +28,18 @@ export class NativeMessagingBackground { private secureSetupResolve: any = null; private sharedSecret: SymmetricCryptoKey; private appId: string; + private validatingFingerprint: boolean; constructor(private storageService: StorageService, private cryptoService: CryptoService, private cryptoFunctionService: CryptoFunctionService, private vaultTimeoutService: VaultTimeoutService, private runtimeBackground: RuntimeBackground, private i18nService: I18nService, private userService: UserService, - private messagingService: MessagingService, private appIdService: AppIdService) {} + private messagingService: MessagingService, private appIdService: AppIdService) { + this.storageService.save(ConstantsService.biometricFingerprintValidated, false); + } async connect() { this.appId = await this.appIdService.getAppId(); + this.storageService.save(ConstantsService.biometricFingerprintValidated, false); return new Promise((resolve, reject) => { this.port = BrowserApi.connectNative('com.8bit.bitwarden'); @@ -71,6 +75,10 @@ export class NativeMessagingBackground { const encrypted = Utils.fromB64ToArray(message.sharedSecret); const decrypted = await this.cryptoFunctionService.rsaDecrypt(encrypted.buffer, this.privateKey, EncryptionAlgorithm); + if (this.validatingFingerprint) { + this.validatingFingerprint = false; + this.storageService.save(ConstantsService.biometricFingerprintValidated, true); + } this.sharedSecret = new SymmetricCryptoKey(decrypted); this.secureSetupResolve(); break; @@ -93,6 +101,7 @@ export class NativeMessagingBackground { break; case 'verifyFingerprint': { if (this.sharedSecret == null) { + this.validatingFingerprint = true; this.showFingerprintDialog(); } break;