core-3nweb-client-lib 0.47.4 → 0.48.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 (88) hide show
  1. package/build/core/asmail/delivery/common.d.ts +2 -0
  2. package/build/core/asmail/delivery/msg.js +2 -2
  3. package/build/core/asmail/inbox/attachments/fs.d.ts +2 -1
  4. package/build/core/asmail/inbox/attachments/fs.js +4 -3
  5. package/build/core/asmail/inbox/index.d.ts +3 -0
  6. package/build/core/asmail/inbox/index.js +4 -3
  7. package/build/core/asmail/index.d.ts +3 -1
  8. package/build/core/asmail/index.js +5 -2
  9. package/build/core/asmail/msg/packer.d.ts +4 -2
  10. package/build/core/asmail/msg/packer.js +28 -22
  11. package/build/core/asmail/sending-params/index.d.ts +2 -1
  12. package/build/core/asmail/sending-params/index.js +2 -2
  13. package/build/core/asmail/sending-params/invitations-anon.d.ts +3 -1
  14. package/build/core/asmail/sending-params/invitations-anon.js +6 -5
  15. package/build/core/id-manager/index.d.ts +4 -2
  16. package/build/core/id-manager/index.js +8 -7
  17. package/build/core/index.d.ts +3 -1
  18. package/build/core/index.js +11 -10
  19. package/build/core/keyring/common.d.ts +3 -2
  20. package/build/core/keyring/common.js +7 -7
  21. package/build/core/keyring/correspondent-keys.d.ts +4 -2
  22. package/build/core/keyring/correspondent-keys.js +10 -9
  23. package/build/core/keyring/index.d.ts +3 -1
  24. package/build/core/keyring/index.js +6 -5
  25. package/build/core/keyring/published-intro-key.d.ts +3 -1
  26. package/build/core/keyring/published-intro-key.js +5 -4
  27. package/build/core/startup/sign-up.d.ts +7 -5
  28. package/build/core/startup/sign-up.js +9 -8
  29. package/build/core/storage/index.d.ts +5 -3
  30. package/build/core/storage/index.js +9 -8
  31. package/build/core/storage/local/storage.d.ts +3 -1
  32. package/build/core/storage/local/storage.js +5 -4
  33. package/build/core/storage/synced/storage.d.ts +4 -2
  34. package/build/core/storage/synced/storage.js +7 -6
  35. package/build/injected-globals/platform-devfs.d.ts +1 -1
  36. package/build/ipc-via-protobuf/connector-services-side.js +1 -2
  37. package/build/lib-client/mailer-id/provisioner.d.ts +3 -1
  38. package/build/lib-client/mailer-id/provisioner.js +3 -3
  39. package/build/lib-client/request-utils.d.ts +2 -2
  40. package/build/lib-client/request-utils.js +3 -3
  41. package/build/lib-client/xsp-fs/common.d.ts +2 -0
  42. package/build/lib-client/xsp-fs/common.js +2 -1
  43. package/build/lib-client/xsp-fs/file-node.d.ts +2 -1
  44. package/build/lib-client/xsp-fs/file-node.js +3 -3
  45. package/build/lib-client/xsp-fs/folder-node.d.ts +3 -2
  46. package/build/lib-client/xsp-fs/folder-node.js +10 -11
  47. package/build/lib-client/xsp-fs/link-node.d.ts +2 -1
  48. package/build/lib-client/xsp-fs/link-node.js +3 -3
  49. package/build/lib-client/xsp-fs/node-persistence.d.ts +4 -2
  50. package/build/lib-client/xsp-fs/node-persistence.js +4 -4
  51. package/build/lib-common/mailerid-sigs/id-provider.d.ts +6 -5
  52. package/build/lib-common/mailerid-sigs/id-provider.js +7 -7
  53. package/build/lib-common/mailerid-sigs/user.d.ts +3 -2
  54. package/build/lib-common/mailerid-sigs/user.js +1 -1
  55. package/build/lib-common/mailerid-sigs/utils-NaCl-Ed.d.ts +3 -2
  56. package/build/lib-common/mailerid-sigs/utils-NaCl-Ed.js +4 -4
  57. package/build/lib-common/rng-def.d.ts +3 -0
  58. package/build/lib-common/rng-def.js +32 -0
  59. package/build/{lib-common → lib-common-on-node}/random-node.js +2 -2
  60. package/build/lib-common-on-node/request-from-node.js +2 -2
  61. package/build/tests/caps-api/asmail/specs/send-with-attacment-from-storage.js +2 -2
  62. package/build/tests/caps-api/file-sink-checks/different-cases.js +1 -1
  63. package/build/tests/caps-api/file-sink-checks/splice.js +5 -5
  64. package/build/tests/caps-api/file-sink-checks/truncate.js +2 -2
  65. package/build/tests/caps-api/fs-checks/not-versioned/getByteSink.js +3 -3
  66. package/build/tests/caps-api/fs-checks/not-versioned/getByteSource.js +2 -2
  67. package/build/tests/caps-api/fs-checks/not-versioned/readBytes.js +3 -3
  68. package/build/tests/caps-api/fs-checks/not-versioned/writeBytes.js +10 -10
  69. package/build/tests/caps-api/fs-checks/sync-on-one-dev/startUpload.js +1 -1
  70. package/build/tests/caps-api/fs-checks/sync-on-one-dev/stat.js +1 -1
  71. package/build/tests/caps-api/fs-checks/sync-on-one-dev/status.js +1 -1
  72. package/build/tests/caps-api/fs-checks/sync-on-one-dev/upload.js +1 -1
  73. package/build/tests/caps-api/fs-checks/sync-with-two-devs/conflicts.js +1 -1
  74. package/build/tests/caps-api/fs-checks/sync-with-two-devs/update-propagation.js +1 -1
  75. package/build/tests/caps-api/fs-checks/versioned/archiveCurrent.js +1 -1
  76. package/build/tests/caps-api/fs-checks/versioned/getByteSink.js +4 -4
  77. package/build/tests/caps-api/fs-checks/versioned/getByteSource.js +2 -2
  78. package/build/tests/caps-api/fs-checks/versioned/readBytes.js +3 -3
  79. package/build/tests/caps-api/fs-checks/versioned/writeBytes.js +9 -9
  80. package/build/tests/caps-api/fs-checks/with-core-restarts/xattrs.js +1 -1
  81. package/build/tests/caps-api/startup/signin-empty-cache.js +1 -1
  82. package/build/tests/computer.3nweb.core/id-manager.js +1 -1
  83. package/build/tests/libs-for-tests/core-runner.js +2 -2
  84. package/build/tests/units/folder-node-serialization.js +1 -1
  85. package/build/tests/units/mid-sigs-NaCl-Ed.js +10 -9
  86. package/build/tests/units/obj-folders.js +1 -1
  87. package/package.json +1 -1
  88. /package/build/{lib-common → lib-common-on-node}/random-node.d.ts +0 -0
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  const sink_utils_1 = require("../../../../lib-common/obj-streaming/sink-utils");
23
23
  exports.specs = {
@@ -41,7 +41,7 @@ it = { expectation: 'creates file in existing folder' };
41
41
  it.func = async function (s) {
42
42
  const { testFS } = s;
43
43
  const path = 'file1';
44
- const content = (0, random_node_1.bytesSync)(2 * 1024);
44
+ const content = await (0, random_node_1.bytes)(2 * 1024);
45
45
  expect(await testFS.checkFilePresence(path)).toBe(false);
46
46
  const sink = await testFS.getByteSink(path, { create: true });
47
47
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -81,7 +81,7 @@ it = { expectation: 'opens existing file' };
81
81
  it.func = async function (s) {
82
82
  const { testFS } = s;
83
83
  const path = 'file2';
84
- const bytes = (0, random_node_1.bytesSync)(2 * 1024);
84
+ const bytes = await (0, random_node_1.bytes)(2 * 1024);
85
85
  const originalSize = bytes.length;
86
86
  await testFS.writeBytes(path, bytes);
87
87
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.getByteSource',
@@ -37,7 +37,7 @@ exports.specs.its.push(it);
37
37
  it = { expectation: 'reads file bytes with seeking available' };
38
38
  it.func = async function (s) {
39
39
  const { testFS } = s;
40
- const original = (0, random_node_1.bytesSync)(12 * 1024 + 3);
40
+ const original = await (0, random_node_1.bytes)(12 * 1024 + 3);
41
41
  let fName = 'file1';
42
42
  await testFS.writeBytes(fName, original);
43
43
  let src = await testFS.getByteSource(fName);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.readBytes',
@@ -42,7 +42,7 @@ exports.specs.its.push(it);
42
42
  it = { expectation: 'reads whole file' };
43
43
  it.func = async function (s) {
44
44
  const { testFS } = s;
45
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 3);
45
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 3);
46
46
  let fName = 'file1';
47
47
  await testFS.writeBytes(fName, originalBytes);
48
48
  let bytes = await testFS.readBytes(fName);
@@ -57,7 +57,7 @@ it = { expectation: 'reads part of the file' };
57
57
  it.func = async function (s) {
58
58
  const { testFS } = s;
59
59
  let fName = 'file3';
60
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 333);
60
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 333);
61
61
  await testFS.writeBytes(fName, originalBytes);
62
62
  let bytes = await testFS.readBytes(fName, 12, 3456);
63
63
  expect((0, bytes_equal_1.bytesEqual)(bytes, originalBytes.subarray(12, 3456))).withContext('should read from a proper file interior').toBe(true);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.writeBytes',
@@ -26,7 +26,7 @@ exports.specs = {
26
26
  let it = { expectation: 'if not allowed to create, fails for missing file' };
27
27
  it.func = async function (s) {
28
28
  const { testFS } = s;
29
- await testFS.writeBytes('non-existing-file', (0, random_node_1.bytesSync)(123), {})
29
+ await testFS.writeBytes('non-existing-file', await (0, random_node_1.bytes)(123), {})
30
30
  .then(() => {
31
31
  fail('should fail for missing file');
32
32
  }, (e) => {
@@ -38,7 +38,7 @@ it = { expectation: 'creates file in existing folder' };
38
38
  it.func = async function (s) {
39
39
  const { testFS } = s;
40
40
  let path = 'file1';
41
- let content = (0, random_node_1.bytesSync)(2 * 1024);
41
+ let content = await (0, random_node_1.bytes)(2 * 1024);
42
42
  expect(await testFS.checkFilePresence(path)).toBe(false);
43
43
  await testFS.writeBytes(path, content);
44
44
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -56,7 +56,7 @@ it.func = async function (s) {
56
56
  expect(await testFS.checkFolderPresence(grParent)).toBe(false);
57
57
  expect(await testFS.checkFolderPresence(parent2)).toBe(false);
58
58
  expect(await testFS.checkFolderPresence(path)).toBe(false);
59
- let content = (0, random_node_1.bytesSync)(2 * 1024);
59
+ let content = await (0, random_node_1.bytes)(2 * 1024);
60
60
  await testFS.writeBytes(path, content);
61
61
  expect(await testFS.checkFolderPresence(grParent)).toBe(true);
62
62
  expect(await testFS.checkFolderPresence(parent2)).toBe(true);
@@ -70,13 +70,13 @@ it.func = async function (s) {
70
70
  const { testFS } = s;
71
71
  let path = 'file3';
72
72
  // setup initial file
73
- let initBytes = (0, random_node_1.bytesSync)(123);
73
+ let initBytes = await (0, random_node_1.bytes)(123);
74
74
  await testFS.writeBytes(path, initBytes);
75
75
  expect(await testFS.checkFilePresence(path)).toBe(true);
76
76
  let bytes = await testFS.readBytes(path);
77
77
  expect((0, bytes_equal_1.bytesEqual)(initBytes, bytes)).toBe(true);
78
78
  // write new file content
79
- let newContent = (0, random_node_1.bytesSync)(3223);
79
+ let newContent = await (0, random_node_1.bytes)(3223);
80
80
  await testFS.writeBytes(path, newContent);
81
81
  expect(await testFS.checkFilePresence(path)).toBe(true);
82
82
  bytes = await testFS.readBytes(path);
@@ -88,11 +88,11 @@ it.func = async function (s) {
88
88
  const { testFS } = s;
89
89
  let path = 'file4';
90
90
  // setup initial file
91
- let initBytes = (0, random_node_1.bytesSync)(123);
91
+ let initBytes = await (0, random_node_1.bytes)(123);
92
92
  await testFS.writeBytes(path, initBytes);
93
93
  expect(await testFS.checkFilePresence(path)).toBe(true);
94
94
  // try an exclusive write
95
- let newContent = (0, random_node_1.bytesSync)(3223);
95
+ let newContent = await (0, random_node_1.bytes)(3223);
96
96
  await testFS.writeBytes(path, newContent, { create: true, exclusive: true })
97
97
  .then(() => {
98
98
  fail('exclusive-create write operation must fail, when file exists.');
@@ -111,7 +111,7 @@ it.func = async function (s) {
111
111
  const { testFS } = s;
112
112
  let path = 'file5';
113
113
  // write some bytes
114
- let bytesToWrite = (0, random_node_1.bytesSync)(3000000);
114
+ let bytesToWrite = await (0, random_node_1.bytes)(3000000);
115
115
  await testFS.writeBytes(path, bytesToWrite);
116
116
  expect(await testFS.checkFilePresence(path)).toBe(true);
117
117
  // check that same bytes are read
@@ -128,7 +128,7 @@ it.func = async function (s) {
128
128
  ['file-16kb', 4 * kb4],
129
129
  ['file-20kb', 5 * kb4],
130
130
  ]) {
131
- const content = (0, random_node_1.bytesSync)(contentLen);
131
+ const content = await (0, random_node_1.bytes)(contentLen);
132
132
  await testFS.writeBytes(fName, content);
133
133
  expect((0, bytes_equal_1.bytesEqual)((await testFS.readBytes(fName)), content)).toBeTrue();
134
134
  }
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
22
22
  const deferred_1 = require("../../../../lib-common/processes/deferred");
23
23
  exports.specs = {
@@ -18,7 +18,7 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
20
  const sleep_1 = require("../../../../lib-common/processes/sleep");
21
- const random_node_1 = require("../../../../lib-common/random-node");
21
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
22
22
  exports.specs = {
23
23
  description: '.v.stat',
24
24
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: '.v.sync.status',
23
23
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
22
22
  const sleep_1 = require("../../../../lib-common/processes/sleep");
23
23
  exports.specs = {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
22
22
  const watching_1 = require("../../../libs-for-tests/watching");
23
23
  exports.specs = {
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
20
  const buffer_utils_1 = require("../../../../lib-common/buffer-utils");
21
21
  const deferred_1 = require("../../../../lib-common/processes/deferred");
22
- const random_node_1 = require("../../../../lib-common/random-node");
22
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
23
23
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
24
24
  const json_equal_1 = require("../../../libs-for-tests/json-equal");
25
25
  const test_utils_1 = require("../test-utils");
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: '.v.archiveCurrent',
23
23
  its: []
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  const sink_utils_1 = require("../../../../lib-common/obj-streaming/sink-utils");
23
23
  exports.specs = {
@@ -42,7 +42,7 @@ it = { expectation: 'creates file in existing folder' };
42
42
  it.func = async function (s) {
43
43
  const { testFS } = s;
44
44
  const path = 'file1';
45
- const content = (0, random_node_1.bytesSync)(2 * 1024);
45
+ const content = await (0, random_node_1.bytes)(2 * 1024);
46
46
  expect(await testFS.checkFilePresence(path)).toBe(false);
47
47
  const { sink, version: v } = await testFS.v.getByteSink(path, { create: true });
48
48
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -83,7 +83,7 @@ it = { expectation: 'opens existing file' };
83
83
  it.func = async function (s) {
84
84
  const { testFS } = s;
85
85
  const path = 'file2';
86
- const bytes = (0, random_node_1.bytesSync)(2 * 1024);
86
+ const bytes = await (0, random_node_1.bytes)(2 * 1024);
87
87
  const originalSize = bytes.length;
88
88
  const v = await testFS.v.writeBytes(path, bytes);
89
89
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -100,7 +100,7 @@ it = { expectation: `doesn't advance file version when write is cancelled` };
100
100
  it.func = async function (s) {
101
101
  const { testFS } = s;
102
102
  const path = 'file2';
103
- const bytes = (0, random_node_1.bytesSync)(2 * 1024);
103
+ const bytes = await (0, random_node_1.bytes)(2 * 1024);
104
104
  const initVersion = await testFS.v.writeBytes(path, bytes);
105
105
  let { sink, version } = await testFS.v.getByteSink(path, {});
106
106
  expect(version).toBe(initVersion + 1);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.v.getByteSource',
@@ -38,7 +38,7 @@ exports.specs.its.push(it);
38
38
  it = { expectation: 'reads file bytes with seeking available' };
39
39
  it.func = async function (s) {
40
40
  const { testFS } = s;
41
- let original = (0, random_node_1.bytesSync)(12 * 1024 + 3);
41
+ let original = await (0, random_node_1.bytes)(12 * 1024 + 3);
42
42
  let fName = 'file1';
43
43
  let v1 = await testFS.v.writeBytes(fName, original);
44
44
  let { src, version } = await testFS.v.getByteSource(fName);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.v.readBytes',
@@ -43,7 +43,7 @@ exports.specs.its.push(it);
43
43
  it = { expectation: 'reads whole file' };
44
44
  it.func = async function (s) {
45
45
  const { testFS } = s;
46
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 3);
46
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 3);
47
47
  let fName = 'file1';
48
48
  let v1 = await testFS.v.writeBytes(fName, originalBytes);
49
49
  let { bytes, version } = await testFS.v.readBytes(fName);
@@ -60,7 +60,7 @@ it = { expectation: 'reads part of the file' };
60
60
  it.func = async function (s) {
61
61
  const { testFS } = s;
62
62
  let fName = 'file3';
63
- let originalBytes = (0, random_node_1.bytesSync)(12 * 1024 + 333);
63
+ let originalBytes = await (0, random_node_1.bytes)(12 * 1024 + 333);
64
64
  let v = await testFS.v.writeBytes(fName, originalBytes);
65
65
  let { bytes, version } = await testFS.v.readBytes(fName, 12, 3456);
66
66
  expect((0, bytes_equal_1.bytesEqual)(bytes, originalBytes.subarray(12, 3456))).withContext('should read from a proper file interior').toBe(true);
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  const bytes_equal_1 = require("../../../libs-for-tests/bytes-equal");
22
22
  exports.specs = {
23
23
  description: '.v.writeBytes',
@@ -26,7 +26,7 @@ exports.specs = {
26
26
  let it = { expectation: 'if not allowed to create, fails for missing file' };
27
27
  it.func = async function (s) {
28
28
  const { testFS } = s;
29
- await testFS.v.writeBytes('non-existing-file', (0, random_node_1.bytesSync)(123), {})
29
+ await testFS.v.writeBytes('non-existing-file', await (0, random_node_1.bytes)(123), {})
30
30
  .then(() => {
31
31
  fail('should fail for missing file');
32
32
  }, (e) => {
@@ -38,7 +38,7 @@ it = { expectation: 'creates file in existing folder' };
38
38
  it.func = async function (s) {
39
39
  const { testFS } = s;
40
40
  let path = 'file1';
41
- let content = (0, random_node_1.bytesSync)(2 * 1024);
41
+ let content = await (0, random_node_1.bytes)(2 * 1024);
42
42
  expect(await testFS.checkFilePresence(path)).toBe(false);
43
43
  let v = await testFS.v.writeBytes(path, content);
44
44
  expect(await testFS.checkFilePresence(path)).toBe(true);
@@ -57,7 +57,7 @@ it.func = async function (s) {
57
57
  expect(await testFS.checkFolderPresence(grParent)).toBe(false);
58
58
  expect(await testFS.checkFolderPresence(parent2)).toBe(false);
59
59
  expect(await testFS.checkFolderPresence(path)).toBe(false);
60
- let content = (0, random_node_1.bytesSync)(2 * 1024);
60
+ let content = await (0, random_node_1.bytes)(2 * 1024);
61
61
  let v = await testFS.v.writeBytes(path, content);
62
62
  expect(await testFS.checkFolderPresence(grParent)).toBe(true);
63
63
  expect(await testFS.checkFolderPresence(parent2)).toBe(true);
@@ -72,14 +72,14 @@ it.func = async function (s) {
72
72
  const { testFS } = s;
73
73
  let path = 'file3';
74
74
  // setup initial file
75
- let initBytes = (0, random_node_1.bytesSync)(123);
75
+ let initBytes = await (0, random_node_1.bytes)(123);
76
76
  let v1 = await testFS.v.writeBytes(path, initBytes);
77
77
  expect(await testFS.checkFilePresence(path)).toBe(true);
78
78
  let { bytes, version } = await testFS.v.readBytes(path);
79
79
  expect((0, bytes_equal_1.bytesEqual)(initBytes, bytes)).toBe(true);
80
80
  expect(version).toBe(v1);
81
81
  // write new file content
82
- let newContent = (0, random_node_1.bytesSync)(3223);
82
+ let newContent = await (0, random_node_1.bytes)(3223);
83
83
  let v2 = await testFS.v.writeBytes(path, newContent);
84
84
  expect(await testFS.checkFilePresence(path)).toBe(true);
85
85
  expect(v2).toBeGreaterThan(v1);
@@ -93,11 +93,11 @@ it.func = async function (s) {
93
93
  const { testFS } = s;
94
94
  let path = 'file4';
95
95
  // setup initial file
96
- let initBytes = (0, random_node_1.bytesSync)(123);
96
+ let initBytes = await (0, random_node_1.bytes)(123);
97
97
  let v = await testFS.v.writeBytes(path, initBytes);
98
98
  expect(await testFS.checkFilePresence(path)).toBe(true);
99
99
  // try an exclusive write
100
- let newContent = (0, random_node_1.bytesSync)(3223);
100
+ let newContent = await (0, random_node_1.bytes)(3223);
101
101
  await testFS.writeBytes(path, newContent, { create: true, exclusive: true })
102
102
  .then(() => {
103
103
  fail('exclusive-create write operation must fail, when file exists.');
@@ -118,7 +118,7 @@ it.func = async function (s) {
118
118
  ['file-4kb', kb4],
119
119
  ['file-16kb', 4 * kb4],
120
120
  ]) {
121
- const content = (0, random_node_1.bytesSync)(contentLen);
121
+ const content = await (0, random_node_1.bytes)(contentLen);
122
122
  await testFS.v.writeBytes(fName, content);
123
123
  expect((0, bytes_equal_1.bytesEqual)((await testFS.v.readBytes(fName)).bytes, content))
124
124
  .toBeTrue();
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.specs = void 0;
20
- const random_node_1 = require("../../../../lib-common/random-node");
20
+ const random_node_1 = require("../../../../lib-common-on-node/random-node");
21
21
  exports.specs = {
22
22
  description: '--',
23
23
  its: []
@@ -21,7 +21,7 @@ const setups_1 = require("../../libs-for-tests/setups");
21
21
  const startup_1 = require("../../libs-for-tests/startup");
22
22
  const core_runner_1 = require("../../libs-for-tests/core-runner");
23
23
  const sleep_1 = require("../../../lib-common/processes/sleep");
24
- const random_node_1 = require("../../../lib-common/random-node");
24
+ const random_node_1 = require("../../../lib-common-on-node/random-node");
25
25
  // NOTE: it-specs inside signIn process expect to run in a given order -- they
26
26
  // change app's state, expected by following specs in this describe.
27
27
  describe('signIn process (empty cache)', () => {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const key_storage_1 = require("../../core/id-manager/key-storage");
20
- const random_node_1 = require("../../lib-common/random-node");
20
+ const random_node_1 = require("../../lib-common-on-node/random-node");
21
21
  const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
22
22
  const json_equal_1 = require("../libs-for-tests/json-equal");
23
23
  const setups_1 = require("../libs-for-tests/setups");
@@ -20,7 +20,7 @@ exports.CoreRunner = exports.testApp = void 0;
20
20
  const lib_index_1 = require("../../lib-index");
21
21
  const path_1 = require("path");
22
22
  const async_fs_node_1 = require("../../lib-common/async-fs-node");
23
- const random_node_1 = require("../../lib-common/random-node");
23
+ const random_node_1 = require("../../lib-common-on-node/random-node");
24
24
  const app_files_1 = require("../../core/app-files");
25
25
  const log_to_file_1 = require("../../lib-client/logging/log-to-file");
26
26
  const error_1 = require("../../lib-common/exceptions/error");
@@ -91,7 +91,7 @@ class CoreRunner {
91
91
  resolve(texts);
92
92
  }
93
93
  }))
94
- }), napi_nacl_1.makeNativeCryptor);
94
+ }), napi_nacl_1.makeNativeCryptor, random_node_1.bytes);
95
95
  }
96
96
  async close() {
97
97
  if (this.appCaps) {
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const folder_node_serialization_1 = require("../../lib-client/xsp-fs/folder-node-serialization");
20
- const random = require("../../lib-common/random-node");
20
+ const random = require("../../lib-common-on-node/random-node");
21
21
  const bytes_fifo_buffer_1 = require("../../lib-common/byte-streaming/bytes-fifo-buffer");
22
22
  const bytes_equal_1 = require("../libs-for-tests/bytes-equal");
23
23
  const fileNode1 = {
@@ -18,13 +18,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  /*
19
19
  * Testing MailerId signing module.
20
20
  */
21
- const random_node_1 = require("../../lib-common/random-node");
21
+ const random_node_1 = require("../../lib-common-on-node/random-node");
22
22
  const buffer_utils_1 = require("../../lib-common/buffer-utils");
23
23
  const jwkeys_1 = require("../../lib-common/jwkeys");
24
24
  const json_equal_1 = require("../libs-for-tests/json-equal");
25
25
  const id_provider_1 = require("../../lib-common/mailerid-sigs/id-provider");
26
26
  const user_1 = require("../../lib-common/mailerid-sigs/user");
27
27
  const relying_party_1 = require("../../lib-common/mailerid-sigs/relying-party");
28
+ const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
28
29
  describe(`MailerId utility library`, () => {
29
30
  const issuer = "test.co/mailerId";
30
31
  let midRoot;
@@ -36,14 +37,14 @@ describe(`MailerId utility library`, () => {
36
37
  let userKeyCert;
37
38
  const rpDomain = "relying.party.domain";
38
39
  let certChain;
39
- beforeEach(() => {
40
+ (0, jasmine_utils_1.beforeAllWithTimeoutLog)(async () => {
40
41
  // 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);
42
+ midRoot = await (0, id_provider_1.generateRootKey)(issuer, 90 * 24 * 60 * 60, random_node_1.bytes);
43
+ provider = await (0, id_provider_1.generateProviderKey)(issuer, 10 * 24 * 60 * 60, midRoot.skey, random_node_1.bytes);
43
44
  certifier = (0, id_provider_1.makeIdProviderCertifier)(issuer, 24 * 60 * 60, provider.skey);
44
45
  // user's provisioning its certificate, using provider's service
45
46
  // user generates its signing key
46
- userKeys = (0, user_1.generateSigningKeyPair)(random_node_1.bytesSync);
47
+ userKeys = await (0, user_1.generateSigningKeyPair)(random_node_1.bytes);
47
48
  // provider certifies user's key
48
49
  userKeyCert = certifier.certify(userKeys.pkey, user, 3 * 60 * 60);
49
50
  // certs' chain
@@ -74,10 +75,10 @@ describe(`MailerId utility library`, () => {
74
75
  (0, relying_party_1.verifyAssertion)(assertion, certChain, issuer, nowSecs + 1);
75
76
  expect(() => (0, relying_party_1.verifyAssertion)(assertion, certChain, issuer, nowSecs + 60 * 60)).toThrow();
76
77
  }
77
- it(`allows to create and to check assertions, used for logins`, () => {
78
+ (0, jasmine_utils_1.itCond)(`allows to create and to check assertions, used for logins`, async () => {
78
79
  const signer = (0, user_1.makeMailerIdSigner)(userKeys.skey, userKeyCert, provider.cert, 20 * 60);
79
80
  // service (relying party) generates session id
80
- const sessionId = buffer_utils_1.base64.pack((0, random_node_1.bytesSync)(24));
81
+ const sessionId = buffer_utils_1.base64.pack(await (0, random_node_1.bytes)(24));
81
82
  // user creates signed assertion with given session id inside
82
83
  let assertion = signer.generateAssertionFor(rpDomain, sessionId, 10 * 60);
83
84
  checkAssertion(rpDomain, sessionId, assertion);
@@ -106,9 +107,9 @@ describe(`MailerId utility library`, () => {
106
107
  const certForPKey = signer.certifyPublicKey(pkey, 30 * 24 * 60 * 60);
107
108
  checkKeyCert(certForPKey, pkey);
108
109
  });
109
- it(`makes signatures and check them`, () => {
110
+ (0, jasmine_utils_1.itCond)(`makes signatures and check them`, async () => {
110
111
  const signer = (0, user_1.makeMailerIdSigner)(userKeys.skey, userKeyCert, provider.cert);
111
- const payload = (0, random_node_1.bytesSync)(200);
112
+ const payload = await (0, random_node_1.bytes)(200);
112
113
  const sig = signer.sign(payload);
113
114
  expect((0, jwkeys_1.isLikeSignedLoad)(sig.signature));
114
115
  expect(sig.signature.load).toBe(buffer_utils_1.base64.pack(payload));
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const jasmine_utils_1 = require("../libs-for-tests/jasmine-utils");
20
- const random_node_1 = require("../../lib-common/random-node");
20
+ const random_node_1 = require("../../lib-common-on-node/random-node");
21
21
  const path_1 = require("path");
22
22
  const async_fs_node_1 = require("../../lib-common/async-fs-node");
23
23
  const obj_folders_1 = require("../../lib-client/objs-on-disk/obj-folders");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.47.4",
3
+ "version": "0.48.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",