core-3nweb-client-lib 0.27.1 → 0.27.3

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 (56) hide show
  1. package/build/api-defs/files.d.ts +4 -7
  2. package/build/core/asmail/inbox/attachments/fs.d.ts +2 -1
  3. package/build/core/asmail/inbox/attachments/fs.js +4 -3
  4. package/build/core/asmail/inbox/index.js +1 -1
  5. package/build/core/id-manager/index.d.ts +43 -0
  6. package/build/core/{id-manager.js → id-manager/index.js} +33 -114
  7. package/build/core/id-manager/key-storage.d.ts +21 -0
  8. package/build/core/id-manager/key-storage.js +96 -0
  9. package/build/core/index.js +21 -23
  10. package/build/core/sign-in.d.ts +1 -2
  11. package/build/core/sign-in.js +4 -13
  12. package/build/core/sign-up.d.ts +2 -0
  13. package/build/core/sign-up.js +2 -1
  14. package/build/core/storage/index.d.ts +4 -2
  15. package/build/core/storage/index.js +36 -57
  16. package/build/core/storage/local/storage.d.ts +1 -1
  17. package/build/core/storage/synced/obj-files-gc.d.ts +1 -4
  18. package/build/core/storage/synced/obj-files-gc.js +1 -18
  19. package/build/core/storage/synced/obj-files.d.ts +9 -1
  20. package/build/core/storage/synced/obj-files.js +41 -33
  21. package/build/core/storage/synced/obj-status.d.ts +18 -7
  22. package/build/core/storage/synced/obj-status.js +148 -83
  23. package/build/core/storage/synced/storage.d.ts +7 -2
  24. package/build/core/storage/synced/storage.js +50 -10
  25. package/build/core/storage/synced/upsyncer.d.ts +4 -4
  26. package/build/core/storage/synced/upsyncer.js +12 -6
  27. package/build/lib-client/3nstorage/exceptions.d.ts +13 -1
  28. package/build/lib-client/3nstorage/exceptions.js +9 -3
  29. package/build/lib-client/3nstorage/service.d.ts +6 -1
  30. package/build/lib-client/3nstorage/service.js +31 -15
  31. package/build/lib-client/3nstorage/util/file-based-json.js +2 -1
  32. package/build/lib-client/3nstorage/util/for-arrays.d.ts +1 -0
  33. package/build/lib-client/3nstorage/util/for-arrays.js +32 -0
  34. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +5 -4
  35. package/build/lib-client/3nstorage/xsp-fs/common.js +1 -0
  36. package/build/lib-client/3nstorage/xsp-fs/file.js +2 -2
  37. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +11 -5
  38. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +232 -68
  39. package/build/lib-client/3nstorage/xsp-fs/fs.js +15 -19
  40. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +4 -9
  41. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +16 -17
  42. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +1 -1
  43. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  44. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  45. package/build/lib-client/local-files/device-fs.js +11 -11
  46. package/build/lib-client/user-with-mid-session.d.ts +2 -1
  47. package/build/lib-client/user-with-mid-session.js +7 -1
  48. package/build/lib-common/async-fs-node.js +8 -8
  49. package/build/lib-common/exceptions/file.d.ts +4 -2
  50. package/build/lib-common/exceptions/file.js +24 -58
  51. package/build/lib-common/ipc/generic-ipc.js +5 -4
  52. package/build/lib-common/objs-on-disk/utils.js +1 -1
  53. package/build/lib-common/service-api/3nstorage/owner.d.ts +8 -5
  54. package/build/lib-common/service-api/3nstorage/owner.js +2 -1
  55. package/package.json +3 -2
  56. package/build/core/id-manager.d.ts +0 -46
@@ -62,10 +62,10 @@ async function makeFolder(root, path, exclusive = false) {
62
62
  continue;
63
63
  }
64
64
  if (!stats.isDirectory()) {
65
- throw (0, file_1.makeFileException)(file_1.Code.notDirectory, path.slice(0, i + 1).join('/'));
65
+ throw (0, file_1.makeFileException)('notDirectory', path.slice(0, i + 1).join('/'));
66
66
  }
67
67
  else if ((i === lastIndex) && exclusive) {
68
- throw (0, file_1.makeFileException)(file_1.Code.alreadyExists, path.join('/'));
68
+ throw (0, file_1.makeFileException)('alreadyExists', path.join('/'));
69
69
  }
70
70
  }
71
71
  }
@@ -227,10 +227,10 @@ class DeviceFS {
227
227
  await fs.lstat(root)
228
228
  .then(stat => {
229
229
  if (create && exclusive) {
230
- throw (0, file_1.makeFileException)(file_1.Code.alreadyExists, root);
230
+ throw (0, file_1.makeFileException)('alreadyExists', root);
231
231
  }
232
232
  if (!stat.isDirectory()) {
233
- throw (0, file_1.makeFileException)(file_1.Code.notDirectory, root);
233
+ throw (0, file_1.makeFileException)('notDirectory', root);
234
234
  }
235
235
  }, async (e) => {
236
236
  if (!e.notFound || !create) {
@@ -455,7 +455,7 @@ class DeviceFS {
455
455
  return txt;
456
456
  }
457
457
  catch (err) {
458
- throw (0, file_1.makeFileException)(file_1.Code.parsingError, path, err);
458
+ throw (0, file_1.makeFileException)('parsingError', path, err);
459
459
  }
460
460
  }
461
461
  writeJSONFile(path, json, flags = WRITE_NONEXCL_FLAGS) {
@@ -469,7 +469,7 @@ class DeviceFS {
469
469
  return json;
470
470
  }
471
471
  catch (err) {
472
- throw (0, file_1.makeFileException)(file_1.Code.parsingError, path, err);
472
+ throw (0, file_1.makeFileException)('parsingError', path, err);
473
473
  }
474
474
  }
475
475
  async deleteFile(path) {
@@ -557,7 +557,7 @@ class DeviceFS {
557
557
  const dstPath = this.root + '/' + dst.join('/');
558
558
  await fs.lstat(dstPath)
559
559
  .then(() => {
560
- throw (0, file_1.makeFileException)(file_1.Code.alreadyExists, newPath);
560
+ throw (0, file_1.makeFileException)('alreadyExists', newPath);
561
561
  }, (exc) => {
562
562
  if (!exc.notFound) {
563
563
  throw exc;
@@ -692,10 +692,10 @@ class DeviceFS {
692
692
  async writableFile(path, flags = WRITE_NONEXCL_FLAGS) {
693
693
  const exists = await this.checkFilePresence(path);
694
694
  if (exists && flags.create && flags.exclusive) {
695
- throw (0, file_1.makeFileException)(file_1.Code.alreadyExists, path);
695
+ throw (0, file_1.makeFileException)('alreadyExists', path);
696
696
  }
697
697
  if (!exists && !flags.create) {
698
- throw (0, file_1.makeFileException)(file_1.Code.notFound, path);
698
+ throw (0, file_1.makeFileException)('notFound', path);
699
699
  }
700
700
  return (0, files_1.wrapWritableFile)(new FileObject(this, path, exists, true));
701
701
  }
@@ -765,7 +765,7 @@ class DeviceFS {
765
765
  }
766
766
  try {
767
767
  if (observer.error) {
768
- observer.error((0, file_1.makeFileException)(sig, path, { code, sig }));
768
+ observer.error((0, file_1.makeFileExceptionFromCode)(sig, path, { code, sig }));
769
769
  }
770
770
  else if (observer.complete) {
771
771
  observer.complete();
@@ -876,7 +876,7 @@ async function checkFolderPresence(path) {
876
876
  throw (0, file_1.maskPathInExc)(0, e);
877
877
  });
878
878
  if (!stat.isDirectory()) {
879
- throw (0, file_1.makeFileException)(file_1.Code.notDirectory, path);
879
+ throw (0, file_1.makeFileException)('notDirectory', path);
880
880
  }
881
881
  }
882
882
  class FileObject {
@@ -8,7 +8,7 @@ import * as WebSocket from 'ws';
8
8
  export declare type IGetMailerIdSigner = () => Promise<mid.MailerIdSigner>;
9
9
  export declare abstract class ServiceUser {
10
10
  readonly userId: string;
11
- private readonly getSigner;
11
+ private getSigner;
12
12
  private getInitServiceURI;
13
13
  protected readonly net: NetClient;
14
14
  private uri;
@@ -28,6 +28,7 @@ export declare abstract class ServiceUser {
28
28
  }, getSigner: IGetMailerIdSigner | undefined, getInitServiceURI: () => Promise<string>, net: NetClient);
29
29
  private get isUriSet();
30
30
  private throwOnBadServiceURI;
31
+ protected setGetterOfSigner(getSigner: IGetMailerIdSigner): void;
31
32
  /**
32
33
  * This initializes service uri, if it hasn't been set, yet.
33
34
  * Else, this function does nothing.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2015, 2017, 2020 3NSoft Inc.
3
+ Copyright (C) 2015, 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
@@ -72,6 +72,12 @@ class ServiceUser {
72
72
  throw new Error(`Service uri is not a string: ${this.serviceURI}`);
73
73
  }
74
74
  }
75
+ setGetterOfSigner(getSigner) {
76
+ if (this.getSigner) {
77
+ throw new Error(`getSigner is already set`);
78
+ }
79
+ this.getSigner = getSigner;
80
+ }
75
81
  /**
76
82
  * This initializes service uri, if it hasn't been set, yet.
77
83
  * Else, this function does nothing.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2015 - 2019, 2021 3NSoft Inc.
3
+ Copyright (C) 2015 - 2019, 2021 - 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
@@ -28,7 +28,7 @@ const path_1 = require("path");
28
28
  var fs_2 = require("fs");
29
29
  Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return fs_2.Stats; } });
30
30
  function makeFileExceptionFromNodes(nodeExc) {
31
- return (0, file_1.makeFileException)(nodeExc.code, nodeExc.path);
31
+ return (0, file_1.makeFileExceptionFromCode)(nodeExc.code, nodeExc.path);
32
32
  }
33
33
  function readFile(path, options) {
34
34
  return new Promise((resolve, reject) => {
@@ -307,7 +307,7 @@ async function readToBuf(fd, pos, buf) {
307
307
  while (bytesRead < buf.length) {
308
308
  const bNum = await readOrig(fd, buf, bytesRead, buf.length - bytesRead, pos);
309
309
  if (bNum === 0) {
310
- throw (0, file_1.makeFileException)(file_1.Code.endOfFile, '<file descriptor>');
310
+ throw (0, file_1.makeFileException)('endOfFile', '<file descriptor>');
311
311
  }
312
312
  bytesRead += bNum;
313
313
  pos += bNum;
@@ -379,7 +379,7 @@ async function existsFolder(path) {
379
379
  return true;
380
380
  }
381
381
  else {
382
- throw (0, file_1.makeFileException)(file_1.Code.notDirectory, path);
382
+ throw (0, file_1.makeFileException)('notDirectory', path);
383
383
  }
384
384
  }
385
385
  catch (e) {
@@ -400,7 +400,7 @@ function existsFolderSync(path) {
400
400
  return true;
401
401
  }
402
402
  else {
403
- throw (0, file_1.makeFileException)(file_1.Code.notDirectory, path);
403
+ throw (0, file_1.makeFileException)('notDirectory', path);
404
404
  }
405
405
  }
406
406
  catch (e) {
@@ -421,7 +421,7 @@ function existsFileSync(path) {
421
421
  return true;
422
422
  }
423
423
  else {
424
- throw (0, file_1.makeFileException)(file_1.Code.notFile, path);
424
+ throw (0, file_1.makeFileException)('notFile', path);
425
425
  }
426
426
  }
427
427
  catch (e) {
@@ -586,7 +586,7 @@ async function streamToExistingFile(filePath, pos, len, src, bufSize) {
586
586
  if (doneReading) {
587
587
  return;
588
588
  }
589
- complete((0, file_1.makeFileException)(file_1.Code.endOfFile, '<input stream>'));
589
+ complete((0, file_1.makeFileException)('endOfFile', '<input stream>'));
590
590
  });
591
591
  src.on('error', (err) => {
592
592
  complete(err);
@@ -614,7 +614,7 @@ async function read(fd, pos, buf) {
614
614
  while (bytesRead < buf.length) {
615
615
  const bNum = await readOrig(fd, buf, bytesRead, buf.length - bytesRead, pos);
616
616
  if (bNum === 0) {
617
- throw (0, file_1.makeFileException)(file_1.Code.endOfFile, '<file descriptor>');
617
+ throw (0, file_1.makeFileException)('endOfFile', '<file descriptor>');
618
618
  }
619
619
  bytesRead += bNum;
620
620
  pos += bNum;
@@ -1,6 +1,8 @@
1
- export declare const Code: web3n.files.exceptionCode;
2
1
  export declare type FileException = web3n.files.FileException;
3
- export declare function makeFileException(code: string | undefined, path: string, cause?: any): FileException;
2
+ export declare type FileExceptionFlag = web3n.files.FileExceptionFlag;
3
+ export declare const Code: web3n.files.exceptionCode;
4
+ export declare function makeFileExceptionFromCode(code: string | undefined, path: string, cause?: any): FileException;
5
+ export declare function makeFileException(flag: keyof FileExceptionFlag, path: string, cause?: any): FileException;
4
6
  export declare function maskPathInExc(pathPrefixMaskLen: number, exc: any): FileException;
5
7
  export declare function ensureCorrectFS(fs: web3n.files.FS, type: web3n.files.FSType, writable: boolean): void;
6
8
  export declare function makeNoAttrsExc(path: string): FileException;
@@ -16,28 +16,26 @@
16
16
  this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.makeVersionMismatchExc = exports.makeNoAttrsExc = exports.ensureCorrectFS = exports.maskPathInExc = exports.makeFileException = exports.Code = void 0;
19
+ exports.makeVersionMismatchExc = exports.makeNoAttrsExc = exports.ensureCorrectFS = exports.maskPathInExc = exports.makeFileException = exports.makeFileExceptionFromCode = exports.Code = void 0;
20
20
  exports.Code = {
21
21
  notFound: 'ENOENT',
22
22
  alreadyExists: 'EEXIST',
23
23
  notDirectory: 'ENOTDIR',
24
24
  notFile: 'ENOTFILE',
25
- notLink: 'not-link',
26
25
  isDirectory: 'EISDIR',
27
26
  notEmpty: 'ENOTEMPTY',
28
27
  endOfFile: 'EEOF',
29
28
  opNotPermitted: 'EPERM',
30
29
  busy: 'EBUSY',
31
30
  ioError: 'EIO',
32
- concurrentUpdate: 'concurrent-update',
33
- parsingError: 'parsing-error',
34
31
  notImplemented: 'ENOSYS',
35
- isEndless: 'is-endless',
36
- storageClosed: 'storage-closed',
37
- versionMismatch: 'version-mismatch',
38
32
  };
39
33
  Object.freeze(exports.Code);
40
- function makeFileException(code, path, cause) {
34
+ const codeToFlag = {};
35
+ for (const [flag, code] of Object.entries(exports.Code)) {
36
+ codeToFlag[code] = flag;
37
+ }
38
+ function makeFileExceptionFromCode(code, path, cause) {
41
39
  const err = {
42
40
  runtimeException: true,
43
41
  type: 'file',
@@ -45,59 +43,27 @@ function makeFileException(code, path, cause) {
45
43
  path,
46
44
  cause
47
45
  };
48
- if (code === exports.Code.alreadyExists) {
49
- err.alreadyExists = true;
50
- }
51
- else if (code === exports.Code.notFound) {
52
- err.notFound = true;
53
- }
54
- else if (code === exports.Code.isDirectory) {
55
- err.isDirectory = true;
56
- }
57
- else if (code === exports.Code.notDirectory) {
58
- err.notDirectory = true;
59
- }
60
- else if (code === exports.Code.notFile) {
61
- err.notFile = true;
62
- }
63
- else if (code === exports.Code.notLink) {
64
- err.notLink = true;
65
- }
66
- else if (code === exports.Code.endOfFile) {
67
- err.endOfFile = true;
68
- }
69
- else if (code === exports.Code.busy) {
70
- err.busy = true;
71
- }
72
- else if (code === exports.Code.ioError) {
73
- err.ioError = true;
74
- }
75
- else if (code === exports.Code.notEmpty) {
76
- err.notEmpty = true;
77
- }
78
- else if (code === exports.Code.opNotPermitted) {
79
- err.opNotPermitted = true;
80
- }
81
- else if (code === exports.Code.concurrentUpdate) {
82
- err.concurrentUpdate = true;
83
- }
84
- else if (code === exports.Code.parsingError) {
85
- err.parsingError = true;
86
- }
87
- else if (code === exports.Code.notImplemented) {
88
- err.notImplemented = true;
89
- }
90
- else if (code === exports.Code.isEndless) {
91
- err.isEndless = true;
92
- }
93
- else if (code === exports.Code.storageClosed) {
94
- err.storageClosed = true;
95
- }
96
- else if (code === exports.Code.versionMismatch) {
97
- err.versionMismatch = true;
46
+ if (code) {
47
+ const flag = codeToFlag[code];
48
+ if (flag) {
49
+ err[flag] = true;
50
+ }
98
51
  }
99
52
  return err;
100
53
  }
54
+ exports.makeFileExceptionFromCode = makeFileExceptionFromCode;
55
+ function makeFileException(flag, path, cause) {
56
+ const code = exports.Code[flag];
57
+ const err = {
58
+ runtimeException: true,
59
+ type: 'file',
60
+ code,
61
+ path,
62
+ cause
63
+ };
64
+ err[flag] = true;
65
+ return err;
66
+ }
101
67
  exports.makeFileException = makeFileException;
102
68
  function maskPathInExc(pathPrefixMaskLen, exc) {
103
69
  if (!exc.runtimeException || !exc.code) {
@@ -278,11 +278,12 @@ function makeRequestServer(channel, comm) {
278
278
  return (new ReplyingSide(channel, comm)).wrap();
279
279
  }
280
280
  exports.makeRequestServer = makeRequestServer;
281
- function makeUnknownEventException() {
281
+ function makeUnknownEventException(message) {
282
282
  return {
283
283
  runtimeException: true,
284
284
  type: 'events',
285
- unknownEvent: true
285
+ unknownEvent: true,
286
+ message
286
287
  };
287
288
  }
288
289
  const SUBSCRIBE_REQ_NAME = 'subscribe';
@@ -307,7 +308,7 @@ class EventsSendingSide extends ReplyingSide {
307
308
  const event = env.req;
308
309
  const gr = this.findGroup(event);
309
310
  if (!gr) {
310
- throw makeUnknownEventException();
311
+ throw makeUnknownEventException(`Events' channel ${event} is not found in handling subscribe`);
311
312
  }
312
313
  this.subscribedEvents.add(event);
313
314
  await gr.subscribe(event);
@@ -316,7 +317,7 @@ class EventsSendingSide extends ReplyingSide {
316
317
  const event = env.req;
317
318
  const gr = this.findGroup(event);
318
319
  if (!gr) {
319
- throw makeUnknownEventException();
320
+ throw makeUnknownEventException(`Events' channel ${event} is not found in handling unsubscribe`);
320
321
  }
321
322
  this.subscribedEvents.delete(event);
322
323
  if (gr.unsubscribe) {
@@ -111,7 +111,7 @@ async function streamToObjFile(file, content, src, maxBufferLen) {
111
111
  });
112
112
  src.on('end', () => {
113
113
  if (chunk) {
114
- complete((0, file_1.makeFileException)(file_1.Code.endOfFile, '<input stream>'));
114
+ complete((0, file_1.makeFileException)('endOfFile', '<input stream>'));
115
115
  }
116
116
  else {
117
117
  complete();
@@ -128,9 +128,10 @@ export declare namespace currentObj {
128
128
  mismatchedObjVer: number;
129
129
  objIncomplete: number;
130
130
  };
131
- interface MismatchedObjVerReply extends ErrorReply {
132
- current_version: number;
133
- }
131
+ type MismatchedObjVerReply = MismatchedObjVerErrReply;
132
+ }
133
+ export interface MismatchedObjVerErrReply extends ErrorReply {
134
+ current_version: number;
134
135
  }
135
136
  export declare namespace currentRootObj {
136
137
  const EXPRESS_URL_END = "root/current";
@@ -236,23 +237,25 @@ export declare namespace rootStatus {
236
237
  export declare namespace archiveObj {
237
238
  const EXPRESS_URL_END = "obj/:objId/archive";
238
239
  function postAndDelReqUrlEnd(objId: string, version: number): string;
239
- type VersionsList = number[];
240
+ type MismatchedObjVerReply = MismatchedObjVerErrReply;
240
241
  const SC: {
241
242
  okPost: number;
242
243
  okDelete: number;
243
244
  unknownObj: number;
244
245
  unknownObjVer: number;
246
+ mismatchedObjVer: number;
245
247
  };
246
248
  }
247
249
  export declare namespace archiveRoot {
248
250
  const EXPRESS_URL_END = "root/archive";
249
251
  function postAndDelReqUrlEnd(version: number): string;
250
- type VersionsList = archiveObj.VersionsList;
252
+ type MismatchedObjVerReply = archiveObj.MismatchedObjVerReply;
251
253
  const SC: {
252
254
  okPost: number;
253
255
  okDelete: number;
254
256
  unknownObj: number;
255
257
  unknownObjVer: number;
258
+ mismatchedObjVer: number;
256
259
  };
257
260
  }
258
261
  export interface ErrorReply {
@@ -258,7 +258,8 @@ var archiveObj;
258
258
  okPost: 200,
259
259
  okDelete: 200,
260
260
  unknownObj: 474,
261
- unknownObjVer: 494
261
+ unknownObjVer: 494,
262
+ mismatchedObjVer: 495
262
263
  };
263
264
  })(archiveObj = exports.archiveObj || (exports.archiveObj = {}));
264
265
  Object.freeze(archiveObj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.27.1",
3
+ "version": "0.27.3",
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",
@@ -31,6 +31,7 @@
31
31
  "protobufjs": "^6.11.3",
32
32
  "punycode": "^2.1.1",
33
33
  "rxjs": "^6.5.2",
34
+ "tsuml2": "^0.6.1",
34
35
  "ws": "^7.4.6",
35
36
  "xsp-files": "^4.0.0"
36
37
  },
@@ -39,7 +40,7 @@
39
40
  "@types/node": "^16.11.7",
40
41
  "@types/ws": "^7.4.7",
41
42
  "jasmine": "^3.9.0",
42
- "spec-3nweb-server": "^1.6.2",
43
+ "spec-3nweb-server": "^1.6.3",
43
44
  "typescript": "^4.7.4"
44
45
  }
45
46
  }
@@ -1,46 +0,0 @@
1
- import { user as mid } from '../lib-common/mid-sigs-NaCl-Ed';
2
- import { JsonKey } from '../lib-common/jwkeys';
3
- import { GenerateKey } from './sign-in';
4
- import { LogError, LogWarning } from '../lib-client/logging/log-to-file';
5
- import { NetClient } from '../lib-client/request-utils';
6
- import { ServiceLocator } from '../lib-client/service-locator';
7
- declare type WritableFS = web3n.files.WritableFS;
8
- /**
9
- * This function completes provisioning process, returning a promise, resolvable
10
- * to either true, when all is done, or to false, when challenge reply is not
11
- * accepted by the server.
12
- */
13
- export interface CompleteProvisioning {
14
- keyParams: any;
15
- complete(defaultSKey: Uint8Array): Promise<boolean>;
16
- }
17
- /**
18
- * This returns a promise, resolvable to mailerId signer.
19
- */
20
- export declare type GetSigner = () => Promise<mid.MailerIdSigner>;
21
- export declare class IdManager {
22
- private makeNet;
23
- private midServiceFor;
24
- private readonly logError;
25
- private readonly logWarning;
26
- private address;
27
- private signer;
28
- private localFS;
29
- private syncedFS;
30
- private provisioningProc;
31
- private constructor();
32
- static initInOneStepWithoutStore(address: string, midLoginKey: GenerateKey | Uint8Array, resolver: ServiceLocator, makeNet: () => NetClient, logError: LogError, logWarning: LogWarning): Promise<IdManager | undefined>;
33
- static initWithoutStore(address: string, resolver: ServiceLocator, makeNet: () => NetClient, logError: LogError, logWarning: LogWarning): Promise<((midLoginKey: GenerateKey | Uint8Array) => Promise<IdManager | undefined>) | undefined>;
34
- static initFromLocalStore(address: string, localFS: WritableFS, resolver: ServiceLocator, makeNet: () => NetClient, logError: LogError, logWarning: LogWarning): Promise<IdManager | undefined>;
35
- private ensureLocalCacheOfKeys;
36
- private getSavedKey;
37
- setStorages(localFS: WritableFS | undefined, syncedFS: WritableFS, keysToSave?: JsonKey[]): Promise<void>;
38
- private provisionWithGivenKey;
39
- private provisionUsingSavedKey;
40
- getId(): string;
41
- getSigner: GetSigner;
42
- isProvisionedAndValid(): boolean;
43
- makeMailerIdCAP(): Service;
44
- }
45
- declare type Service = web3n.mailerid.Service;
46
- export {};