1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-08 03:23:15 +00:00

[bug] Adjust state scope of several biometric data points

This commit is contained in:
addison
2021-11-03 17:16:08 -04:00
parent 67677b7abe
commit 90f8318592
3 changed files with 33 additions and 33 deletions

View File

@@ -37,10 +37,6 @@ export class Account {
apiKeyClientSecret: string;
alwaysShowDock: boolean;
autoFillOnPageLoadDefault: boolean;
biometricAwaitingAcceptance: boolean;
biometricFingerprintValidated: boolean;
biometricText: string;
biometricUnlock: boolean;
encryptedCiphers: { [id: string]: CipherData };
decryptedCiphers: CipherView[];
cryptoMasterKey: SymmetricCryptoKey;
@@ -49,7 +45,6 @@ export class Account {
decryptedCryptoSymmetricKey: SymmetricCryptoKey;
defaultUriMatch: UriMatchType;
disableAddLoginNotification: boolean;
disableAutoBiometricsPrompt: boolean;
disableAutoTotpCopy: boolean;
disableBadgeCounter: boolean;
disableChangedPasswordNotification: boolean;
@@ -61,7 +56,6 @@ export class Account {
emailVerified: boolean;
enableAlwaysOnTop: boolean;
enableAutoFillOnPageLoad: boolean;
enableBiometric: boolean;
enableBrowserIntegration: boolean;
enableBrowserIntegrationFingerprint: boolean;
enableCloseToTray: boolean;
@@ -92,8 +86,6 @@ export class Account {
mainWindowSize: number;
minimizeOnCopyToClipboard: boolean;
neverDomains: string[];
noAutoPromptBiometrics: boolean;
noAutoPromptBiometricsText: string;
openAtLogin: boolean;
encryptedPasswordGenerationHistory: GeneratedPasswordHistory[];
decryptedPasswordGenerationHistory: GeneratedPasswordHistory[];
@@ -127,11 +119,18 @@ export class Account {
locale: string;
organizations: { [id: string]: OrganizationData };
everBeenUnlocked: boolean;
biometricLocked: boolean;
enableGravitars: boolean;
addEditCipherInfo: any;
authenticationStatus: AuthenticationStatus;
autoConfirmFingerPrints: boolean;
disableAutoBiometricsPrompt: boolean;
noAutoPromptBiometrics: boolean;
biometricLocked: boolean;
biometricUnlock: boolean;
biometricText: string;
enableBiometric: boolean;
enableBiometrics: boolean;
noAutoPromptBiometricsText: string;
private hasPremiumPersonally: boolean;
constructor(userId: string, userEmail: string,

View File

@@ -1,12 +1,9 @@
export class Globals {
biometricText: string;
decodedToken: any;
enableAlwaysOnTop: boolean;
enableBiometrics: boolean;
installedVersion: string;
lastActive: number;
locale: string;
noAutoPromptBiometricsText: string;
openAtLogin: boolean;
organizationInvitation: any;
rememberEmail: boolean;
@@ -14,4 +11,7 @@ export class Globals {
theme: string;
window: Map<string, any> = new Map<string, any>();
twoFactorToken: string;
biometricAwaitingAcceptance: boolean;
biometricFingerprintValidated: boolean;
}

View File

@@ -112,15 +112,15 @@ export class StateService implements StateServiceAbstraction {
}
async getBiometricAwaitingAcceptance(options?: StorageOptions): Promise<boolean> {
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))?.biometricAwaitingAcceptance ?? false;
return (await this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions)))?.biometricAwaitingAcceptance ?? false;
}
async getBiometricFingerprintValidated(options?: StorageOptions): Promise<boolean> {
return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))?.biometricFingerprintValidated ?? false;
return (await this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions)))?.biometricFingerprintValidated ?? false;
}
async getBiometricText(options?: StorageOptions): Promise<string> {
return (await this.getGlobals(this.reconcileOptions(options, this.defaultOnDiskOptions)))?.biometricText;
return (await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskOptions)))?.biometricText;
}
async getBiometricUnlock(options?: StorageOptions): Promise<boolean> {
@@ -160,7 +160,8 @@ export class StateService implements StateServiceAbstraction {
if (options?.keySuffix == null) {
throw new RequiredSuffixError();
}
return (await this.getAccount(this.reconcileOptions(options, this.defaultSecureStorageOptions)))?.cryptoMasterKeyB64;
const value = (await this.getAccount(this.reconcileOptions(options, this.defaultSecureStorageOptions)))?.cryptoMasterKeyB64;
return value;
} catch (e) {
this.logService.error(e);
}
@@ -233,7 +234,7 @@ export class StateService implements StateServiceAbstraction {
}
async getEnableBiometric(options?: StorageOptions): Promise<boolean> {
return (await this.getGlobals(this.reconcileOptions(options, this.defaultOnDiskOptions)))?.enableBiometrics ?? false;
return (await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskOptions)))?.enableBiometrics ?? false;
}
async getEnableBrowserIntegration(options?: StorageOptions): Promise<boolean> {
@@ -375,7 +376,7 @@ export class StateService implements StateServiceAbstraction {
}
async getNoAutoPromptBiometricsText(options?: StorageOptions): Promise<string> {
return (await this.getGlobals(this.reconcileOptions(options, this.defaultOnDiskOptions)))?.noAutoPromptBiometricsText;
return (await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskOptions)))?.noAutoPromptBiometricsText;
}
async getOpenAtLogin(options?: StorageOptions): Promise<boolean> {
@@ -546,21 +547,21 @@ export class StateService implements StateServiceAbstraction {
}
async setBiometricAwaitingAcceptance(value: boolean, options?: StorageOptions): Promise<void> {
const account = await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
account.biometricAwaitingAcceptance = value;
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
const globals = await this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions));
globals.biometricAwaitingAcceptance = value;
await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions));
}
async setBiometricFingerprintValidated(value: boolean, options?: StorageOptions): Promise<void> {
const account = await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions));
account.biometricFingerprintValidated = value;
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
const globals = await this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions));
globals.biometricFingerprintValidated = value;
await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions));
}
async setBiometricText(value: string, options?: StorageOptions): Promise<void> {
const globals = await this.getGlobals(this.reconcileOptions(options, this.defaultOnDiskOptions));
globals.biometricText = value;
await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultOnDiskOptions));
const account = await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskOptions));
account.biometricText = value;
await this.saveAccount(account, this.reconcileOptions(options, this.defaultOnDiskOptions));
}
async setBiometricUnlock(value: boolean, options?: StorageOptions): Promise<void> {
@@ -734,9 +735,9 @@ export class StateService implements StateServiceAbstraction {
}
async setEnableBiometric(value: boolean, options?: StorageOptions): Promise<void> {
const globals = await this.getGlobals(this.reconcileOptions(options, this.defaultOnDiskOptions));
globals.enableBiometrics = value;
await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultOnDiskOptions));
const account = await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskOptions));
account.enableBiometrics = value;
await this.saveAccount(account, this.reconcileOptions(options, this.defaultOnDiskOptions));
}
async setEnableBrowserIntegration(value: boolean, options?: StorageOptions): Promise<void> {
@@ -938,9 +939,9 @@ export class StateService implements StateServiceAbstraction {
}
async setNoAutoPromptBiometricsText(value: string, options?: StorageOptions): Promise<void> {
const globals = await this.getGlobals(this.reconcileOptions(options, this.defaultOnDiskOptions));
globals.noAutoPromptBiometricsText = value;
await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultOnDiskOptions));
const account = await this.getAccount(this.reconcileOptions(options, this.defaultOnDiskOptions));
account.noAutoPromptBiometricsText = value;
await this.saveAccount(account, this.reconcileOptions(options, this.defaultOnDiskOptions));
}
async setOpenAtLogin(value: boolean, options?: StorageOptions): Promise<void> {