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,50 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 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
+ exports.specs = void 0;
20
+ const random_node_1 = require("../../../../lib-common/random-node");
21
+ exports.specs = {
22
+ description: '--',
23
+ its: []
24
+ };
25
+ let it = {
26
+ expectation: 'reading and writing file with xattrs'
27
+ };
28
+ it.func = async function ({ dev1FS, dev2, dev2FS }) {
29
+ const file = `file-with-xattrs`;
30
+ const fileContent = (0, random_node_1.stringOfB64CharsSync)(100);
31
+ const xattrValue = {
32
+ "string-attr": 'blah, blah',
33
+ "empty-string-attr": '',
34
+ "number-attr": 42
35
+ };
36
+ await dev2FS().writeTxtFile(file, fileContent);
37
+ await dev2FS().updateXAttrs(file, { set: xattrValue });
38
+ await dev2FS().v.sync.upload(file);
39
+ await dev2FS().v.sync.upload('');
40
+ // Let's read file on another device
41
+ await dev1FS().v.sync.status('');
42
+ await dev1FS().v.sync.adoptRemote('');
43
+ expect(await dev1FS().readTxtFile(file)).toBe(fileContent);
44
+ // Let's read file on original device after restart
45
+ await dev2.stop();
46
+ await dev2.start();
47
+ expect(await dev2FS().readTxtFile(file)).toBe(fileContent);
48
+ };
49
+ exports.specs.its.push(it);
50
+ Object.freeze(exports);
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 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
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
20
+ const setups_1 = require("../libs-for-tests/setups");
21
+ const assert_1 = require("../../lib-common/assert");
22
+ const jwkeys_1 = require("../../lib-common/jwkeys");
23
+ const canonical_address_1 = require("../../lib-common/canonical-address");
24
+ const json_utils_1 = require("../../lib-common/json-utils");
25
+ describe('keyrings', () => {
26
+ const userAddr = 'Bob Perkins @company.inc';
27
+ const s = (0, setups_1.setupWithUsers)(true, [userAddr]);
28
+ let keyrings;
29
+ let asmailConfig;
30
+ beforeAll(() => {
31
+ (0, assert_1.assert)(s.users.length >= 1, `at least one user should be set up`);
32
+ const w3n = s.testAppCapsByUserIndex(0);
33
+ keyrings = w3n.keyrings;
34
+ asmailConfig = w3n.mail.config;
35
+ });
36
+ (0, jasmine_utils_1.itCond)(`can view and update intro key on server`, async () => {
37
+ // intro key CAP in this test
38
+ const pkeyCAP = keyrings.introKeyOnASMailServer;
39
+ // see key that should be currently on server
40
+ const fstCert = await pkeyCAP.getCurrent();
41
+ expect(fstCert).toBeTruthy();
42
+ expect((0, canonical_address_1.areAddressesEqual)(userAddr, (0, jwkeys_1.getPrincipalAddress)(fstCert.pkeyCert))).toBeTrue();
43
+ expect((0, json_utils_1.deepEqual)(fstCert, await asmailConfig.getOnServer('init-pub-key'))).toBeTrue();
44
+ const fstKid = (0, jwkeys_1.getPubKey)(fstCert.pkeyCert);
45
+ // removing intro key from ASMail server
46
+ await pkeyCAP.remove();
47
+ expect(await pkeyCAP.getCurrent()).toBeNull();
48
+ expect(await asmailConfig.getOnServer('init-pub-key')).toBeNull();
49
+ // second removal is a noop
50
+ await pkeyCAP.remove();
51
+ expect(await pkeyCAP.getCurrent()).toBeNull();
52
+ expect(await asmailConfig.getOnServer('init-pub-key')).toBeNull();
53
+ // update makes and publishes new keys
54
+ const sndKey = await pkeyCAP.makeAndPublishNew();
55
+ expect(sndKey).toBeTruthy();
56
+ const sndKid = (0, jwkeys_1.getPubKey)(sndKey.pkeyCert);
57
+ expect(sndKid).not.toBe(fstKid);
58
+ expect((0, json_utils_1.deepEqual)(sndKey, await asmailConfig.getOnServer('init-pub-key'))).toBeTrue();
59
+ const thirdKey = await pkeyCAP.makeAndPublishNew();
60
+ expect(thirdKey).toBeTruthy();
61
+ const thirdKid = (0, jwkeys_1.getPubKey)(thirdKey.pkeyCert);
62
+ expect(thirdKid).not.toBe(fstKid);
63
+ expect(thirdKid).not.toBe(sndKid);
64
+ expect((0, json_utils_1.deepEqual)(thirdKey, await asmailConfig.getOnServer('init-pub-key'))).toBeTrue();
65
+ }, undefined, s);
66
+ (0, jasmine_utils_1.itCond)(`has method to view correpondent's keys info`, async () => {
67
+ expect(typeof keyrings.getCorrespondentKeys).toBe('function');
68
+ });
69
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2020, 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
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
20
+ const setups_1 = require("../libs-for-tests/setups");
21
+ const assert_1 = require("../../lib-common/assert");
22
+ const buffer_utils_1 = require("../../lib-common/buffer-utils");
23
+ describe('MailerId', () => {
24
+ const s = (0, setups_1.setupWithUsers)(true, ['Bob Perkins @company.inc']);
25
+ const srv = (0, setups_1.serviceWithMailerIdLogin)();
26
+ let user;
27
+ let w3n;
28
+ beforeAll(() => {
29
+ (0, assert_1.assert)(s.users.length >= 1, `at least one user should be set up`);
30
+ user = s.users[0];
31
+ w3n = s.testAppCapsByUser(user);
32
+ });
33
+ (0, jasmine_utils_1.itCond)('gets current user id', async () => {
34
+ const userId = await w3n.mailerid.getUserId();
35
+ expect(userId).toBe(user.userId);
36
+ }, undefined, s);
37
+ (0, jasmine_utils_1.itCond)('performs MailerId login', async () => {
38
+ const sessionId = await w3n.mailerid.login(srv.serviceUrl);
39
+ expect(await srv.isSessionValid(sessionId)).toBe(true);
40
+ }, undefined, s);
41
+ (0, jasmine_utils_1.itCond)('signs and checks MailerId signatures', async () => {
42
+ const payloadAsObj = {
43
+ some: '1234324',
44
+ fields: 123
45
+ };
46
+ const payloadBytes = buffer_utils_1.utf8.pack(JSON.stringify(payloadAsObj));
47
+ const sig = await w3n.mailerid.sign(payloadBytes);
48
+ expect(sig.signature.load).toBe(buffer_utils_1.base64.pack(payloadBytes));
49
+ // check good signature
50
+ const check1 = await w3n.mailerid.verifySignature(sig);
51
+ expect(check1.cryptoCheck).toBeTrue();
52
+ expect(check1.midProviderCheck).toBe('all-ok');
53
+ // and messed up signature
54
+ sig.signature.load = sig.signature.load.substring(4);
55
+ const check2 = await w3n.mailerid.verifySignature(sig);
56
+ expect(check2.cryptoCheck).toBeFalse();
57
+ expect(check2.midProviderCheck).toBeUndefined();
58
+ });
59
+ });
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2016 - 2018, 2020, 2022, 2024 - 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
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../../libs-for-tests/jasmine-utils");
20
+ const setups_1 = require("../../libs-for-tests/setups");
21
+ const startup_1 = require("../../libs-for-tests/startup");
22
+ const core_runner_1 = require("../../libs-for-tests/core-runner");
23
+ const sleep_1 = require("../../../lib-common/processes/sleep");
24
+ const random_node_1 = require("../../../lib-common/random-node");
25
+ // NOTE: it-specs inside signIn process expect to run in a given order -- they
26
+ // change app's state, expected by following specs in this describe.
27
+ describe('signIn process (empty cache)', () => {
28
+ const s = (0, setups_1.setupWithUsers)();
29
+ let user;
30
+ let w3n;
31
+ let coreInit;
32
+ let coreAppsInit;
33
+ let closeIPC;
34
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
35
+ if (!s.isUp) {
36
+ return;
37
+ }
38
+ user = s.users[0];
39
+ const runner = s.runners.get(user.userId);
40
+ await (0, sleep_1.sleep)(3000); // attempt to let processes settle
41
+ await runner.restart(true, false);
42
+ ({ closeIPC, coreInit, coreAppsInit, w3n } = runner.startCore());
43
+ }, 30000);
44
+ (0, jasmine_utils_1.afterAllCond)(async () => {
45
+ closeIPC();
46
+ });
47
+ (0, jasmine_utils_1.itCond)('has no users on disk', async () => {
48
+ const users = await w3n.signIn.getUsersOnDisk();
49
+ expect(Array.isArray(users)).toBe(true);
50
+ expect(users.length).toBe(0);
51
+ });
52
+ (0, jasmine_utils_1.itCond)(`fails for user id with wrong domain`, async () => {
53
+ try {
54
+ const unknownId = user.userId + (0, random_node_1.stringOfB64UrlSafeCharsSync)(20);
55
+ await w3n.signIn.startLoginToRemoteStorage(unknownId);
56
+ fail(`Case with bad domain should throw an exception`);
57
+ }
58
+ catch (exc) {
59
+ expect(exc.runtimeException).toBe(true);
60
+ expect(exc.cause).toBeTruthy();
61
+ }
62
+ });
63
+ (0, jasmine_utils_1.itCond)(`fails MailerId provisioning with unknown user id`, async () => {
64
+ const unknownId = (0, random_node_1.stringOfB64UrlSafeCharsSync)(20) + user.userId;
65
+ const userExists = await w3n.signIn.startLoginToRemoteStorage(unknownId);
66
+ expect(userExists).toBe(false);
67
+ });
68
+ (0, jasmine_utils_1.itCond)(`won't startup with a wrong pass`, async () => {
69
+ // start MailerId provisioning
70
+ const userExists = await w3n.signIn.startLoginToRemoteStorage(user.userId);
71
+ expect(userExists).toBe(true);
72
+ // completing MailerId provisioning
73
+ const notifications = [];
74
+ const notifier = (p) => { notifications.push(p); };
75
+ const ok = await w3n.signIn.completeLoginAndLocalSetup('wrong password', notifier);
76
+ expect(ok).withContext('false should be returned for wrong pass').toBe(false);
77
+ (0, startup_1.checkKeyDerivNotifications)(notifications);
78
+ }, 60000);
79
+ (0, jasmine_utils_1.itCond)('starts with correct pass', async () => {
80
+ const core = s.runners.get(user.userId).core;
81
+ try {
82
+ core.makeCAPsForApp(core_runner_1.testApp.appDomain, core_runner_1.testApp.capsRequested);
83
+ fail(`Attempt to make app CAPs before core initialization should throw up`);
84
+ }
85
+ catch (err) { }
86
+ // start login
87
+ const userExists = await w3n.signIn.startLoginToRemoteStorage(user.userId);
88
+ expect(userExists).toBe(true);
89
+ // complete login and a local storage setup
90
+ const notifications = [];
91
+ const notifier = (p) => { notifications.push(p); };
92
+ const ok = await w3n.signIn.completeLoginAndLocalSetup(user.pass, notifier);
93
+ expect(ok).withContext('indicates completion of login and storage setup').toBe(true);
94
+ (0, startup_1.checkKeyDerivNotifications)(notifications);
95
+ const initAs = await coreInit;
96
+ expect(initAs).toBe(user.userId);
97
+ await coreAppsInit;
98
+ try {
99
+ const { caps, close } = core.makeCAPsForApp(core_runner_1.testApp.appDomain, core_runner_1.testApp.capsRequested);
100
+ expect(typeof caps).toBe('object');
101
+ expect(typeof close).toBe('function');
102
+ close();
103
+ }
104
+ catch (err) {
105
+ fail(err);
106
+ }
107
+ }, 60000);
108
+ });
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2016 - 2018, 2020, 2022, 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
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../../libs-for-tests/jasmine-utils");
20
+ const setups_1 = require("../../libs-for-tests/setups");
21
+ const startup_1 = require("../../libs-for-tests/startup");
22
+ const core_runner_1 = require("../../libs-for-tests/core-runner");
23
+ const sleep_1 = require("../../../lib-common/processes/sleep");
24
+ // NOTE: it-specs inside signIn process expect to run in a given order -- they
25
+ // change app's state, expected by following specs in this describe.
26
+ describe('signIn process (with cache)', () => {
27
+ const s = (0, setups_1.setupWithUsers)();
28
+ let user;
29
+ let w3n;
30
+ let coreInit;
31
+ let coreAppsInit;
32
+ let closeIPC;
33
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
34
+ if (!s.isUp) {
35
+ return;
36
+ }
37
+ user = s.users[0];
38
+ const runner = s.runners.get(user.userId);
39
+ await (0, sleep_1.sleep)(3000);
40
+ await runner.restart(false, false);
41
+ ({ closeIPC, coreInit, coreAppsInit, w3n } = runner.startCore());
42
+ }, 30000);
43
+ (0, jasmine_utils_1.afterAllCond)(async () => {
44
+ closeIPC();
45
+ });
46
+ (0, jasmine_utils_1.itCond)('identifies user on disk', async () => {
47
+ const users = await w3n.signIn.getUsersOnDisk();
48
+ expect(Array.isArray(users)).toBe(true);
49
+ expect(users).toContain(user.userId);
50
+ });
51
+ (0, jasmine_utils_1.itCond)(`won't startup with a wrong pass`, async () => {
52
+ const notifications = [];
53
+ const notifier = (p) => { notifications.push(p); };
54
+ const passOK = await w3n.signIn.useExistingStorage(user.userId, 'wrong password', notifier);
55
+ expect(passOK).toBe(false);
56
+ (0, startup_1.checkKeyDerivNotifications)(notifications);
57
+ }, 60000);
58
+ (0, jasmine_utils_1.itCond)('starts with correct pass', async () => {
59
+ const core = s.runners.get(user.userId).core;
60
+ try {
61
+ core.makeCAPsForApp(core_runner_1.testApp.appDomain, core_runner_1.testApp.capsRequested);
62
+ fail(`Attempt to make app CAPs before core initialization should throw up`);
63
+ }
64
+ catch (err) { }
65
+ const notifications = [];
66
+ const notifier = (p) => { notifications.push(p); };
67
+ const passOK = await w3n.signIn.useExistingStorage(user.userId, user.pass, notifier);
68
+ expect(passOK).toBe(true);
69
+ (0, startup_1.checkKeyDerivNotifications)(notifications);
70
+ const initAs = await coreInit;
71
+ expect(initAs).toBe(user.userId);
72
+ await coreAppsInit;
73
+ try {
74
+ const { caps, close } = core.makeCAPsForApp(core_runner_1.testApp.appDomain, core_runner_1.testApp.capsRequested);
75
+ expect(typeof caps).toBe('object');
76
+ expect(typeof close).toBe('function');
77
+ close();
78
+ }
79
+ catch (err) {
80
+ fail(err);
81
+ }
82
+ }, 60000);
83
+ });
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2020, 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
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../../libs-for-tests/jasmine-utils");
20
+ const setups_1 = require("../../libs-for-tests/setups");
21
+ describe('signUp process with token for single user', () => {
22
+ const s = (0, setups_1.minimalSetup)({
23
+ noTokenSignup: [],
24
+ other: ['home.town']
25
+ });
26
+ let w3n;
27
+ let coreInit;
28
+ let coreAppsInit;
29
+ let closeIPC;
30
+ const userId = 'Bob Miller @home.town';
31
+ const pass = 'some long passphrase';
32
+ let token;
33
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
34
+ if (!s.isUp) {
35
+ return;
36
+ }
37
+ ({ closeIPC, coreInit, coreAppsInit, w3n } = s.runner.startCore());
38
+ token = await s.server.createSingleUserSignupCtx(userId);
39
+ });
40
+ (0, jasmine_utils_1.afterAllCond)(async () => {
41
+ closeIPC();
42
+ });
43
+ (0, jasmine_utils_1.itCond)('creates user account, allowing caps for apps', async () => {
44
+ await w3n.signUp.createUserParams(pass, () => { });
45
+ let isCreated = await w3n.signUp.addUser(userId, 'wrong token');
46
+ expect(isCreated).toBe(false);
47
+ isCreated = await w3n.signUp.addUser(userId, token);
48
+ expect(isCreated).toBe(true);
49
+ const initAs = await coreInit;
50
+ expect(initAs).toBe(userId);
51
+ await coreAppsInit;
52
+ }, 10000);
53
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (C) 2016, 2018, 2020, 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
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ const jasmine_utils_1 = require("../../libs-for-tests/jasmine-utils");
20
+ const setups_1 = require("../../libs-for-tests/setups");
21
+ const startup_1 = require("../../libs-for-tests/startup");
22
+ const core_runner_1 = require("../../libs-for-tests/core-runner");
23
+ // NOTE: it-specs inside signUp process expect to run in a given order -- they
24
+ // change app's state, expected by following specs in this describe.
25
+ describe('signUp process', () => {
26
+ const s = (0, setups_1.minimalSetup)();
27
+ let w3n;
28
+ let coreInit;
29
+ let coreAppsInit;
30
+ let closeIPC;
31
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
32
+ if (!s.isUp) {
33
+ return;
34
+ }
35
+ ({ closeIPC, coreInit, coreAppsInit, w3n } = s.runner.startCore());
36
+ }, 30000);
37
+ (0, jasmine_utils_1.afterAllCond)(async () => {
38
+ closeIPC();
39
+ });
40
+ const name = 'Mike Marlow ';
41
+ const pass = 'some long passphrase';
42
+ (0, jasmine_utils_1.itCond)('gets available domains', async () => {
43
+ const domains = await w3n.signUp.getAvailableDomains();
44
+ expect(Array.isArray(domains)).toBe(true);
45
+ expect(domains.length).toBe(s.signupDomains.length);
46
+ for (let d of s.signupDomains) {
47
+ expect(domains).toContain(d);
48
+ }
49
+ });
50
+ (0, jasmine_utils_1.itCond)('gets available addresses', async () => {
51
+ const addresses = await w3n.signUp.getAvailableAddresses(name);
52
+ expect(Array.isArray(addresses)).toBe(true);
53
+ expect(addresses.length).toBe(s.signupDomains.length);
54
+ for (let d of s.signupDomains) {
55
+ expect(addresses).toContain(`${name}@${d}`);
56
+ }
57
+ });
58
+ (0, jasmine_utils_1.itCond)('creates user parameters', async () => {
59
+ const notifications = [];
60
+ const notifier = (p) => { notifications.push(p); };
61
+ await w3n.signUp.createUserParams(pass, notifier);
62
+ (0, startup_1.checkKeyDerivNotifications)(notifications);
63
+ }, 60000);
64
+ (0, jasmine_utils_1.itCond)('creates user account, allowing caps for apps', async () => {
65
+ try {
66
+ s.runner.core.makeCAPsForApp(core_runner_1.testApp.appDomain, core_runner_1.testApp.capsRequested);
67
+ fail(`Attempt to make app CAPs before core initialization should throw up`);
68
+ }
69
+ catch (err) { }
70
+ const userId = `${name}@${s.signupDomains[0]}`;
71
+ const isCreated = await w3n.signUp.addUser(userId);
72
+ expect(isCreated).toBe(true);
73
+ const initAs = await coreInit;
74
+ expect(initAs).toBe(userId);
75
+ await coreAppsInit;
76
+ try {
77
+ const { caps, close } = s.runner.core.makeCAPsForApp(core_runner_1.testApp.appDomain, core_runner_1.testApp.capsRequested);
78
+ expect(typeof caps).toBe('object');
79
+ expect(typeof close).toBe('function');
80
+ close();
81
+ }
82
+ catch (err) {
83
+ fail(err);
84
+ }
85
+ }, 10000);
86
+ });
@@ -0,0 +1 @@
1
+ export {};