mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[PM-10741] Refactor biometrics interface & add dynamic status (#10973)
This commit is contained in:
27
apps/cli/src/key-management/cli-biometrics-service.ts
Normal file
27
apps/cli/src/key-management/cli-biometrics-service.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { UserKey } from "@bitwarden/common/types/key";
|
||||
import { BiometricsService, BiometricsStatus } from "@bitwarden/key-management";
|
||||
|
||||
export class CliBiometricsService extends BiometricsService {
|
||||
async authenticateWithBiometrics(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
async getBiometricsStatus(): Promise<BiometricsStatus> {
|
||||
return BiometricsStatus.PlatformUnsupported;
|
||||
}
|
||||
|
||||
async unlockWithBiometricsForUser(userId: UserId): Promise<UserKey | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
async getBiometricsStatusForUser(userId: UserId): Promise<BiometricsStatus> {
|
||||
return BiometricsStatus.PlatformUnsupported;
|
||||
}
|
||||
|
||||
async getShouldAutopromptNow(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
async setShouldAutopromptNow(value: boolean): Promise<void> {}
|
||||
}
|
||||
@@ -165,6 +165,7 @@ import {
|
||||
VaultExportServiceAbstraction,
|
||||
} from "@bitwarden/vault-export-core";
|
||||
|
||||
import { CliBiometricsService } from "../key-management/cli-biometrics-service";
|
||||
import { flagEnabled } from "../platform/flags";
|
||||
import { CliPlatformUtilsService } from "../platform/services/cli-platform-utils.service";
|
||||
import { ConsoleLogService } from "../platform/services/console-log.service";
|
||||
@@ -693,12 +694,12 @@ export class ServiceContainer {
|
||||
this.userVerificationApiService,
|
||||
this.userDecryptionOptionsService,
|
||||
this.pinService,
|
||||
this.logService,
|
||||
this.vaultTimeoutSettingsService,
|
||||
this.platformUtilsService,
|
||||
this.kdfConfigService,
|
||||
new CliBiometricsService(),
|
||||
);
|
||||
|
||||
const biometricService = new CliBiometricsService();
|
||||
|
||||
this.vaultTimeoutService = new VaultTimeoutService(
|
||||
this.accountService,
|
||||
this.masterPasswordService,
|
||||
@@ -714,6 +715,7 @@ export class ServiceContainer {
|
||||
this.stateEventRunnerService,
|
||||
this.taskSchedulerService,
|
||||
this.logService,
|
||||
biometricService,
|
||||
lockedCallback,
|
||||
undefined,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user