mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
[PM-5275] Migrate state in Fido2ClientService to State Providers (#7745)
* added state definition and key definition * created vault settings service * created enable passkeys migrations * created enable passkeys migrations * renamed the state definition * created vault settings service * updated enable passkey key definition * updated references with vault settings service * renamed files to avoid conflict * removed set and get enable passkeys from state service * removed comment * fixed comments * added readonly keyword * removed service registartion from service module * removed readonly keyword from abstract class * swicted to used optional chaining * renamed files * added disk-local argument for web
This commit is contained in:
@@ -252,8 +252,6 @@ export abstract class StateService<T extends Account = Account> {
|
||||
value: boolean,
|
||||
options?: StorageOptions,
|
||||
) => Promise<void>;
|
||||
getEnablePasskeys: (options?: StorageOptions) => Promise<boolean>;
|
||||
setEnablePasskeys: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||
getDisableContextMenuItem: (options?: StorageOptions) => Promise<boolean>;
|
||||
setDisableContextMenuItem: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||
/**
|
||||
|
||||
@@ -1211,24 +1211,6 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEnablePasskeys(options?: StorageOptions): Promise<boolean> {
|
||||
return (
|
||||
(await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions())))
|
||||
?.enablePasskeys ?? true
|
||||
);
|
||||
}
|
||||
|
||||
async setEnablePasskeys(value: boolean, options?: StorageOptions): Promise<void> {
|
||||
const globals = await this.getGlobals(
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
globals.enablePasskeys = value;
|
||||
await this.saveGlobals(
|
||||
globals,
|
||||
this.reconcileOptions(options, await this.defaultOnDiskOptions()),
|
||||
);
|
||||
}
|
||||
|
||||
async getDisableContextMenuItem(options?: StorageOptions): Promise<boolean> {
|
||||
return (
|
||||
(await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions())))
|
||||
|
||||
@@ -39,3 +39,7 @@ export const PROVIDERS_DISK = new StateDefinition("providers", "disk");
|
||||
export const FOLDER_DISK = new StateDefinition("folder", "disk", { web: "memory" });
|
||||
|
||||
export const SYNC_STATE = new StateDefinition("sync", "disk", { web: "memory" });
|
||||
|
||||
export const VAULT_SETTINGS_DISK = new StateDefinition("vaultSettings", "disk", {
|
||||
web: "disk-local",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user