1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

update account model with new keys serialization

This commit is contained in:
Jacob Fink
2023-06-14 09:58:40 -04:00
parent 7110e3cda6
commit 9c6739f40a

View File

@@ -22,7 +22,7 @@ import { CollectionView } from "../../../vault/models/view/collection.view";
import { Utils } from "../../misc/utils"; import { Utils } from "../../misc/utils";
import { ServerConfigData } from "../../models/data/server-config.data"; import { ServerConfigData } from "../../models/data/server-config.data";
import { EncString } from "./enc-string"; import { EncryptedString, EncString } from "./enc-string";
import { DeviceKey, MasterKey, SymmetricCryptoKey, UserSymKey } from "./symmetric-crypto-key"; import { DeviceKey, MasterKey, SymmetricCryptoKey, UserSymKey } from "./symmetric-crypto-key";
export class EncryptionPair<TEncrypted, TDecrypted> { export class EncryptionPair<TEncrypted, TDecrypted> {
@@ -99,14 +99,11 @@ export class AccountData {
} }
export class AccountKeys { export class AccountKeys {
// new keys
userSymKey?: UserSymKey; userSymKey?: UserSymKey;
masterKey?: MasterKey; masterKey?: MasterKey;
userSymKeyMasterKey?: string; userSymKeyMasterKey?: string;
userSymKeyAuto?: string; userSymKeyAuto?: string;
userSymKeyBiometric?: string; userSymKeyBiometric?: string;
// end new keys
// deprecated keys // deprecated keys
cryptoMasterKey?: SymmetricCryptoKey; cryptoMasterKey?: SymmetricCryptoKey;
cryptoMasterKeyAuto?: string; cryptoMasterKeyAuto?: string;
@@ -117,7 +114,6 @@ export class AccountKeys {
SymmetricCryptoKey SymmetricCryptoKey
>(); >();
// end deprecated keys // end deprecated keys
deviceKey?: DeviceKey; deviceKey?: DeviceKey;
organizationKeys?: EncryptionPair< organizationKeys?: EncryptionPair<
{ [orgId: string]: EncryptedOrganizationKeyData }, { [orgId: string]: EncryptedOrganizationKeyData },
@@ -146,6 +142,8 @@ export class AccountKeys {
} }
return Object.assign(new AccountKeys(), { return Object.assign(new AccountKeys(), {
userSymKey: SymmetricCryptoKey.fromJSON(obj?.userSymKey),
masterKey: SymmetricCryptoKey.fromJSON(obj?.masterKey),
cryptoMasterKey: SymmetricCryptoKey.fromJSON(obj?.cryptoMasterKey), cryptoMasterKey: SymmetricCryptoKey.fromJSON(obj?.cryptoMasterKey),
cryptoSymmetricKey: EncryptionPair.fromJSON( cryptoSymmetricKey: EncryptionPair.fromJSON(
obj?.cryptoSymmetricKey, obj?.cryptoSymmetricKey,