mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
[PM-5717] Fix calling methods on undefined in biometrics service (#7559)
* Fix calling init() on undefined in biometrics.service.ts * Add guard on osSupportsBiometric * Create NoopBiometricsService instead of method guards --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
c0e157610e
commit
53be4946de
@ -0,0 +1,34 @@
|
||||
import { OsBiometricService } from "./biometrics.service.abstraction";
|
||||
|
||||
export default class NoopBiometricsService implements OsBiometricService {
|
||||
constructor() {}
|
||||
|
||||
async init() {}
|
||||
|
||||
async osSupportsBiometric(): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
async getBiometricKey(
|
||||
service: string,
|
||||
storageKey: string,
|
||||
clientKeyHalfB64: string,
|
||||
): Promise<string | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
async setBiometricKey(
|
||||
service: string,
|
||||
storageKey: string,
|
||||
value: string,
|
||||
clientKeyPartB64: string | undefined,
|
||||
): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
async deleteBiometricKey(service: string, key: string): Promise<void> {}
|
||||
|
||||
async authenticateBiometric(): Promise<boolean> {
|
||||
throw new Error("Not supported on this platform");
|
||||
}
|
||||
}
|
@ -27,6 +27,8 @@ export class BiometricsService implements BiometricsServiceAbstraction {
|
||||
this.loadWindowsHelloService();
|
||||
} else if (platform === "darwin") {
|
||||
this.loadMacOSService();
|
||||
} else {
|
||||
this.loadNoopBiometricsService();
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,6 +49,12 @@ export class BiometricsService implements BiometricsServiceAbstraction {
|
||||
this.platformSpecificService = new BiometricDarwinMain(this.i18nService, this.stateService);
|
||||
}
|
||||
|
||||
private loadNoopBiometricsService() {
|
||||
// eslint-disable-next-line
|
||||
const NoopBiometricsService = require("./biometric.noop.main").default;
|
||||
this.platformSpecificService = new NoopBiometricsService();
|
||||
}
|
||||
|
||||
async init() {
|
||||
return await this.platformSpecificService.init();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user