Skip to content

Commit

Permalink
fix(cli): corrected view note cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinTh committed Sep 21, 2024
1 parent c1c69c8 commit 6ae4d4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/view-note/view-note.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit 6ae4d4b

Please sign in to comment.