core-3nweb-client-lib 0.19.5 → 0.20.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 (47) hide show
  1. package/build/api-defs/asmail.d.ts +2 -2
  2. package/build/api-defs/web3n.d.ts +2 -1
  3. package/build/core/asmail/delivery/index.js +1 -1
  4. package/build/core/index.js +1 -1
  5. package/build/core/sign-up.js +5 -6
  6. package/build/ipc-via-protobuf/asmail-cap.js +4 -4
  7. package/build/ipc-via-protobuf/bytes.js +1 -1
  8. package/build/ipc-via-protobuf/connector-clients-side.js +3 -0
  9. package/build/ipc-via-protobuf/connector-services-side.js +1 -1
  10. package/build/ipc-via-protobuf/connector.d.ts +2 -2
  11. package/build/ipc-via-protobuf/connector.js +4 -1
  12. package/build/ipc-via-protobuf/file.d.ts +2 -1
  13. package/build/ipc-via-protobuf/file.js +1 -1
  14. package/build/ipc-via-protobuf/fs.d.ts +2 -1
  15. package/build/ipc-via-protobuf/fs.js +1 -1
  16. package/build/ipc-via-protobuf/log-cap.js +1 -1
  17. package/build/ipc-via-protobuf/mailerid.js +1 -1
  18. package/build/ipc-via-protobuf/proto-defs.js +1 -1
  19. package/build/ipc-via-protobuf/protobuf-msg.d.ts +2 -9
  20. package/build/ipc-via-protobuf/protobuf-msg.js +13 -70
  21. package/build/ipc-via-protobuf/protos/asmail.proto +1 -1
  22. package/build/ipc-via-protobuf/startup-cap.js +1 -1
  23. package/build/ipc-via-protobuf/storage-cap.js +1 -1
  24. package/build/lib-client/cryptor/cryptor-in-worker.d.ts +19 -5
  25. package/build/lib-client/cryptor/cryptor-in-worker.js +191 -157
  26. package/build/lib-client/cryptor/cryptor-wasm.js +1 -0
  27. package/build/lib-client/cryptor/cryptor.d.ts +5 -3
  28. package/build/lib-client/cryptor/cryptor.js +19 -7
  29. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  30. package/build/lib-client/cryptor/{cryptor-in-proc.d.ts → in-proc-js.d.ts} +0 -0
  31. package/build/lib-client/cryptor/{cryptor-in-proc.js → in-proc-js.js} +0 -0
  32. package/build/lib-client/cryptor/in-proc-wasm.d.ts +2 -0
  33. package/build/lib-client/cryptor/in-proc-wasm.js +187 -0
  34. package/build/lib-client/cryptor/proto-defs.js +50 -0
  35. package/build/lib-client/cryptor/protos/cryptor.proto +45 -0
  36. package/build/lib-client/cryptor/wasm-mp1-modules.d.ts +5 -0
  37. package/build/lib-client/cryptor/wasm-mp1-modules.js +79 -0
  38. package/build/lib-client/cryptor/worker-js.d.ts +1 -0
  39. package/build/lib-client/cryptor/worker-js.js +139 -0
  40. package/build/lib-client/cryptor/worker-wasm.d.ts +1 -0
  41. package/build/lib-client/cryptor/worker-wasm.js +37 -0
  42. package/build/lib-client/key-derivation.js +1 -1
  43. package/build/lib-client/protobuf-loader.d.ts +12 -0
  44. package/build/lib-client/protobuf-loader.js +96 -0
  45. package/build/lib-index.d.ts +5 -3
  46. package/build/lib-index.js +5 -3
  47. package/package.json +2 -2
@@ -51,9 +51,9 @@ declare namespace web3n.asmail {
51
51
 
52
52
  interface DeliveryOptions {
53
53
  /**
54
- * sendImmeditely flag forces immediate delivery with true value.
54
+ * sendImmediately flag forces immediate delivery with true value.
55
55
  */
56
- sendImmeditely?: boolean;
56
+ sendImmediately?: boolean;
57
57
  /**
58
58
  * localMeta is an optional data field that is attached to this message's
59
59
  * delivery progress. This data never leaves local machine and is
@@ -33,7 +33,8 @@ declare namespace web3n {
33
33
  }
34
34
 
35
35
  interface EncryptionException {
36
- failedCipherVerification: true;
36
+ failedCipherVerification?: true;
37
+ failedSignatureVerification?: true;
37
38
  }
38
39
 
39
40
  interface AsyncIterator<T> {
@@ -156,7 +156,7 @@ class Delivery {
156
156
  const msgFS = await this.makeFSForNewMsg(id);
157
157
  const msg = await msg_1.Msg.forNew(id, msgFS, msgToSend, sender, recipients, this.r, attachments, localMeta);
158
158
  // add and schedule
159
- const sendImmediately = (opts ? !!opts.sendImmeditely : false);
159
+ const sendImmediately = (opts ? !!opts.sendImmediately : false);
160
160
  this.addMsgAndSchedule(msg, sendImmediately);
161
161
  }
162
162
  async makeFSForNewMsg(id) {
@@ -101,7 +101,7 @@ class Core {
101
101
  };
102
102
  this.closeBroadcast = new rxjs_1.Subject();
103
103
  this.close$ = this.closeBroadcast.asObservable();
104
- this.cryptor = makeCryptor(this.logger.logWarning);
104
+ this.cryptor = makeCryptor(this.logger.logError, this.logger.logWarning);
105
105
  this.storages = new storage_1.Storages(this.cryptor.cryptor.sbox, this.appDirs.storagePathFor);
106
106
  this.asmail = new asmail_1.ASMail(this.cryptor.cryptor.sbox, this.makeNet, this.appDirs.inboxPathFor, this.logger);
107
107
  Object.seal(this);
@@ -39,21 +39,20 @@ const defaultDerivParams = {
39
39
  Object.freeze(defaultDerivParams);
40
40
  const SALT_LEN = 32;
41
41
  const KEY_ID_LEN = 10;
42
- function makeLabeledMidLoginKey() {
43
- const sk = random.bytesSync(ecma_nacl_1.secret_box.KEY_LENGTH);
42
+ async function makeLabeledMidLoginKey(cryptor) {
43
+ const sk = await random.bytes(ecma_nacl_1.box.KEY_LENGTH);
44
44
  const skey = jwkeys_1.keyToJson({
45
45
  k: sk,
46
46
  alg: ecma_nacl_1.box.JWK_ALG_NAME,
47
47
  use: jwkeys_1.use.MID_PKLOGIN,
48
- kid: random.stringOfB64CharsSync(KEY_ID_LEN)
48
+ kid: await random.stringOfB64Chars(KEY_ID_LEN)
49
49
  });
50
50
  const pkey = jwkeys_1.keyToJson({
51
- k: ecma_nacl_1.box.generate_pubkey(sk),
51
+ k: await cryptor.box.generate_pubkey(sk),
52
52
  alg: skey.alg,
53
53
  use: skey.use,
54
54
  kid: skey.kid
55
55
  });
56
- ecma_nacl_1.arrays.wipe(sk);
57
56
  return { skey, pkey };
58
57
  }
59
58
  class SignUp {
@@ -157,7 +156,7 @@ class SignUp {
157
156
  };
158
157
  const progressCB = sign_in_1.makeKeyGenProgressCB(progressStart, progressEnd, originalProgressCB);
159
158
  const defaultPair = await keyDeriv.deriveMidKeyPair(this.cryptor, pass, derivParams, progressCB, jwkeys_1.use.MID_PKLOGIN, '_');
160
- const labeledKey = makeLabeledMidLoginKey();
159
+ const labeledKey = await makeLabeledMidLoginKey(this.cryptor);
161
160
  this.mid = {
162
161
  defaultSKey: defaultPair.skey,
163
162
  labeledSKey: labeledKey.skey,
@@ -69,7 +69,7 @@ function makeASMailCaller(caller, objPath) {
69
69
  }
70
70
  exports.makeASMailCaller = makeASMailCaller;
71
71
  function asmailType(type) {
72
- return protobuf_msg_1.ProtoType.makeFrom('asmail.proto', `asmail.${type}`);
72
+ return protobuf_msg_1.makeProtobufTypeFrom('asmail.proto', `asmail.${type}`);
73
73
  }
74
74
  var getUserId;
75
75
  (function (getUserId) {
@@ -336,10 +336,10 @@ var addMsg;
336
336
  }
337
337
  function wrapService(fn, expServices) {
338
338
  return (reqBody) => {
339
- const { id, recipients, msg, localMeta, sendImmeditely } = requestType.unpack(reqBody);
339
+ const { id, recipients, msg, localMeta, sendImmediately } = requestType.unpack(reqBody);
340
340
  const promise = fn(protobuf_msg_1.fixArray(recipients), unpackMsg(msg, expServices), id, {
341
341
  localMeta: protobuf_msg_1.valOfOptAny(localMeta),
342
- sendImmeditely: protobuf_msg_1.valOfOpt(sendImmeditely)
342
+ sendImmediately: protobuf_msg_1.valOfOpt(sendImmediately)
343
343
  });
344
344
  return { promise };
345
345
  };
@@ -350,7 +350,7 @@ var addMsg;
350
350
  return async (recipients, msg, id, opts) => {
351
351
  const req = { id, msg: packMsg(msg, caller), recipients };
352
352
  if (opts) {
353
- req.sendImmeditely = protobuf_msg_1.toOptVal(opts.sendImmeditely);
353
+ req.sendImmediately = protobuf_msg_1.toOptVal(opts.sendImmediately);
354
354
  req.localMeta = protobuf_msg_1.toOptAny(opts.localMeta);
355
355
  }
356
356
  await caller.startPromiseCall(path, requestType.pack(req));
@@ -70,7 +70,7 @@ function exposeSrcService(src, expServices) {
70
70
  }
71
71
  exports.exposeSrcService = exposeSrcService;
72
72
  function bytesType(type) {
73
- return protobuf_msg_1.ProtoType.makeFrom('bytes.proto', `bytes.${type}`);
73
+ return protobuf_msg_1.makeProtobufTypeFrom('bytes.proto', `bytes.${type}`);
74
74
  }
75
75
  var sinkGetSize;
76
76
  (function (sinkGetSize) {
@@ -35,6 +35,9 @@ class ClientsSideImpl {
35
35
  Object.seal(this);
36
36
  }
37
37
  stop(exc) {
38
+ if (this.isStopped) {
39
+ return;
40
+ }
38
41
  this.isStopped = true;
39
42
  for (const call of this.fnCalls.values()) {
40
43
  if (call.deferred) {
@@ -113,7 +113,7 @@ class ServicesSideImpl {
113
113
  this.exposedObjs.drop(path[0]);
114
114
  }
115
115
  else {
116
- throw connector_1.makeIPCException({ invalidPath: true });
116
+ throw connector_1.makeIPCException({ invalidPath: true, path });
117
117
  }
118
118
  }
119
119
  processListObj(fnCallNum, path) {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { Observable, Observer, Subject } from "rxjs";
3
- import { ProtoType, ObjectReference, ExposedObjType, Value } from "./protobuf-msg";
3
+ import { ObjectReference, ExposedObjType, Value } from "./protobuf-msg";
4
4
  export interface ExposedServices {
5
5
  exposeDroppableService(objType: ExposedObjType, exp: ExposedFn | ExposedObj<any>, original: any): ObjectReference;
6
6
  getOriginalObj<T>(ref: ObjectReference): T;
@@ -59,7 +59,7 @@ export declare type EnvelopeBody = Buffer | void;
59
59
  export declare type MsgType = ClientToService | ServiceToClient;
60
60
  export declare type ClientToService = 'start' | 'cancel' | 'drop' | 'list-obj';
61
61
  export declare type ServiceToClient = 'interim' | 'end' | 'error';
62
- export declare const msgProtoType: ProtoType<Envelope>;
62
+ export declare const msgProtoType: import("../lib-client/protobuf-loader").ProtoType<Envelope>;
63
63
  export declare type ExposedFn = (reqBody: EnvelopeBody) => ({
64
64
  promise?: Promise<EnvelopeBody>;
65
65
  obs?: Observable<EnvelopeBody>;
@@ -18,6 +18,9 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.checkRefObjTypeIs = exports.makeIPCException = exports.msgProtoType = exports.ensureCorrectRefObjType = exports.W3N_NAME = exports.ObjectsConnector = void 0;
20
20
  const protobuf_msg_1 = require("./protobuf-msg");
21
+ // Note that make_?_Side functions could've been imported normally, but client
22
+ // side uses weakrefs, while services side doesn't, and services side is used
23
+ // in embedding without weakrefs, needing to hide require points.
21
24
  function makeServicesSide(sendMsg) {
22
25
  const srvClassFn = require('./connector-services-side').ServicesSideImpl;
23
26
  return new srvClassFn(sendMsg);
@@ -168,7 +171,7 @@ function ensureCorrectRefObjType(objType) {
168
171
  }
169
172
  }
170
173
  exports.ensureCorrectRefObjType = ensureCorrectRefObjType;
171
- exports.msgProtoType = protobuf_msg_1.ProtoType.makeFrom('ipc.proto', 'ipc.Envelope');
174
+ exports.msgProtoType = protobuf_msg_1.makeProtobufTypeFrom('ipc.proto', 'ipc.Envelope');
172
175
  function makeIPCException(fields) {
173
176
  const exc = {
174
177
  runtimeException: true,
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { ObjectReference, ProtoType, Value } from "./protobuf-msg";
2
+ import { ObjectReference, Value } from "./protobuf-msg";
3
3
  import { ExposedFn, EnvelopeBody, Caller, ExposedServices } from "./connector";
4
+ import { ProtoType } from "../lib-client/protobuf-loader";
4
5
  declare type ReadonlyFile = web3n.files.ReadonlyFile;
5
6
  declare type ReadonlyFileVersionedAPI = web3n.files.ReadonlyFileVersionedAPI;
6
7
  declare type WritableFile = web3n.files.WritableFile;
@@ -119,7 +119,7 @@ function exposeFileService(file, expServices) {
119
119
  }
120
120
  exports.exposeFileService = exposeFileService;
121
121
  function makeFileType(type) {
122
- return protobuf_msg_1.ProtoType.makeFrom('file.proto', `file.${type}`);
122
+ return protobuf_msg_1.makeProtobufTypeFrom('file.proto', `file.${type}`);
123
123
  }
124
124
  exports.fileMsgType = makeFileType('File');
125
125
  const statsMsgType = makeFileType('StatsMsg');
@@ -1,6 +1,7 @@
1
- import { ObjectReference, ProtoType, Value } from "./protobuf-msg";
1
+ import { ObjectReference, Value } from "./protobuf-msg";
2
2
  import { Caller, ExposedServices } from "./connector";
3
3
  import { FileMsg } from "./file";
4
+ import { ProtoType } from "../lib-client/protobuf-loader";
4
5
  declare type FS = web3n.files.FS;
5
6
  declare type FSItem = web3n.files.FSItem;
6
7
  export declare function makeFSCaller(caller: Caller, fsMsg: FSMsg): FS;
@@ -166,7 +166,7 @@ function exposeFSService(fs, expServices) {
166
166
  }
167
167
  exports.exposeFSService = exposeFSService;
168
168
  function makeFSType(type) {
169
- return protobuf_msg_1.ProtoType.makeFrom('fs.proto', `fs.${type}`);
169
+ return protobuf_msg_1.makeProtobufTypeFrom('fs.proto', `fs.${type}`);
170
170
  }
171
171
  exports.fsMsgType = makeFSType('FS');
172
172
  var checkPresence;
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.makeLogCaller = exports.exposeLogger = void 0;
20
20
  const protobuf_msg_1 = require("./protobuf-msg");
21
21
  function loggerType(type) {
22
- return protobuf_msg_1.ProtoType.makeFrom('logger.proto', `logger.${type}`);
22
+ return protobuf_msg_1.makeProtobufTypeFrom('logger.proto', `logger.${type}`);
23
23
  }
24
24
  const logReqType = loggerType('LogRequestBody');
25
25
  function exposeLogger(fn) {
@@ -34,7 +34,7 @@ function makeMailerIdCaller(caller, objPath) {
34
34
  }
35
35
  exports.makeMailerIdCaller = makeMailerIdCaller;
36
36
  function maileridType(type) {
37
- return protobuf_msg_1.ProtoType.makeFrom('mailerid.proto', `mailerid.${type}`);
37
+ return protobuf_msg_1.makeProtobufTypeFrom('mailerid.proto', `mailerid.${type}`);
38
38
  }
39
39
  var getUserId;
40
40
  (function (getUserId) {
@@ -79,7 +79,7 @@ message AddMsgRequestBody {
79
79
  repeated string recipients = 1;
80
80
  OutgoingMessageMsg msg = 2;
81
81
  string id = 3;
82
- common.BooleanValue send_immeditely = 4;
82
+ common.BooleanValue send_immediately = 4;
83
83
  common.AnyValue local_meta = 5;
84
84
  }
85
85
 
@@ -1,15 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import { EnvelopeBody } from './connector';
3
+ import { ProtoType } from '../lib-client/protobuf-loader';
3
4
  declare type RuntimeException = web3n.RuntimeException;
4
- export declare class ProtoType<T extends object> {
5
- private type;
6
- private constructor();
7
- static makeFrom<T extends object>(protoFile: string, typeName: string): ProtoType<T>;
8
- pack(msg: T): Buffer;
9
- unpack(bytes: Buffer | void): T;
10
- packToBase64(msg: T): string;
11
- unpackFromBase64(str: string): T;
12
- }
5
+ export declare function makeProtobufTypeFrom<T extends object>(protoFile: string, typeName: string): ProtoType<T>;
13
6
  export declare type ExposedObjType = 'FileByteSink' | 'FileByteSource' | 'FileImpl' | 'FSImpl' | 'SymLinkImpl' | 'FSCollection' | 'FSItemsIter';
14
7
  export interface ObjectReference {
15
8
  objType: ExposedObjType;
@@ -16,83 +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.valOfOptAny = exports.toOptAny = exports.toOptJson = exports.valOfOptJson = exports.valOfOpt = exports.valOf = exports.toOptVal = exports.toVal = exports.errFromMsg = exports.errToMsg = exports.errBodyType = exports.unpackInt = exports.packInt = exports.valOfOptInt = exports.fixInt = exports.fixArray = exports.strArrValType = exports.boolValType = exports.objRefType = exports.ProtoType = void 0;
20
- const protobuf = require("protobufjs");
21
- const path_1 = require("path");
19
+ exports.valOfOptAny = exports.toOptAny = exports.toOptJson = exports.valOfOptJson = exports.valOfOpt = exports.valOf = exports.toOptVal = exports.toVal = exports.errFromMsg = exports.errToMsg = exports.errBodyType = exports.unpackInt = exports.packInt = exports.valOfOptInt = exports.fixInt = exports.fixArray = exports.strArrValType = exports.boolValType = exports.objRefType = exports.makeProtobufTypeFrom = void 0;
22
20
  const connector_1 = require("./connector");
23
21
  const error_1 = require("../lib-common/exceptions/error");
24
- const fs = require("fs");
25
22
  const buffer_utils_1 = require("../lib-common/buffer-utils");
26
- class ProtoType {
27
- constructor(type) {
28
- this.type = type;
29
- Object.freeze(this);
30
- }
31
- static makeFrom(protoFile, typeName) {
32
- const root = loadRoot(protoFile);
33
- const type = root.lookupType(typeName);
34
- return new ProtoType(type);
35
- }
36
- pack(msg) {
37
- const err = this.type.verify(msg);
38
- if (err) {
39
- throw new Error(err);
40
- }
41
- return this.type.encode(msg).finish();
23
+ const protobuf_loader_1 = require("../lib-client/protobuf-loader");
24
+ function makeProtobufTypeFrom(protoFile, typeName) {
25
+ try {
26
+ // make sure to copy protos with compile step (use npm script)
27
+ return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName);
42
28
  }
43
- unpack(bytes) {
44
- if (!bytes) {
45
- throw connector_1.makeIPCException({ missingBodyBytes: true });
46
- }
47
- return this.type.decode(bytes);
48
- }
49
- packToBase64(msg) {
50
- return this.pack(msg).toString('base64');
51
- }
52
- unpackFromBase64(str) {
53
- return this.unpack(Buffer.from(str, 'base64'));
54
- }
55
- }
56
- exports.ProtoType = ProtoType;
57
- Object.freeze(ProtoType.prototype);
58
- Object.freeze(ProtoType);
59
- // make sure to copy protos with compile step (use npm script)
60
- const protosDir = path_1.resolve(__dirname, './protos');
61
- const roots = new Map();
62
- function loadRoot(fileName) {
63
- let root = roots.get(fileName);
64
- if (!root) {
65
- // if proto files file, we try to get definitions from the module
66
- try {
67
- root = protobuf.loadSync(path_1.join(protosDir, fileName));
68
- }
69
- catch (err) {
70
- // make sure to generate proto-defs with compile step (use npm script)
71
- const protos = require('./proto-defs').protos;
72
- if (!protos || (typeof protos !== 'object')) {
73
- throw new Error(`proto-defs doesn't have expected object`);
74
- }
75
- const initFunc = fs.readFileSync;
76
- try {
77
- fs.readFileSync = (fName) => {
78
- const protoDefsStr = protos[fName];
79
- if (!protoDefsStr) {
80
- throw new Error(`Don't have in module proto definition for ${fName}`);
81
- }
82
- return Buffer.from(protoDefsStr, 'utf8');
83
- };
84
- root = protobuf.loadSync(fileName);
85
- }
86
- finally {
87
- fs.readFileSync = initFunc;
88
- }
89
- }
90
- roots.set(fileName, root);
29
+ catch (err) {
30
+ // we won't get here if referenced module exists, but metro packager
31
+ // in LiqudCore needs static path require
32
+ const fallback = require('./proto-defs');
33
+ return protobuf_loader_1.ProtoType.makeFrom(__dirname, protoFile, typeName, fallback);
91
34
  }
92
- return root;
93
35
  }
36
+ exports.makeProtobufTypeFrom = makeProtobufTypeFrom;
94
37
  function commonType(type) {
95
- return ProtoType.makeFrom('common.proto', `common.${type}`);
38
+ return makeProtobufTypeFrom('common.proto', `common.${type}`);
96
39
  }
97
40
  exports.objRefType = commonType('ObjectReference');
98
41
  exports.boolValType = commonType('BooleanValue');
@@ -77,7 +77,7 @@ message AddMsgRequestBody {
77
77
  repeated string recipients = 1;
78
78
  OutgoingMessageMsg msg = 2;
79
79
  string id = 3;
80
- common.BooleanValue send_immeditely = 4;
80
+ common.BooleanValue send_immediately = 4;
81
81
  common.AnyValue local_meta = 5;
82
82
  }
83
83
 
@@ -58,7 +58,7 @@ function makeSignUpCaller(caller, objPath) {
58
58
  }
59
59
  exports.makeSignUpCaller = makeSignUpCaller;
60
60
  function startupType(type) {
61
- return protobuf_msg_1.ProtoType.makeFrom('startup.proto', `startup.${type}`);
61
+ return protobuf_msg_1.makeProtobufTypeFrom('startup.proto', `startup.${type}`);
62
62
  }
63
63
  var getAvailableAddresses;
64
64
  (function (getAvailableAddresses) {
@@ -51,7 +51,7 @@ function makeStorageCaller(caller, objPath) {
51
51
  }
52
52
  exports.makeStorageCaller = makeStorageCaller;
53
53
  function storageType(type) {
54
- return protobuf_msg_1.ProtoType.makeFrom('storage.proto', `storage.${type}`);
54
+ return protobuf_msg_1.makeProtobufTypeFrom('storage.proto', `storage.${type}`);
55
55
  }
56
56
  var getAppLocalFS;
57
57
  (function (getAppLocalFS) {
@@ -1,6 +1,20 @@
1
- import { Cryptor } from './cryptor';
2
- import { LogWarning } from '../logging/log-to-file';
3
- export declare function makeInWorkerCryptor(logWarning: LogWarning, maxThreads: number | undefined): {
4
- cryptor: Cryptor;
5
- close: () => void;
1
+ import { makeCryptor } from './cryptor';
2
+ export interface RequestMsg {
3
+ func: Func;
4
+ args: any[];
5
+ }
6
+ export declare type Func = 'scrypt' | 'box.calc_dhshared_key' | 'box.generate_pubkey' | 'sbox.open' | 'sbox.pack' | 'sbox.formatWN.open' | 'sbox.formatWN.pack' | 'sign.generate_keypair' | 'sign.signature' | 'sign.verify';
7
+ export interface ReplyMsg {
8
+ res?: any;
9
+ interim?: any;
10
+ err?: any;
11
+ }
12
+ export declare type Code = (args: any[]) => {
13
+ res: any;
14
+ trans?: ArrayBuffer[];
6
15
  };
16
+ export interface WorkerData {
17
+ loadDir: string;
18
+ }
19
+ export declare const makeInWorkerCryptor: makeCryptor;
20
+ export declare const makeInWorkerWasmCryptor: makeCryptor;