core-3nweb-client-lib 0.30.3 → 0.30.4
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/build/api-defs/asmail.d.ts +9 -6
- package/build/core/app-files.d.ts +4 -4
- package/build/core/app-files.js +2 -2
- package/build/core/asmail/asmail-cap-ipc.d.ts +1 -1
- package/build/core/asmail/asmail-cap-ipc.js +2 -3
- package/build/core/asmail/config/common.d.ts +2 -2
- package/build/core/asmail/config/index.d.ts +1 -1
- package/build/core/asmail/config/invitations-anon.d.ts +1 -1
- package/build/core/asmail/config/invitations-anon.js +1 -2
- package/build/core/asmail/config/published-intro-key.d.ts +2 -2
- package/build/core/asmail/config/published-intro-key.js +1 -2
- package/build/core/asmail/delivery/common.d.ts +6 -6
- package/build/core/asmail/delivery/common.js +3 -3
- package/build/core/asmail/delivery/index.d.ts +4 -4
- package/build/core/asmail/delivery/msg.d.ts +4 -4
- package/build/core/asmail/delivery/msg.js +3 -3
- package/build/core/asmail/inbox/attachments/fs.d.ts +1 -1
- package/build/core/asmail/inbox/attachments/fs.js +1 -2
- package/build/core/asmail/inbox/inbox-events.d.ts +4 -3
- package/build/core/asmail/inbox/inbox-events.js +1 -1
- package/build/core/asmail/inbox/index.d.ts +2 -2
- package/build/core/asmail/inbox/index.js +7 -4
- package/build/core/asmail/inbox/msg-indexing/index.d.ts +2 -2
- package/build/core/asmail/inbox/msg-indexing/logs-n-entries.d.ts +3 -3
- package/build/core/asmail/inbox/msg-indexing/logs-n-entries.js +2 -2
- package/build/core/asmail/inbox/msg-indexing/sql-indexing.d.ts +1 -1
- package/build/core/asmail/inbox/msg-indexing/sql-indexing.js +1 -2
- package/build/core/asmail/inbox/msg-on-disk.d.ts +2 -2
- package/build/core/asmail/inbox/msg-on-disk.js +3 -3
- package/build/core/asmail/index.d.ts +3 -3
- package/build/core/asmail/key-verification.js +2 -3
- package/build/core/asmail/keyring/common.d.ts +1 -1
- package/build/core/asmail/keyring/common.js +7 -7
- package/build/core/asmail/keyring/correspondent-keys.d.ts +1 -1
- package/build/core/asmail/keyring/correspondent-keys.js +5 -5
- package/build/core/asmail/keyring/index.d.ts +3 -3
- package/build/core/asmail/keyring/index.js +2 -2
- package/build/core/asmail/keyring/keyring-storage.d.ts +1 -1
- package/build/core/asmail/keyring/keyring-storage.js +1 -2
- package/build/core/asmail/msg/attachments-container.d.ts +3 -3
- package/build/core/asmail/msg/attachments-container.js +7 -8
- package/build/core/asmail/msg/opener.js +2 -2
- package/build/core/asmail/msg/packer.d.ts +2 -2
- package/build/core/asmail/sending-params/index.d.ts +3 -3
- package/build/core/asmail/sending-params/own-params.d.ts +3 -3
- package/build/core/asmail/sending-params/params-from-others.d.ts +3 -3
- package/build/core/id-manager/index.d.ts +4 -4
- package/build/core/id-manager/key-storage.d.ts +1 -1
- package/build/core/id-manager/mailerid-cap-ipc.d.ts +1 -1
- package/build/core/id-manager/mailerid-cap-ipc.js +2 -3
- package/build/core/index.d.ts +3 -3
- package/build/core/startup/sign-in.d.ts +6 -6
- package/build/core/startup/sign-in.js +2 -2
- package/build/core/startup/sign-up.d.ts +1 -1
- package/build/core/startup/sign-up.js +6 -6
- package/build/core/startup/startup-cap.d.ts +2 -2
- package/build/core/startup/startup-cap.js +4 -5
- package/build/core/storage/common/obj-info-file.js +12 -13
- package/build/core/storage/common/utils.js +2 -3
- package/build/core/storage/index.d.ts +5 -5
- package/build/core/storage/index.js +2 -2
- package/build/core/storage/local/storage.d.ts +3 -3
- package/build/core/storage/storage-cap-ipc.d.ts +1 -1
- package/build/core/storage/storage-cap-ipc.js +3 -4
- package/build/core/storage/synced/obj-files.d.ts +1 -1
- package/build/core/storage/synced/obj-status.d.ts +2 -2
- package/build/core/storage/synced/obj-status.js +2 -2
- package/build/core/storage/synced/storage.d.ts +4 -4
- package/build/core/storage/synced/upload-header-file.js +3 -3
- package/build/core/storage/synced/upsyncer.d.ts +1 -1
- package/build/core/storage/system-folders/apps-data.d.ts +1 -1
- package/build/core/storage/system-folders/index.d.ts +2 -2
- package/build/core/storage/system-folders/index.js +4 -4
- package/build/core-ipc/bytes.d.ts +2 -2
- package/build/core-ipc/bytes.js +4 -5
- package/build/core-ipc/common-caps.d.ts +1 -1
- package/build/core-ipc/common-caps.js +3 -4
- package/build/core-ipc/file.d.ts +13 -14
- package/build/core-ipc/file.js +31 -31
- package/build/core-ipc/fs.d.ts +3 -3
- package/build/core-ipc/fs.js +6 -6
- package/build/core-ipc/generic.d.ts +4 -4
- package/build/core-ipc/generic.js +3 -4
- package/build/core-ipc/log-cap.d.ts +1 -1
- package/build/core-ipc/log-cap.js +2 -3
- package/build/core-ipc/startup-caps.d.ts +1 -1
- package/build/core-ipc/startup-caps.js +2 -3
- package/build/ipc-via-protobuf/connector.d.ts +6 -7
- package/build/ipc-via-protobuf/connector.js +3 -3
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -2
- package/build/ipc-via-protobuf/protobuf-msg.js +20 -20
- package/build/lib-client/3nstorage/exceptions.d.ts +1 -1
- package/build/lib-client/3nstorage/exceptions.js +9 -10
- package/build/lib-client/3nstorage/service.d.ts +2 -2
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +3 -3
- package/build/lib-client/3nstorage/util/for-arrays.js +1 -2
- package/build/lib-client/3nstorage/xsp-fs/attrs.d.ts +1 -2
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +12 -12
- package/build/lib-client/3nstorage/xsp-fs/common.js +5 -5
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +4 -4
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +15 -15
- package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +2 -3
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +7 -7
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +27 -27
- package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +2 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +7 -7
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +11 -11
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +2 -2
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +1 -2
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +3 -4
- package/build/lib-client/3nweb-signup.js +4 -5
- package/build/lib-client/asmail/recipient.d.ts +1 -1
- package/build/lib-client/asmail/recipient.js +4 -4
- package/build/lib-client/asmail/sender.d.ts +3 -3
- package/build/lib-client/asmail/sender.js +9 -9
- package/build/lib-client/cryptor/cryptor-in-worker.d.ts +2 -2
- package/build/lib-client/cryptor/cryptor.d.ts +2 -2
- package/build/lib-client/cryptor/cryptor.js +3 -3
- package/build/lib-client/cryptor/in-proc-js.js +1 -2
- package/build/lib-client/cryptor/in-proc-wasm.js +1 -2
- package/build/lib-client/cryptor/serialization-for-wasm.d.ts +1 -2
- package/build/lib-client/cryptor/serialization-for-wasm.js +6 -7
- package/build/lib-client/cryptor/wasm-mp1-modules.js +1 -2
- package/build/lib-client/cryptor-work-labels.js +1 -1
- package/build/lib-client/fs-utils/files-select.d.ts +3 -3
- package/build/lib-client/fs-utils/files-select.js +1 -2
- package/build/lib-client/fs-utils/files.d.ts +7 -7
- package/build/lib-client/fs-utils/files.js +7 -8
- package/build/lib-client/fs-utils/fs-collection.d.ts +1 -1
- package/build/lib-client/fs-utils/fs-collection.js +2 -3
- package/build/lib-client/fs-utils/fs-sync-utils.d.ts +5 -5
- package/build/lib-client/fs-utils/fs-sync-utils.js +4 -5
- package/build/lib-client/fs-utils/fs-view.d.ts +4 -4
- package/build/lib-client/fs-utils/fs-view.js +1 -2
- package/build/lib-client/key-derivation.js +3 -4
- package/build/lib-client/local-files/dev-file-sink.d.ts +2 -3
- package/build/lib-client/local-files/dev-file-src.d.ts +0 -1
- package/build/lib-client/local-files/device-fs.d.ts +18 -18
- package/build/lib-client/logging/log-to-file.d.ts +5 -5
- package/build/lib-client/logging/log-to-file.js +2 -2
- package/build/lib-client/mailer-id/login.js +2 -3
- package/build/lib-client/objs-on-disk/file-writing-proc.d.ts +1 -1
- package/build/lib-client/objs-on-disk/obj-folders.d.ts +1 -1
- package/build/lib-client/objs-on-disk/obj-folders.js +3 -3
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +1 -1
- package/build/lib-client/protobuf-type.d.ts +0 -1
- package/build/lib-client/request-utils.d.ts +2 -4
- package/build/lib-client/request-utils.js +6 -6
- package/build/lib-client/service-locator.d.ts +3 -4
- package/build/lib-client/service-locator.js +5 -6
- package/build/lib-client/user-with-mid-session.d.ts +1 -1
- package/build/lib-client/user-with-mid-session.js +17 -17
- package/build/lib-client/user-with-pkl-session.js +16 -16
- package/build/lib-client/ws-utils.js +1 -2
- package/build/lib-common/assert.js +1 -2
- package/build/lib-common/async-cryptor-wrap.js +4 -5
- package/build/lib-common/async-fs-node.d.ts +0 -3
- package/build/lib-common/async-fs-node.js +35 -35
- package/build/lib-common/async-iter.js +2 -3
- package/build/lib-common/big-endian.d.ts +0 -1
- package/build/lib-common/big-endian.js +10 -11
- package/build/lib-common/binding.js +1 -2
- package/build/lib-common/buffer-utils.d.ts +0 -1
- package/build/lib-common/buffer-utils.js +9 -9
- package/build/lib-common/byte-streaming/bytes-fifo-buffer.js +5 -5
- package/build/lib-common/byte-streaming/pipe.d.ts +2 -2
- package/build/lib-common/byte-streaming/pipe.js +1 -2
- package/build/lib-common/byte-streaming/wrapping.d.ts +2 -2
- package/build/lib-common/byte-streaming/wrapping.js +3 -4
- package/build/lib-common/bytes-equal.js +1 -2
- package/build/lib-common/canonical-address.js +3 -4
- package/build/lib-common/exceptions/error.js +3 -4
- package/build/lib-common/exceptions/file.d.ts +2 -2
- package/build/lib-common/exceptions/file.js +7 -7
- package/build/lib-common/exceptions/http.js +2 -3
- package/build/lib-common/exceptions/runtime.js +1 -2
- package/build/lib-common/ipc/generic-ipc.d.ts +3 -3
- package/build/lib-common/ipc/generic-ipc.js +11 -11
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/json-utils.js +4 -5
- package/build/lib-common/jwkeys.d.ts +1 -1
- package/build/lib-common/jwkeys.js +13 -13
- package/build/lib-common/mid-sigs-NaCl-Ed.d.ts +3 -3
- package/build/lib-common/mid-sigs-NaCl-Ed.js +5 -5
- package/build/lib-common/obj-streaming/sink-utils.d.ts +2 -2
- package/build/lib-common/obj-streaming/sink-utils.js +2 -3
- package/build/lib-common/obj-streaming/wrapping.js +1 -2
- package/build/lib-common/objs-on-disk/file-layout.d.ts +4 -5
- package/build/lib-common/objs-on-disk/obj-file.d.ts +0 -1
- package/build/lib-common/objs-on-disk/utils.d.ts +3 -5
- package/build/lib-common/objs-on-disk/utils.js +5 -6
- package/build/lib-common/objs-on-disk/v1-obj-file-format.d.ts +0 -1
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +1 -1
- package/build/lib-common/processes/deferred.js +1 -2
- package/build/lib-common/processes/sleep.js +1 -2
- package/build/lib-common/processes/synced.d.ts +1 -1
- package/build/lib-common/processes/synced.js +2 -2
- package/build/lib-common/processes/timeout.js +1 -2
- package/build/lib-common/random-node.js +10 -11
- package/build/lib-common/service-api/3nstorage/owner.js +19 -19
- package/build/lib-common/service-api/asmail/config.js +3 -3
- package/build/lib-common/service-api/asmail/delivery.js +8 -8
- package/build/lib-common/service-api/asmail/retrieval.js +11 -11
- package/build/lib-common/service-api/mailer-id/login.js +2 -2
- package/build/lib-common/service-api/mailer-id/provisioning.js +2 -2
- package/build/lib-common/service-api/pub-key-login.js +2 -2
- package/build/lib-common/service-api/web-socket-base.d.ts +1 -1
- package/build/lib-common/service-api/web-socket-base.js +3 -3
- package/build/lib-common/session-encryptor.js +1 -2
- package/build/lib-common/timed-cache.js +1 -2
- package/build/lib-common/user-admin-api/signup.js +4 -4
- package/build/lib-common/utils-for-observables.js +5 -5
- package/build/lib-sqlite-on-3nstorage/deferred.js +1 -2
- package/build/lib-sqlite-on-3nstorage/index.d.ts +5 -5
- package/build/lib-sqlite-on-3nstorage/index.js +2 -2
- package/build/lib-sqlite-on-3nstorage/synced.d.ts +1 -1
- package/build/lib-sqlite-on-3nstorage/synced.js +2 -2
- package/build/raw-3nweb-clients.d.ts +7 -7
- package/build/raw-3nweb-clients.js +2 -2
- package/package.json +2 -2
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.readonlyWrapFSCollection = readonlyWrapFSCollection;
|
|
20
|
+
exports.makeFSCollection = makeFSCollection;
|
|
20
21
|
const rxjs_1 = require("rxjs");
|
|
21
22
|
const utils_for_observables_1 = require("../../lib-common/utils-for-observables");
|
|
22
23
|
class FSItemsCollection {
|
|
@@ -97,9 +98,7 @@ function readonlyWrapFSCollection(c) {
|
|
|
97
98
|
};
|
|
98
99
|
return Object.freeze(w);
|
|
99
100
|
}
|
|
100
|
-
exports.readonlyWrapFSCollection = readonlyWrapFSCollection;
|
|
101
101
|
function makeFSCollection() {
|
|
102
102
|
return (new FSItemsCollection()).wrap();
|
|
103
103
|
}
|
|
104
|
-
exports.makeFSCollection = makeFSCollection;
|
|
105
104
|
Object.freeze(exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Observable } from "rxjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
type WritableFS = web3n.files.WritableFS;
|
|
3
|
+
type ReadonlyFS = web3n.files.ReadonlyFS;
|
|
4
|
+
type RemoteEvent = web3n.files.RemoteEvent;
|
|
5
|
+
type FileEvent = web3n.files.FileEvent;
|
|
6
|
+
type FolderEvent = web3n.files.FolderEvent;
|
|
7
7
|
export declare function getRemoteFolderChanges(fs: WritableFS, forceServerCheck?: boolean): Promise<void>;
|
|
8
8
|
export declare function getOrMakeAndUploadFolderIn(fs: WritableFS, folder: string): Promise<WritableFS>;
|
|
9
9
|
export declare function uploadFolderChangesIfAny(fs: WritableFS): Promise<void>;
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.getRemoteFolderChanges = getRemoteFolderChanges;
|
|
20
|
+
exports.getOrMakeAndUploadFolderIn = getOrMakeAndUploadFolderIn;
|
|
21
|
+
exports.uploadFolderChangesIfAny = uploadFolderChangesIfAny;
|
|
22
|
+
exports.observableFromTreeEvents = observableFromTreeEvents;
|
|
20
23
|
const rxjs_1 = require("rxjs");
|
|
21
24
|
const exceptions_1 = require("../3nstorage/exceptions");
|
|
22
25
|
async function getRemoteFolderChanges(fs, forceServerCheck = false) {
|
|
@@ -38,7 +41,6 @@ async function getRemoteFolderChanges(fs, forceServerCheck = false) {
|
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
exports.getRemoteFolderChanges = getRemoteFolderChanges;
|
|
42
44
|
async function getOrMakeAndUploadFolderIn(fs, folder) {
|
|
43
45
|
try {
|
|
44
46
|
const childFolder = await fs.writableSubRoot(folder, { create: false });
|
|
@@ -56,7 +58,6 @@ async function getOrMakeAndUploadFolderIn(fs, folder) {
|
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
exports.getOrMakeAndUploadFolderIn = getOrMakeAndUploadFolderIn;
|
|
60
61
|
async function uploadFolderChangesIfAny(fs) {
|
|
61
62
|
const { state } = await fs.v.sync.status('');
|
|
62
63
|
if (state === 'unsynced') {
|
|
@@ -64,9 +65,7 @@ async function uploadFolderChangesIfAny(fs) {
|
|
|
64
65
|
await fs.v.sync.upload('');
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
exports.uploadFolderChangesIfAny = uploadFolderChangesIfAny;
|
|
68
68
|
function observableFromTreeEvents(fs, rootPath) {
|
|
69
69
|
return new rxjs_1.Observable(obs => fs.watchTree(rootPath, undefined, obs));
|
|
70
70
|
}
|
|
71
|
-
exports.observableFromTreeEvents = observableFromTreeEvents;
|
|
72
71
|
Object.freeze(exports);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type ReadonlyFS = web3n.files.ReadonlyFS;
|
|
2
|
+
type WritableFS = web3n.files.WritableFS;
|
|
3
|
+
type WritableFile = web3n.files.WritableFile;
|
|
4
4
|
export interface FSReadView extends ReadonlyFS {
|
|
5
5
|
}
|
|
6
6
|
export interface FSWriteView extends WritableFS {
|
|
7
7
|
rollbackWrite(): Promise<void>;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type FSWrite = FSReadView | FSWriteView;
|
|
10
10
|
export interface FileWriteView extends WritableFile {
|
|
11
11
|
rollbackWrite(): Promise<void>;
|
|
12
12
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.readonlyFSView =
|
|
19
|
+
exports.readonlyFSView = readonlyFSView;
|
|
20
20
|
async function readonlyFSView(fs, state) {
|
|
21
21
|
// XXX
|
|
22
22
|
// Notes:
|
|
@@ -29,5 +29,4 @@ async function readonlyFSView(fs, state) {
|
|
|
29
29
|
// as being part of sync wall.
|
|
30
30
|
throw new Error('Function not implemented.');
|
|
31
31
|
}
|
|
32
|
-
exports.readonlyFSView = readonlyFSView;
|
|
33
32
|
Object.freeze(exports);
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.checkParams = checkParams;
|
|
19
|
+
exports.deriveStorageSKey = deriveStorageSKey;
|
|
20
|
+
exports.deriveMidKeyPair = deriveMidKeyPair;
|
|
19
21
|
const jwkeys_1 = require("../lib-common/jwkeys");
|
|
20
22
|
const buffer_utils_1 = require("../lib-common/buffer-utils");
|
|
21
23
|
const ecma_nacl_1 = require("ecma-nacl");
|
|
@@ -34,13 +36,11 @@ function checkParams(params) {
|
|
|
34
36
|
}
|
|
35
37
|
return true;
|
|
36
38
|
}
|
|
37
|
-
exports.checkParams = checkParams;
|
|
38
39
|
function deriveStorageSKey(cryptor, pass, derivParams, progressCB) {
|
|
39
40
|
const passBytes = buffer_utils_1.utf8.pack(pass);
|
|
40
41
|
const saltBytes = buffer_utils_1.base64.open(derivParams.salt);
|
|
41
42
|
return cryptor.scrypt(passBytes, saltBytes, derivParams.logN, derivParams.r, derivParams.p, ecma_nacl_1.secret_box.KEY_LENGTH, progressCB);
|
|
42
43
|
}
|
|
43
|
-
exports.deriveStorageSKey = deriveStorageSKey;
|
|
44
44
|
async function deriveMidKeyPair(cryptor, pass, derivParams, progressCB, use = '', kid = '') {
|
|
45
45
|
const passBytes = buffer_utils_1.utf8.pack(pass);
|
|
46
46
|
const saltBytes = buffer_utils_1.base64.open(derivParams.salt);
|
|
@@ -57,5 +57,4 @@ async function deriveMidKeyPair(cryptor, pass, derivParams, progressCB, use = ''
|
|
|
57
57
|
pkey: pkeyJSON
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
exports.deriveMidKeyPair = deriveMidKeyPair;
|
|
61
60
|
Object.freeze(exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import * as fs from '../../lib-common/async-fs-node';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type FileByteSink = web3n.files.FileByteSink;
|
|
3
|
+
type Layout = web3n.files.FileLayout;
|
|
5
4
|
export declare class DevFileByteSink implements FileByteSink {
|
|
6
5
|
private readonly path;
|
|
7
6
|
private readonly pathPrefixMaskLen;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { LinkParameters, Linkable } from '../fs-utils/files';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
type Stats = web3n.files.Stats;
|
|
3
|
+
type FS = web3n.files.FS;
|
|
4
|
+
type WritableFS = web3n.files.WritableFS;
|
|
5
|
+
type ReadonlyFS = web3n.files.ReadonlyFS;
|
|
6
|
+
type File = web3n.files.File;
|
|
7
|
+
type WritableFile = web3n.files.WritableFile;
|
|
8
|
+
type ReadonlyFile = web3n.files.ReadonlyFile;
|
|
9
|
+
type FSType = web3n.files.FSType;
|
|
10
|
+
type ListingEntry = web3n.files.ListingEntry;
|
|
11
|
+
type SymLink = web3n.files.SymLink;
|
|
12
|
+
type FolderEvent = web3n.files.FolderEvent;
|
|
13
|
+
type FileEvent = web3n.files.FileEvent;
|
|
14
|
+
type Observer<T> = web3n.Observer<T>;
|
|
15
|
+
type SelectCriteria = web3n.files.SelectCriteria;
|
|
16
|
+
type FSCollection = web3n.files.FSCollection;
|
|
17
|
+
type FileByteSource = web3n.files.FileByteSource;
|
|
18
|
+
type FileByteSink = web3n.files.FileByteSink;
|
|
19
|
+
type XAttrsChanges = web3n.files.XAttrsChanges;
|
|
20
20
|
interface FolderLinkParams {
|
|
21
21
|
path: string;
|
|
22
22
|
}
|
|
@@ -2,10 +2,10 @@ export declare const LOGS_FOLDER = "logs";
|
|
|
2
2
|
export declare function makeLogger(utilDir: string): Readonly<{
|
|
3
3
|
logError: (err: any, msg?: string) => Promise<void>;
|
|
4
4
|
logWarning: (msg: string, err?: any) => Promise<void>;
|
|
5
|
-
appLog: (type:
|
|
5
|
+
appLog: (type: "error" | "info" | "warning", appDomain: string, msg: string, err?: any) => Promise<void>;
|
|
6
6
|
recordUnhandledRejectionsInProcess: () => void;
|
|
7
7
|
}>;
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
8
|
+
export type Logger = ReturnType<typeof makeLogger>;
|
|
9
|
+
export type LogError = Logger['logError'];
|
|
10
|
+
export type LogWarning = Logger['logWarning'];
|
|
11
|
+
export type AppLog = Logger['appLog'];
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.LOGS_FOLDER = void 0;
|
|
20
|
+
exports.makeLogger = makeLogger;
|
|
20
21
|
const error_1 = require("../../lib-common/exceptions/error");
|
|
21
22
|
const synced_1 = require("../../lib-common/processes/synced");
|
|
22
23
|
const async_fs_node_1 = require("../../lib-common/async-fs-node");
|
|
@@ -127,6 +128,5 @@ ${(0, error_1.stringifyErr)(err)}`;
|
|
|
127
128
|
logError, logWarning, appLog, recordUnhandledRejectionsInProcess
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
|
-
exports.makeLogger = makeLogger;
|
|
131
131
|
function noop() { }
|
|
132
132
|
Object.freeze(exports);
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.startMidSession = startMidSession;
|
|
20
|
+
exports.authenticateMidSession = authenticateMidSession;
|
|
20
21
|
const api = require("../../lib-common/service-api/mailer-id/login");
|
|
21
22
|
const request_utils_1 = require("../request-utils");
|
|
22
23
|
const url_1 = require("url");
|
|
@@ -53,7 +54,6 @@ async function startMidSession(userId, net, loginUrl) {
|
|
|
53
54
|
throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
exports.startMidSession = startMidSession;
|
|
57
57
|
async function authenticateMidSession(sessionId, midSigner, net, loginUrl) {
|
|
58
58
|
const domain = (0, url_1.parse)(loginUrl).hostname;
|
|
59
59
|
const reqData = {
|
|
@@ -81,5 +81,4 @@ async function authenticateMidSession(sessionId, midSigner, net, loginUrl) {
|
|
|
81
81
|
throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
exports.authenticateMidSession = authenticateMidSession;
|
|
85
84
|
Object.freeze(exports);
|
|
@@ -19,7 +19,7 @@ export interface Cfg {
|
|
|
19
19
|
export interface CfgWithGens extends Cfg {
|
|
20
20
|
generations: GenerationCfg[];
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type CanMoveObjToDeeperCache = (objId: string, folderPath: string) => Promise<boolean>;
|
|
23
23
|
export declare class ObjFolders {
|
|
24
24
|
private readonly path;
|
|
25
25
|
private readonly numOfSplits;
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.ObjFolders =
|
|
19
|
+
exports.ObjFolders = void 0;
|
|
20
|
+
exports.makeNotFoundExc = makeNotFoundExc;
|
|
21
|
+
exports.makeAlreadyExistExc = makeAlreadyExistExc;
|
|
20
22
|
const fs = require("../../lib-common/async-fs-node");
|
|
21
23
|
const synced_1 = require("../../lib-common/processes/synced");
|
|
22
24
|
const xsp_files_1 = require("xsp-files");
|
|
@@ -31,7 +33,6 @@ function makeNotFoundExc(msg) {
|
|
|
31
33
|
notFound: true
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
|
-
exports.makeNotFoundExc = makeNotFoundExc;
|
|
35
36
|
function makeAlreadyExistExc(msg) {
|
|
36
37
|
return {
|
|
37
38
|
runtimeException: true,
|
|
@@ -40,7 +41,6 @@ function makeAlreadyExistExc(msg) {
|
|
|
40
41
|
alreadyExist: true
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
exports.makeAlreadyExistExc = makeAlreadyExistExc;
|
|
44
44
|
function alreadyExistsOrReThrow(exc) {
|
|
45
45
|
if (!exc.alreadyExists) {
|
|
46
46
|
throw exc;
|
|
@@ -4,7 +4,7 @@ import { FileWrite } from './file-writing-proc';
|
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
5
|
import { NotOnDiskFiniteChunk, FiniteChunk } from '../../lib-common/objs-on-disk/file-layout';
|
|
6
6
|
import { DiffInfo } from '../../lib-common/service-api/3nstorage/owner';
|
|
7
|
-
export
|
|
7
|
+
export type GetBaseSegsOnDisk = (version: number, ofs: number, len: number) => Promise<(Uint8Array | NotOnDiskFiniteChunk)[]>;
|
|
8
8
|
export declare class ObjOnDisk {
|
|
9
9
|
readonly objId: ObjId;
|
|
10
10
|
readonly version: number;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { HTTPException } from '../lib-common/exceptions/http';
|
|
4
2
|
import * as https from 'https';
|
|
5
3
|
import { ClientRequest } from 'http';
|
|
@@ -28,8 +26,8 @@ export interface RequestOpts {
|
|
|
28
26
|
export interface Headers {
|
|
29
27
|
get(name: string): string | undefined;
|
|
30
28
|
}
|
|
31
|
-
export
|
|
32
|
-
export
|
|
29
|
+
export type ContentType = 'application/json' | 'application/octet-stream' | 'text/plain';
|
|
30
|
+
export type RequestFn<T> = (opts: RequestOpts, contentType?: ContentType, reqBody?: Uint8Array) => Promise<Reply<T>>;
|
|
33
31
|
export declare function processRequest<T>(requester: (opts: https.RequestOptions) => ClientRequest, httpsOpts: https.RequestOptions, opts: RequestOpts, reqBody: Uint8Array | undefined, attempt?: number): Promise<Reply<T>>;
|
|
34
32
|
export declare function formHttpsReqOpts(opts: RequestOpts, contentType?: ContentType, reqBody?: Uint8Array): https.RequestOptions;
|
|
35
33
|
/**
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.CONTENT_TYPE_HEADER = exports.SESSION_ID_HEADER = void 0;
|
|
19
|
+
exports.processRequest = processRequest;
|
|
20
|
+
exports.formHttpsReqOpts = formHttpsReqOpts;
|
|
21
|
+
exports.makeException = makeException;
|
|
22
|
+
exports.extractIntHeader = extractIntHeader;
|
|
23
|
+
exports.makeNetClient = makeNetClient;
|
|
19
24
|
const http_1 = require("../lib-common/exceptions/http");
|
|
20
25
|
const bytes_fifo_buffer_1 = require("../lib-common/byte-streaming/bytes-fifo-buffer");
|
|
21
26
|
const https = require("https");
|
|
@@ -43,7 +48,6 @@ async function processRequest(requester, httpsOpts, opts, reqBody, attempt = 0)
|
|
|
43
48
|
throw err;
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
|
-
exports.processRequest = processRequest;
|
|
47
51
|
function formHttpsReqOpts(opts, contentType, reqBody) {
|
|
48
52
|
if (!opts.url) {
|
|
49
53
|
throw new Error(`Cannot send net request, cause url is not set in given options.`);
|
|
@@ -71,7 +75,6 @@ function formHttpsReqOpts(opts, contentType, reqBody) {
|
|
|
71
75
|
}
|
|
72
76
|
return netReqOpts;
|
|
73
77
|
}
|
|
74
|
-
exports.formHttpsReqOpts = formHttpsReqOpts;
|
|
75
78
|
async function attachRequestReaders(clReq, opts) {
|
|
76
79
|
// XXX do something for timeouts, that doesn't break good long connections
|
|
77
80
|
// const timeout = (opts.timeout ? opts.timeout : DEFAULT_TIMEOUT);
|
|
@@ -173,7 +176,6 @@ function makeHeaders(headers) {
|
|
|
173
176
|
function makeException(rep, errMsg) {
|
|
174
177
|
return (0, http_1.makeHTTPException)(rep.url, rep.method, rep.status, errMsg);
|
|
175
178
|
}
|
|
176
|
-
exports.makeException = makeException;
|
|
177
179
|
function extractIntHeader(rep, headerName) {
|
|
178
180
|
const intHeader = parseInt(rep.headers.get(headerName));
|
|
179
181
|
if (isNaN(intHeader)) {
|
|
@@ -181,7 +183,6 @@ function extractIntHeader(rep, headerName) {
|
|
|
181
183
|
}
|
|
182
184
|
return intHeader;
|
|
183
185
|
}
|
|
184
|
-
exports.extractIntHeader = extractIntHeader;
|
|
185
186
|
function makeNodeRequest() {
|
|
186
187
|
const nodeRequest = (opts) => https.request(opts);
|
|
187
188
|
return (opts, contentType, reqBody) => {
|
|
@@ -215,5 +216,4 @@ function makeNetClient(request = makeNodeRequest()) {
|
|
|
215
216
|
};
|
|
216
217
|
return Object.freeze(client);
|
|
217
218
|
}
|
|
218
|
-
exports.makeNetClient = makeNetClient;
|
|
219
219
|
Object.freeze(exports);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { SignedLoad } from '../lib-common/jwkeys';
|
|
3
2
|
import { NetClient } from './request-utils';
|
|
4
3
|
import { promises as dnsPromises } from 'dns';
|
|
@@ -35,9 +34,9 @@ export interface StorageRoutes {
|
|
|
35
34
|
* @param url
|
|
36
35
|
*/
|
|
37
36
|
export declare function storageInfoAt(client: NetClient, url: string): Promise<StorageRoutes>;
|
|
38
|
-
export
|
|
39
|
-
export
|
|
40
|
-
export
|
|
37
|
+
export type ServiceTypeDNSLabel = 'mailerid' | 'asmail' | '3nstorage';
|
|
38
|
+
export type ServiceLocatorMaker = (serviceLabel: ServiceTypeDNSLabel) => ServiceLocator;
|
|
39
|
+
export type ServiceLocator = (address: string) => Promise<string>;
|
|
41
40
|
export declare function makeServiceLocator(resolver: {
|
|
42
41
|
resolveTxt: (typeof dnsPromises)['resolveTxt'];
|
|
43
42
|
}): ServiceLocatorMaker;
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.asmailInfoAt = asmailInfoAt;
|
|
20
|
+
exports.mailerIdInfoAt = mailerIdInfoAt;
|
|
21
|
+
exports.storageInfoAt = storageInfoAt;
|
|
22
|
+
exports.makeServiceLocator = makeServiceLocator;
|
|
23
|
+
exports.getMailerIdInfoFor = getMailerIdInfoFor;
|
|
20
24
|
const jwkeys_1 = require("../lib-common/jwkeys");
|
|
21
25
|
const url_1 = require("url");
|
|
22
26
|
const request_utils_1 = require("./request-utils");
|
|
@@ -74,7 +78,6 @@ async function asmailInfoAt(client, url) {
|
|
|
74
78
|
Object.freeze(transform);
|
|
75
79
|
return transform;
|
|
76
80
|
}
|
|
77
|
-
exports.asmailInfoAt = asmailInfoAt;
|
|
78
81
|
/**
|
|
79
82
|
* This returns a promise, resolvable to MailerIdRoutes object.
|
|
80
83
|
* @param client
|
|
@@ -101,7 +104,6 @@ async function mailerIdInfoAt(client, url) {
|
|
|
101
104
|
Object.freeze(transform);
|
|
102
105
|
return transform;
|
|
103
106
|
}
|
|
104
|
-
exports.mailerIdInfoAt = mailerIdInfoAt;
|
|
105
107
|
/**
|
|
106
108
|
* This returns a promise, resolvable to StorageRoutes object.
|
|
107
109
|
* @param client
|
|
@@ -122,7 +124,6 @@ async function storageInfoAt(client, url) {
|
|
|
122
124
|
}
|
|
123
125
|
return transform;
|
|
124
126
|
}
|
|
125
|
-
exports.storageInfoAt = storageInfoAt;
|
|
126
127
|
/**
|
|
127
128
|
* @param address
|
|
128
129
|
* @return domain string, extracted from a given address
|
|
@@ -253,7 +254,6 @@ function makeServiceLocator(resolver) {
|
|
|
253
254
|
}
|
|
254
255
|
};
|
|
255
256
|
}
|
|
256
|
-
exports.makeServiceLocator = makeServiceLocator;
|
|
257
257
|
/**
|
|
258
258
|
* @param resolver
|
|
259
259
|
* @param address
|
|
@@ -268,5 +268,4 @@ async function getMailerIdInfoFor(resolver, client, address) {
|
|
|
268
268
|
domain: rootAddr
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
-
exports.getMailerIdInfoFor = getMailerIdInfoFor;
|
|
272
271
|
Object.freeze(exports);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Reply, RequestOpts, NetClient } from '../lib-client/request-utils';
|
|
6
6
|
import { user as mid } from '../lib-common/mid-sigs-NaCl-Ed';
|
|
7
7
|
import * as WebSocket from 'ws';
|
|
8
|
-
export
|
|
8
|
+
export type IGetMailerIdSigner = () => Promise<mid.MailerIdSigner>;
|
|
9
9
|
export declare abstract class ServiceUser {
|
|
10
10
|
readonly userId: string;
|
|
11
11
|
private getSigner;
|
|
@@ -28,23 +28,6 @@ const url_1 = require("url");
|
|
|
28
28
|
const login_1 = require("./mailer-id/login");
|
|
29
29
|
const assert_1 = require("../lib-common/assert");
|
|
30
30
|
class ServiceUser {
|
|
31
|
-
constructor(userId, opts, getSigner, getInitServiceURI, net) {
|
|
32
|
-
this.userId = userId;
|
|
33
|
-
this.getSigner = getSigner;
|
|
34
|
-
this.getInitServiceURI = getInitServiceURI;
|
|
35
|
-
this.net = net;
|
|
36
|
-
this.uri = undefined;
|
|
37
|
-
this.redirectedFrom = undefined;
|
|
38
|
-
this.sessionId = undefined;
|
|
39
|
-
this.loginProc = undefined;
|
|
40
|
-
this.loginUrlPart = opts.login;
|
|
41
|
-
if ((this.loginUrlPart.length > 0)
|
|
42
|
-
&& (this.loginUrlPart[this.loginUrlPart.length - 1] !== '/')) {
|
|
43
|
-
this.loginUrlPart += '/';
|
|
44
|
-
}
|
|
45
|
-
this.logoutUrlEnd = opts.logout;
|
|
46
|
-
this.canBeRedirected = !!opts.canBeRedirected;
|
|
47
|
-
}
|
|
48
31
|
get serviceURI() {
|
|
49
32
|
return this.uri;
|
|
50
33
|
}
|
|
@@ -64,6 +47,23 @@ class ServiceUser {
|
|
|
64
47
|
get loginUrl() {
|
|
65
48
|
return `${this.serviceURI}${this.loginUrlPart}`;
|
|
66
49
|
}
|
|
50
|
+
constructor(userId, opts, getSigner, getInitServiceURI, net) {
|
|
51
|
+
this.userId = userId;
|
|
52
|
+
this.getSigner = getSigner;
|
|
53
|
+
this.getInitServiceURI = getInitServiceURI;
|
|
54
|
+
this.net = net;
|
|
55
|
+
this.uri = undefined;
|
|
56
|
+
this.redirectedFrom = undefined;
|
|
57
|
+
this.sessionId = undefined;
|
|
58
|
+
this.loginProc = undefined;
|
|
59
|
+
this.loginUrlPart = opts.login;
|
|
60
|
+
if ((this.loginUrlPart.length > 0)
|
|
61
|
+
&& (this.loginUrlPart[this.loginUrlPart.length - 1] !== '/')) {
|
|
62
|
+
this.loginUrlPart += '/';
|
|
63
|
+
}
|
|
64
|
+
this.logoutUrlEnd = opts.logout;
|
|
65
|
+
this.canBeRedirected = !!opts.canBeRedirected;
|
|
66
|
+
}
|
|
67
67
|
get isUriSet() {
|
|
68
68
|
return (typeof this.serviceURI === 'string');
|
|
69
69
|
}
|
|
@@ -29,6 +29,22 @@ const loginApi = require("../lib-common/service-api/pub-key-login");
|
|
|
29
29
|
const url_1 = require("url");
|
|
30
30
|
const assert_1 = require("../lib-common/assert");
|
|
31
31
|
class ServiceUser {
|
|
32
|
+
get serviceURI() {
|
|
33
|
+
return this.uri;
|
|
34
|
+
}
|
|
35
|
+
set serviceURI(uriString) {
|
|
36
|
+
const u = (0, url_1.parse)(uriString);
|
|
37
|
+
if (u.protocol !== 'https:') {
|
|
38
|
+
throw new Error("Url protocol must be https.");
|
|
39
|
+
}
|
|
40
|
+
if (!u.host) {
|
|
41
|
+
throw new Error("Host name is missing.");
|
|
42
|
+
}
|
|
43
|
+
this.uri = `${u.protocol}//${u.host}${u.pathname}`;
|
|
44
|
+
if (!this.uri.endsWith('/')) {
|
|
45
|
+
this.uri += '/';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
32
48
|
constructor(userId, opts, net) {
|
|
33
49
|
this.userId = userId;
|
|
34
50
|
this.net = net;
|
|
@@ -51,22 +67,6 @@ class ServiceUser {
|
|
|
51
67
|
this.logoutUrlEnd = opts.logout;
|
|
52
68
|
this.canBeRedirected = !!opts.canBeRedirected;
|
|
53
69
|
}
|
|
54
|
-
get serviceURI() {
|
|
55
|
-
return this.uri;
|
|
56
|
-
}
|
|
57
|
-
set serviceURI(uriString) {
|
|
58
|
-
const u = (0, url_1.parse)(uriString);
|
|
59
|
-
if (u.protocol !== 'https:') {
|
|
60
|
-
throw new Error("Url protocol must be https.");
|
|
61
|
-
}
|
|
62
|
-
if (!u.host) {
|
|
63
|
-
throw new Error("Host name is missing.");
|
|
64
|
-
}
|
|
65
|
-
this.uri = `${u.protocol}//${u.host}${u.pathname}`;
|
|
66
|
-
if (!this.uri.endsWith('/')) {
|
|
67
|
-
this.uri += '/';
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
70
|
async startSession(keyId) {
|
|
71
71
|
const reqData = {
|
|
72
72
|
userId: this.userId,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.openSocket =
|
|
18
|
+
exports.openSocket = openSocket;
|
|
19
19
|
const WebSocket = require("ws");
|
|
20
20
|
const request_utils_1 = require("./request-utils");
|
|
21
21
|
const deferred_1 = require("../lib-common/processes/deferred");
|
|
@@ -54,5 +54,4 @@ function openSocket(url, sessionId) {
|
|
|
54
54
|
});
|
|
55
55
|
return opening.promise;
|
|
56
56
|
}
|
|
57
|
-
exports.openSocket = openSocket;
|
|
58
57
|
Object.freeze(exports);
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.assert =
|
|
18
|
+
exports.assert = assert;
|
|
19
19
|
function assert(ok, errMsg) {
|
|
20
20
|
if (!ok) {
|
|
21
21
|
throw new Error(errMsg);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
exports.assert = assert;
|
|
25
24
|
Object.freeze(exports);
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.makeEncryptor = makeEncryptor;
|
|
19
|
+
exports.makeDecryptor = makeDecryptor;
|
|
20
|
+
exports.makeDecryptorForKeyPair = makeDecryptorForKeyPair;
|
|
21
|
+
exports.makeEncryptorWithKeyPair = makeEncryptorWithKeyPair;
|
|
19
22
|
const xsp_files_1 = require("xsp-files");
|
|
20
23
|
const ecma_nacl_1 = require("ecma-nacl");
|
|
21
24
|
const buffer_utils_1 = require("./buffer-utils");
|
|
@@ -85,7 +88,6 @@ function makeEncryptor(cryptor, workLabel, key, nextNonce, delta) {
|
|
|
85
88
|
};
|
|
86
89
|
return Object.freeze(encryptor);
|
|
87
90
|
}
|
|
88
|
-
exports.makeEncryptor = makeEncryptor;
|
|
89
91
|
/**
|
|
90
92
|
* @param cryptor
|
|
91
93
|
* @param workLabel
|
|
@@ -119,19 +121,16 @@ function makeDecryptor(cryptor, workLabel, key) {
|
|
|
119
121
|
};
|
|
120
122
|
return Object.freeze(decryptor);
|
|
121
123
|
}
|
|
122
|
-
exports.makeDecryptor = makeDecryptor;
|
|
123
124
|
function makeDecryptorForKeyPair(cryptor, workLabel, pkey, skey) {
|
|
124
125
|
const dhSharedKey = ecma_nacl_1.box.calc_dhshared_key(pkey, skey);
|
|
125
126
|
const decryptor = makeDecryptor(cryptor, workLabel, dhSharedKey);
|
|
126
127
|
dhSharedKey.fill(0);
|
|
127
128
|
return decryptor;
|
|
128
129
|
}
|
|
129
|
-
exports.makeDecryptorForKeyPair = makeDecryptorForKeyPair;
|
|
130
130
|
function makeEncryptorWithKeyPair(cryptor, workLabel, pkey, skey, nextNonce, delta) {
|
|
131
131
|
const dhSharedKey = ecma_nacl_1.box.calc_dhshared_key(pkey, skey);
|
|
132
132
|
const decryptor = makeEncryptor(cryptor, workLabel, dhSharedKey, nextNonce, delta);
|
|
133
133
|
dhSharedKey.fill(0);
|
|
134
134
|
return decryptor;
|
|
135
135
|
}
|
|
136
|
-
exports.makeEncryptorWithKeyPair = makeEncryptorWithKeyPair;
|
|
137
136
|
Object.freeze(exports);
|