From 64fa810b6eaf66747e1dfcbf0f52d1565cf048e7 Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Mon, 24 Jul 2023 14:34:45 +0200 Subject: [PATCH] [PM-3120] fix: device key not being saved properly --- libs/common/src/platform/models/domain/account.ts | 6 +++--- libs/common/src/platform/services/state.service.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/common/src/platform/models/domain/account.ts b/libs/common/src/platform/models/domain/account.ts index b3da761f8a73..bcf8b157739c 100644 --- a/libs/common/src/platform/models/domain/account.ts +++ b/libs/common/src/platform/models/domain/account.ts @@ -26,7 +26,7 @@ import { Utils } from "../../misc/utils"; import { ServerConfigData } from "../../models/data/server-config.data"; import { EncryptedString, EncString } from "./enc-string"; -import { DeviceKey, MasterKey, SymmetricCryptoKey, UserKey } from "./symmetric-crypto-key"; +import { MasterKey, SymmetricCryptoKey, UserKey } from "./symmetric-crypto-key"; export class EncryptionPair { encrypted?: TEncrypted; @@ -107,7 +107,7 @@ export class AccountKeys { userKeyMasterKey?: string; userKeyAuto?: string; userKeyBiometric?: string; - deviceKey?: DeviceKey; + deviceKey?: ReturnType; organizationKeys?: EncryptionPair< { [orgId: string]: EncryptedOrganizationKeyData }, Record @@ -149,7 +149,7 @@ export class AccountKeys { return Object.assign(new AccountKeys(), { userKey: SymmetricCryptoKey.fromJSON(obj?.userKey), masterKey: SymmetricCryptoKey.fromJSON(obj?.masterKey), - deviceKey: SymmetricCryptoKey.fromJSON(obj?.deviceKey), + deviceKey: obj?.deviceKey, cryptoMasterKey: SymmetricCryptoKey.fromJSON(obj?.cryptoMasterKey), cryptoSymmetricKey: EncryptionPair.fromJSON( obj?.cryptoSymmetricKey, diff --git a/libs/common/src/platform/services/state.service.ts b/libs/common/src/platform/services/state.service.ts index 50ac5668f031..02984fe83151 100644 --- a/libs/common/src/platform/services/state.service.ts +++ b/libs/common/src/platform/services/state.service.ts @@ -1321,7 +1321,7 @@ export class StateService< const account = await this.getAccount(options); - account.keys.deviceKey = value; + account.keys.deviceKey = value.toJSON(); await this.saveAccount(account, options); }