diff --git a/src/app/services.module.ts b/src/app/services.module.ts index 22566ed6d77..b44085654ef 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -135,7 +135,7 @@ const eventService = new EventService(storageService, apiService, userService, c const systemService = new SystemService(storageService, vaultTimeoutService, messagingService, platformUtilsService, null); const nativeMessagingService = new NativeMessagingService(cryptoFunctionService, cryptoService, platformUtilsService, - logService, i18nService, userService, messagingService); + logService, i18nService, userService, messagingService, vaultTimeoutService); const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService); containerService.attachToGlobal(window); diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index a891f313278..6f70527abe3 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -1453,9 +1453,15 @@ "verifyBrowserTitle": { "message": "Verify browser connection" }, - "verifyBrowserDescription": { + "verifyBrowserDesc": { "message": "Please ensure the shown fingerprint is identical to the fingerprint showed in the browser extension." }, + "biometricsNotEnabledTitle": { + "message": "Biometrics not enabled" + }, + "biometricsNotEnabledDesc": { + "message": "Browser biometric requires desktop biometric to be enabled in the settings first." + }, "personalOwnershipSubmitError": { "message": "Due to an Enterprise Policy, you are restricted from saving items to your personal vault. Change the Ownership option to an organization and choose from available Collections." } diff --git a/src/services/nativeMessaging.service.ts b/src/services/nativeMessaging.service.ts index 029aa61a778..a45f6bfc806 100644 --- a/src/services/nativeMessaging.service.ts +++ b/src/services/nativeMessaging.service.ts @@ -8,6 +8,7 @@ import { LogService } from 'jslib/abstractions/log.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { UserService } from 'jslib/abstractions/user.service'; +import { VaultTimeoutService } from 'jslib/abstractions/vaultTimeout.service'; import { Utils } from 'jslib/misc/utils'; import { SymmetricCryptoKey } from 'jslib/models/domain/symmetricCryptoKey'; @@ -20,7 +21,7 @@ export class NativeMessagingService { constructor(private cryptoFunctionService: CryptoFunctionService, private cryptoService: CryptoService, private platformUtilService: PlatformUtilsService, private logService: LogService, private i18nService: I18nService, - private userService: UserService, private messagingService: MessagingService) { + private userService: UserService, private messagingService: MessagingService, private vaultTimeoutService: VaultTimeoutService) { ipcRenderer.on('nativeMessaging', async (event: any, message: any) => { this.messageHandler(message); }); @@ -40,7 +41,7 @@ export class NativeMessagingService { // Await confirmation that fingerprint is correct const submitted = await Swal.fire({ title: this.i18nService.t('verifyBrowserTitle'), - html: `${this.i18nService.t('verifyBrowserDescription')}

${fingerprint}`, + html: `${this.i18nService.t('verifyBrowserDesc')}

${fingerprint}`, showCancelButton: true, cancelButtonText: this.i18nService.t('cancel'), showConfirmButton: true, @@ -75,6 +76,18 @@ export class NativeMessagingService { return this.send({command: 'biometricUnlock', response: 'not supported'}, appId); } + if (! await this.vaultTimeoutService.isBiometricLockSet()) { + this.send({command: 'biometricUnlock', response: 'not enabled'}, appId); + + return await Swal.fire({ + title: this.i18nService.t('biometricsNotEnabledTitle'), + text: this.i18nService.t('biometricsNotEnabledDesc'), + showCancelButton: true, + cancelButtonText: this.i18nService.t('cancel'), + showConfirmButton: false, + }); + } + const response = await this.platformUtilService.authenticateBiometric(); if (response) { this.send({command: 'biometricUnlock', response: 'unlocked', keyB64: (await this.cryptoService.getKey()).keyB64}, appId);