SystemService, Store if fingerprints have been validated or not (#1528)

This commit is contained in:
Oscar Hinton 2021-01-13 23:31:44 +01:00 committed by GitHub
parent 98cfdccec5
commit c4388dad66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -28,14 +28,18 @@ export class NativeMessagingBackground {
private secureSetupResolve: any = null; private secureSetupResolve: any = null;
private sharedSecret: SymmetricCryptoKey; private sharedSecret: SymmetricCryptoKey;
private appId: string; private appId: string;
private validatingFingerprint: boolean;
constructor(private storageService: StorageService, private cryptoService: CryptoService, constructor(private storageService: StorageService, private cryptoService: CryptoService,
private cryptoFunctionService: CryptoFunctionService, private vaultTimeoutService: VaultTimeoutService, private cryptoFunctionService: CryptoFunctionService, private vaultTimeoutService: VaultTimeoutService,
private runtimeBackground: RuntimeBackground, private i18nService: I18nService, private userService: UserService, 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() { async connect() {
this.appId = await this.appIdService.getAppId(); this.appId = await this.appIdService.getAppId();
this.storageService.save(ConstantsService.biometricFingerprintValidated, false);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.port = BrowserApi.connectNative('com.8bit.bitwarden'); this.port = BrowserApi.connectNative('com.8bit.bitwarden');
@ -71,6 +75,10 @@ export class NativeMessagingBackground {
const encrypted = Utils.fromB64ToArray(message.sharedSecret); const encrypted = Utils.fromB64ToArray(message.sharedSecret);
const decrypted = await this.cryptoFunctionService.rsaDecrypt(encrypted.buffer, this.privateKey, EncryptionAlgorithm); 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.sharedSecret = new SymmetricCryptoKey(decrypted);
this.secureSetupResolve(); this.secureSetupResolve();
break; break;
@ -93,6 +101,7 @@ export class NativeMessagingBackground {
break; break;
case 'verifyFingerprint': { case 'verifyFingerprint': {
if (this.sharedSecret == null) { if (this.sharedSecret == null) {
this.validatingFingerprint = true;
this.showFingerprintDialog(); this.showFingerprintDialog();
} }
break; break;