diff --git a/libs/common/src/vault/services/cipher.service.spec.ts b/libs/common/src/vault/services/cipher.service.spec.ts index ba85f51c38..c84fd066b2 100644 --- a/libs/common/src/vault/services/cipher.service.spec.ts +++ b/libs/common/src/vault/services/cipher.service.spec.ts @@ -352,8 +352,10 @@ describe("Cipher Service", () => { const cipher1 = new CipherView(cipherObj); cipher1.id = "Cipher 1"; + cipher1.organizationId = null; const cipher2 = new CipherView(cipherObj); cipher2.id = "Cipher 2"; + cipher2.organizationId = null; decryptedCiphers = new BehaviorSubject({ Cipher1: cipher1, diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index d2d28c2d81..1d06ae1dd0 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -1184,11 +1184,16 @@ export class CipherService implements CipherServiceAbstraction { let encryptedCiphers: CipherWithIdRequest[] = []; const ciphers = await this.getAllDecrypted(); - if (!ciphers || ciphers.length === 0) { + if (!ciphers) { + return encryptedCiphers; + } + + const userCiphers = ciphers.filter((c) => c.organizationId == null); + if (userCiphers.length === 0) { return encryptedCiphers; } encryptedCiphers = await Promise.all( - ciphers.map(async (cipher) => { + userCiphers.map(async (cipher) => { const encryptedCipher = await this.encrypt(cipher, newUserKey, originalUserKey); return new CipherWithIdRequest(encryptedCipher); }),