mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
update account model with new keys serialization
This commit is contained in:
@@ -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,15 +99,12 @@ 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;
|
||||||
cryptoMasterKeyB64?: string;
|
cryptoMasterKeyB64?: 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,
|
||||||
|
|||||||
Reference in New Issue
Block a user