(id: string, userId: UserId)
| 119 | } |
| 120 | |
| 121 | private async getCipherView(id: string, userId: UserId): Promise<CipherView | CipherView[]> { |
| 122 | let decCipher: CipherView = null; |
| 123 | |
| 124 | if (Utils.isGuid(id)) { |
| 125 | const cipher = await this.cipherService.get(id, userId); |
| 126 | if (cipher != null) { |
| 127 | decCipher = await this.cipherService.decrypt(cipher, userId); |
| 128 | } |
| 129 | } else if (id.trim() !== "") { |
| 130 | let ciphers = await this.cipherService.getAllDecrypted(userId); |
| 131 | ciphers = ciphers.filter((c) => !c.isDeleted && !c.isArchived); |
| 132 | ciphers = this.searchService.searchCiphersBasic(ciphers, id); |
| 133 | if (ciphers.length > 1) { |
| 134 | return ciphers; |
| 135 | } |
| 136 | if (ciphers.length > 0) { |
| 137 | decCipher = ciphers[0]; |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | return decCipher; |
| 142 | } |
| 143 | |
| 144 | private async getCipher(id: string, filter?: (c: CipherView) => boolean) { |
| 145 | const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId)); |
no test coverage detected