1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

Biometric support (#470)

* Initial work on windows hello support

* Hide login button if not enabled

* Add windows.security.credentials.ui dependency to desktop as well.

* Only enable biometric on windows.

* Add support for dynamic biometric text.

* Add untested darwin implementation

* Ensure we support biometric before showing login with windows hello / touchid.

* Ensure compatability with latest jslib

* Only require module on use.

* Add windows.security.credentials.ui to src/package.json.

* Update requirements

* Update consent messages for biometrics
This commit is contained in:
Oscar Hinton
2020-07-23 19:32:36 +02:00
committed by GitHub
parent 560b58f9de
commit 26b023a3cb
12 changed files with 89 additions and 6 deletions

View File

@@ -48,6 +48,9 @@ export class SettingsComponent implements OnInit {
clearClipboardOptions: any[];
enableTrayText: string;
enableTrayDescText: string;
supportsBiometric: boolean;
biometric: boolean;
biometricText: string;
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
@@ -125,6 +128,9 @@ export class SettingsComponent implements OnInit {
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
this.minimizeOnCopyToClipboard = await this.storageService.get<boolean>(
ElectronConstants.minimizeOnCopyToClipboardKey);
this.supportsBiometric = await this.platformUtilsService.supportsBiometric();
this.biometric = await this.vaultTimeoutService.isBiometricLockSet();
this.biometricText = await this.storageService.get<string>(ConstantsService.biometricText);
}
async saveVaultTimeoutOptions() {
@@ -201,6 +207,25 @@ export class SettingsComponent implements OnInit {
}
}
async updateBiometric() {
const current = this.biometric;
if (this.biometric) {
this.biometric = false;
} else if (this.supportsBiometric) {
this.biometric = await this.platformUtilsService.authenticateBiometric();
}
if (this.biometric === current) {
return;
}
if (this.biometric) {
await this.storageService.save(ConstantsService.biometricUnlockKey, true);
} else {
await this.storageService.remove(ConstantsService.biometricUnlockKey);
}
this.vaultTimeoutService.biometricLocked = false;
await this.cryptoService.toggleKey();
}
async saveFavicons() {
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicons);
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicons);