mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
Desktop biometrics support (#119)
* Initial work on windows hello support * Switch to use windows.security.credentials.ui UserConsentVerifier * Fix linting warnings * Remove unessesary supportsBiometric from lock screen * Rename biometric.main to windows.biometric.main. Add abstraction for biometric. * Add support for dynamic biometric text. * Add untested darwin implementation * Rename fingerprintUnlock to biometric * Add new functions to cliPlatformUtils.service.ts. * Hide login if biometric is not supported * Export default for biometric.*.main.ts * Remove @nodert-win10-rs4/windows.security.credentials * Add build requirements to readme * Auto prompt biometric when starting the application. * Ensure we support biometric before trying to auto prompt. * Fix review comments and linting errors
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
clipboard,
|
||||
ipcRenderer,
|
||||
remote,
|
||||
shell,
|
||||
} from 'electron';
|
||||
@@ -15,8 +16,10 @@ import { DeviceType } from '../../enums/deviceType';
|
||||
import { I18nService } from '../../abstractions/i18n.service';
|
||||
import { MessagingService } from '../../abstractions/messaging.service';
|
||||
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
|
||||
import { StorageService } from '../../abstractions/storage.service';
|
||||
|
||||
import { AnalyticsIds } from '../../misc/analytics';
|
||||
import { ElectronConstants } from '../electronConstants';
|
||||
|
||||
export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||
identityClientId: string;
|
||||
@@ -25,7 +28,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||
private analyticsIdCache: string = null;
|
||||
|
||||
constructor(private i18nService: I18nService, private messagingService: MessagingService,
|
||||
private isDesktopApp: boolean) {
|
||||
private isDesktopApp: boolean, private storageService: StorageService) {
|
||||
this.identityClientId = isDesktopApp ? 'desktop' : 'connector';
|
||||
}
|
||||
|
||||
@@ -203,4 +206,17 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||
const type = options ? options.type : null;
|
||||
return Promise.resolve(clipboard.readText(type));
|
||||
}
|
||||
|
||||
supportsBiometric(): Promise<boolean> {
|
||||
return this.storageService.get(ElectronConstants.enableBiometric);
|
||||
}
|
||||
|
||||
authenticateBiometric(): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
const val = ipcRenderer.sendSync('biometric', {
|
||||
action: 'authenticate',
|
||||
});
|
||||
resolve(val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user