SystemService, Store if fingerprints have been validated or not (#1528)
This commit is contained in:
parent
98cfdccec5
commit
c4388dad66
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue