1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-15 16:05:03 +00:00

Feature flag ui changes

This commit is contained in:
Bernd Schoolmann
2025-09-04 21:23:09 +02:00
parent 1ae7c30047
commit 6257efa3fb
8 changed files with 30 additions and 3 deletions

View File

@@ -81,7 +81,10 @@
"additionalTouchIdSettings" | i18n
}}</small>
</div>
<div class="form-group" *ngIf="this.form.value.biometric && this.isWindows">
<div
class="form-group"
*ngIf="this.form.value.biometric && this.isWindows && isBiometricV2Enabled"
>
<div class="checkbox form-group-child">
<label for="requireMasterPasswordOnAppRestart">
<input

View File

@@ -135,6 +135,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
pinEnabled$: Observable<boolean> = of(true);
hasPremium: boolean = false;
isBiometricV2Enabled: boolean = false;
form = this.formBuilder.group({
// Security
@@ -274,6 +275,8 @@ export class SettingsComponent implements OnInit, OnDestroy {
}
async ngOnInit() {
this.isBiometricV2Enabled = await this.biometricsService.isV2BiometricsBackendEnabled();
this.vaultTimeoutOptions = await this.generateVaultTimeoutOptions();
const activeAccount = await firstValueFrom(this.accountService.activeAccount$);
@@ -477,7 +480,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
.pipe(
concatMap(async (requireMasterPassword) => {
const userKey = await firstValueFrom(this.keyService.userKey$(activeAccount.id));
if (!requireMasterPassword) {
if (!requireMasterPassword && this.isBiometricV2Enabled) {
// Allow biometric unlock on app restart
if (!(await this.biometricsService.hasPersistentKey(activeAccount.id))) {
await this.biometricsService.enrollPersistent(activeAccount.id, userKey);

View File

@@ -17,4 +17,5 @@ export abstract class DesktopBiometricsService extends BiometricsService {
abstract hasPersistentKey(userId: UserId): Promise<boolean>;
/* Enables the v2 biometrics re-write. This will stay enabled until the application is restarted. */
abstract enableV2BiometricsBackend(): Promise<void>;
abstract isV2BiometricsBackendEnabled(): Promise<boolean>;
}

View File

@@ -60,6 +60,8 @@ export class MainBiometricsIPCListener {
);
case BiometricAction.EnableV2:
return await this.biometricService.enableV2BiometricsBackend();
case BiometricAction.IsV2Enabled:
return await this.biometricService.isV2BiometricsBackendEnabled();
default:
return;
}

View File

@@ -15,6 +15,7 @@ import { LinuxBiometricsSystem, MacBiometricsSystem, WindowsBiometricsSystem } f
export class MainBiometricsService extends DesktopBiometricsService {
private osBiometricsService: OsBiometricService;
private shouldAutoPrompt = true;
private v2BiometricsEnabled = false;
constructor(
private i18nService: I18nService,
@@ -61,6 +62,8 @@ export class MainBiometricsService extends DesktopBiometricsService {
} else {
throw new Error("Unsupported platform");
}
this.v2BiometricsEnabled = true;
}
/**
@@ -162,6 +165,12 @@ export class MainBiometricsService extends DesktopBiometricsService {
}
async enableV2BiometricsBackend(): Promise<void> {
this.loadNativeBiometricsModuleV2();
if (this.v2BiometricsEnabled == false) {
this.loadNativeBiometricsModuleV2();
}
}
async isV2BiometricsBackendEnabled(): Promise<boolean> {
return this.v2BiometricsEnabled;
}
}

View File

@@ -80,4 +80,8 @@ export class RendererBiometricsService extends DesktopBiometricsService {
async enableV2BiometricsBackend(): Promise<void> {
return await ipc.keyManagement.biometric.enableBiometricsV2();
}
async isV2BiometricsBackendEnabled(): Promise<boolean> {
return await ipc.keyManagement.biometric.isBiometricsV2Enabled();
}
}

View File

@@ -65,6 +65,10 @@ const biometric = {
ipcRenderer.invoke("biometric", {
action: BiometricAction.EnableV2,
} satisfies BiometricMessage),
isBiometricsV2Enabled: (): Promise<boolean> =>
ipcRenderer.invoke("biometric", {
action: BiometricAction.IsV2Enabled,
} satisfies BiometricMessage),
};
export default {

View File

@@ -18,6 +18,7 @@ export enum BiometricAction {
HasPersistentKey = "hasPersistentKey",
EnableV2 = "enableV2",
IsV2Enabled = "isV2Enabled",
}
export type BiometricMessage =