MCPcopy Create free account
hub / github.com/bitwarden/clients / getCipherView

Method getCipherView

apps/cli/src/commands/get.command.ts:121–142  ·  view source on GitHub ↗
(id: string, userId: UserId)

Source from the content-addressed store, hash-verified

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));

Callers 2

getCipherMethod · 0.95
getAttachmentMethod · 0.95

Calls 6

isGuidMethod · 0.80
searchCiphersBasicMethod · 0.80
getMethod · 0.45
decryptMethod · 0.45
getAllDecryptedMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected