core-3nweb-client-lib 0.25.6 → 0.27.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 (215) hide show
  1. package/README.md +2 -2
  2. package/build/api-defs/asmail.d.ts +1 -1
  3. package/build/api-defs/files.d.ts +282 -70
  4. package/build/core/app-files.js +7 -7
  5. package/build/core/asmail/config/common.js +4 -4
  6. package/build/core/asmail/config/index.js +2 -2
  7. package/build/core/asmail/config/published-intro-key.js +1 -1
  8. package/build/core/asmail/delivery/common.js +7 -7
  9. package/build/core/asmail/delivery/index.js +7 -6
  10. package/build/core/asmail/delivery/msg.js +8 -7
  11. package/build/core/asmail/delivery/per-recipient-wip.js +3 -3
  12. package/build/core/asmail/inbox/attachments/fs.js +11 -1
  13. package/build/core/asmail/inbox/cached-msgs.js +3 -3
  14. package/build/core/asmail/inbox/inbox-events.js +5 -4
  15. package/build/core/asmail/inbox/index.js +12 -12
  16. package/build/core/asmail/inbox/msg-downloader.js +3 -3
  17. package/build/core/asmail/inbox/msg-indexing.js +4 -4
  18. package/build/core/asmail/inbox/msg-on-disk.js +7 -7
  19. package/build/core/asmail/index.d.ts +3 -3
  20. package/build/core/asmail/index.js +13 -8
  21. package/build/core/asmail/key-verification.js +5 -5
  22. package/build/core/asmail/keyring/common.js +7 -6
  23. package/build/core/asmail/keyring/correspondent-keys.js +8 -7
  24. package/build/core/asmail/keyring/id-to-email-map.js +2 -1
  25. package/build/core/asmail/keyring/index.d.ts +7 -8
  26. package/build/core/asmail/keyring/index.js +15 -14
  27. package/build/core/asmail/keyring/keyring-storage.js +4 -3
  28. package/build/core/asmail/msg/opener.js +3 -3
  29. package/build/core/asmail/msg/packer.js +13 -13
  30. package/build/core/asmail/sending-params/own-params.js +4 -4
  31. package/build/core/asmail/sending-params/params-from-others.js +3 -3
  32. package/build/core/id-manager.js +8 -5
  33. package/build/core/index.d.ts +2 -1
  34. package/build/core/index.js +14 -14
  35. package/build/core/sign-in.d.ts +5 -4
  36. package/build/core/sign-in.js +12 -14
  37. package/build/core/sign-up.d.ts +1 -0
  38. package/build/core/sign-up.js +15 -11
  39. package/build/core/storage/common/json-saving.d.ts +21 -0
  40. package/build/core/storage/common/json-saving.js +82 -0
  41. package/build/core/storage/common/obj-info-file.d.ts +51 -0
  42. package/build/core/storage/common/obj-info-file.js +153 -5
  43. package/build/core/storage/common/utils.d.ts +2 -0
  44. package/build/core/storage/common/utils.js +32 -0
  45. package/build/core/storage/index.d.ts +3 -17
  46. package/build/core/storage/index.js +57 -77
  47. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  48. package/build/core/storage/local/obj-files-gc.js +53 -39
  49. package/build/core/storage/local/obj-files.d.ts +6 -9
  50. package/build/core/storage/local/obj-files.js +16 -19
  51. package/build/core/storage/local/obj-status.d.ts +20 -30
  52. package/build/core/storage/local/obj-status.js +46 -113
  53. package/build/core/storage/local/storage.d.ts +15 -5
  54. package/build/core/storage/local/storage.js +37 -18
  55. package/build/core/storage/synced/downloader.js +7 -6
  56. package/build/core/storage/synced/obj-files-gc.d.ts +6 -1
  57. package/build/core/storage/synced/obj-files-gc.js +106 -13
  58. package/build/core/storage/synced/obj-files.d.ts +46 -47
  59. package/build/core/storage/synced/obj-files.js +207 -154
  60. package/build/core/storage/synced/obj-status.d.ts +103 -42
  61. package/build/core/storage/synced/obj-status.js +525 -137
  62. package/build/core/storage/synced/remote-events.d.ts +11 -12
  63. package/build/core/storage/synced/remote-events.js +80 -57
  64. package/build/core/storage/synced/storage.d.ts +24 -5
  65. package/build/core/storage/synced/storage.js +123 -38
  66. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  67. package/build/core/storage/synced/upload-header-file.js +64 -0
  68. package/build/core/storage/synced/upsyncer.d.ts +15 -9
  69. package/build/core/storage/synced/upsyncer.js +219 -246
  70. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  71. package/build/core/storage/system-folders/apps-data.js +110 -0
  72. package/build/core/storage/system-folders/index.d.ts +18 -0
  73. package/build/core/storage/system-folders/index.js +77 -0
  74. package/build/core-ipc/common-caps.js +3 -3
  75. package/build/core-ipc/generic.js +8 -8
  76. package/build/core-ipc/startup-caps.js +2 -2
  77. package/build/cryptors.js +6 -2
  78. package/build/ipc-via-protobuf/asmail-cap.js +67 -83
  79. package/build/ipc-via-protobuf/bytes.js +16 -17
  80. package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
  81. package/build/ipc-via-protobuf/connector-clients-side.js +62 -25
  82. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  83. package/build/ipc-via-protobuf/connector.js +4 -4
  84. package/build/ipc-via-protobuf/file.d.ts +48 -12
  85. package/build/ipc-via-protobuf/file.js +476 -120
  86. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  87. package/build/ipc-via-protobuf/fs.js +592 -159
  88. package/build/ipc-via-protobuf/log-cap.js +2 -2
  89. package/build/ipc-via-protobuf/mailerid.js +3 -3
  90. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  91. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  92. package/build/ipc-via-protobuf/startup-cap.js +23 -23
  93. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  94. package/build/ipc.js +7 -2
  95. package/build/lib-client/3nstorage/exceptions.d.ts +12 -8
  96. package/build/lib-client/3nstorage/exceptions.js +31 -10
  97. package/build/lib-client/3nstorage/service.d.ts +16 -2
  98. package/build/lib-client/3nstorage/service.js +109 -39
  99. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  100. package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
  101. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  102. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +52 -14
  103. package/build/lib-client/3nstorage/xsp-fs/common.js +31 -16
  104. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  105. package/build/lib-client/3nstorage/xsp-fs/file-node.js +18 -14
  106. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  107. package/build/lib-client/3nstorage/xsp-fs/file.js +74 -23
  108. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  109. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
  110. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +599 -189
  111. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +45 -9
  112. package/build/lib-client/3nstorage/xsp-fs/fs.js +326 -74
  113. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  114. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  115. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -20
  116. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +239 -106
  117. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  118. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +18 -19
  119. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +5 -5
  120. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +56 -56
  121. package/build/lib-client/3nweb-signup.js +4 -4
  122. package/build/lib-client/asmail/recipient.js +15 -15
  123. package/build/lib-client/asmail/sender.js +22 -22
  124. package/build/lib-client/asmail/service-config.js +3 -3
  125. package/build/lib-client/cryptor/cryptor-in-worker.js +19 -17
  126. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  127. package/build/lib-client/cryptor/cryptor.js +4 -2
  128. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  129. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  130. package/build/lib-client/cryptor/in-proc-wasm.js +7 -7
  131. package/build/lib-client/cryptor/worker-js.js +2 -2
  132. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  133. package/build/lib-client/files-select.js +1 -1
  134. package/build/lib-client/files.d.ts +1 -1
  135. package/build/lib-client/files.js +71 -4
  136. package/build/lib-client/fs-collection.js +3 -2
  137. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  138. package/build/lib-client/fs-sync-utils.js +61 -0
  139. package/build/lib-client/fs-view.d.ts +14 -0
  140. package/build/lib-client/fs-view.js +33 -0
  141. package/build/lib-client/key-derivation.js +1 -1
  142. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  143. package/build/lib-client/local-files/dev-file-src.js +2 -2
  144. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  145. package/build/lib-client/local-files/device-fs.js +56 -54
  146. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  147. package/build/lib-client/logging/log-to-file.js +11 -11
  148. package/build/lib-client/mailer-id/login.js +7 -7
  149. package/build/lib-client/mailer-id/provisioner.js +12 -12
  150. package/build/lib-client/objs-on-disk/file-writing-proc.js +5 -5
  151. package/build/lib-client/objs-on-disk/obj-folders.js +33 -33
  152. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  153. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  154. package/build/lib-client/request-utils.d.ts +1 -0
  155. package/build/lib-client/request-utils.js +14 -14
  156. package/build/lib-client/server-events.d.ts +3 -3
  157. package/build/lib-client/server-events.js +12 -10
  158. package/build/lib-client/service-locator.js +10 -10
  159. package/build/lib-client/user-with-mid-session.js +7 -7
  160. package/build/lib-client/user-with-pkl-session.js +25 -25
  161. package/build/lib-client/ws-utils.js +3 -3
  162. package/build/lib-common/async-cryptor-wrap.js +4 -4
  163. package/build/lib-common/async-fs-node.d.ts +5 -3
  164. package/build/lib-common/async-fs-node.js +19 -18
  165. package/build/lib-common/byte-streaming/pipe.js +1 -1
  166. package/build/lib-common/byte-streaming/wrapping.js +17 -17
  167. package/build/lib-common/canonical-address.js +1 -1
  168. package/build/lib-common/exceptions/error.d.ts +1 -0
  169. package/build/lib-common/exceptions/error.js +7 -6
  170. package/build/lib-common/exceptions/file.js +10 -1
  171. package/build/lib-common/ipc/generic-ipc.js +2 -2
  172. package/build/lib-common/ipc/ws-ipc.js +2 -2
  173. package/build/lib-common/json-utils.js +2 -1
  174. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  175. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  176. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  177. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  178. package/build/lib-common/objs-on-disk/obj-file.js +99 -37
  179. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  180. package/build/lib-common/objs-on-disk/utils.js +4 -4
  181. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  182. package/build/lib-common/processes/deferred.d.ts +6 -0
  183. package/build/lib-common/processes/deferred.js +30 -0
  184. package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
  185. package/build/lib-common/processes/labelled-exec-pools.js +141 -0
  186. package/build/lib-common/processes/pressure.d.ts +7 -0
  187. package/build/lib-common/processes/pressure.js +56 -0
  188. package/build/lib-common/processes/sleep.d.ts +1 -0
  189. package/build/lib-common/processes/sleep.js +26 -0
  190. package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
  191. package/build/lib-common/{processes.js → processes/synced.js} +187 -204
  192. package/build/lib-common/processes/timeout.d.ts +1 -0
  193. package/build/lib-common/processes/timeout.js +51 -0
  194. package/build/lib-common/random-node.js +7 -7
  195. package/build/lib-common/service-api/3nstorage/owner.d.ts +100 -39
  196. package/build/lib-common/service-api/3nstorage/owner.js +85 -42
  197. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  198. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  199. package/build/lib-common/timed-cache.d.ts +1 -0
  200. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  201. package/build/lib-common/timed-non-weak-cache.js +11 -0
  202. package/build/lib-common/utils-for-observables.d.ts +15 -1
  203. package/build/lib-common/utils-for-observables.js +70 -19
  204. package/build/lib-common/weak-cache.d.ts +1 -0
  205. package/build/lib-common/weak-cache.js +12 -1
  206. package/build/lib-index.d.ts +2 -1
  207. package/build/lib-index.js +10 -7
  208. package/build/protos/asmail.proto.js +12912 -7127
  209. package/build/protos/file.proto.js +4848 -2399
  210. package/build/protos/fs.proto.js +9230 -3445
  211. package/package.json +8 -7
  212. package/protos/file.proto +91 -11
  213. package/protos/fs.proto +107 -8
  214. package/build/core/storage/synced/upsync-status.d.ts +0 -41
  215. package/build/core/storage/synced/upsync-status.js +0 -158
@@ -26,7 +26,7 @@ class Attachments {
26
26
  Object.freeze(this);
27
27
  }
28
28
  static fromMsg(msg) {
29
- if (!attachments_container_1.isContainerEmpty(msg.attachments)) {
29
+ if (!(0, attachments_container_1.isContainerEmpty)(msg.attachments)) {
30
30
  return new Attachments(msg.attachments, undefined);
31
31
  }
32
32
  return;
@@ -42,11 +42,11 @@ class Attachments {
42
42
  const link = await msgFS.readLink(`${ATTACHMENTS_NAME}/${f.name}`);
43
43
  if (link.isFile) {
44
44
  const file = (await link.target());
45
- attachments_container_1.addFileTo(container, file, f.name);
45
+ (0, attachments_container_1.addFileTo)(container, file, f.name);
46
46
  }
47
47
  else if (link.isFolder) {
48
48
  const fs = (await link.target());
49
- attachments_container_1.addFolderTo(container, fs, f.name);
49
+ (0, attachments_container_1.addFolderTo)(container, fs, f.name);
50
50
  }
51
51
  }
52
52
  return new Attachments(container, undefined);
@@ -63,10 +63,10 @@ class Attachments {
63
63
  async linkIn(msgFS) {
64
64
  if (this.container) {
65
65
  await msgFS.makeFolder(ATTACHMENTS_NAME);
66
- for (const f of attachments_container_1.iterFilesIn(this.container)) {
66
+ for (const f of (0, attachments_container_1.iterFilesIn)(this.container)) {
67
67
  msgFS.link(`${ATTACHMENTS_NAME}/${f.fileName}`, f.file);
68
68
  }
69
- for (const f of attachments_container_1.iterFoldersIn(this.container)) {
69
+ for (const f of (0, attachments_container_1.iterFoldersIn)(this.container)) {
70
70
  msgFS.link(`${ATTACHMENTS_NAME}/${f.folderName}`, f.folder);
71
71
  }
72
72
  }
@@ -85,13 +85,13 @@ class Attachments {
85
85
  async estimatedPackedSize() {
86
86
  if (this.container) {
87
87
  let totalSize = 0;
88
- for (const f of attachments_container_1.iterFilesIn(this.container)) {
88
+ for (const f of (0, attachments_container_1.iterFilesIn)(this.container)) {
89
89
  const fileSize = (await f.file.stat()).size;
90
90
  if (typeof fileSize === 'number') {
91
91
  totalSize += await estimatePackedSizeOf(fileSize);
92
92
  }
93
93
  }
94
- for (const f of attachments_container_1.iterFoldersIn(this.container)) {
94
+ for (const f of (0, attachments_container_1.iterFoldersIn)(this.container)) {
95
95
  totalSize += await estimatePackedSizeOfFolder(f.folder);
96
96
  }
97
97
  return totalSize;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2016 - 2017, 2020 - 2021 3NSoft Inc.
3
+ Copyright (C) 2016 - 2017, 2020 - 2022 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -24,6 +24,7 @@ const common_1 = require("./common");
24
24
  const json_utils_1 = require("../../../lib-common/json-utils");
25
25
  const rxjs_1 = require("rxjs");
26
26
  const operators_1 = require("rxjs/operators");
27
+ const utils_for_observables_1 = require("../../../lib-common/utils-for-observables");
27
28
  const SMALL_MSG_SIZE = 1024 * 1024;
28
29
  const MSGS_FOLDER = 'msgs';
29
30
  function idToMsgFolder(id) {
@@ -50,8 +51,8 @@ class Delivery {
50
51
  */
51
52
  this.queuedDelivery = [];
52
53
  this.allDeliveries = new rxjs_1.Subject();
53
- this.allDeliveries$ = this.allDeliveries.asObservable().pipe(operators_1.share());
54
- file_1.ensureCorrectFS(fs, 'local', true);
54
+ this.allDeliveries$ = this.allDeliveries.asObservable().pipe((0, operators_1.share)());
55
+ (0, file_1.ensureCorrectFS)(fs, 'local', true);
55
56
  this.r.notifyMsgProgress =
56
57
  (id, progress) => this.allDeliveries.next({ id, progress });
57
58
  Object.freeze(this.r);
@@ -113,18 +114,18 @@ class Delivery {
113
114
  }
114
115
  if (msg.isDone()) {
115
116
  if (observer.next) {
116
- observer.next(json_utils_1.copy(msg.progress));
117
+ observer.next((0, json_utils_1.copy)(msg.progress));
117
118
  }
118
119
  if (observer.complete) {
119
120
  observer.complete();
120
121
  }
121
122
  return () => { };
122
123
  }
123
- const subToProgress = msg.progress$.subscribe(observer);
124
+ const subToProgress = msg.progress$.subscribe((0, utils_for_observables_1.toRxObserver)(observer));
124
125
  return () => { subToProgress.unsubscribe(); };
125
126
  }
126
127
  observeAllDeliveries(observer) {
127
- const subToProgress = this.allDeliveries$.subscribe(observer);
128
+ const subToProgress = this.allDeliveries$.subscribe((0, utils_for_observables_1.toRxObserver)(observer));
128
129
  return () => subToProgress.unsubscribe();
129
130
  }
130
131
  async preFlight(recipient) {
@@ -17,12 +17,13 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.Msg = void 0;
19
19
  const packer_1 = require("../msg/packer");
20
- const processes_1 = require("../../../lib-common/processes");
20
+ const synced_1 = require("../../../lib-common/processes/synced");
21
21
  const buffer_utils_1 = require("../../../lib-common/buffer-utils");
22
22
  const common_1 = require("./common");
23
23
  const per_recipient_wip_1 = require("./per-recipient-wip");
24
24
  const rxjs_1 = require("rxjs");
25
25
  const json_utils_1 = require("../../../lib-common/json-utils");
26
+ const deferred_1 = require("../../../lib-common/processes/deferred");
26
27
  const MAIN_OBJ_FILE_NAME = 'msg.json';
27
28
  const PROGRESS_INFO_FILE_NAME = 'progress.json';
28
29
  const WIPS_INFO_FILE_NAME = 'wips.json';
@@ -36,7 +37,7 @@ function checkIfAllRecipientsDone(progress) {
36
37
  return true;
37
38
  }
38
39
  async function estimatedPackedSize(msgToSend, attachments) {
39
- let totalSize = common_1.estimatePackedSizeOf(buffer_utils_1.utf8.pack(JSON.stringify(msgToSend)).length);
40
+ let totalSize = (0, common_1.estimatePackedSizeOf)(buffer_utils_1.utf8.pack(JSON.stringify(msgToSend)).length);
40
41
  if (attachments) {
41
42
  totalSize += await attachments.estimatedPackedSize();
42
43
  }
@@ -48,9 +49,9 @@ class Msg {
48
49
  this.r = r;
49
50
  this.progress = progress;
50
51
  this.msgFS = msgFS;
51
- this.sendingProc = new processes_1.SingleProc();
52
+ this.sendingProc = new synced_1.SingleProc();
52
53
  this.completionPromise = undefined;
53
- this.progressSavingProc = new processes_1.SingleProc();
54
+ this.progressSavingProc = new synced_1.SingleProc();
54
55
  this.cancelled = false;
55
56
  this.sender = undefined;
56
57
  this.recipients = undefined;
@@ -126,8 +127,8 @@ class Msg {
126
127
  this.progress.allDone = true;
127
128
  saveProgress = true;
128
129
  }
129
- this.r.notifyMsgProgress(this.id, json_utils_1.copy(this.progress));
130
- this.progressPublisher.next(json_utils_1.copy(this.progress));
130
+ this.r.notifyMsgProgress(this.id, (0, json_utils_1.copy)(this.progress));
131
+ this.progressPublisher.next((0, json_utils_1.copy)(this.progress));
131
132
  if (saveProgress) {
132
133
  this.progressSavingProc.startOrChain(async () => {
133
134
  await this.msgFS.writeJSONFile(PROGRESS_INFO_FILE_NAME, this.progress, {});
@@ -197,7 +198,7 @@ class Msg {
197
198
  throw new Error(`Message delivery has already completed.`);
198
199
  }
199
200
  if (!this.completionPromise) {
200
- this.completionPromise = processes_1.defer();
201
+ this.completionPromise = (0, deferred_1.defer)();
201
202
  }
202
203
  return this.completionPromise.promise;
203
204
  }
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.WIP = void 0;
20
20
  const buffer_utils_1 = require("../../../lib-common/buffer-utils");
21
21
  const sender_1 = require("../../../lib-client/asmail/sender");
22
- const processes_1 = require("../../../lib-common/processes");
22
+ const synced_1 = require("../../../lib-common/processes/synced");
23
23
  const key_verification_1 = require("../key-verification");
24
24
  const MSG_SIZE_FOR_STATE_RECORDING = 1024 * 1024;
25
25
  const EMPTY_BYTE_ARR = new Uint8Array(0);
@@ -34,7 +34,7 @@ class WIP {
34
34
  this.msg = msg;
35
35
  this.state = state;
36
36
  this.cryptor = cryptor;
37
- this.proc = new processes_1.SingleProc();
37
+ this.proc = new synced_1.SingleProc();
38
38
  this.sender = undefined;
39
39
  this.packer = undefined;
40
40
  this.currentObjIndInMeta = 0;
@@ -205,7 +205,7 @@ class WIP {
205
205
  return;
206
206
  }
207
207
  const certs = await this.sender.getRecipientsInitPubKey();
208
- return key_verification_1.checkAndExtractPKey(this.sender.net, this.msg.r.midResolver, recipient, certs).catch(err => {
208
+ return (0, key_verification_1.checkAndExtractPKey)(this.sender.net, this.msg.r.midResolver, recipient, certs).catch(err => {
209
209
  const exc = {
210
210
  runtimeException: true,
211
211
  type: 'asmail-delivery',
@@ -27,8 +27,15 @@ class AttachmentStore {
27
27
  this.type = 'asmail-msg';
28
28
  this.versioned = false;
29
29
  this.nodes = new common_1.NodesContainer();
30
+ this.connect = undefined;
30
31
  Object.seal(this);
31
32
  }
33
+ getNodeEvents() {
34
+ throw new Error(`Attachment's storage is readonly.`);
35
+ }
36
+ broadcastNodeEvent() {
37
+ throw new Error(`Attachment's storage is readonly.`);
38
+ }
32
39
  storageForLinking(type, location) {
33
40
  if (type === 'share') {
34
41
  return this.getStorages('share', location);
@@ -37,10 +44,13 @@ class AttachmentStore {
37
44
  throw new Error(`Attachment's storage cannot link to ${type} storage.`);
38
45
  }
39
46
  }
47
+ status() {
48
+ throw new Error(`Attachment's storage is not versioned`);
49
+ }
40
50
  generateNewObjId() {
41
51
  throw new Error(`Attachment's storage is readonly.`);
42
52
  }
43
- getObj(objId) {
53
+ getObjSrc(objId) {
44
54
  if (typeof objId !== 'string') {
45
55
  throw new Error(`Attachment's storage uses only string objId's, while given parameter is: ${objId}`);
46
56
  }
@@ -20,13 +20,13 @@ exports.CachedMessages = void 0;
20
20
  const msg_on_disk_1 = require("./msg-on-disk");
21
21
  const timed_cache_1 = require("../../../lib-common/timed-cache");
22
22
  const obj_folders_1 = require("../../../lib-client/objs-on-disk/obj-folders");
23
- const processes_1 = require("../../../lib-common/processes");
23
+ const synced_1 = require("../../../lib-common/processes/synced");
24
24
  class CachedMessages {
25
25
  constructor(folders, downloader) {
26
26
  this.folders = folders;
27
27
  this.downloader = downloader;
28
- this.syncProc = new processes_1.NamedProcs();
29
- this.msgFiles = timed_cache_1.makeTimedCache(60 * 1000);
28
+ this.syncProc = new synced_1.NamedProcs();
29
+ this.msgFiles = (0, timed_cache_1.makeTimedCache)(60 * 1000);
30
30
  Object.freeze(this);
31
31
  }
32
32
  static async makeFor(path, downloader, logError) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2017, 2019 3NSoft Inc.
3
+ Copyright (C) 2017, 2019, 2022 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -19,6 +19,7 @@ exports.InboxEvents = void 0;
19
19
  const retrieval_1 = require("../../../lib-common/service-api/asmail/retrieval");
20
20
  const server_events_1 = require("../../../lib-client/server-events");
21
21
  const operators_1 = require("rxjs/operators");
22
+ const utils_for_observables_1 = require("../../../lib-common/utils-for-observables");
22
23
  const SERVER_EVENTS_RESTART_WAIT_SECS = 30;
23
24
  /**
24
25
  * Instance of this class handles event subscription from UI side. It observes
@@ -29,16 +30,16 @@ class InboxEvents {
29
30
  constructor(msgReceiver, getMsg, logError) {
30
31
  const serverEvents = new server_events_1.ServerEvents(() => msgReceiver.openEventSource(), SERVER_EVENTS_RESTART_WAIT_SECS);
31
32
  this.newMsg$ = serverEvents.observe(retrieval_1.msgRecievedCompletely.EVENT_NAME)
32
- .pipe(operators_1.mergeMap(ev => getMsg(ev.msgId)
33
+ .pipe((0, operators_1.mergeMap)(ev => getMsg(ev.msgId)
33
34
  .catch(async (err) => {
34
35
  // TODO should more error handling logic be added here?
35
36
  await logError(err, `Cannot get message ${ev.msgId}`);
36
- })), operators_1.filter(msg => !!msg), operators_1.share());
37
+ })), (0, operators_1.filter)(msg => !!msg), (0, operators_1.share)());
37
38
  Object.seal(this);
38
39
  }
39
40
  subscribe(event, observer) {
40
41
  if (event === 'message') {
41
- const subscription = this.newMsg$.subscribe(observer);
42
+ const subscription = this.newMsg$.subscribe((0, utils_for_observables_1.toRxObserver)(observer));
42
43
  return () => subscription.unsubscribe();
43
44
  }
44
45
  else {
@@ -18,7 +18,7 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.InboxOnServer = void 0;
20
20
  const error_1 = require("../../../lib-common/exceptions/error");
21
- const processes_1 = require("../../../lib-common/processes");
21
+ const synced_1 = require("../../../lib-common/processes/synced");
22
22
  const recipient_1 = require("../../../lib-client/asmail/recipient");
23
23
  const opener_1 = require("../msg/opener");
24
24
  const msg_indexing_1 = require("./msg-indexing");
@@ -48,14 +48,14 @@ class InboxOnServer {
48
48
  this.cache = cache;
49
49
  this.index = index;
50
50
  this.logError = logError;
51
- this.procs = new processes_1.NamedProcs();
52
- this.recentlyOpenedMsgs = timed_cache_1.makeTimedCache(60 * 1000);
51
+ this.procs = new synced_1.NamedProcs();
52
+ this.recentlyOpenedMsgs = (0, timed_cache_1.makeTimedCache)(60 * 1000);
53
53
  this.inboxEvents = new inbox_events_1.InboxEvents(this.msgReceiver, this.getMsg.bind(this), this.logError);
54
54
  Object.seal(this);
55
55
  }
56
56
  static async makeAndStart(cachePath, fs, r) {
57
57
  try {
58
- file_1.ensureCorrectFS(fs, 'synced', true);
58
+ (0, file_1.ensureCorrectFS)(fs, 'synced', true);
59
59
  const msgReceiver = new recipient_1.MailRecipient(r.address, r.getSigner, () => r.asmailResolver(r.address), r.makeNet());
60
60
  const downloader = new msg_downloader_1.MsgDownloader(msgReceiver);
61
61
  const cache = await cached_msgs_1.CachedMessages.makeFor(cachePath, downloader, r.logError);
@@ -63,7 +63,7 @@ class InboxOnServer {
63
63
  return new InboxOnServer(r.correspondents, msgReceiver, r.getStorages, r.cryptor, downloader, cache, index, r.logError);
64
64
  }
65
65
  catch (err) {
66
- throw error_1.errWithCause(err, 'Failed to initialize Inbox');
66
+ throw (0, error_1.errWithCause)(err, 'Failed to initialize Inbox');
67
67
  }
68
68
  }
69
69
  wrap() {
@@ -122,12 +122,12 @@ class InboxOnServer {
122
122
  mainObjSrc = await msgOnDisk.getMsgObj(mainObjId);
123
123
  }
124
124
  const fKey = buffer_utils_1.base64.open(mainObjFileKey);
125
- const openedMsg = await opener_1.openMsg(msgId, mainObjId, mainObjSrc, msgKeyPackLen, fKey, this.cryptor);
125
+ const openedMsg = await (0, opener_1.openMsg)(msgId, mainObjId, mainObjSrc, msgKeyPackLen, fKey, this.cryptor);
126
126
  fKey.fill(0);
127
127
  return openedMsg;
128
128
  };
129
129
  const checkMidKeyCerts = (certs) => {
130
- return key_verification_1.checkAndExtractPKeyWithAddress(this.msgReceiver.getNet(), this.r.midResolver, certs, Math.round(msgOnDisk.deliveryTS / 1000));
130
+ return (0, key_verification_1.checkAndExtractPKeyWithAddress)(this.msgReceiver.getNet(), this.r.midResolver, certs, Math.round(msgOnDisk.deliveryTS / 1000));
131
131
  };
132
132
  const decrOut = await this.r.msgDecryptor(meta.extMeta, getMainObjHeader, getOpenedMsg, checkMidKeyCerts);
133
133
  if (decrOut) {
@@ -183,7 +183,7 @@ class InboxOnServer {
183
183
  // if sender authenticated to server, check that it matches address,
184
184
  // recovered from message decryption
185
185
  if (meta.authSender &&
186
- !canonical_address_1.areAddressesEqual(meta.authSender, decrInfo.correspondent)) {
186
+ !(0, canonical_address_1.areAddressesEqual)(meta.authSender, decrInfo.correspondent)) {
187
187
  throw new Error(`Sender authenticated to server as ${meta.authSender}, while decrypting key is associated with ${decrInfo.correspondent}`);
188
188
  }
189
189
  }
@@ -252,7 +252,7 @@ class InboxOnServer {
252
252
  // this.index.remove(msgInfo),
253
253
  // this.removeMsgFromServerAndCache(msgId)
254
254
  // ]);
255
- throw recipient_1.makeMsgNotFoundException(msgId);
255
+ throw (0, recipient_1.makeMsgNotFoundException)(msgId);
256
256
  }
257
257
  else if (msgOnDisk.keyStatus === 'not-checked') {
258
258
  await this.startCachingAndAddKeyToIndex(msgId);
@@ -265,9 +265,9 @@ class InboxOnServer {
265
265
  const mainObj = await msgOnDisk.getMsgObj(mainObjId);
266
266
  const msgKey = await this.index.fKeyFor({ msgId, deliveryTS: meta.deliveryCompletion });
267
267
  if (!msgKey) {
268
- throw recipient_1.makeMsgNotFoundException(msgId);
268
+ throw (0, recipient_1.makeMsgNotFoundException)(msgId);
269
269
  }
270
- msg = await opener_1.openMsg(msgId, mainObjId, mainObj, msgKey.mainObjHeaderOfs, msgKey.msgKey, this.cryptor);
270
+ msg = await (0, opener_1.openMsg)(msgId, mainObjId, mainObj, msgKey.mainObjHeaderOfs, msgKey.msgKey, this.cryptor);
271
271
  msg.setMsgKeyRole(msgKey.msgKeyRole);
272
272
  return this.msgToUIForm(msg, msgOnDisk.deliveryTS, msgOnDisk);
273
273
  });
@@ -297,7 +297,7 @@ class InboxOnServer {
297
297
  }
298
298
  const attachments = msg.attachmentsJSON;
299
299
  if (attachments) {
300
- m.attachments = fs_1.fsForAttachments(msgOnDisk, attachments, this.storages, this.cryptor);
300
+ m.attachments = (0, fs_1.fsForAttachments)(msgOnDisk, attachments, this.storages, this.cryptor);
301
301
  }
302
302
  return m;
303
303
  }
@@ -16,7 +16,7 @@
16
16
  this program. If not, see <http://www.gnu.org/licenses/>. */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.MsgDownloader = void 0;
19
- const processes_1 = require("../../../lib-common/processes");
19
+ const synced_1 = require("../../../lib-common/processes/synced");
20
20
  const buffer_utils_1 = require("../../../lib-common/buffer-utils");
21
21
  const MAX_GETTING_CHUNK = 512 * 1024;
22
22
  const DOWNLOAD_START_CHUNK = 128 * 1024;
@@ -32,7 +32,7 @@ class MsgDownloader {
32
32
  * When it comes to the download start, if chain exists, it means that
33
33
  * process has already started.
34
34
  */
35
- this.downloadProcs = new processes_1.NamedProcs();
35
+ this.downloadProcs = new synced_1.NamedProcs();
36
36
  Object.freeze(this);
37
37
  }
38
38
  async sync(msgId, objId, action) {
@@ -76,7 +76,7 @@ class MsgDownloader {
76
76
  chunks.push(chunk);
77
77
  ofs += chunk.length;
78
78
  }
79
- return buffer_utils_1.joinByteArrs(chunks);
79
+ return (0, buffer_utils_1.joinByteArrs)(chunks);
80
80
  }
81
81
  });
82
82
  }
@@ -17,7 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.MsgIndex = void 0;
20
- const processes_1 = require("../../../lib-common/processes");
20
+ const synced_1 = require("../../../lib-common/processes/synced");
21
21
  const buffer_utils_1 = require("../../../lib-common/buffer-utils");
22
22
  const timed_cache_1 = require("../../../lib-common/timed-cache");
23
23
  const LIMIT_RECORDS_PER_FILE = 200;
@@ -97,9 +97,9 @@ class MsgIndex {
97
97
  constructor(files) {
98
98
  this.files = files;
99
99
  this.latest = undefined;
100
- this.cached = timed_cache_1.makeTimedCache(10 * 60 * 1000);
100
+ this.cached = (0, timed_cache_1.makeTimedCache)(10 * 60 * 1000);
101
101
  this.fileTSs = undefined;
102
- this.fileProc = new processes_1.SingleProc();
102
+ this.fileProc = new synced_1.SingleProc();
103
103
  Object.seal(this);
104
104
  }
105
105
  static async makeWith(files) {
@@ -297,7 +297,7 @@ class MsgIndex {
297
297
  }
298
298
  if (msgFound) {
299
299
  removeFrom(records, msgId);
300
- if ((records.fileTS !== null) && (records.ordered.length === 0)) {
300
+ if (!!records.fileTS && (records.ordered.length === 0)) {
301
301
  await this.files.deleteFile(records.fileTS + INDEX_EXT);
302
302
  }
303
303
  else {
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.MsgOnDisk = void 0;
19
19
  const fs = require("../../../lib-common/async-fs-node");
20
20
  const obj_on_disk_1 = require("../../../lib-client/objs-on-disk/obj-on-disk");
21
- const processes_1 = require("../../../lib-common/processes");
21
+ const synced_1 = require("../../../lib-common/processes/synced");
22
22
  const error_1 = require("../../../lib-common/exceptions/error");
23
23
  const path_1 = require("path");
24
24
  const META_FNAME = 'meta.json';
@@ -39,7 +39,7 @@ class MsgOnDisk {
39
39
  this.msgDownloader = msgDownloader;
40
40
  this.status = status;
41
41
  this.objsIds = objsIds;
42
- this.syncProc = new processes_1.SingleProc();
42
+ this.syncProc = new synced_1.SingleProc();
43
43
  this.objs = new Map();
44
44
  this.objDownloader = this.msgDownloader.getObjDownloader(msgId);
45
45
  Object.freeze(this.objDownloader);
@@ -63,7 +63,7 @@ class MsgOnDisk {
63
63
  return readJSON(this.msgFolderPath, META_FNAME, this.msgId);
64
64
  }
65
65
  objFilePath(objId) {
66
- return path_1.join(this.msgFolderPath, objId);
66
+ return (0, path_1.join)(this.msgFolderPath, objId);
67
67
  }
68
68
  async getObjFile(objId) {
69
69
  let file = this.objs.get(objId);
@@ -79,7 +79,7 @@ class MsgOnDisk {
79
79
  if (exc.notFound) {
80
80
  return;
81
81
  }
82
- throw error_1.errWithCause(exc, `Cannot stat message obj at ${path}`);
82
+ throw (0, error_1.errWithCause)(exc, `Cannot stat message obj at ${path}`);
83
83
  }));
84
84
  file = (isOnDisk ?
85
85
  await obj_on_disk_1.ObjOnDisk.forExistingFile(objId, 0, path, this.objDownloader) :
@@ -119,16 +119,16 @@ exports.MsgOnDisk = MsgOnDisk;
119
119
  Object.freeze(MsgOnDisk.prototype);
120
120
  Object.freeze(MsgOnDisk);
121
121
  async function readJSON(msgFolderPath, fname, msgId) {
122
- const path = path_1.join(msgFolderPath, fname);
122
+ const path = (0, path_1.join)(msgFolderPath, fname);
123
123
  try {
124
124
  return JSON.parse(await fs.readFile(path, { flag: 'r', encoding: 'utf8' }));
125
125
  }
126
126
  catch (err) {
127
- throw error_1.errWithCause(err, `Can't read file ${fname} of message ${msgId}`);
127
+ throw (0, error_1.errWithCause)(err, `Can't read file ${fname} of message ${msgId}`);
128
128
  }
129
129
  }
130
130
  async function writeJSON(msgFolderPath, fname, json, exclusive = false) {
131
- const path = path_1.join(msgFolderPath, fname);
131
+ const path = (0, path_1.join)(msgFolderPath, fname);
132
132
  await fs.writeFile(path, JSON.stringify(json), { flag: (exclusive ? 'wx' : 'w') });
133
133
  }
134
134
  function objIdsFromMeta(meta) {
@@ -2,15 +2,14 @@ import { InboxPathForUser } from '../app-files';
2
2
  import { StorageGetter } from '../../lib-client/3nstorage/xsp-fs/common';
3
3
  import { GetSigner } from '../id-manager';
4
4
  import { AsyncSBoxCryptor } from 'xsp-files';
5
- import { NetClient } from '../../lib-client/request-utils';
6
5
  import { Logger } from '../../lib-client/logging/log-to-file';
7
6
  import { ServiceLocatorMaker } from '../../lib-client/service-locator';
7
+ import { MakeNet } from '..';
8
8
  declare type WritableFS = web3n.files.WritableFS;
9
9
  declare type Service = web3n.asmail.Service;
10
10
  export declare type MailCAPMaker = () => Service;
11
11
  export declare class ASMail {
12
12
  private readonly cryptor;
13
- private readonly makeNet;
14
13
  private readonly inboxPathForUser;
15
14
  private readonly logger;
16
15
  private keyring;
@@ -19,7 +18,8 @@ export declare class ASMail {
19
18
  private delivery;
20
19
  private config;
21
20
  private sendingParams;
22
- constructor(cryptor: AsyncSBoxCryptor, makeNet: () => NetClient, inboxPathForUser: InboxPathForUser, logger: Logger);
21
+ private readonly makeNet;
22
+ constructor(cryptor: AsyncSBoxCryptor, makeNet: MakeNet, inboxPathForUser: InboxPathForUser, logger: Logger);
23
23
  init(address: string, getSigner: GetSigner, syncedFS: WritableFS, localFS: WritableFS, getStorages: StorageGetter, makeResolver: ServiceLocatorMaker): Promise<void>;
24
24
  private setupConfig;
25
25
  private setupKeyring;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2015 - 2018, 2020 - 2021 3NSoft Inc.
3
+ Copyright (C) 2015 - 2018, 2020 - 2022 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -23,6 +23,7 @@ const keyring_1 = require("./keyring");
23
23
  const config_1 = require("./config");
24
24
  const delivery_1 = require("./delivery");
25
25
  const sending_params_1 = require("./sending-params");
26
+ const fs_sync_utils_1 = require("../../lib-client/fs-sync-utils");
26
27
  const KEYRING_DATA_FOLDER = 'keyring';
27
28
  const INBOX_DATA_FOLDER = 'inbox';
28
29
  const CONFIG_DATA_FOLDER = 'config';
@@ -31,7 +32,6 @@ const SEND_PARAMS_DATA_FOLDER = 'sending-params';
31
32
  class ASMail {
32
33
  constructor(cryptor, makeNet, inboxPathForUser, logger) {
33
34
  this.cryptor = cryptor;
34
- this.makeNet = makeNet;
35
35
  this.inboxPathForUser = inboxPathForUser;
36
36
  this.logger = logger;
37
37
  this.keyring = undefined;
@@ -40,11 +40,13 @@ class ASMail {
40
40
  this.delivery = undefined;
41
41
  this.config = undefined;
42
42
  this.sendingParams = undefined;
43
+ this.makeNet = () => makeNet();
43
44
  Object.seal(this);
44
45
  }
45
46
  async init(address, getSigner, syncedFS, localFS, getStorages, makeResolver) {
46
47
  try {
47
48
  this.address = address;
49
+ await (0, fs_sync_utils_1.getRemoteFolderChanges)(syncedFS);
48
50
  await this.setupConfig(getSigner, syncedFS, makeResolver('asmail'));
49
51
  await Promise.all([
50
52
  this.setupKeyring(syncedFS),
@@ -54,23 +56,24 @@ class ASMail {
54
56
  this.setupInbox(syncedFS, getSigner, getStorages, makeResolver),
55
57
  this.setupDelivery(localFS, getSigner, makeResolver)
56
58
  ]);
59
+ await (0, fs_sync_utils_1.uploadFolderChangesIfAny)(syncedFS);
57
60
  await syncedFS.close();
58
61
  await localFS.close();
59
62
  }
60
63
  catch (err) {
61
- throw error_1.errWithCause(err, 'Failed to initialize ASMail');
64
+ throw (0, error_1.errWithCause)(err, 'Failed to initialize ASMail');
62
65
  }
63
66
  }
64
67
  async setupConfig(getSigner, syncedFS, resolver) {
65
- const fs = await syncedFS.writableSubRoot(CONFIG_DATA_FOLDER);
68
+ const fs = await (0, fs_sync_utils_1.getOrMakeAndUploadFolderIn)(syncedFS, CONFIG_DATA_FOLDER);
66
69
  this.config = await config_1.ConfigOfASMailServer.makeAndStart(this.address, getSigner, resolver, this.makeNet(), fs);
67
70
  }
68
71
  async setupKeyring(syncedFS) {
69
- const fs = await syncedFS.writableSubRoot(KEYRING_DATA_FOLDER);
72
+ const fs = await (0, fs_sync_utils_1.getOrMakeAndUploadFolderIn)(syncedFS, KEYRING_DATA_FOLDER);
70
73
  this.keyring = await keyring_1.KeyRing.makeAndStart(this.cryptor, fs, this.config.publishedKeys);
71
74
  }
72
75
  async setupSendingParams(syncedFS) {
73
- const fs = await syncedFS.writableSubRoot(SEND_PARAMS_DATA_FOLDER);
76
+ const fs = await (0, fs_sync_utils_1.getOrMakeAndUploadFolderIn)(syncedFS, SEND_PARAMS_DATA_FOLDER);
74
77
  this.sendingParams = await sending_params_1.SendingParamsHolder.makeAndStart(fs, this.config.anonSenderInvites);
75
78
  }
76
79
  async setupDelivery(localFS, getSigner, makeResolver) {
@@ -96,7 +99,7 @@ class ASMail {
96
99
  }
97
100
  async setupInbox(syncedFS, getSigner, getStorages, makeResolver) {
98
101
  const cachePath = this.inboxPathForUser(this.address);
99
- const inboxFS = await syncedFS.writableSubRoot(INBOX_DATA_FOLDER);
102
+ const inboxFS = await (0, fs_sync_utils_1.getOrMakeAndUploadFolderIn)(syncedFS, INBOX_DATA_FOLDER);
100
103
  this.inbox = await inbox_1.InboxOnServer.makeAndStart(cachePath, inboxFS, {
101
104
  address: this.address,
102
105
  cryptor: this.cryptor,
@@ -117,7 +120,7 @@ class ASMail {
117
120
  const w = {
118
121
  getUserId: async () => this.address,
119
122
  delivery: this.delivery.wrap(),
120
- inbox: this.inbox.wrap()
123
+ inbox: this.inbox.wrap(),
121
124
  };
122
125
  return Object.freeze(w);
123
126
  }
@@ -127,4 +130,6 @@ class ASMail {
127
130
  }
128
131
  }
129
132
  exports.ASMail = ASMail;
133
+ Object.freeze(ASMail.prototype);
134
+ Object.freeze(ASMail);
130
135
  Object.freeze(exports);
@@ -30,10 +30,10 @@ const service_locator_1 = require("../../lib-client/service-locator");
30
30
  * @param certs is an object with a MailerId certificates chain for a public key
31
31
  */
32
32
  async function checkAndExtractPKey(client, resolver, address, certs) {
33
- address = canonical_address_1.toCanonicalAddress(address);
33
+ address = (0, canonical_address_1.toCanonicalAddress)(address);
34
34
  const validAt = Math.round(Date.now() / 1000);
35
35
  // get MailerId provider's info with a root certificate(s)
36
- const data = await service_locator_1.getMailerIdInfoFor(resolver, client, address);
36
+ const data = await (0, service_locator_1.getMailerIdInfoFor)(resolver, client, address);
37
37
  // TODO choose proper root certificate, as it may not be current one
38
38
  const rootAddr = data.domain;
39
39
  const rootCert = data.info.currentCert;
@@ -56,13 +56,13 @@ async function checkAndExtractPKeyWithAddress(client, resolver, certs, validAt)
56
56
  // address here comes from certificates; we return it for further checks
57
57
  let address;
58
58
  try {
59
- address = jwkeys_1.getKeyCert(certs.pkeyCert).cert.principal.address;
59
+ address = (0, jwkeys_1.getKeyCert)(certs.pkeyCert).cert.principal.address;
60
60
  }
61
61
  catch (err) {
62
- throw mid_sigs_NaCl_Ed_1.makeMalformedCertsException(`Cannot read public key certificate`, err);
62
+ throw (0, mid_sigs_NaCl_Ed_1.makeMalformedCertsException)(`Cannot read public key certificate`, err);
63
63
  }
64
64
  // get MailerId provider's info with a root certificate(s)
65
- const data = await service_locator_1.getMailerIdInfoFor(resolver, client, address);
65
+ const data = await (0, service_locator_1.getMailerIdInfoFor)(resolver, client, address);
66
66
  // TODO choose proper root certificate, as it may not be current one
67
67
  const rootAddr = data.domain;
68
68
  const rootCert = data.info.currentCert;