orgnote-api 0.7.12 → 0.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,24 +66,18 @@ exports[`Should encrypt note via keys 1`] = `
66
66
  }
67
67
  `;
68
68
 
69
- exports[`Should not encrypt note with disabled encryption 1`] = `
69
+ exports[`Should encrypt note with empty encrypted property 1`] = `
70
70
  {
71
71
  "author": {
72
72
  "email": "test@mail.com",
73
73
  "id": "1",
74
74
  "name": "John Doe",
75
75
  },
76
- "content": "#+ID: qweqwe
77
- #+TITLE: Hello worlld
78
-
79
- * Hello?",
80
- "encrypted": null,
76
+ "encrypted": "gpgPassword",
81
77
  "id": "id",
82
78
  "meta": {
83
- "description": "Awesome description",
84
- "images": [],
79
+ "id": undefined,
85
80
  "published": false,
86
- "title": "My note title",
87
81
  },
88
82
  }
89
83
  `;
@@ -109,25 +103,3 @@ exports[`Should not encrypt public note 1`] = `
109
103
  },
110
104
  }
111
105
  `;
112
-
113
- exports[`Should not encrypt publick note 1`] = `
114
- {
115
- "author": {
116
- "email": "test@mail.com",
117
- "id": "1",
118
- "name": "John Doe",
119
- },
120
- "content": "#+ID: qweqwe
121
- #+TITLE: Hello worlld
122
-
123
- * Hello?",
124
- "encrypted": "gpgPassword",
125
- "id": "id",
126
- "meta": {
127
- "description": "Awesome description",
128
- "images": [],
129
- "published": true,
130
- "title": "My note title",
131
- },
132
- }
133
- `;
@@ -195,7 +195,7 @@ test('Should not encrypt public note', async () => {
195
195
  expect(encryptedNote).toMatchSnapshot();
196
196
  });
197
197
 
198
- test('Should not encrypt note with disabled encryption', async () => {
198
+ test('Should encrypt note with empty encrypted property', async () => {
199
199
  const content = `#+ID: qweqwe
200
200
  #+TITLE: Hello worlld
201
201
 
@@ -203,7 +203,6 @@ test('Should not encrypt note with disabled encryption', async () => {
203
203
 
204
204
  const note: Note = {
205
205
  id: 'id',
206
- encrypted: null,
207
206
  meta: {
208
207
  title: 'My note title',
209
208
  images: [],
@@ -224,7 +223,9 @@ test('Should not encrypt note with disabled encryption', async () => {
224
223
  });
225
224
 
226
225
  expect(encryptedNote.content.startsWith('-----BEGIN PGP MESSAGE-----')).toBe(
227
- false
226
+ true
228
227
  );
228
+
229
+ delete encryptedNote.content;
229
230
  expect(encryptedNote).toMatchSnapshot();
230
231
  });
@@ -23,7 +23,6 @@ export async function encryptNote<T extends AbstractEncryptedNote>(
23
23
  encryptionParams: OrgNoteEncryption
24
24
  ): Promise<T> {
25
25
  if (
26
- !note.encrypted ||
27
26
  !encryptionParams.type ||
28
27
  encryptionParams.type === ModelsPublicNoteEncryptedEnum.Disabled ||
29
28
  note.meta.published
@@ -80,7 +79,7 @@ export async function decryptNote<T extends AbstractEncryptedNote>(
80
79
  encryptionParams: OrgNoteEncryption
81
80
  ): Promise<T> {
82
81
  if (
83
- !note.encrypted ||
82
+ note.meta.published ||
84
83
  !encryptionParams.type ||
85
84
  encryptionParams.type === ModelsPublicNoteEncryptedEnum.Disabled
86
85
  ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orgnote-api",
3
- "version": "0.7.12",
3
+ "version": "0.7.13",
4
4
  "description": "Official API for creating extensions for OrgNote app",
5
5
  "type": "module",
6
6
  "main": "./index.ts",