core-3nweb-client-lib 0.44.11 → 0.45.0

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.
Files changed (206) hide show
  1. package/build/core/asmail/msg/opener.js +1 -1
  2. package/build/core/asmail/msg/packer.js +1 -1
  3. package/build/core/index.d.ts +2 -2
  4. package/build/core/keyring/correspondent-keys.js +1 -1
  5. package/build/core/keyring/index.js +1 -1
  6. package/build/core/startup/sign-in.d.ts +1 -1
  7. package/build/core/startup/sign-up.d.ts +1 -1
  8. package/build/core/storage/index.d.ts +1 -1
  9. package/build/lib-client/key-derivation.d.ts +1 -1
  10. package/build/lib-client/xsp-fs/attrs.d.ts +3 -2
  11. package/build/lib-client/xsp-fs/attrs.js +7 -6
  12. package/build/lib-client/xsp-fs/folder-node.js +1 -1
  13. package/build/lib-client/xsp-fs/node-in-fs.js +1 -0
  14. package/build/lib-client/xsp-fs/node-persistence.js +1 -1
  15. package/build/lib-client/xsp-fs/xsp-payload-v2.js +1 -1
  16. package/build/tests/caps-api/asmail/specs/events.d.ts +2 -0
  17. package/build/tests/caps-api/asmail/specs/events.js +63 -0
  18. package/build/tests/caps-api/asmail/specs/send-to-wrong-address.d.ts +2 -0
  19. package/build/tests/caps-api/asmail/specs/send-to-wrong-address.js +68 -0
  20. package/build/tests/caps-api/asmail/specs/send-with-attacment-from-storage.d.ts +2 -0
  21. package/build/tests/caps-api/asmail/specs/send-with-attacment-from-storage.js +259 -0
  22. package/build/tests/caps-api/asmail/specs/send-without-attachments.d.ts +2 -0
  23. package/build/tests/caps-api/asmail/specs/send-without-attachments.js +90 -0
  24. package/build/tests/caps-api/asmail/test-utils.d.ts +12 -0
  25. package/build/tests/caps-api/asmail/test-utils.js +60 -0
  26. package/build/tests/caps-api/asmail.js +86 -0
  27. package/build/tests/caps-api/file-sink-checks/different-cases.d.ts +2 -0
  28. package/build/tests/caps-api/file-sink-checks/different-cases.js +47 -0
  29. package/build/tests/caps-api/file-sink-checks/splice.d.ts +2 -0
  30. package/build/tests/caps-api/file-sink-checks/splice.js +122 -0
  31. package/build/tests/caps-api/file-sink-checks/truncate.d.ts +2 -0
  32. package/build/tests/caps-api/file-sink-checks/truncate.js +122 -0
  33. package/build/tests/caps-api/fs-checks/local-to-synced-linking/link.d.ts +2 -0
  34. package/build/tests/caps-api/fs-checks/local-to-synced-linking/link.js +82 -0
  35. package/build/tests/caps-api/fs-checks/local-to-synced-linking/reversed-linking.d.ts +2 -0
  36. package/build/tests/caps-api/fs-checks/local-to-synced-linking/reversed-linking.js +50 -0
  37. package/build/tests/caps-api/fs-checks/not-versioned/deleteFile.d.ts +2 -0
  38. package/build/tests/caps-api/fs-checks/not-versioned/deleteFile.js +73 -0
  39. package/build/tests/caps-api/fs-checks/not-versioned/deleteFolder.d.ts +2 -0
  40. package/build/tests/caps-api/fs-checks/not-versioned/deleteFolder.js +75 -0
  41. package/build/tests/caps-api/fs-checks/not-versioned/getByteSink.d.ts +2 -0
  42. package/build/tests/caps-api/fs-checks/not-versioned/getByteSink.js +96 -0
  43. package/build/tests/caps-api/fs-checks/not-versioned/getByteSource.d.ts +2 -0
  44. package/build/tests/caps-api/fs-checks/not-versioned/getByteSource.js +67 -0
  45. package/build/tests/caps-api/fs-checks/not-versioned/getXAttr.d.ts +2 -0
  46. package/build/tests/caps-api/fs-checks/not-versioned/getXAttr.js +77 -0
  47. package/build/tests/caps-api/fs-checks/not-versioned/link.d.ts +2 -0
  48. package/build/tests/caps-api/fs-checks/not-versioned/link.js +115 -0
  49. package/build/tests/caps-api/fs-checks/not-versioned/listFolder.d.ts +2 -0
  50. package/build/tests/caps-api/fs-checks/not-versioned/listFolder.js +129 -0
  51. package/build/tests/caps-api/fs-checks/not-versioned/listXAttrs.d.ts +2 -0
  52. package/build/tests/caps-api/fs-checks/not-versioned/listXAttrs.js +73 -0
  53. package/build/tests/caps-api/fs-checks/not-versioned/makeFolder.d.ts +2 -0
  54. package/build/tests/caps-api/fs-checks/not-versioned/makeFolder.js +95 -0
  55. package/build/tests/caps-api/fs-checks/not-versioned/move.d.ts +2 -0
  56. package/build/tests/caps-api/fs-checks/not-versioned/move.js +127 -0
  57. package/build/tests/caps-api/fs-checks/not-versioned/readBytes.d.ts +2 -0
  58. package/build/tests/caps-api/fs-checks/not-versioned/readBytes.js +80 -0
  59. package/build/tests/caps-api/fs-checks/not-versioned/readJSONFile.d.ts +2 -0
  60. package/build/tests/caps-api/fs-checks/not-versioned/readJSONFile.js +59 -0
  61. package/build/tests/caps-api/fs-checks/not-versioned/readLink.d.ts +2 -0
  62. package/build/tests/caps-api/fs-checks/not-versioned/readLink.js +39 -0
  63. package/build/tests/caps-api/fs-checks/not-versioned/readTxtFile.d.ts +2 -0
  64. package/build/tests/caps-api/fs-checks/not-versioned/readTxtFile.js +54 -0
  65. package/build/tests/caps-api/fs-checks/not-versioned/readonlyFile.d.ts +2 -0
  66. package/build/tests/caps-api/fs-checks/not-versioned/readonlyFile.js +55 -0
  67. package/build/tests/caps-api/fs-checks/not-versioned/readonlySubRoot.d.ts +2 -0
  68. package/build/tests/caps-api/fs-checks/not-versioned/readonlySubRoot.js +55 -0
  69. package/build/tests/caps-api/fs-checks/not-versioned/select.d.ts +2 -0
  70. package/build/tests/caps-api/fs-checks/not-versioned/select.js +119 -0
  71. package/build/tests/caps-api/fs-checks/not-versioned/stat.d.ts +2 -0
  72. package/build/tests/caps-api/fs-checks/not-versioned/stat.js +96 -0
  73. package/build/tests/caps-api/fs-checks/not-versioned/updateXAttrs.d.ts +2 -0
  74. package/build/tests/caps-api/fs-checks/not-versioned/updateXAttrs.js +126 -0
  75. package/build/tests/caps-api/fs-checks/not-versioned/writableFile.d.ts +2 -0
  76. package/build/tests/caps-api/fs-checks/not-versioned/writableFile.js +79 -0
  77. package/build/tests/caps-api/fs-checks/not-versioned/writableSubRoot.d.ts +2 -0
  78. package/build/tests/caps-api/fs-checks/not-versioned/writableSubRoot.js +90 -0
  79. package/build/tests/caps-api/fs-checks/not-versioned/writeBytes.d.ts +2 -0
  80. package/build/tests/caps-api/fs-checks/not-versioned/writeBytes.js +137 -0
  81. package/build/tests/caps-api/fs-checks/not-versioned/writeJSONFile.d.ts +2 -0
  82. package/build/tests/caps-api/fs-checks/not-versioned/writeJSONFile.js +101 -0
  83. package/build/tests/caps-api/fs-checks/not-versioned/writeTxtFile.d.ts +2 -0
  84. package/build/tests/caps-api/fs-checks/not-versioned/writeTxtFile.js +100 -0
  85. package/build/tests/caps-api/fs-checks/sync-on-one-dev/startUpload.d.ts +2 -0
  86. package/build/tests/caps-api/fs-checks/sync-on-one-dev/startUpload.js +187 -0
  87. package/build/tests/caps-api/fs-checks/sync-on-one-dev/stat.d.ts +2 -0
  88. package/build/tests/caps-api/fs-checks/sync-on-one-dev/stat.js +70 -0
  89. package/build/tests/caps-api/fs-checks/sync-on-one-dev/status.d.ts +2 -0
  90. package/build/tests/caps-api/fs-checks/sync-on-one-dev/status.js +53 -0
  91. package/build/tests/caps-api/fs-checks/sync-on-one-dev/upload.d.ts +2 -0
  92. package/build/tests/caps-api/fs-checks/sync-on-one-dev/upload.js +194 -0
  93. package/build/tests/caps-api/fs-checks/sync-with-two-devs/conflicts.d.ts +2 -0
  94. package/build/tests/caps-api/fs-checks/sync-with-two-devs/conflicts.js +396 -0
  95. package/build/tests/caps-api/fs-checks/sync-with-two-devs/update-propagation.d.ts +2 -0
  96. package/build/tests/caps-api/fs-checks/sync-with-two-devs/update-propagation.js +229 -0
  97. package/build/tests/caps-api/fs-checks/test-utils.d.ts +34 -0
  98. package/build/tests/caps-api/fs-checks/test-utils.js +95 -0
  99. package/build/tests/caps-api/fs-checks/versioned/archiveCurrent.d.ts +2 -0
  100. package/build/tests/caps-api/fs-checks/versioned/archiveCurrent.js +73 -0
  101. package/build/tests/caps-api/fs-checks/versioned/getByteSink.d.ts +2 -0
  102. package/build/tests/caps-api/fs-checks/versioned/getByteSink.js +122 -0
  103. package/build/tests/caps-api/fs-checks/versioned/getByteSource.d.ts +2 -0
  104. package/build/tests/caps-api/fs-checks/versioned/getByteSource.js +71 -0
  105. package/build/tests/caps-api/fs-checks/versioned/listFolder.d.ts +2 -0
  106. package/build/tests/caps-api/fs-checks/versioned/listFolder.js +109 -0
  107. package/build/tests/caps-api/fs-checks/versioned/listVersions.d.ts +2 -0
  108. package/build/tests/caps-api/fs-checks/versioned/listVersions.js +48 -0
  109. package/build/tests/caps-api/fs-checks/versioned/readBytes.d.ts +2 -0
  110. package/build/tests/caps-api/fs-checks/versioned/readBytes.js +90 -0
  111. package/build/tests/caps-api/fs-checks/versioned/readJSONFile.d.ts +2 -0
  112. package/build/tests/caps-api/fs-checks/versioned/readJSONFile.js +60 -0
  113. package/build/tests/caps-api/fs-checks/versioned/readTxtFile.d.ts +2 -0
  114. package/build/tests/caps-api/fs-checks/versioned/readTxtFile.js +56 -0
  115. package/build/tests/caps-api/fs-checks/versioned/stat.d.ts +2 -0
  116. package/build/tests/caps-api/fs-checks/versioned/stat.js +80 -0
  117. package/build/tests/caps-api/fs-checks/versioned/watchFile.d.ts +2 -0
  118. package/build/tests/caps-api/fs-checks/versioned/watchFile.js +64 -0
  119. package/build/tests/caps-api/fs-checks/versioned/writeBytes.d.ts +2 -0
  120. package/build/tests/caps-api/fs-checks/versioned/writeBytes.js +128 -0
  121. package/build/tests/caps-api/fs-checks/versioned/writeJSONFile.d.ts +2 -0
  122. package/build/tests/caps-api/fs-checks/versioned/writeJSONFile.js +111 -0
  123. package/build/tests/caps-api/fs-checks/versioned/writeTxtFile.d.ts +2 -0
  124. package/build/tests/caps-api/fs-checks/versioned/writeTxtFile.js +107 -0
  125. package/build/tests/caps-api/fs-checks/with-core-restarts/xattrs.d.ts +2 -0
  126. package/build/tests/caps-api/fs-checks/with-core-restarts/xattrs.js +50 -0
  127. package/build/tests/caps-api/keyrings.js +69 -0
  128. package/build/tests/caps-api/mailerid.d.ts +1 -0
  129. package/build/tests/caps-api/mailerid.js +59 -0
  130. package/build/tests/caps-api/startup/signin-empty-cache.d.ts +1 -0
  131. package/build/tests/caps-api/startup/signin-empty-cache.js +108 -0
  132. package/build/tests/caps-api/startup/signin-with-cache.d.ts +1 -0
  133. package/build/tests/caps-api/startup/signin-with-cache.js +83 -0
  134. package/build/tests/caps-api/startup/signup-with-token.d.ts +1 -0
  135. package/build/tests/caps-api/startup/signup-with-token.js +53 -0
  136. package/build/tests/caps-api/startup/signup.d.ts +1 -0
  137. package/build/tests/caps-api/startup/signup.js +86 -0
  138. package/build/tests/caps-api/storage.d.ts +1 -0
  139. package/build/tests/caps-api/storage.js +225 -0
  140. package/build/tests/computer.3nweb.core/id-manager.d.ts +1 -0
  141. package/build/tests/computer.3nweb.core/id-manager.js +78 -0
  142. package/build/tests/computer.3nweb.core/inbox/msg-indexing.d.ts +1 -0
  143. package/build/tests/computer.3nweb.core/inbox/msg-indexing.js +145 -0
  144. package/build/tests/computer.3nweb.core/keyrings.d.ts +1 -0
  145. package/build/tests/computer.3nweb.core/keyrings.js +64 -0
  146. package/build/tests/computer.3nweb.core/test-utils.d.ts +21 -0
  147. package/build/tests/computer.3nweb.core/test-utils.js +92 -0
  148. package/build/tests/jasmine.d.ts +1 -0
  149. package/build/tests/jasmine.js +45 -0
  150. package/build/tests/libs-for-tests/bytes-equal.d.ts +1 -0
  151. package/build/tests/libs-for-tests/bytes-equal.js +32 -0
  152. package/build/tests/libs-for-tests/caps-ipc-wrap.d.ts +11 -0
  153. package/build/tests/libs-for-tests/caps-ipc-wrap.js +55 -0
  154. package/build/tests/libs-for-tests/core-runner.d.ts +39 -0
  155. package/build/tests/libs-for-tests/core-runner.js +231 -0
  156. package/build/tests/libs-for-tests/jasmine-utils.d.ts +13 -0
  157. package/build/tests/libs-for-tests/jasmine-utils.js +110 -0
  158. package/build/tests/libs-for-tests/json-equal.d.ts +1 -0
  159. package/build/tests/libs-for-tests/json-equal.js +78 -0
  160. package/build/tests/libs-for-tests/services-runner.d.ts +18 -0
  161. package/build/tests/libs-for-tests/services-runner.js +64 -0
  162. package/build/tests/libs-for-tests/setups.d.ts +51 -0
  163. package/build/tests/libs-for-tests/setups.js +305 -0
  164. package/build/tests/libs-for-tests/spec-module.d.ts +16 -0
  165. package/build/tests/libs-for-tests/spec-module.js +92 -0
  166. package/build/tests/libs-for-tests/startup.d.ts +1 -0
  167. package/build/tests/libs-for-tests/startup.js +29 -0
  168. package/build/tests/libs-for-tests/watching.d.ts +7 -0
  169. package/build/tests/libs-for-tests/watching.js +33 -0
  170. package/build/tests/units/canonical-address.d.ts +1 -0
  171. package/build/tests/units/canonical-address.js +41 -0
  172. package/build/tests/units/device-fs.d.ts +1 -0
  173. package/build/tests/units/device-fs.js +70 -0
  174. package/build/tests/units/folder-node-serialization.d.ts +1 -0
  175. package/build/tests/units/folder-node-serialization.js +74 -0
  176. package/build/tests/units/mid-sigs-NaCl-Ed.d.ts +1 -0
  177. package/build/tests/units/mid-sigs-NaCl-Ed.js +123 -0
  178. package/build/tests/units/number-line.d.ts +1 -0
  179. package/build/tests/units/number-line.js +63 -0
  180. package/build/tests/units/obj-folders.d.ts +1 -0
  181. package/build/tests/units/obj-folders.js +152 -0
  182. package/package.json +11 -3
  183. package/postinstall.js +1 -1
  184. package/build/cryptors.d.ts +0 -1
  185. package/build/cryptors.js +0 -34
  186. package/build/lib-client/cryptor/cryptor-in-worker.d.ts +0 -20
  187. package/build/lib-client/cryptor/cryptor-in-worker.js +0 -357
  188. package/build/lib-client/cryptor/cryptor-wasm.js +0 -1
  189. package/build/lib-client/cryptor/cryptor.d.ts +0 -30
  190. package/build/lib-client/cryptor/cryptor.js +0 -44
  191. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  192. package/build/lib-client/cryptor/in-proc-js.d.ts +0 -2
  193. package/build/lib-client/cryptor/in-proc-js.js +0 -57
  194. package/build/lib-client/cryptor/in-proc-wasm.d.ts +0 -2
  195. package/build/lib-client/cryptor/in-proc-wasm.js +0 -176
  196. package/build/lib-client/cryptor/serialization-for-wasm.d.ts +0 -35
  197. package/build/lib-client/cryptor/serialization-for-wasm.js +0 -57
  198. package/build/lib-client/cryptor/wasm-mp1-modules.d.ts +0 -5
  199. package/build/lib-client/cryptor/wasm-mp1-modules.js +0 -78
  200. package/build/lib-client/cryptor/worker-js.js +0 -131
  201. package/build/lib-client/cryptor/worker-wasm.js +0 -37
  202. package/build/protos/cryptor.proto.js +0 -1804
  203. /package/build/lib-client/{cryptor/cryptor-work-labels.d.ts → cryptor-work-labels.d.ts} +0 -0
  204. /package/build/lib-client/{cryptor/cryptor-work-labels.js → cryptor-work-labels.js} +0 -0
  205. /package/build/{lib-client/cryptor/worker-js.d.ts → tests/caps-api/asmail.d.ts} +0 -0
  206. /package/build/{lib-client/cryptor/worker-wasm.d.ts → tests/caps-api/keyrings.d.ts} +0 -0
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2016 - 2017, 2020 - 2021, 2026 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
20
+ const device_fs_1 = require("../../lib-client/local-files/device-fs");
21
+ const async_fs_node_1 = require("../../lib-common/async-fs-node");
22
+ const path_1 = require("path");
23
+ const spec_module_1 = require("../libs-for-tests/spec-module");
24
+ const test_utils_1 = require("../caps-api/fs-checks/test-utils");
25
+ const os_1 = require("os");
26
+ const TEST_DATA = (0, path_1.join)(__dirname, '..', '..', '..', 'test-data');
27
+ describe('DeviceFS', () => {
28
+ const rootPath = (0, path_1.join)(TEST_DATA, 'root');
29
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
30
+ await (0, async_fs_node_1.rmDirWithContent)(TEST_DATA).catch((e) => {
31
+ if (!e.notFound) {
32
+ throw e;
33
+ }
34
+ });
35
+ await (0, async_fs_node_1.mkdir)(TEST_DATA);
36
+ await (0, async_fs_node_1.mkdir)(rootPath);
37
+ });
38
+ (0, jasmine_utils_1.afterAllCond)(async () => {
39
+ await (0, async_fs_node_1.rmDirWithContent)(TEST_DATA);
40
+ });
41
+ (0, jasmine_utils_1.itCond)('is created with static make function', async () => {
42
+ // creating on non-existing folder should fail
43
+ try {
44
+ await device_fs_1.DeviceFS.makeWritable((0, path_1.join)(TEST_DATA, 'not-existing-folder'));
45
+ fail('device fs should not be created in non-existing folder');
46
+ }
47
+ catch (e) {
48
+ expect(e.notFound).toBeTruthy();
49
+ }
50
+ let rootPath = (0, path_1.join)(TEST_DATA, 'root-for-creation');
51
+ await (0, async_fs_node_1.mkdir)(rootPath);
52
+ let devFS = await device_fs_1.DeviceFS.makeWritable(rootPath);
53
+ expect(devFS).toBeTruthy();
54
+ (0, async_fs_node_1.rmdir)(rootPath);
55
+ });
56
+ describe('is web3n.files.WritableFS', () => {
57
+ const s = {};
58
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
59
+ s.isUp = true;
60
+ s.testFS = await device_fs_1.DeviceFS.makeWritable(rootPath);
61
+ });
62
+ (0, jasmine_utils_1.afterEachCond)(async () => {
63
+ await (0, test_utils_1.clearFS)(s.testFS);
64
+ });
65
+ (0, spec_module_1.loadSpecs)(s, (0, path_1.join)(__dirname, '..', 'caps-api', 'fs-checks', 'not-versioned'), (((0, os_1.platform)() === 'win32') ?
66
+ ['win-local-fs', 'device-fs'] :
67
+ ['device-fs']));
68
+ (0, spec_module_1.loadSpecs)(s, (0, path_1.join)(__dirname, '..', 'caps-api', 'file-sink-checks'), ['device-fs']);
69
+ });
70
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2017, 2022 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const folder_node_serialization_1 = require("../../lib-client/xsp-fs/folder-node-serialization");
20
+ const random = require("../../lib-common/random-node");
21
+ const bytes_fifo_buffer_1 = require("../../lib-common/byte-streaming/bytes-fifo-buffer");
22
+ const bytes_equal_1 = require("../libs-for-tests/bytes-equal");
23
+ const fileNode1 = {
24
+ name: 'file 1',
25
+ objId: random.stringOfB64UrlSafeCharsSync(32),
26
+ key: random.bytesSync(32),
27
+ isFile: true
28
+ };
29
+ const folderNode1 = {
30
+ name: 'folder 1',
31
+ objId: random.stringOfB64UrlSafeCharsSync(32),
32
+ key: random.bytesSync(32),
33
+ isFolder: true
34
+ };
35
+ const f1 = { nodes: {} };
36
+ f1.nodes[fileNode1.name] = fileNode1;
37
+ f1.nodes[folderNode1.name] = folderNode1;
38
+ const emptyFI = { nodes: {} };
39
+ function compareNodeInfos(actual, expected) {
40
+ expect(actual).toBeTruthy();
41
+ expect(actual.name).toBe(expected.name);
42
+ expect(actual.objId).toBe(expected.objId);
43
+ expect((0, bytes_equal_1.bytesEqual)(actual.key, expected.key)).toBe(true);
44
+ expect(actual.isFile).toBe(expected.isFile);
45
+ expect(actual.isFolder).toBe(expected.isFolder);
46
+ expect(actual.isLink).toBe(expected.isLink);
47
+ }
48
+ describe('Folder node serialization', () => {
49
+ it('function serializeFolderInfo produces array of byte arrays', () => {
50
+ let bytes = (0, folder_node_serialization_1.serializeFolderInfo)(emptyFI);
51
+ expect(Array.isArray(bytes)).toBe(true);
52
+ expect(bytes[0].length).toBe(1, 'version section take one byte');
53
+ bytes = (0, folder_node_serialization_1.serializeFolderInfo)(f1);
54
+ expect(bytes.length).toBeGreaterThan(1);
55
+ });
56
+ it('function parseFolderInfo assembles empty folder info', () => {
57
+ const buf = new bytes_fifo_buffer_1.BytesFIFOBuffer();
58
+ (0, folder_node_serialization_1.serializeFolderInfo)(emptyFI)
59
+ .forEach(chunk => buf.push(chunk));
60
+ let info = (0, folder_node_serialization_1.parseFolderInfo)(buf.getBytes(undefined));
61
+ expect(typeof info.nodes).toBe('object');
62
+ expect(Object.values(info.nodes).length).toBe(0);
63
+ });
64
+ it('function parseFolderInfo assembles non-empty folder info', () => {
65
+ const buf = new bytes_fifo_buffer_1.BytesFIFOBuffer();
66
+ (0, folder_node_serialization_1.serializeFolderInfo)(f1)
67
+ .forEach(chunk => buf.push(chunk));
68
+ let info = (0, folder_node_serialization_1.parseFolderInfo)(buf.getBytes(undefined));
69
+ expect(typeof info.nodes).toBe('object');
70
+ expect(Object.values(info.nodes).length).toBe(2);
71
+ compareNodeInfos(info.nodes[fileNode1.name], fileNode1);
72
+ compareNodeInfos(info.nodes[folderNode1.name], folderNode1);
73
+ });
74
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2015, 2025 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>. */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ /*
19
+ * Testing MailerId signing module.
20
+ */
21
+ const random_node_1 = require("../../lib-common/random-node");
22
+ const buffer_utils_1 = require("../../lib-common/buffer-utils");
23
+ const jwkeys_1 = require("../../lib-common/jwkeys");
24
+ const json_equal_1 = require("../libs-for-tests/json-equal");
25
+ const id_provider_1 = require("../../lib-common/mailerid-sigs/id-provider");
26
+ const user_1 = require("../../lib-common/mailerid-sigs/user");
27
+ const relying_party_1 = require("../../lib-common/mailerid-sigs/relying-party");
28
+ describe(`MailerId utility library`, () => {
29
+ const issuer = "test.co/mailerId";
30
+ let midRoot;
31
+ let provider;
32
+ let certifier;
33
+ // XXX test things with address that is not in a canonical form
34
+ const user = "user@some.com";
35
+ let userKeys;
36
+ let userKeyCert;
37
+ const rpDomain = "relying.party.domain";
38
+ let certChain;
39
+ beforeEach(() => {
40
+ // provider's setup functions
41
+ midRoot = (0, id_provider_1.generateRootKey)(issuer, 90 * 24 * 60 * 60, random_node_1.bytesSync);
42
+ provider = (0, id_provider_1.generateProviderKey)(issuer, 10 * 24 * 60 * 60, midRoot.skey, random_node_1.bytesSync);
43
+ certifier = (0, id_provider_1.makeIdProviderCertifier)(issuer, 24 * 60 * 60, provider.skey);
44
+ // user's provisioning its certificate, using provider's service
45
+ // user generates its signing key
46
+ userKeys = (0, user_1.generateSigningKeyPair)(random_node_1.bytesSync);
47
+ // provider certifies user's key
48
+ userKeyCert = certifier.certify(userKeys.pkey, user, 3 * 60 * 60);
49
+ // certs' chain
50
+ certChain = {
51
+ user: userKeyCert,
52
+ prov: provider.cert,
53
+ root: midRoot.cert
54
+ };
55
+ });
56
+ it(`allows relying party to check certificates' chain from user to root`, () => {
57
+ const nowSecs = Math.floor(Date.now() / 1000);
58
+ // relying party verifies user's certificate all way to root certificate
59
+ const certInfo = (0, relying_party_1.verifyChainAndGetUserKey)(certChain, issuer, nowSecs);
60
+ expect(certInfo.address).toBe(user);
61
+ expect((0, json_equal_1.deepEqual)((0, jwkeys_1.keyToJson)(certInfo.pkey), userKeys.pkey)).toBe(true);
62
+ // certificate can be checked for a particular moment in time
63
+ (0, relying_party_1.verifyChainAndGetUserKey)(certChain, issuer, nowSecs + 60 * 60);
64
+ expect(() => (0, relying_party_1.verifyChainAndGetUserKey)(certChain, issuer, nowSecs + 4 * 60 * 60)).toThrow();
65
+ });
66
+ function checkAssertion(rpDomain, sessionId, assertion) {
67
+ const nowSecs = Math.floor(Date.now() / 1000);
68
+ // relying party verifies an assertion
69
+ const assertInfo = (0, relying_party_1.verifyAssertion)(assertion, certChain, issuer, nowSecs);
70
+ expect(assertInfo.user).toBe(user);
71
+ expect(assertInfo.sessionId).toBe(sessionId);
72
+ expect(assertInfo.relyingPartyDomain).toBe(rpDomain);
73
+ // assertion can be checked for a particular moment in time
74
+ (0, relying_party_1.verifyAssertion)(assertion, certChain, issuer, nowSecs + 1);
75
+ expect(() => (0, relying_party_1.verifyAssertion)(assertion, certChain, issuer, nowSecs + 60 * 60)).toThrow();
76
+ }
77
+ it(`allows to create and to check assertions, used for logins`, () => {
78
+ const signer = (0, user_1.makeMailerIdSigner)(userKeys.skey, userKeyCert, provider.cert, 20 * 60);
79
+ // service (relying party) generates session id
80
+ const sessionId = buffer_utils_1.base64.pack((0, random_node_1.bytesSync)(24));
81
+ // user creates signed assertion with given session id inside
82
+ let assertion = signer.generateAssertionFor(rpDomain, sessionId, 10 * 60);
83
+ checkAssertion(rpDomain, sessionId, assertion);
84
+ assertion = signer.generateAssertionFor(rpDomain, sessionId);
85
+ checkAssertion(rpDomain, sessionId, assertion);
86
+ });
87
+ function checkKeyCert(certForPKey, pkey) {
88
+ const nowSecs = Math.floor(Date.now() / 1000);
89
+ const certInfo = (0, relying_party_1.verifyChainAndGetUserKey)(certChain, issuer, nowSecs);
90
+ // peer (relying party) verifies signed key
91
+ const pkeyFromCert = (0, relying_party_1.verifyKeyCert)(certForPKey, certInfo.address, certInfo.pkey, nowSecs);
92
+ expect((0, json_equal_1.deepEqual)(pkeyFromCert, pkey));
93
+ // certificate can be checked for a particular moment in time
94
+ (0, relying_party_1.verifyKeyCert)(certForPKey, certInfo.address, certInfo.pkey, nowSecs + 9 * 60);
95
+ expect(() => (0, relying_party_1.verifyKeyCert)(certForPKey, certInfo.address, certInfo.pkey, nowSecs + (30 * 24 * 60 * 60) + (20 * 60))).toThrow();
96
+ }
97
+ it(`signs keys, and checks resulting certificates`, () => {
98
+ const signer = (0, user_1.makeMailerIdSigner)(userKeys.skey, userKeyCert, provider.cert, 20 * 60);
99
+ // user signes its public key
100
+ const pkey = {
101
+ use: 'some use',
102
+ alg: 'some NaCl alg',
103
+ k: 'RkYr4Rf48Z5NOcHEi6mvtiCVFO4bBZsy9LyHQCFjyuw=',
104
+ kid: '12345'
105
+ };
106
+ const certForPKey = signer.certifyPublicKey(pkey, 30 * 24 * 60 * 60);
107
+ checkKeyCert(certForPKey, pkey);
108
+ });
109
+ it(`makes signatures and check them`, () => {
110
+ const signer = (0, user_1.makeMailerIdSigner)(userKeys.skey, userKeyCert, provider.cert);
111
+ const payload = (0, random_node_1.bytesSync)(200);
112
+ const sig = signer.sign(payload);
113
+ expect((0, jwkeys_1.isLikeSignedLoad)(sig.signature));
114
+ expect(sig.signature.load).toBe(buffer_utils_1.base64.pack(payload));
115
+ expect((0, json_equal_1.deepEqual)(sig.signeeCert, userKeyCert)).toBeTrue();
116
+ expect(sig.signeeCert).not.toBe(userKeyCert);
117
+ expect((0, json_equal_1.deepEqual)(sig.provCert, provider.cert)).toBeTrue();
118
+ expect(sig.provCert).not.toBe(provider.cert);
119
+ expect((0, relying_party_1.verifySignature)(midRoot.cert, sig.provCert, sig.signeeCert, sig.signature)).toBeTrue();
120
+ sig.signature.load = sig.signature.load.substring(4);
121
+ expect((0, relying_party_1.verifySignature)(midRoot.cert, sig.provCert, sig.signeeCert, sig.signature)).toBeFalse();
122
+ });
123
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2018 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const common_1 = require("../../core/asmail/delivery/common");
20
+ const json_utils_1 = require("../../lib-common/json-utils");
21
+ describe(`Function addToNumberLineSegments`, () => {
22
+ it(`inserts number to empty segments array`, () => {
23
+ const segments = [];
24
+ const n = 1;
25
+ (0, common_1.addToNumberLineSegments)(segments, n);
26
+ expect((0, json_utils_1.deepEqual)(segments, [[n, n]])).toBeTruthy();
27
+ });
28
+ it(`expands existing segment on lower side`, () => {
29
+ let segments = [[1, 1], [4, 4]];
30
+ (0, common_1.addToNumberLineSegments)(segments, 3);
31
+ expect((0, json_utils_1.deepEqual)(segments, [[1, 1], [3, 4]])).toBeTruthy();
32
+ });
33
+ it(`expands existing segment on higher side`, () => {
34
+ const segments = [[1, 1], [4, 4]];
35
+ (0, common_1.addToNumberLineSegments)(segments, 2);
36
+ expect((0, json_utils_1.deepEqual)(segments, [[1, 2], [4, 4]])).toBeTruthy();
37
+ });
38
+ it(`expands existing segment and merges it with an overlapping one`, () => {
39
+ const segments = [[1, 2], [4, 4]];
40
+ (0, common_1.addToNumberLineSegments)(segments, 3);
41
+ expect((0, json_utils_1.deepEqual)(segments, [[1, 4]])).toBeTruthy();
42
+ });
43
+ it(`changes nothing when number is already in an existing segment`, () => {
44
+ const segments = [[1, 2], [4, 4]];
45
+ (0, common_1.addToNumberLineSegments)(segments, 2);
46
+ expect((0, json_utils_1.deepEqual)(segments, [[1, 2], [4, 4]])).toBeTruthy();
47
+ });
48
+ it(`adds new segment on a lower side`, () => {
49
+ const segments = [[4, 6], [10, 12]];
50
+ (0, common_1.addToNumberLineSegments)(segments, 2);
51
+ expect((0, json_utils_1.deepEqual)(segments, [[2, 2], [4, 6], [10, 12]])).toBeTruthy();
52
+ });
53
+ it(`adds new segment in the middle`, () => {
54
+ const segments = [[4, 6], [10, 12]];
55
+ (0, common_1.addToNumberLineSegments)(segments, 8);
56
+ expect((0, json_utils_1.deepEqual)(segments, [[4, 6], [8, 8], [10, 12]])).toBeTruthy();
57
+ });
58
+ it(`adds new segment on a higher side`, () => {
59
+ const segments = [[4, 6], [10, 12]];
60
+ (0, common_1.addToNumberLineSegments)(segments, 15);
61
+ expect((0, json_utils_1.deepEqual)(segments, [[4, 6], [10, 12], [15, 15]])).toBeTruthy();
62
+ });
63
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2022 3NSoft Inc.
4
+
5
+ This program is free software: you can redistribute it and/or modify it under
6
+ the terms of the GNU General Public License as published by the Free Software
7
+ Foundation, either version 3 of the License, or (at your option) any later
8
+ version.
9
+
10
+ This program is distributed in the hope that it will be useful, but
11
+ WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
+ See the GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License along with
16
+ this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
20
+ const random_node_1 = require("../../lib-common/random-node");
21
+ const path_1 = require("path");
22
+ const async_fs_node_1 = require("../../lib-common/async-fs-node");
23
+ const obj_folders_1 = require("../../lib-client/objs-on-disk/obj-folders");
24
+ const TEST_DATA = (0, path_1.join)(__dirname, `../../../test-ObjFolders-${(0, random_node_1.stringOfB64UrlSafeCharsSync)(10)}`);
25
+ // internal constants from source file with used names
26
+ const ROOT_OBJ_DIR = '=root=';
27
+ const ACCESS_DIR = 'objs';
28
+ const GENERATIONS_DIR = 'generations';
29
+ const CONFIG_FILE = 'obj-folders-cfg.json';
30
+ const objsDir = (0, path_1.join)(TEST_DATA, ACCESS_DIR);
31
+ const gensDir = (0, path_1.join)(TEST_DATA, GENERATIONS_DIR);
32
+ async function readJSONFile(path) {
33
+ const str = await (0, async_fs_node_1.readFile)(path, { encoding: 'utf8' });
34
+ return JSON.parse(str);
35
+ }
36
+ async function numOfItemsIn(path) {
37
+ return (await (0, async_fs_node_1.readdir)(path)).length;
38
+ }
39
+ async function writeFilesTo(folder, numOfFiles) {
40
+ for (let i = 1; i <= numOfFiles; i += 1) {
41
+ const fileContent = await (0, random_node_1.bytes)(100);
42
+ await (0, async_fs_node_1.writeFile)((0, path_1.join)(folder, `${i}.x`), fileContent);
43
+ }
44
+ }
45
+ const charsInSplit = 3;
46
+ const numOfSplits = 3;
47
+ const idA = `111222333aaaaaa`;
48
+ const idB = `111222333bbbbbb`;
49
+ const idC = `111222555cccccc`;
50
+ describe('ObjFolders without timed generations', () => {
51
+ let folders;
52
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
53
+ await (0, async_fs_node_1.mkdir)(TEST_DATA);
54
+ folders = await obj_folders_1.ObjFolders.makeSimple(TEST_DATA, async (err, msg) => {
55
+ console.error(`ObjFolders test error logging:\n${msg}`, err);
56
+ fail(err);
57
+ });
58
+ });
59
+ (0, jasmine_utils_1.afterAllCond)(async () => {
60
+ await (0, async_fs_node_1.rmDirWithContent)(TEST_DATA);
61
+ });
62
+ (0, jasmine_utils_1.itCond)(`static folder content`, async () => {
63
+ expect((0, async_fs_node_1.existsFolderSync)((0, path_1.join)(TEST_DATA, ACCESS_DIR))).toBeTrue();
64
+ const cfg = await readJSONFile((0, path_1.join)(TEST_DATA, CONFIG_FILE));
65
+ expect(cfg.charsInSplit).withContext('default config value').toBe(charsInSplit);
66
+ expect(cfg.numOfSplits).withContext('default config value').toBe(numOfSplits);
67
+ });
68
+ (0, jasmine_utils_1.itCond)(`null id for root object`, async () => {
69
+ const rootObjPath = (0, path_1.join)(objsDir, ROOT_OBJ_DIR);
70
+ // behaviour with missing obj folder and no creation
71
+ expect((0, async_fs_node_1.existsFolderSync)(rootObjPath)).not.toBeTrue();
72
+ let folderPath = await folders.getFolderAccessFor(null);
73
+ expect(folderPath).withContext(`obj folder not present, and is not created`).toBeUndefined();
74
+ expect((0, async_fs_node_1.existsFolderSync)(rootObjPath)).not.toBeTrue();
75
+ folderPath = await folders.getFolderAccessFor(null, true);
76
+ expect(folderPath).toBe(rootObjPath);
77
+ expect((0, async_fs_node_1.existsFolderSync)(folderPath)).toBeTrue();
78
+ await writeFilesTo(folderPath, 4);
79
+ // behaviour with exiting obj folder
80
+ let existingPath = await folders.getFolderAccessFor(null);
81
+ expect(existingPath).toBe(folderPath);
82
+ existingPath = await folders.getFolderAccessFor(null);
83
+ expect(existingPath).toBe(folderPath);
84
+ try {
85
+ await folders.removeFolderOf(null);
86
+ fail(`attempt to remove root obj must fail`);
87
+ }
88
+ catch (err) {
89
+ expect(err).toBeDefined();
90
+ }
91
+ });
92
+ (0, jasmine_utils_1.itCond)(`ids with same start`, async () => {
93
+ const sameFstIdPart = idA.slice(0, charsInSplit * 1);
94
+ const sameSndIdPart = idA.slice(charsInSplit * 1, charsInSplit * 2);
95
+ const sameThirdIdPart = idA.slice(charsInSplit * 2, charsInSplit * 3);
96
+ const fstDepthCount = await numOfItemsIn(objsDir);
97
+ // behaviour with missing obj folder and no creation
98
+ expect((0, async_fs_node_1.existsFolderSync)((0, path_1.join)(objsDir, sameFstIdPart))).not.toBeTrue();
99
+ let folderA = await folders.getFolderAccessFor(idA);
100
+ expect(folderA).withContext(`obj folder not present, and is not created`).toBeUndefined();
101
+ folderA = await folders.getFolderAccessFor(idA, true);
102
+ expect((0, async_fs_node_1.existsFolderSync)(folderA)).toBeTrue();
103
+ expect((0, path_1.basename)(folderA)).toBe(idA.slice(numOfSplits * charsInSplit));
104
+ const threeLevelsDown = (0, path_1.join)(objsDir, sameFstIdPart, sameSndIdPart, sameThirdIdPart);
105
+ expect(await numOfItemsIn(threeLevelsDown)).toBe(1);
106
+ await writeFilesTo(folderA, 4);
107
+ // behaviour with exiting obj folder
108
+ let existingPath = await folders.getFolderAccessFor(idA);
109
+ expect(existingPath).toBe(folderA);
110
+ existingPath = await folders.getFolderAccessFor(idA);
111
+ expect(existingPath).toBe(folderA);
112
+ expect(await numOfItemsIn(objsDir)).toBe(fstDepthCount + 1);
113
+ expect((0, async_fs_node_1.existsFolderSync)((0, path_1.join)(objsDir, sameFstIdPart))).toBeTrue();
114
+ const twoLevelsDown = (0, path_1.join)(objsDir, sameFstIdPart, sameSndIdPart);
115
+ const thirdDepthCount = await numOfItemsIn(twoLevelsDown);
116
+ const folderB = await folders.getFolderAccessFor(idB, true);
117
+ expect((0, async_fs_node_1.existsFolderSync)(folderB)).toBeTrue();
118
+ expect((0, path_1.basename)(folderB)).toBe(idB.slice(numOfSplits * charsInSplit));
119
+ expect(await numOfItemsIn(objsDir)).toBe(fstDepthCount + 1);
120
+ expect(await numOfItemsIn(twoLevelsDown)).toBe(thirdDepthCount);
121
+ expect(await numOfItemsIn(threeLevelsDown)).toBe(2);
122
+ await writeFilesTo(folderB, 4);
123
+ const folderC = await folders.getFolderAccessFor(idC, true);
124
+ expect((0, async_fs_node_1.existsFolderSync)(folderC)).toBeTrue();
125
+ expect((0, path_1.basename)(folderC)).toBe(idC.slice(numOfSplits * charsInSplit));
126
+ expect(await numOfItemsIn(objsDir)).toBe(fstDepthCount + 1);
127
+ expect(await numOfItemsIn(twoLevelsDown)).toBe(thirdDepthCount + 1);
128
+ await writeFilesTo(folderC, 4);
129
+ // listing obj folders
130
+ const lstBeforeRemoval = await folders.listRecent();
131
+ expect(lstBeforeRemoval.find(({ objId, path }) => ((objId === idA) && (path === folderA)))).toBeDefined();
132
+ expect(lstBeforeRemoval.find(({ objId, path }) => ((objId === idB) && (path === folderB)))).toBeDefined();
133
+ expect(lstBeforeRemoval.find(({ objId, path }) => ((objId === idC) && (path === folderC)))).toBeDefined();
134
+ await folders.removeFolderOf(idA);
135
+ let lst = await folders.listRecent();
136
+ expect(lst.length).toBe(lstBeforeRemoval.length - 1);
137
+ expect(await numOfItemsIn(objsDir)).toBe(fstDepthCount + 1);
138
+ expect(await numOfItemsIn(twoLevelsDown)).toBe(thirdDepthCount + 1);
139
+ expect(await numOfItemsIn(threeLevelsDown)).toBe(1);
140
+ await folders.removeFolderOf(idB);
141
+ lst = await folders.listRecent();
142
+ expect(lst.length).toBe(lstBeforeRemoval.length - 2);
143
+ expect(await numOfItemsIn(objsDir)).toBe(fstDepthCount + 1);
144
+ expect(await numOfItemsIn(twoLevelsDown)).toBe(thirdDepthCount);
145
+ await folders.removeFolderOf(idC);
146
+ lst = await folders.listRecent();
147
+ expect(lst.length).toBe(lstBeforeRemoval.length - 3);
148
+ expect(await numOfItemsIn(objsDir)).toBe(fstDepthCount);
149
+ // removing non-existing obj is a noop
150
+ await folders.removeFolderOf('nonExistingObject');
151
+ });
152
+ });
package/package.json CHANGED
@@ -1,12 +1,19 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.44.11",
3
+ "version": "0.45.0",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",
7
+ "files": [
8
+ "build",
9
+ "protos",
10
+ "postinstall.js",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
7
14
  "scripts": {
8
15
  "build-only-ts": "tsc -p ts-code && bash -c 'cp -rf ts-code/lib-sqlite-on-3nstorage/sqljs.* build/lib-sqlite-on-3nstorage/' ",
9
- "build": "bash packing/protos-to-node-module.sh && npm run build-only-ts && bash packing/copy-api.sh && bash packing/build-wasm-cryptor.sh",
16
+ "build": "bash packing/protos-to-node-module.sh && npm run build-only-ts && bash packing/copy-api.sh",
10
17
  "test": "node build/tests/jasmine.js",
11
18
  "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
12
19
  },
@@ -28,7 +35,7 @@
28
35
  },
29
36
  "license": "GPL-3.0-or-later",
30
37
  "dependencies": {
31
- "ecma-nacl": "^2.5.1",
38
+ "ecma-nacl-cryptors": "^1.0.1",
32
39
  "protobufjs": "^7.0.1",
33
40
  "punycode": "^2.1.1",
34
41
  "rxjs": "^7.5.7",
@@ -40,6 +47,7 @@
40
47
  "@types/node": "^22.13.14",
41
48
  "@types/punycode": "^2.1.1",
42
49
  "@types/ws": "^8.18.1",
50
+ "napi-nacl": "^1.2.0",
43
51
  "jasmine": "^5.13.0",
44
52
  "protobufjs-cli": "^1.0.2",
45
53
  "spec-3nweb-server": "^1.8.5",
package/postinstall.js CHANGED
@@ -12,7 +12,7 @@ const COLOR = is(env.npm_config_color);
12
12
  const BANNER = `\u001B[96mThank you for using core-3nweb-client-lib (\u001B[94m https://github.com/3nsoft/core-3nweb-client-lib.git \u001B[96m) to power core of 3NWeb client side platform, like PrivacySafe, within which this library is developed\u001B[0m
13
13
 
14
14
  \u001B[96mThe project needs your help! Please consider supporting PrivacySafe on Open Collective: \u001B[0m
15
- \u001B[96m>\u001B[94m https://opencollective.com/privacysafe \u001B[0m
15
+ \u001B[96m>\u001B[94m https://liberapay.com/PrivacySafe/donate \u001B[0m
16
16
  `;
17
17
 
18
18
  function isBannerRequired() {
@@ -1 +0,0 @@
1
- export * from './lib-client/cryptor/cryptor';
package/build/cryptors.js DELETED
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /*
3
- Copyright (C) 2020 - 2021 3NSoft Inc.
4
-
5
- This program is free software: you can redistribute it and/or modify it under
6
- the terms of the GNU General Public License as published by the Free Software
7
- Foundation, either version 3 of the License, or (at your option) any later
8
- version.
9
-
10
- This program is distributed in the hope that it will be useful, but
11
- WITHOUT ANY WARRANTY; without even the implied warranty of
12
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
- See the GNU General Public License for more details.
14
-
15
- You should have received a copy of the GNU General Public License along with
16
- this program. If not, see <http://www.gnu.org/licenses/>.
17
- */
18
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- var desc = Object.getOwnPropertyDescriptor(m, k);
21
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
- desc = { enumerable: true, get: function() { return m[k]; } };
23
- }
24
- Object.defineProperty(o, k2, desc);
25
- }) : (function(o, m, k, k2) {
26
- if (k2 === undefined) k2 = k;
27
- o[k2] = m[k];
28
- }));
29
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- __exportStar(require("./lib-client/cryptor/cryptor"), exports);
34
- Object.freeze(exports);
@@ -1,20 +0,0 @@
1
- import { makeCryptor } from './cryptor';
2
- export interface RequestMsg {
3
- func: Func;
4
- args: any[];
5
- }
6
- export type Func = 'scrypt' | 'box.calc_dhshared_key' | 'box.generate_pubkey' | 'sbox.open' | 'sbox.pack' | 'sbox.formatWN.open' | 'sbox.formatWN.pack' | 'sign.generate_keypair' | 'sign.signature' | 'sign.verify';
7
- export interface ReplyMsg {
8
- res?: any;
9
- interim?: any;
10
- err?: any;
11
- }
12
- export type Code = (args: any[]) => {
13
- res: any;
14
- trans?: ArrayBuffer[];
15
- };
16
- export interface WorkerData {
17
- loadDir: string;
18
- }
19
- export declare const makeInWorkerCryptor: makeCryptor;
20
- export declare const makeInWorkerWasmCryptor: makeCryptor;