orgnote-api 0.7.16 → 0.7.17

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.
@@ -82,6 +82,28 @@ exports[`Should encrypt note with empty encrypted property 1`] = `
82
82
  }
83
83
  `;
84
84
 
85
+ exports[`Should not decrypt note without provided encrypted type 1`] = `
86
+ {
87
+ "author": {
88
+ "email": "test@mail.com",
89
+ "id": "1",
90
+ "name": "John Doe",
91
+ },
92
+ "content": "#+ID: qweqwe
93
+ #+TITLE: Hello worlld
94
+
95
+ * Hello?",
96
+ "encrypted": undefined,
97
+ "id": "id",
98
+ "meta": {
99
+ "description": "Awesome description",
100
+ "images": [],
101
+ "published": false,
102
+ "title": "My note title",
103
+ },
104
+ }
105
+ `;
106
+
85
107
  exports[`Should not encrypt public note 1`] = `
86
108
  {
87
109
  "author": {
@@ -229,3 +229,33 @@ test('Should encrypt note with empty encrypted property', async () => {
229
229
  delete encryptedNote.content;
230
230
  expect(encryptedNote).toMatchSnapshot();
231
231
  });
232
+
233
+ test('Should not decrypt note without provided encrypted type', async () => {
234
+ const content = `#+ID: qweqwe
235
+ #+TITLE: Hello worlld
236
+
237
+ * Hello?`;
238
+ const note: Note = {
239
+ id: 'id',
240
+ meta: {
241
+ title: 'My note title',
242
+ images: [],
243
+ published: false,
244
+ description: 'Awesome description',
245
+ },
246
+ encrypted: undefined,
247
+ content,
248
+ author: {
249
+ id: '1',
250
+ name: 'John Doe',
251
+ email: 'test@mail.com',
252
+ },
253
+ };
254
+
255
+ const decryptedNote = await decryptNote(note, {
256
+ type: 'gpgPassword',
257
+ password: '123',
258
+ });
259
+
260
+ expect(decryptedNote).toMatchSnapshot();
261
+ });
@@ -80,6 +80,7 @@ export async function decryptNote<T extends AbstractEncryptedNote>(
80
80
  ): Promise<T> {
81
81
  if (
82
82
  note.meta.published ||
83
+ !note.encrypted ||
83
84
  !encryptionParams.type ||
84
85
  encryptionParams.type === ModelsPublicNoteEncryptedEnum.Disabled
85
86
  ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orgnote-api",
3
- "version": "0.7.16",
3
+ "version": "0.7.17",
4
4
  "description": "Official API for creating extensions for OrgNote app",
5
5
  "type": "module",
6
6
  "main": "./index.ts",