diff --git a/libs/common/src/vault/models/domain/cipher.ts b/libs/common/src/vault/models/domain/cipher.ts index 41cce837fbc..8a16a5e6f4b 100644 --- a/libs/common/src/vault/models/domain/cipher.ts +++ b/libs/common/src/vault/models/domain/cipher.ts @@ -384,27 +384,28 @@ export class Cipher extends Domain implements Decryptable { // version: 1, data: typeof this.data === "string" ? this.data : JSON.stringify(this.data), }; + console.log("Cipher toSdkCipher data:", sdkCipher.data, ". \n\n\nIt is of type ", typeof this.data); - // switch (this.type) { - // case CipherType.Login: - // sdkCipher.login = this.login.toSdkLogin(); - // break; - // case CipherType.SecureNote: - // sdkCipher.secureNote = this.secureNote.toSdkSecureNote(); - // break; - // case CipherType.Card: - // sdkCipher.card = this.card.toSdkCard(); - // break; - // case CipherType.Identity: - // sdkCipher.identity = this.identity.toSdkIdentity(); - // break; - // case CipherType.SshKey: - // sdkCipher.sshKey = this.sshKey.toSdkSshKey(); - // break; - // default: - // break; - // } + switch (this.type) { + case CipherType.Login: + sdkCipher.login = this.login.toSdkLogin(); + break; + case CipherType.SecureNote: + sdkCipher.secureNote = this.secureNote.toSdkSecureNote(); + break; + case CipherType.Card: + sdkCipher.card = this.card.toSdkCard(); + break; + case CipherType.Identity: + sdkCipher.identity = this.identity.toSdkIdentity(); + break; + case CipherType.SshKey: + sdkCipher.sshKey = this.sshKey.toSdkSshKey(); + break; + default: + break; + } return sdkCipher; } diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index c1d96cf1721..4b7581aab13 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -1133,12 +1133,14 @@ export class CipherService implements CipherServiceAbstraction { cipherObjects, userId, )); - // migratedCiphers.forEach((c) => (ciphers[c.id] = c.toCipherData())); - migratedCiphers.forEach((c) => (ciphers[c.id] = ciphers[c.id])); + // TODO: Something here broke loading my ciphers... need to investigate. + const res = await this.updateEncryptedCipherState((current) => { + migratedCiphers.forEach((c) => (current[c.id as CipherId] = c.toCipherData())); + return current; + }, userId); - console.log("REPLAZCE: Replacing all ciphers for user", userId); + console.log("== Replacing all ciphers for user", userId); - await this.updateEncryptedCipherState(() => ciphers, userId); } /**