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

Method editFolder

apps/cli/src/commands/edit.command.ts:240–264  ·  view source on GitHub ↗
(id: string, req: FolderExport)

Source from the content-addressed store, hash-verified

238 }
239
240 private async editFolder(id: string, req: FolderExport) {
241 const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
242 const folder = await this.folderService.getFromState(id, activeUserId);
243 if (folder == null) {
244 return Response.notFound();
245 }
246
247 const userKey = await firstValueFrom(this.keyService.userKey$(activeUserId));
248 let folderView = await folder.decrypt(userKey);
249 folderView = FolderExport.toView(req, folderView);
250
251 const encFolder = await this.folderService.encrypt(folderView, userKey);
252 try {
253 const folder = await this.folderApiService.save(encFolder, activeUserId);
254 const updatedFolder = new Folder(folder);
255 const decFolder = await updatedFolder.decrypt(userKey);
256 const useSharedFoldersTerm = await this.configService.getFeatureFlag(
257 FeatureFlag.VFO1Foundation,
258 );
259 const res = new FolderResponse(decFolder, useSharedFoldersTerm);
260 return Response.success(res);
261 } catch (e) {
262 return Response.error(e);
263 }
264 }
265
266 private async editOrganizationCollection(
267 id: string,

Callers 1

runMethod · 0.95

Calls 11

decryptMethod · 0.95
notFoundMethod · 0.80
userKey$Method · 0.80
getFeatureFlagMethod · 0.80
successMethod · 0.80
errorMethod · 0.65
getFromStateMethod · 0.45
decryptMethod · 0.45
toViewMethod · 0.45
encryptMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected