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.
- package/README.md +2 -2
- package/build/api-defs/asmail.d.ts +1 -1
- package/build/api-defs/files.d.ts +282 -70
- package/build/core/app-files.js +7 -7
- package/build/core/asmail/config/common.js +4 -4
- package/build/core/asmail/config/index.js +2 -2
- package/build/core/asmail/config/published-intro-key.js +1 -1
- package/build/core/asmail/delivery/common.js +7 -7
- package/build/core/asmail/delivery/index.js +7 -6
- package/build/core/asmail/delivery/msg.js +8 -7
- package/build/core/asmail/delivery/per-recipient-wip.js +3 -3
- package/build/core/asmail/inbox/attachments/fs.js +11 -1
- package/build/core/asmail/inbox/cached-msgs.js +3 -3
- package/build/core/asmail/inbox/inbox-events.js +5 -4
- package/build/core/asmail/inbox/index.js +12 -12
- package/build/core/asmail/inbox/msg-downloader.js +3 -3
- package/build/core/asmail/inbox/msg-indexing.js +4 -4
- package/build/core/asmail/inbox/msg-on-disk.js +7 -7
- package/build/core/asmail/index.d.ts +3 -3
- package/build/core/asmail/index.js +13 -8
- package/build/core/asmail/key-verification.js +5 -5
- package/build/core/asmail/keyring/common.js +7 -6
- package/build/core/asmail/keyring/correspondent-keys.js +8 -7
- package/build/core/asmail/keyring/id-to-email-map.js +2 -1
- package/build/core/asmail/keyring/index.d.ts +7 -8
- package/build/core/asmail/keyring/index.js +15 -14
- package/build/core/asmail/keyring/keyring-storage.js +4 -3
- package/build/core/asmail/msg/opener.js +3 -3
- package/build/core/asmail/msg/packer.js +13 -13
- package/build/core/asmail/sending-params/own-params.js +4 -4
- package/build/core/asmail/sending-params/params-from-others.js +3 -3
- package/build/core/id-manager.js +8 -5
- package/build/core/index.d.ts +2 -1
- package/build/core/index.js +14 -14
- package/build/core/sign-in.d.ts +5 -4
- package/build/core/sign-in.js +12 -14
- package/build/core/sign-up.d.ts +1 -0
- package/build/core/sign-up.js +15 -11
- package/build/core/storage/common/json-saving.d.ts +21 -0
- package/build/core/storage/common/json-saving.js +82 -0
- package/build/core/storage/common/obj-info-file.d.ts +51 -0
- package/build/core/storage/common/obj-info-file.js +153 -5
- package/build/core/storage/common/utils.d.ts +2 -0
- package/build/core/storage/common/utils.js +32 -0
- package/build/core/storage/index.d.ts +3 -17
- package/build/core/storage/index.js +57 -77
- package/build/core/storage/local/obj-files-gc.d.ts +2 -0
- package/build/core/storage/local/obj-files-gc.js +53 -39
- package/build/core/storage/local/obj-files.d.ts +6 -9
- package/build/core/storage/local/obj-files.js +16 -19
- package/build/core/storage/local/obj-status.d.ts +20 -30
- package/build/core/storage/local/obj-status.js +46 -113
- package/build/core/storage/local/storage.d.ts +15 -5
- package/build/core/storage/local/storage.js +37 -18
- package/build/core/storage/synced/downloader.js +7 -6
- package/build/core/storage/synced/obj-files-gc.d.ts +6 -1
- package/build/core/storage/synced/obj-files-gc.js +106 -13
- package/build/core/storage/synced/obj-files.d.ts +46 -47
- package/build/core/storage/synced/obj-files.js +207 -154
- package/build/core/storage/synced/obj-status.d.ts +103 -42
- package/build/core/storage/synced/obj-status.js +525 -137
- package/build/core/storage/synced/remote-events.d.ts +11 -12
- package/build/core/storage/synced/remote-events.js +80 -57
- package/build/core/storage/synced/storage.d.ts +24 -5
- package/build/core/storage/synced/storage.js +123 -38
- package/build/core/storage/synced/upload-header-file.d.ts +4 -0
- package/build/core/storage/synced/upload-header-file.js +64 -0
- package/build/core/storage/synced/upsyncer.d.ts +15 -9
- package/build/core/storage/synced/upsyncer.js +219 -246
- package/build/core/storage/system-folders/apps-data.d.ts +16 -0
- package/build/core/storage/system-folders/apps-data.js +110 -0
- package/build/core/storage/system-folders/index.d.ts +18 -0
- package/build/core/storage/system-folders/index.js +77 -0
- package/build/core-ipc/common-caps.js +3 -3
- package/build/core-ipc/generic.js +8 -8
- package/build/core-ipc/startup-caps.js +2 -2
- package/build/cryptors.js +6 -2
- package/build/ipc-via-protobuf/asmail-cap.js +67 -83
- package/build/ipc-via-protobuf/bytes.js +16 -17
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
- package/build/ipc-via-protobuf/connector-clients-side.js +62 -25
- package/build/ipc-via-protobuf/connector-services-side.js +10 -10
- package/build/ipc-via-protobuf/connector.js +4 -4
- package/build/ipc-via-protobuf/file.d.ts +48 -12
- package/build/ipc-via-protobuf/file.js +476 -120
- package/build/ipc-via-protobuf/fs.d.ts +8 -0
- package/build/ipc-via-protobuf/fs.js +592 -159
- package/build/ipc-via-protobuf/log-cap.js +2 -2
- package/build/ipc-via-protobuf/mailerid.js +3 -3
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
- package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
- package/build/ipc-via-protobuf/startup-cap.js +23 -23
- package/build/ipc-via-protobuf/storage-cap.js +12 -12
- package/build/ipc.js +7 -2
- package/build/lib-client/3nstorage/exceptions.d.ts +12 -8
- package/build/lib-client/3nstorage/exceptions.js +31 -10
- package/build/lib-client/3nstorage/service.d.ts +16 -2
- package/build/lib-client/3nstorage/service.js +109 -39
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
- package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
- package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +52 -14
- package/build/lib-client/3nstorage/xsp-fs/common.js +31 -16
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +18 -14
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
- package/build/lib-client/3nstorage/xsp-fs/file.js +74 -23
- package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +599 -189
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +45 -9
- package/build/lib-client/3nstorage/xsp-fs/fs.js +326 -74
- package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -20
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +239 -106
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +18 -19
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +5 -5
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +56 -56
- package/build/lib-client/3nweb-signup.js +4 -4
- package/build/lib-client/asmail/recipient.js +15 -15
- package/build/lib-client/asmail/sender.js +22 -22
- package/build/lib-client/asmail/service-config.js +3 -3
- package/build/lib-client/cryptor/cryptor-in-worker.js +19 -17
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.js +4 -2
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-js.js +1 -1
- package/build/lib-client/cryptor/in-proc-wasm.js +7 -7
- package/build/lib-client/cryptor/worker-js.js +2 -2
- package/build/lib-client/cryptor/worker-wasm.js +2 -2
- package/build/lib-client/files-select.js +1 -1
- package/build/lib-client/files.d.ts +1 -1
- package/build/lib-client/files.js +71 -4
- package/build/lib-client/fs-collection.js +3 -2
- package/build/lib-client/fs-sync-utils.d.ts +5 -0
- package/build/lib-client/fs-sync-utils.js +61 -0
- package/build/lib-client/fs-view.d.ts +14 -0
- package/build/lib-client/fs-view.js +33 -0
- package/build/lib-client/key-derivation.js +1 -1
- package/build/lib-client/local-files/dev-file-sink.js +9 -9
- package/build/lib-client/local-files/dev-file-src.js +2 -2
- package/build/lib-client/local-files/device-fs.d.ts +1 -1
- package/build/lib-client/local-files/device-fs.js +56 -54
- package/build/lib-client/logging/log-to-file.d.ts +1 -1
- package/build/lib-client/logging/log-to-file.js +11 -11
- package/build/lib-client/mailer-id/login.js +7 -7
- package/build/lib-client/mailer-id/provisioner.js +12 -12
- package/build/lib-client/objs-on-disk/file-writing-proc.js +5 -5
- package/build/lib-client/objs-on-disk/obj-folders.js +33 -33
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
- package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
- package/build/lib-client/request-utils.d.ts +1 -0
- package/build/lib-client/request-utils.js +14 -14
- package/build/lib-client/server-events.d.ts +3 -3
- package/build/lib-client/server-events.js +12 -10
- package/build/lib-client/service-locator.js +10 -10
- package/build/lib-client/user-with-mid-session.js +7 -7
- package/build/lib-client/user-with-pkl-session.js +25 -25
- package/build/lib-client/ws-utils.js +3 -3
- package/build/lib-common/async-cryptor-wrap.js +4 -4
- package/build/lib-common/async-fs-node.d.ts +5 -3
- package/build/lib-common/async-fs-node.js +19 -18
- package/build/lib-common/byte-streaming/pipe.js +1 -1
- package/build/lib-common/byte-streaming/wrapping.js +17 -17
- package/build/lib-common/canonical-address.js +1 -1
- package/build/lib-common/exceptions/error.d.ts +1 -0
- package/build/lib-common/exceptions/error.js +7 -6
- package/build/lib-common/exceptions/file.js +10 -1
- package/build/lib-common/ipc/generic-ipc.js +2 -2
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/json-utils.js +2 -1
- package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
- package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
- package/build/lib-common/objs-on-disk/file-layout.js +130 -12
- package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
- package/build/lib-common/objs-on-disk/obj-file.js +99 -37
- package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
- package/build/lib-common/objs-on-disk/utils.js +4 -4
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
- package/build/lib-common/processes/deferred.d.ts +6 -0
- package/build/lib-common/processes/deferred.js +30 -0
- package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
- package/build/lib-common/processes/labelled-exec-pools.js +141 -0
- package/build/lib-common/processes/pressure.d.ts +7 -0
- package/build/lib-common/processes/pressure.js +56 -0
- package/build/lib-common/processes/sleep.d.ts +1 -0
- package/build/lib-common/processes/sleep.js +26 -0
- package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
- package/build/lib-common/{processes.js → processes/synced.js} +187 -204
- package/build/lib-common/processes/timeout.d.ts +1 -0
- package/build/lib-common/processes/timeout.js +51 -0
- package/build/lib-common/random-node.js +7 -7
- package/build/lib-common/service-api/3nstorage/owner.d.ts +100 -39
- package/build/lib-common/service-api/3nstorage/owner.js +85 -42
- package/build/lib-common/service-api/asmail/delivery.js +2 -2
- package/build/lib-common/service-api/asmail/retrieval.js +1 -1
- package/build/lib-common/timed-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.js +11 -0
- package/build/lib-common/utils-for-observables.d.ts +15 -1
- package/build/lib-common/utils-for-observables.js +70 -19
- package/build/lib-common/weak-cache.d.ts +1 -0
- package/build/lib-common/weak-cache.js +12 -1
- package/build/lib-index.d.ts +2 -1
- package/build/lib-index.js +10 -7
- package/build/protos/asmail.proto.js +12912 -7127
- package/build/protos/file.proto.js +4848 -2399
- package/build/protos/fs.proto.js +9230 -3445
- package/package.json +8 -7
- package/protos/file.proto +91 -11
- package/protos/fs.proto +107 -8
- package/build/core/storage/synced/upsync-status.d.ts +0 -41
- package/build/core/storage/synced/upsync-status.js +0 -158
package/build/core/sign-in.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2018, 2020 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
|
|
@@ -34,8 +34,7 @@ class SignIn {
|
|
|
34
34
|
return !!this.completeInitWithoutCache;
|
|
35
35
|
}
|
|
36
36
|
catch (err) {
|
|
37
|
-
await this.
|
|
38
|
-
throw err;
|
|
37
|
+
throw await this.logAndWrap(err, 'Fail to start login to remote storage');
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
this.completeLoginAndLocalSetup = async (pass, progressCB) => {
|
|
@@ -44,9 +43,9 @@ class SignIn {
|
|
|
44
43
|
}
|
|
45
44
|
try {
|
|
46
45
|
const midKeyProgressCB = makeKeyGenProgressCB(0, 50, progressCB);
|
|
47
|
-
const midKeyGen = async (params) => (await key_derivation_1.deriveMidKeyPair(this.cryptor, pass, params, midKeyProgressCB)).skey;
|
|
46
|
+
const midKeyGen = async (params) => (await (0, key_derivation_1.deriveMidKeyPair)(this.cryptor, pass, params, midKeyProgressCB)).skey;
|
|
48
47
|
const storeKeyProgressCB = makeKeyGenProgressCB(51, 100, progressCB);
|
|
49
|
-
const storeKeyGen = params => key_derivation_1.deriveStorageSKey(this.cryptor, pass, params, storeKeyProgressCB);
|
|
48
|
+
const storeKeyGen = (params) => (0, key_derivation_1.deriveStorageSKey)(this.cryptor, pass, params, storeKeyProgressCB);
|
|
50
49
|
const idManager = await this.completeInitWithoutCache(midKeyGen, storeKeyGen);
|
|
51
50
|
if (!idManager) {
|
|
52
51
|
return false;
|
|
@@ -55,8 +54,7 @@ class SignIn {
|
|
|
55
54
|
return true;
|
|
56
55
|
}
|
|
57
56
|
catch (err) {
|
|
58
|
-
await this.
|
|
59
|
-
throw err;
|
|
57
|
+
throw await this.logAndWrap(err, 'Fail to initialize from a state without cache');
|
|
60
58
|
}
|
|
61
59
|
};
|
|
62
60
|
this.doneBroadcast = new rxjs_1.Subject();
|
|
@@ -64,7 +62,7 @@ class SignIn {
|
|
|
64
62
|
this.useExistingStorage = async (user, pass, progressCB) => {
|
|
65
63
|
try {
|
|
66
64
|
const storeKeyProgressCB = makeKeyGenProgressCB(0, 99, progressCB);
|
|
67
|
-
const storeKeyGen = params => key_derivation_1.deriveStorageSKey(this.cryptor, pass, params, storeKeyProgressCB);
|
|
65
|
+
const storeKeyGen = params => (0, key_derivation_1.deriveStorageSKey)(this.cryptor, pass, params, storeKeyProgressCB);
|
|
68
66
|
const res = await this.initWithCache(user, storeKeyGen);
|
|
69
67
|
if (!res) {
|
|
70
68
|
return false;
|
|
@@ -75,7 +73,7 @@ class SignIn {
|
|
|
75
73
|
}
|
|
76
74
|
progressCB(49);
|
|
77
75
|
const midKeyProgressCB = makeKeyGenProgressCB(50, 99, progressCB);
|
|
78
|
-
const midKeyGen = async (params) => (await key_derivation_1.deriveMidKeyPair(this.cryptor, pass, params, midKeyProgressCB)).skey;
|
|
76
|
+
const midKeyGen = async (params) => (await (0, key_derivation_1.deriveMidKeyPair)(this.cryptor, pass, params, midKeyProgressCB)).skey;
|
|
79
77
|
const idManager = await res(midKeyGen);
|
|
80
78
|
if (!idManager) {
|
|
81
79
|
return false;
|
|
@@ -84,8 +82,7 @@ class SignIn {
|
|
|
84
82
|
return true;
|
|
85
83
|
}
|
|
86
84
|
catch (err) {
|
|
87
|
-
await this.
|
|
88
|
-
throw err;
|
|
85
|
+
throw await this.logAndWrap(err, 'Failing to start in a state with cache');
|
|
89
86
|
}
|
|
90
87
|
};
|
|
91
88
|
Object.seal(this);
|
|
@@ -99,8 +96,9 @@ class SignIn {
|
|
|
99
96
|
};
|
|
100
97
|
return Object.freeze(service);
|
|
101
98
|
}
|
|
102
|
-
async
|
|
103
|
-
await this.logError(
|
|
99
|
+
async logAndWrap(err, msg) {
|
|
100
|
+
await this.logError(err, msg);
|
|
101
|
+
return (0, error_1.errWithCause)(err, msg);
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
104
|
exports.SignIn = SignIn;
|
|
@@ -113,7 +111,7 @@ function makeKeyGenProgressCB(progressStart, progressEnd, progressCB) {
|
|
|
113
111
|
let currentProgress = 0;
|
|
114
112
|
let totalProgress = progressStart;
|
|
115
113
|
const progressRange = progressEnd - progressStart;
|
|
116
|
-
return
|
|
114
|
+
return p => {
|
|
117
115
|
if (currentProgress >= p) {
|
|
118
116
|
return;
|
|
119
117
|
}
|
package/build/core/sign-up.d.ts
CHANGED
package/build/core/sign-up.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 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
|
|
@@ -27,6 +27,7 @@ const random = require("../lib-common/random-node");
|
|
|
27
27
|
const ecma_nacl_1 = require("ecma-nacl");
|
|
28
28
|
const sign_in_1 = require("./sign-in");
|
|
29
29
|
const rxjs_1 = require("rxjs");
|
|
30
|
+
const error_1 = require("../lib-common/exceptions/error");
|
|
30
31
|
/**
|
|
31
32
|
* With these parameters scrypt shall use memory around:
|
|
32
33
|
* (2^7)*r*N === (2^7)*(2^3)*(2^17) === 2^27 === (2^7)*(2^20) === 128MB
|
|
@@ -41,13 +42,13 @@ const SALT_LEN = 32;
|
|
|
41
42
|
const KEY_ID_LEN = 10;
|
|
42
43
|
async function makeLabeledMidLoginKey(cryptor) {
|
|
43
44
|
const sk = await random.bytes(ecma_nacl_1.box.KEY_LENGTH);
|
|
44
|
-
const skey = jwkeys_1.keyToJson({
|
|
45
|
+
const skey = (0, jwkeys_1.keyToJson)({
|
|
45
46
|
k: sk,
|
|
46
47
|
alg: ecma_nacl_1.box.JWK_ALG_NAME,
|
|
47
48
|
use: jwkeys_1.use.MID_PKLOGIN,
|
|
48
49
|
kid: await random.stringOfB64Chars(KEY_ID_LEN)
|
|
49
50
|
});
|
|
50
|
-
const pkey = jwkeys_1.keyToJson({
|
|
51
|
+
const pkey = (0, jwkeys_1.keyToJson)({
|
|
51
52
|
k: await cryptor.box.generate_pubkey(sk),
|
|
52
53
|
alg: skey.alg,
|
|
53
54
|
use: skey.use,
|
|
@@ -65,7 +66,7 @@ class SignUp {
|
|
|
65
66
|
this.store = undefined;
|
|
66
67
|
this.netLazyInit = undefined;
|
|
67
68
|
this.getAvailableAddresses = async (name, signupToken) => {
|
|
68
|
-
const addresses = await _3nweb_signup_1.checkAvailableAddressesForName(this.net, this.serviceURL, name, signupToken);
|
|
69
|
+
const addresses = await (0, _3nweb_signup_1.checkAvailableAddressesForName)(this.net, this.serviceURL, name, signupToken);
|
|
69
70
|
return addresses;
|
|
70
71
|
};
|
|
71
72
|
this.createUserParams = async (pass, progressCB) => {
|
|
@@ -74,18 +75,17 @@ class SignUp {
|
|
|
74
75
|
};
|
|
75
76
|
this.addUser = async (address, signupToken) => {
|
|
76
77
|
for (const user of await this.getUsersOnDisk()) {
|
|
77
|
-
if (canonical_address_1.areAddressesEqual(address, user)) {
|
|
78
|
+
if ((0, canonical_address_1.areAddressesEqual)(address, user)) {
|
|
78
79
|
throw new Error(`Account ${user} already exists on a disk.`);
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
const accountCreated = await _3nweb_signup_1.addUser(this.net, this.serviceURL, {
|
|
82
|
+
const accountCreated = await (0, _3nweb_signup_1.addUser)(this.net, this.serviceURL, {
|
|
82
83
|
userId: address,
|
|
83
84
|
mailerId: this.mid.params,
|
|
84
85
|
storage: this.store.params,
|
|
85
86
|
signupToken
|
|
86
87
|
}).catch(async (err) => {
|
|
87
|
-
await this.
|
|
88
|
-
throw err;
|
|
88
|
+
throw await this.logAndWrap(err, `Failed to create user account ${address}.`);
|
|
89
89
|
});
|
|
90
90
|
if (!accountCreated) {
|
|
91
91
|
return false;
|
|
@@ -113,7 +113,7 @@ class SignUp {
|
|
|
113
113
|
return this.netLazyInit;
|
|
114
114
|
}
|
|
115
115
|
setServiceURL(serviceURL) {
|
|
116
|
-
const url = url_1.parse(serviceURL);
|
|
116
|
+
const url = (0, url_1.parse)(serviceURL);
|
|
117
117
|
if (url.protocol !== 'https:') {
|
|
118
118
|
throw new Error("Url protocol must be https.");
|
|
119
119
|
}
|
|
@@ -138,7 +138,7 @@ class SignUp {
|
|
|
138
138
|
p: defaultDerivParams.p,
|
|
139
139
|
salt: buffer_utils_1.base64.pack(await random.bytes(SALT_LEN))
|
|
140
140
|
};
|
|
141
|
-
const progressCB = sign_in_1.makeKeyGenProgressCB(progressStart, progressEnd, originalProgressCB);
|
|
141
|
+
const progressCB = (0, sign_in_1.makeKeyGenProgressCB)(progressStart, progressEnd, originalProgressCB);
|
|
142
142
|
const skey = await keyDeriv.deriveStorageSKey(this.cryptor, pass, derivParams, progressCB);
|
|
143
143
|
this.store = {
|
|
144
144
|
skey: skey,
|
|
@@ -154,7 +154,7 @@ class SignUp {
|
|
|
154
154
|
p: defaultDerivParams.p,
|
|
155
155
|
salt: buffer_utils_1.base64.pack(await random.bytes(SALT_LEN))
|
|
156
156
|
};
|
|
157
|
-
const progressCB = sign_in_1.makeKeyGenProgressCB(progressStart, progressEnd, originalProgressCB);
|
|
157
|
+
const progressCB = (0, sign_in_1.makeKeyGenProgressCB)(progressStart, progressEnd, originalProgressCB);
|
|
158
158
|
const defaultPair = await keyDeriv.deriveMidKeyPair(this.cryptor, pass, derivParams, progressCB, jwkeys_1.use.MID_PKLOGIN, '_');
|
|
159
159
|
const labeledKey = await makeLabeledMidLoginKey(this.cryptor);
|
|
160
160
|
this.mid = {
|
|
@@ -169,6 +169,10 @@ class SignUp {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
+
async logAndWrap(err, msg) {
|
|
173
|
+
await this.logError(err, msg);
|
|
174
|
+
return (0, error_1.errWithCause)(err, msg);
|
|
175
|
+
}
|
|
172
176
|
forgetKeys() {
|
|
173
177
|
this.store = undefined;
|
|
174
178
|
this.mid = undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class JSONSavingProc<T> {
|
|
2
|
+
private readonly path;
|
|
3
|
+
private readonly getForSerialization;
|
|
4
|
+
private proc;
|
|
5
|
+
private jsonNeedsSaving;
|
|
6
|
+
/**
|
|
7
|
+
* @param path where json file is saved
|
|
8
|
+
* @param getForSerialization function that either returns something to
|
|
9
|
+
* jsonify and save, or undefined to remove the file.
|
|
10
|
+
* @param logError is an optional log function saving errors.
|
|
11
|
+
*/
|
|
12
|
+
constructor(path: string, getForSerialization: () => T | undefined);
|
|
13
|
+
/**
|
|
14
|
+
* This triggers saving. One may await returned promise, but doesn't have to.
|
|
15
|
+
* Several triggers can be done, but overlapping ones will save only the
|
|
16
|
+
* latest value.
|
|
17
|
+
*/
|
|
18
|
+
trigger(): Promise<void>;
|
|
19
|
+
isSaved(): boolean;
|
|
20
|
+
private save;
|
|
21
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2022 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.JSONSavingProc = void 0;
|
|
20
|
+
const async_fs_node_1 = require("../../../lib-common/async-fs-node");
|
|
21
|
+
class JSONSavingProc {
|
|
22
|
+
/**
|
|
23
|
+
* @param path where json file is saved
|
|
24
|
+
* @param getForSerialization function that either returns something to
|
|
25
|
+
* jsonify and save, or undefined to remove the file.
|
|
26
|
+
* @param logError is an optional log function saving errors.
|
|
27
|
+
*/
|
|
28
|
+
constructor(path, getForSerialization) {
|
|
29
|
+
this.path = path;
|
|
30
|
+
this.getForSerialization = getForSerialization;
|
|
31
|
+
this.proc = undefined;
|
|
32
|
+
this.jsonNeedsSaving = false;
|
|
33
|
+
Object.seal(this);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* This triggers saving. One may await returned promise, but doesn't have to.
|
|
37
|
+
* Several triggers can be done, but overlapping ones will save only the
|
|
38
|
+
* latest value.
|
|
39
|
+
*/
|
|
40
|
+
trigger() {
|
|
41
|
+
if (!this.jsonNeedsSaving) {
|
|
42
|
+
this.jsonNeedsSaving = true;
|
|
43
|
+
if (!this.proc) {
|
|
44
|
+
this.proc = this.save();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return this.proc;
|
|
48
|
+
}
|
|
49
|
+
isSaved() {
|
|
50
|
+
return !this.jsonNeedsSaving;
|
|
51
|
+
}
|
|
52
|
+
async save() {
|
|
53
|
+
try {
|
|
54
|
+
this.jsonNeedsSaving = false;
|
|
55
|
+
const serialForm = this.getForSerialization();
|
|
56
|
+
if (serialForm === undefined) {
|
|
57
|
+
await (0, async_fs_node_1.unlink)(this.path)
|
|
58
|
+
.catch((e) => {
|
|
59
|
+
if (!e.notFound) {
|
|
60
|
+
throw e;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const json = JSON.stringify(serialForm);
|
|
66
|
+
await (0, async_fs_node_1.writeFile)(this.path, json, { encoding: 'utf8' });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
if (this.jsonNeedsSaving) {
|
|
71
|
+
return this.save();
|
|
72
|
+
}
|
|
73
|
+
{
|
|
74
|
+
this.proc = undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.JSONSavingProc = JSONSavingProc;
|
|
80
|
+
Object.freeze(JSONSavingProc.prototype);
|
|
81
|
+
Object.freeze(JSONSavingProc);
|
|
82
|
+
Object.freeze(exports);
|
|
@@ -1 +1,52 @@
|
|
|
1
1
|
export declare function readJSONInfoFileIn<T>(objFolder: string, fileName: string): Promise<T | undefined>;
|
|
2
|
+
export interface VersionsInfo {
|
|
3
|
+
/**
|
|
4
|
+
* This field indicates current object version in cache.
|
|
5
|
+
*/
|
|
6
|
+
current?: number;
|
|
7
|
+
/**
|
|
8
|
+
* This is a list of archived versions in the cache.
|
|
9
|
+
*/
|
|
10
|
+
archived?: number[];
|
|
11
|
+
/**
|
|
12
|
+
* This is a map from base version to diff-ed version, that uses base.
|
|
13
|
+
*/
|
|
14
|
+
baseToDiff: {
|
|
15
|
+
[baseVersion: number]: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* This is a map from diff version to base version.
|
|
19
|
+
*/
|
|
20
|
+
diffToBase: {
|
|
21
|
+
[diffVersion: number]: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This function adds base->diff link to given versions info.
|
|
26
|
+
* @param versions
|
|
27
|
+
* @param diffVer
|
|
28
|
+
* @param baseVer
|
|
29
|
+
*/
|
|
30
|
+
export declare function addBaseToDiffLinkInVersInfo(versions: VersionsInfo, diffVer: number, baseVer: number): void;
|
|
31
|
+
export declare function isVersionIn(version: number, vers: VersionsInfo): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* This function removes given version from versions info, if it is neither
|
|
34
|
+
* archived, nor is a base for another version. If given version is itself
|
|
35
|
+
* based on another, this function is recursively applied to base version, as
|
|
36
|
+
* well.
|
|
37
|
+
* @param versions
|
|
38
|
+
* @param ver
|
|
39
|
+
*/
|
|
40
|
+
export declare function rmNonArchVersionsIn(versions: VersionsInfo, ver: number): void;
|
|
41
|
+
export declare function rmArchVersionFrom(versions: VersionsInfo, ver: number): boolean;
|
|
42
|
+
export declare function setCurrentVersionIn(versions: VersionsInfo, version: number, baseVer: number | undefined): void;
|
|
43
|
+
export declare function rmCurrentVersionIn(versions: VersionsInfo): number | undefined;
|
|
44
|
+
export declare function rmVersionIn(version: number, vers: VersionsInfo): void;
|
|
45
|
+
export declare function nonGarbageVersionsIn(versions: VersionsInfo): Set<number>;
|
|
46
|
+
export interface NonGarbageVersions {
|
|
47
|
+
gcMaxVer?: number;
|
|
48
|
+
nonGarbage: Set<number>;
|
|
49
|
+
}
|
|
50
|
+
export declare function addWithBasesTo(nonGarbage: Set<number>, ver: number | undefined, versions: VersionsInfo): void;
|
|
51
|
+
export declare function addArchived(versions: VersionsInfo, version: number): boolean;
|
|
52
|
+
export declare function isEmptyVersions(versions: VersionsInfo): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 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
|
|
@@ -13,15 +13,16 @@
|
|
|
13
13
|
See the GNU General Public License for more details.
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
|
-
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.readJSONInfoFileIn = void 0;
|
|
19
|
+
exports.isEmptyVersions = exports.addArchived = exports.addWithBasesTo = exports.nonGarbageVersionsIn = exports.rmVersionIn = exports.rmCurrentVersionIn = exports.setCurrentVersionIn = exports.rmArchVersionFrom = exports.rmNonArchVersionsIn = exports.isVersionIn = exports.addBaseToDiffLinkInVersInfo = exports.readJSONInfoFileIn = void 0;
|
|
19
20
|
const fs = require("../../../lib-common/async-fs-node");
|
|
20
21
|
const path_1 = require("path");
|
|
21
22
|
const exceptions_1 = require("../../../lib-client/3nstorage/exceptions");
|
|
22
23
|
async function readJSONInfoFileIn(objFolder, fileName) {
|
|
23
24
|
try {
|
|
24
|
-
const infoJSONStr = await fs.readFile(path_1.join(objFolder, fileName), { encoding: 'utf8' }).catch((exc) => {
|
|
25
|
+
const infoJSONStr = await fs.readFile((0, path_1.join)(objFolder, fileName), { encoding: 'utf8' }).catch((exc) => {
|
|
25
26
|
if (!exc.notFound) {
|
|
26
27
|
throw exc;
|
|
27
28
|
}
|
|
@@ -34,11 +35,158 @@ async function readJSONInfoFileIn(objFolder, fileName) {
|
|
|
34
35
|
return status;
|
|
35
36
|
}
|
|
36
37
|
catch (err) {
|
|
37
|
-
throw exceptions_1.makeStorageException({
|
|
38
|
+
throw (0, exceptions_1.makeStorageException)({
|
|
38
39
|
message: `Can't read and parse content of obj info file ${fileName} in obj folder ${objFolder}`,
|
|
39
40
|
cause: err
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
exports.readJSONInfoFileIn = readJSONInfoFileIn;
|
|
45
|
+
/**
|
|
46
|
+
* This function adds base->diff link to given versions info.
|
|
47
|
+
* @param versions
|
|
48
|
+
* @param diffVer
|
|
49
|
+
* @param baseVer
|
|
50
|
+
*/
|
|
51
|
+
function addBaseToDiffLinkInVersInfo(versions, diffVer, baseVer) {
|
|
52
|
+
if (diffVer <= baseVer) {
|
|
53
|
+
throw new Error(`Given diff version ${diffVer} is not greater than base version ${baseVer}`);
|
|
54
|
+
}
|
|
55
|
+
versions.diffToBase[diffVer] = baseVer;
|
|
56
|
+
versions.baseToDiff[baseVer] = diffVer;
|
|
57
|
+
}
|
|
58
|
+
exports.addBaseToDiffLinkInVersInfo = addBaseToDiffLinkInVersInfo;
|
|
59
|
+
function isVersionIn(version, vers) {
|
|
60
|
+
if (vers.current === version) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
if (vers.archived && vers.archived.includes(version)) {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
exports.isVersionIn = isVersionIn;
|
|
69
|
+
/**
|
|
70
|
+
* This function removes given version from versions info, if it is neither
|
|
71
|
+
* archived, nor is a base for another version. If given version is itself
|
|
72
|
+
* based on another, this function is recursively applied to base version, as
|
|
73
|
+
* well.
|
|
74
|
+
* @param versions
|
|
75
|
+
* @param ver
|
|
76
|
+
*/
|
|
77
|
+
function rmNonArchVersionsIn(versions, ver) {
|
|
78
|
+
if (versions.archived
|
|
79
|
+
&& versions.archived.includes(ver)) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (versions.baseToDiff[ver]) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const base = versions.diffToBase[ver];
|
|
86
|
+
if (base) {
|
|
87
|
+
delete versions.diffToBase[ver];
|
|
88
|
+
delete versions.baseToDiff[base];
|
|
89
|
+
rmNonArchVersionsIn(versions, base);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.rmNonArchVersionsIn = rmNonArchVersionsIn;
|
|
93
|
+
function rmArchVersionFrom(versions, ver) {
|
|
94
|
+
if (!versions.archived) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
const vInd = versions.archived.indexOf(ver);
|
|
98
|
+
if (vInd < 0) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
versions.archived.splice(vInd, 1);
|
|
102
|
+
if (versions.archived.length === 0) {
|
|
103
|
+
versions.archived = undefined;
|
|
104
|
+
}
|
|
105
|
+
rmNonArchVersionsIn(versions, ver);
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
exports.rmArchVersionFrom = rmArchVersionFrom;
|
|
109
|
+
function setCurrentVersionIn(versions, version, baseVer) {
|
|
110
|
+
if (baseVer !== undefined) {
|
|
111
|
+
// base->diff links should be added before removals
|
|
112
|
+
addBaseToDiffLinkInVersInfo(versions, version, baseVer);
|
|
113
|
+
}
|
|
114
|
+
const initCurrent = versions.current;
|
|
115
|
+
if (typeof initCurrent === 'number') {
|
|
116
|
+
rmNonArchVersionsIn(versions, initCurrent);
|
|
117
|
+
}
|
|
118
|
+
versions.current = version;
|
|
119
|
+
}
|
|
120
|
+
exports.setCurrentVersionIn = setCurrentVersionIn;
|
|
121
|
+
function rmCurrentVersionIn(versions) {
|
|
122
|
+
const current = versions.current;
|
|
123
|
+
if (typeof current === 'number') {
|
|
124
|
+
rmNonArchVersionsIn(versions, current);
|
|
125
|
+
versions.current = undefined;
|
|
126
|
+
}
|
|
127
|
+
return current;
|
|
128
|
+
}
|
|
129
|
+
exports.rmCurrentVersionIn = rmCurrentVersionIn;
|
|
130
|
+
function rmVersionIn(version, vers) {
|
|
131
|
+
if (vers.current === version) {
|
|
132
|
+
vers.current = undefined;
|
|
133
|
+
rmNonArchVersionsIn(vers, version);
|
|
134
|
+
}
|
|
135
|
+
if (isVersionIn(version, vers)) {
|
|
136
|
+
rmArchVersionFrom(vers, version);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.rmVersionIn = rmVersionIn;
|
|
140
|
+
function nonGarbageVersionsIn(versions) {
|
|
141
|
+
const nonGarbage = new Set();
|
|
142
|
+
addWithBasesTo(nonGarbage, versions.current, versions);
|
|
143
|
+
if (versions.archived) {
|
|
144
|
+
for (const archVer of versions.archived) {
|
|
145
|
+
addWithBasesTo(nonGarbage, archVer, versions);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return nonGarbage;
|
|
149
|
+
}
|
|
150
|
+
exports.nonGarbageVersionsIn = nonGarbageVersionsIn;
|
|
151
|
+
function addWithBasesTo(nonGarbage, ver, versions) {
|
|
152
|
+
while (typeof ver === 'number') {
|
|
153
|
+
if (nonGarbage.has(ver)) {
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
nonGarbage.add(ver);
|
|
157
|
+
if (!versions.diffToBase) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
ver = versions.diffToBase[ver];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.addWithBasesTo = addWithBasesTo;
|
|
164
|
+
function addArchived(versions, version) {
|
|
165
|
+
if (!versions.archived) {
|
|
166
|
+
versions.archived = [];
|
|
167
|
+
}
|
|
168
|
+
else if (versions.archived.includes(version)) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
versions.archived.push(version);
|
|
172
|
+
versions.archived.sort();
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
exports.addArchived = addArchived;
|
|
176
|
+
function isEmptyVersions(versions) {
|
|
177
|
+
if (versions.current) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
if (!versions.archived) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
else if (versions.archived.length > 0) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
versions.archived = undefined;
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.isEmptyVersions = isEmptyVersions;
|
|
44
192
|
Object.freeze(exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 - 2020 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.noop = exports.getAndRemoveOneFrom = void 0;
|
|
20
|
+
function getAndRemoveOneFrom(set) {
|
|
21
|
+
const iter = set.values();
|
|
22
|
+
const { value, done } = iter.next();
|
|
23
|
+
if (done) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
set.delete(value);
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
exports.getAndRemoveOneFrom = getAndRemoveOneFrom;
|
|
30
|
+
function noop() { }
|
|
31
|
+
exports.noop = noop;
|
|
32
|
+
Object.freeze(exports);
|
|
@@ -3,24 +3,12 @@ import { GenerateKey } from '../sign-in';
|
|
|
3
3
|
import { StorageGetter } from '../../lib-client/3nstorage/xsp-fs/common';
|
|
4
4
|
import { ServiceLocator } from '../../lib-client/service-locator';
|
|
5
5
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
6
|
-
import { NetClient } from '../../lib-client/request-utils';
|
|
7
6
|
import { StoragePathForUser } from '../app-files';
|
|
8
7
|
import { LogError } from '../../lib-client/logging/log-to-file';
|
|
8
|
+
import { MakeNet } from '..';
|
|
9
9
|
declare type WritableFS = web3n.files.WritableFS;
|
|
10
10
|
declare type StorageType = web3n.storage.StorageType;
|
|
11
11
|
declare type FSItem = web3n.files.FSItem;
|
|
12
|
-
export declare const sysFolders: {
|
|
13
|
-
appData: string;
|
|
14
|
-
apps: string;
|
|
15
|
-
packages: string;
|
|
16
|
-
sharedLibs: string;
|
|
17
|
-
userFiles: string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* This function creates initial folder structure in a given root.
|
|
21
|
-
* @param root
|
|
22
|
-
*/
|
|
23
|
-
export declare function initSysFolders(root: WritableFS): Promise<void>;
|
|
24
12
|
export declare class Storages implements FactoryOfFSs {
|
|
25
13
|
private cryptor;
|
|
26
14
|
private storageDirForUser;
|
|
@@ -42,8 +30,8 @@ export declare class Storages implements FactoryOfFSs {
|
|
|
42
30
|
* This is a storage getter for links and linking in synced storage.
|
|
43
31
|
*/
|
|
44
32
|
private storageGetterForSyncedStorage;
|
|
45
|
-
startInitFromCache(user: string, keyGen: GenerateKey, makeNet:
|
|
46
|
-
initFromRemote(user: string, getSigner: GetSigner, keyOrGen: GenerateKey | Uint8Array, makeNet:
|
|
33
|
+
startInitFromCache(user: string, keyGen: GenerateKey, makeNet: MakeNet, resolver: ServiceLocator, logError: LogError): Promise<((getSigner: GetSigner) => Promise<boolean>) | undefined>;
|
|
34
|
+
initFromRemote(user: string, getSigner: GetSigner, keyOrGen: GenerateKey | Uint8Array, makeNet: MakeNet, resolver: ServiceLocator, logError: LogError): Promise<boolean>;
|
|
47
35
|
makeSyncedFSForApp(appFolder: string): Promise<WritableFS>;
|
|
48
36
|
makeLocalFSForApp(appFolder: string): Promise<WritableFS>;
|
|
49
37
|
getUserFS(type: StorageType): Promise<FSItem>;
|
|
@@ -51,8 +39,6 @@ export declare class Storages implements FactoryOfFSs {
|
|
|
51
39
|
close(): Promise<void>;
|
|
52
40
|
wrap(): FactoryOfFSs;
|
|
53
41
|
}
|
|
54
|
-
export declare function userFilesOnDevice(): Promise<WritableFS>;
|
|
55
|
-
export declare function sysFilesOnDevice(): Promise<FSItem>;
|
|
56
42
|
export interface FactoryOfFSs {
|
|
57
43
|
makeSyncedFSForApp(appFolder: string): Promise<WritableFS>;
|
|
58
44
|
makeLocalFSForApp(appFolder: string): Promise<WritableFS>;
|