1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

Ensure biometric unlock works even if popup is not in focus

This commit is contained in:
Hinton
2020-10-12 18:01:34 +02:00
parent 5eb0ce1e09
commit 894d245361
6 changed files with 80 additions and 42 deletions

View File

@@ -20,7 +20,7 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
constructor(private messagingService: MessagingService,
private clipboardWriteCallback: (clipboardValue: string, clearMs: number) => void,
private nativeMessagingBackground: NativeMessagingBackground) { }
private biometricCallback: () => Promise<boolean>) { }
getDevice(): DeviceType {
if (this.deviceCache) {
@@ -293,13 +293,8 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
return Promise.resolve(true);
}
async authenticateBiometric() {
const responsePromise = this.nativeMessagingBackground.await();
this.nativeMessagingBackground.send({'command': 'biometricUnlock'});
const response = await responsePromise;
return response.response === 'unlocked';
authenticateBiometric() {
return this.biometricCallback();
}
sidebarViewName(): string {