1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-12 06:13:38 +00:00

Prefer UserKeyDefinitions for getUser state (#9487)

This commit is contained in:
Matt Gibson
2024-06-04 11:13:04 -04:00
committed by GitHub
parent 6fa12fea49
commit 3e93fc9461

View File

@@ -6,7 +6,7 @@ import {
awaitAsync, awaitAsync,
trackEmissions, trackEmissions,
} from "../../../spec"; } from "../../../spec";
import { GENERATOR_DISK, KeyDefinition } from "../../platform/state"; import { GENERATOR_DISK, UserKeyDefinition } from "../../platform/state";
import { UserId } from "../../types/guid"; import { UserId } from "../../types/guid";
import { BufferedKeyDefinition } from "./buffered-key-definition"; import { BufferedKeyDefinition } from "./buffered-key-definition";
@@ -16,8 +16,9 @@ const SomeUser = "SomeUser" as UserId;
const accountService = mockAccountServiceWith(SomeUser); const accountService = mockAccountServiceWith(SomeUser);
type SomeType = { foo: boolean; bar: boolean }; type SomeType = { foo: boolean; bar: boolean };
const SOME_KEY = new KeyDefinition<SomeType>(GENERATOR_DISK, "fooBar", { const SOME_KEY = new UserKeyDefinition<SomeType>(GENERATOR_DISK, "fooBar", {
deserializer: (jsonValue) => jsonValue as SomeType, deserializer: (jsonValue) => jsonValue as SomeType,
clearOn: [],
}); });
const BUFFER_KEY = new BufferedKeyDefinition<SomeType>(GENERATOR_DISK, "fooBar_buffer", { const BUFFER_KEY = new BufferedKeyDefinition<SomeType>(GENERATOR_DISK, "fooBar_buffer", {
deserializer: (jsonValue) => jsonValue as SomeType, deserializer: (jsonValue) => jsonValue as SomeType,