From 6ae4d4b468936d2731ae4b8c5667ea19ff91b1a0 Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Sat, 21 Sep 2024 23:22:58 +0200 Subject: [PATCH] fix(cli): corrected view note cli command --- .github/workflows/ci-cli.yaml | 4 ++-- packages/cli/src/view-note/view-note.command.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-cli.yaml b/.github/workflows/ci-cli.yaml index 7a7881b1..abc6015f 100644 --- a/.github/workflows/ci-cli.yaml +++ b/.github/workflows/ci-cli.yaml @@ -30,8 +30,8 @@ jobs: - name: Run linters run: pnpm lint - # - name: Type check - # run: pnpm typecheck + - name: Type check + run: pnpm typecheck # - name: Run unit test # run: pnpm test diff --git a/packages/cli/src/view-note/view-note.command.ts b/packages/cli/src/view-note/view-note.command.ts index aac2c632..7cf2fa20 100644 --- a/packages/cli/src/view-note/view-note.command.ts +++ b/packages/cli/src/view-note/view-note.command.ts @@ -27,20 +27,20 @@ export const viewNoteCommand = defineCommand({ const { noteUrl, password } = args; try { - const { noteId, encryptionKey } = parseNoteUrl({ noteUrl }); + const { noteId, encryptionKey, isPasswordProtected } = parseNoteUrl({ noteUrl }); - const { content: encryptedContent, isPasswordProtected } = await fetchNote({ + const { payload } = await fetchNote({ noteId, apiBaseUrl: getInstanceUrl(), }); - const { decryptedContent } = await decryptNote({ - encryptedContent, + const { note } = await decryptNote({ + encryptedPayload: payload, encryptionKey, password: isPasswordProtected ? password ?? await promptForPassword() : undefined, }); - console.log(decryptedContent); + console.log(note.content); } catch (error) { if (isApiClientErrorWithStatusCode({ error, statusCode: 404 })) { console.error(picocolors.red('Note not found'));