1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

Auth UserKeyDefinition Migration (#8587)

* Migrate DeviceTrustCryptoService

* Migrate SsoLoginService

* Migrate TokenService

* Update libs/common/src/auth/services/token.state.ts

Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>

* Fix Test

* Actually Fix Tests

---------

Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
This commit is contained in:
Justin Baur
2024-04-10 08:59:20 -05:00
committed by GitHub
parent 2bce6c538c
commit 84cd01165c
5 changed files with 61 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
import { KeyDefinition } from "../../platform/state";
import { KeyDefinition, UserKeyDefinition } from "../../platform/state";
import {
ACCESS_TOKEN_DISK,
@@ -28,8 +28,8 @@ describe.each([
"deserializes state key definitions",
(
keyDefinition:
| KeyDefinition<string>
| KeyDefinition<boolean>
| UserKeyDefinition<string>
| UserKeyDefinition<boolean>
| KeyDefinition<Record<string, string>>,
state: string | boolean | Record<string, string>,
) => {
@@ -50,7 +50,10 @@ describe.each([
return typeof value === "object" && value !== null && !Array.isArray(value);
}
function testDeserialization<T>(keyDefinition: KeyDefinition<T>, state: T) {
function testDeserialization<T>(
keyDefinition: KeyDefinition<T> | UserKeyDefinition<T>,
state: T,
) {
const deserialized = keyDefinition.deserializer(JSON.parse(JSON.stringify(state)));
expect(deserialized).toEqual(state);
}