core-3nweb-client-lib 0.34.2 → 0.35.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/build/api-defs/asmail.d.ts +70 -5
- package/build/api-defs/common-caps.d.ts +3 -0
- package/build/api-defs/keys.d.ts +154 -0
- package/build/api-defs/mailerid.d.ts +8 -0
- package/build/api-defs/web3n.d.ts +1 -0
- package/build/core/asmail/asmail-cap-ipc.js +20 -1
- package/build/core/asmail/config.d.ts +16 -0
- package/build/core/asmail/config.js +43 -0
- package/build/core/asmail/delivery/common.d.ts +2 -2
- package/build/core/asmail/delivery/common.js +2 -1
- package/build/core/asmail/delivery/index.d.ts +2 -1
- package/build/core/asmail/delivery/index.js +4 -1
- package/build/core/asmail/delivery/per-recipient-wip.js +1 -1
- package/build/core/asmail/inbox/attachments/fs.d.ts +1 -1
- package/build/core/asmail/inbox/attachments/fs.js +2 -2
- package/build/core/asmail/inbox/index.d.ts +6 -6
- package/build/core/asmail/inbox/index.js +1 -1
- package/build/core/asmail/inbox/msg-indexing/index.d.ts +1 -1
- package/build/core/asmail/inbox/msg-indexing/logs-n-entries.d.ts +1 -1
- package/build/core/asmail/index.d.ts +4 -4
- package/build/core/asmail/index.js +11 -22
- package/build/core/asmail/key-verification.d.ts +5 -4
- package/build/core/asmail/key-verification.js +2 -1
- package/build/core/asmail/msg/common.d.ts +5 -4
- package/build/core/asmail/msg/opener.d.ts +4 -4
- package/build/core/asmail/msg/opener.js +1 -1
- package/build/core/asmail/msg/packer.d.ts +3 -3
- package/build/core/asmail/msg/packer.js +2 -2
- package/build/core/asmail/sending-params/index.d.ts +7 -6
- package/build/core/asmail/sending-params/index.js +21 -12
- package/build/core/asmail/sending-params/invitations-anon.d.ts +35 -0
- package/build/core/asmail/sending-params/invitations-anon.js +164 -0
- package/build/core/asmail/sending-params/own-params.d.ts +10 -19
- package/build/core/asmail/sending-params/own-params.js +27 -20
- package/build/core/asmail/sending-params/params-from-others.d.ts +7 -11
- package/build/core/asmail/sending-params/params-from-others.js +32 -23
- package/build/core/id-manager/index.d.ts +1 -1
- package/build/core/id-manager/key-storage.d.ts +1 -1
- package/build/core/index.d.ts +3 -0
- package/build/core/index.js +39 -11
- package/build/core/{asmail/keyring → keyring}/common.d.ts +3 -1
- package/build/core/{asmail/keyring → keyring}/common.js +2 -2
- package/build/core/{asmail/keyring → keyring}/correspondent-keys.d.ts +5 -3
- package/build/core/{asmail/keyring → keyring}/correspondent-keys.js +5 -5
- package/build/core/keyring/index.d.ts +72 -0
- package/build/core/{asmail/keyring → keyring}/index.js +68 -59
- package/build/core/{asmail/keyring → keyring}/keyring-storage.js +1 -1
- package/build/core/keyring/keyrings-cap-ipc.d.ts +5 -0
- package/build/core/keyring/keyrings-cap-ipc.js +50 -0
- package/build/core/keyring/published-intro-key.d.ts +43 -0
- package/build/core/keyring/published-intro-key.js +176 -0
- package/build/core/startup/sign-up.d.ts +1 -1
- package/build/core/storage/common/constants.d.ts +4 -0
- package/build/core/storage/common/constants.js +24 -0
- package/build/core/storage/common/obj-info-file.js +1 -1
- package/build/core/storage/index.d.ts +7 -1
- package/build/core/storage/index.js +33 -3
- package/build/core/storage/local/obj-files.d.ts +1 -1
- package/build/core/storage/local/obj-status.d.ts +1 -1
- package/build/core/storage/local/obj-status.js +1 -1
- package/build/core/storage/local/storage.d.ts +1 -1
- package/build/core/storage/local/storage.js +2 -2
- package/build/core/storage/synced/downloader.d.ts +2 -2
- package/build/core/storage/synced/obj-files.d.ts +3 -3
- package/build/core/storage/synced/obj-files.js +1 -1
- package/build/core/storage/synced/obj-status.d.ts +1 -1
- package/build/core/storage/synced/obj-status.js +1 -1
- package/build/core/storage/synced/remote-events.d.ts +2 -2
- package/build/core/storage/synced/storage.d.ts +2 -2
- package/build/core/storage/synced/storage.js +5 -5
- package/build/core/storage/synced/upload-header-file.d.ts +1 -1
- package/build/core/storage/synced/upsyncer.d.ts +1 -1
- package/build/core/storage/synced/upsyncer.js +1 -1
- package/build/core-ipc/common-caps.js +4 -0
- package/build/lib-client/3nstorage/{service.d.ts → storage-owner.d.ts} +1 -4
- package/build/lib-client/3nstorage/{service.js → storage-owner.js} +21 -25
- package/build/lib-client/asmail/recipient.d.ts +0 -3
- package/build/lib-client/asmail/recipient.js +19 -17
- package/build/lib-client/asmail/service-config.d.ts +9 -5
- package/build/lib-client/asmail/service-config.js +42 -17
- package/build/lib-client/cryptor/cryptor-in-worker.js +1 -1
- package/build/lib-client/cryptor/in-proc-js.js +1 -1
- package/build/lib-client/cryptor/in-proc-wasm.js +1 -1
- package/build/lib-client/fs-utils/fs-sync-utils.js +1 -1
- package/build/lib-client/key-derivation.d.ts +2 -1
- package/build/lib-client/objs-on-disk/obj-folders.d.ts +1 -1
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +1 -1
- package/build/lib-client/request-utils.js +4 -2
- package/build/lib-client/service-locator.d.ts +2 -1
- package/build/lib-client/user-with-mid-session.d.ts +6 -5
- package/build/lib-client/user-with-mid-session.js +4 -4
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/attrs.js +3 -3
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/common.d.ts +2 -2
- package/build/lib-client/{3nstorage → xsp-fs}/exceptions.d.ts +1 -1
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/file-node.d.ts +1 -1
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/file-node.js +4 -4
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/file.d.ts +1 -1
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/file.js +5 -5
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/folder-node-serialization.js +3 -3
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/folder-node.d.ts +1 -1
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/folder-node.js +9 -9
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/fs.d.ts +1 -1
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/fs.js +6 -6
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/link-node.d.ts +1 -1
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/link-node.js +2 -2
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/node-in-fs.js +6 -6
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/node-persistence.js +4 -4
- package/build/lib-client/{3nstorage → xsp-fs}/util/file-based-json.d.ts +10 -4
- package/build/lib-client/{3nstorage → xsp-fs}/util/file-based-json.js +33 -15
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/xsp-payload-v1.js +3 -3
- package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/xsp-payload-v2.js +5 -5
- package/build/lib-common/jwkeys.d.ts +6 -106
- package/build/lib-common/mid-sigs-NaCl-Ed.d.ts +4 -1
- package/build/lib-common/service-api/asmail/config.d.ts +9 -30
- package/build/lib-common/service-api/asmail/config.js +4 -1
- package/build/lib-common/service-api/asmail/delivery.d.ts +5 -12
- package/build/lib-common/service-api/asmail/delivery.js +3 -0
- package/build/lib-common/service-api/mailer-id/login.d.ts +3 -6
- package/build/lib-common/service-api/mailer-id/provisioning.d.ts +6 -7
- package/build/lib-common/service-api/mailer-id/provisioning.js +3 -0
- package/build/lib-common/user-admin-api/signup.d.ts +2 -1
- package/build/raw-3nweb-clients.d.ts +1 -1
- package/build/raw-3nweb-clients.js +2 -2
- package/package.json +2 -2
- package/build/core/asmail/config/common.d.ts +0 -24
- package/build/core/asmail/config/common.js +0 -87
- package/build/core/asmail/config/index.d.ts +0 -47
- package/build/core/asmail/config/index.js +0 -69
- package/build/core/asmail/config/invitations-anon.d.ts +0 -13
- package/build/core/asmail/config/invitations-anon.js +0 -99
- package/build/core/asmail/config/published-intro-key.d.ts +0 -17
- package/build/core/asmail/config/published-intro-key.js +0 -104
- package/build/core/asmail/keyring/index.d.ts +0 -36
- /package/build/core/{asmail/keyring → keyring}/id-to-email-map.d.ts +0 -0
- /package/build/core/{asmail/keyring → keyring}/id-to-email-map.js +0 -0
- /package/build/core/{asmail/keyring → keyring}/keyring-storage.d.ts +0 -0
- /package/build/lib-client/{cryptor-work-labels.d.ts → cryptor/cryptor-work-labels.d.ts} +0 -0
- /package/build/lib-client/{cryptor-work-labels.js → cryptor/cryptor-work-labels.js} +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/attrs.d.ts +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/common.js +0 -0
- /package/build/lib-client/{3nstorage → xsp-fs}/exceptions.js +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/folder-node-serialization.d.ts +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/node-in-fs.d.ts +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/node-persistence.d.ts +0 -0
- /package/build/lib-client/{3nstorage → xsp-fs}/util/for-arrays.d.ts +0 -0
- /package/build/lib-client/{3nstorage → xsp-fs}/util/for-arrays.js +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/xsp-payload-v1.d.ts +0 -0
- /package/build/lib-client/{3nstorage/xsp-fs → xsp-fs}/xsp-payload-v2.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ScryptGenParams } from '
|
|
1
|
+
import { ScryptGenParams } from '../key-derivation';
|
|
2
2
|
import { AsyncSBoxCryptor, Subscribe, ObjSource } from 'xsp-files';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
-
import { LogError } from '
|
|
4
|
+
import { LogError } from '../logging/log-to-file';
|
|
5
5
|
export { AsyncSBoxCryptor } from 'xsp-files';
|
|
6
6
|
export { FolderInJSON } from './folder-node';
|
|
7
7
|
type StorageType = web3n.files.FSType;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* reliance set.
|
|
4
4
|
*/
|
|
5
5
|
import { NodeInFS } from './node-in-fs';
|
|
6
|
-
import { LinkParameters } from '
|
|
6
|
+
import { LinkParameters } from '../fs-utils/files';
|
|
7
7
|
import { Storage, AsyncSBoxCryptor } from './common';
|
|
8
8
|
import { Subscribe, ObjSource } from 'xsp-files';
|
|
9
9
|
import { CommonAttrs, XAttrs } from './attrs';
|
|
@@ -22,12 +22,12 @@ exports.FileNode = void 0;
|
|
|
22
22
|
* reliance set.
|
|
23
23
|
*/
|
|
24
24
|
const node_in_fs_1 = require("./node-in-fs");
|
|
25
|
-
const buffer_utils_1 = require("
|
|
26
|
-
const deferred_1 = require("
|
|
25
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
26
|
+
const deferred_1 = require("../../lib-common/processes/deferred");
|
|
27
27
|
const xsp_files_1 = require("xsp-files");
|
|
28
|
-
const assert_1 = require("
|
|
28
|
+
const assert_1 = require("../../lib-common/assert");
|
|
29
29
|
const attrs_1 = require("./attrs");
|
|
30
|
-
const file_1 = require("
|
|
30
|
+
const file_1 = require("../../lib-common/exceptions/file");
|
|
31
31
|
const node_persistence_1 = require("./node-persistence");
|
|
32
32
|
async function fileAttrsFrom(payload) {
|
|
33
33
|
const attrs = payload.getAttrs();
|
|
@@ -21,12 +21,12 @@ exports.FileObject = void 0;
|
|
|
21
21
|
* Everything in this module is assumed to be inside of a file system
|
|
22
22
|
* reliance set.
|
|
23
23
|
*/
|
|
24
|
-
const file_1 = require("
|
|
25
|
-
const files_1 = require("
|
|
24
|
+
const file_1 = require("../../lib-common/exceptions/file");
|
|
25
|
+
const files_1 = require("../fs-utils/files");
|
|
26
26
|
const file_node_1 = require("./file-node");
|
|
27
|
-
const buffer_utils_1 = require("
|
|
28
|
-
const pipe_1 = require("
|
|
29
|
-
const utils_for_observables_1 = require("
|
|
27
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
28
|
+
const pipe_1 = require("../../lib-common/byte-streaming/pipe");
|
|
29
|
+
const utils_for_observables_1 = require("../../lib-common/utils-for-observables");
|
|
30
30
|
class FileObject {
|
|
31
31
|
constructor(name, isNew, node, makeOrGetNode, writable, isInSyncedStorage) {
|
|
32
32
|
this.name = name;
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.parseFolderInfo = parseFolderInfo;
|
|
20
20
|
exports.serializeFolderInfo = serializeFolderInfo;
|
|
21
|
-
const buffer_utils_1 = require("
|
|
21
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
22
22
|
const xsp_files_1 = require("xsp-files");
|
|
23
|
-
const big_endian_1 = require("
|
|
24
|
-
const assert_1 = require("
|
|
23
|
+
const big_endian_1 = require("../../lib-common/big-endian");
|
|
24
|
+
const assert_1 = require("../../lib-common/assert");
|
|
25
25
|
const ver1Serialization = new Uint8Array([1]);
|
|
26
26
|
function parseFolderInfo(bytes) {
|
|
27
27
|
if (!bytes) {
|
|
@@ -2,7 +2,7 @@ import { Storage, NodeType } from './common';
|
|
|
2
2
|
import { NodeInFS } from './node-in-fs';
|
|
3
3
|
import { FileNode } from './file-node';
|
|
4
4
|
import { LinkNode } from './link-node';
|
|
5
|
-
import { LinkParameters } from '
|
|
5
|
+
import { LinkParameters } from '../fs-utils/files';
|
|
6
6
|
import { AsyncSBoxCryptor, Subscribe, ObjSource } from 'xsp-files';
|
|
7
7
|
import { CommonAttrs, XAttrs } from './attrs';
|
|
8
8
|
import { NodePersistance } from './node-persistence';
|
|
@@ -21,23 +21,23 @@ exports.FolderNode = void 0;
|
|
|
21
21
|
* Everything in this module is assumed to be inside of a file system
|
|
22
22
|
* reliance set.
|
|
23
23
|
*/
|
|
24
|
-
const buffer_utils_1 = require("
|
|
25
|
-
const file_1 = require("
|
|
26
|
-
const error_1 = require("
|
|
24
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
25
|
+
const file_1 = require("../../lib-common/exceptions/file");
|
|
26
|
+
const error_1 = require("../../lib-common/exceptions/error");
|
|
27
27
|
const common_1 = require("./common");
|
|
28
28
|
const node_in_fs_1 = require("./node-in-fs");
|
|
29
29
|
const file_node_1 = require("./file-node");
|
|
30
30
|
const link_node_1 = require("./link-node");
|
|
31
|
-
const exceptions_1 = require("
|
|
32
|
-
const deferred_1 = require("
|
|
33
|
-
const json_utils_1 = require("
|
|
31
|
+
const exceptions_1 = require("./exceptions");
|
|
32
|
+
const deferred_1 = require("../../lib-common/processes/deferred");
|
|
33
|
+
const json_utils_1 = require("../../lib-common/json-utils");
|
|
34
34
|
const xsp_files_1 = require("xsp-files");
|
|
35
|
-
const random = require("
|
|
35
|
+
const random = require("../../lib-common/random-node");
|
|
36
36
|
const folder_node_serialization_1 = require("./folder-node-serialization");
|
|
37
37
|
const attrs_1 = require("./attrs");
|
|
38
38
|
const node_persistence_1 = require("./node-persistence");
|
|
39
|
-
const assert_1 = require("
|
|
40
|
-
const for_arrays_1 = require("
|
|
39
|
+
const assert_1 = require("../../lib-common/assert");
|
|
40
|
+
const for_arrays_1 = require("./util/for-arrays");
|
|
41
41
|
function jsonToInfoAndAttrs(json) {
|
|
42
42
|
const folderInfo = {
|
|
43
43
|
nodes: (0, json_utils_1.copy)(json.nodes)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FolderNode, FolderLinkParams, FolderInJSON } from './folder-node';
|
|
2
2
|
import { FileNode } from './file-node';
|
|
3
3
|
import { Storage } from './common';
|
|
4
|
-
import { LinkParameters } from '
|
|
4
|
+
import { LinkParameters } from '../fs-utils/files';
|
|
5
5
|
import { NodeInFS } from './node-in-fs';
|
|
6
6
|
type Stats = web3n.files.Stats;
|
|
7
7
|
type FS = web3n.files.FS;
|
|
@@ -21,19 +21,19 @@ exports.XspFS = void 0;
|
|
|
21
21
|
* Everything in this module is assumed to be inside of a file system
|
|
22
22
|
* reliance set, exposing to outside only file system's wrap.
|
|
23
23
|
*/
|
|
24
|
-
const file_1 = require("
|
|
24
|
+
const file_1 = require("../../lib-common/exceptions/file");
|
|
25
25
|
const folder_node_1 = require("./folder-node");
|
|
26
26
|
const file_2 = require("./file");
|
|
27
27
|
const common_1 = require("./common");
|
|
28
|
-
const files_1 = require("
|
|
29
|
-
const files_select_1 = require("
|
|
28
|
+
const files_1 = require("../fs-utils/files");
|
|
29
|
+
const files_select_1 = require("../fs-utils/files-select");
|
|
30
30
|
const path_1 = require("path");
|
|
31
|
-
const pipe_1 = require("
|
|
32
|
-
const buffer_utils_1 = require("
|
|
31
|
+
const pipe_1 = require("../../lib-common/byte-streaming/pipe");
|
|
32
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
33
33
|
const rxjs_1 = require("rxjs");
|
|
34
34
|
const operators_1 = require("rxjs/operators");
|
|
35
35
|
const node_in_fs_1 = require("./node-in-fs");
|
|
36
|
-
const utils_for_observables_1 = require("
|
|
36
|
+
const utils_for_observables_1 = require("../../lib-common/utils-for-observables");
|
|
37
37
|
function splitPathIntoParts(path) {
|
|
38
38
|
return path_1.posix.resolve('/', path).split('/').filter(part => !!part);
|
|
39
39
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* reliance set.
|
|
4
4
|
*/
|
|
5
5
|
import { NodeInFS } from './node-in-fs';
|
|
6
|
-
import { LinkParameters } from '
|
|
6
|
+
import { LinkParameters } from '../fs-utils/files';
|
|
7
7
|
import { Storage, AsyncSBoxCryptor } from './common';
|
|
8
8
|
import { ObjSource, Subscribe } from 'xsp-files';
|
|
9
9
|
import { CommonAttrs, XAttrs } from './attrs';
|
|
@@ -22,8 +22,8 @@ exports.LinkNode = void 0;
|
|
|
22
22
|
* reliance set.
|
|
23
23
|
*/
|
|
24
24
|
const node_in_fs_1 = require("./node-in-fs");
|
|
25
|
-
const buffer_utils_1 = require("
|
|
26
|
-
const device_fs_1 = require("
|
|
25
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
26
|
+
const device_fs_1 = require("../local-files/device-fs");
|
|
27
27
|
const file_1 = require("./file");
|
|
28
28
|
const fs_1 = require("./fs");
|
|
29
29
|
const xsp_files_1 = require("xsp-files");
|
|
@@ -22,16 +22,16 @@ exports.shouldReadCurrentVersion = shouldReadCurrentVersion;
|
|
|
22
22
|
* Everything in this module is assumed to be inside of a file system
|
|
23
23
|
* reliance set.
|
|
24
24
|
*/
|
|
25
|
-
const synced_1 = require("
|
|
25
|
+
const synced_1 = require("../../lib-common/processes/synced");
|
|
26
26
|
const common_1 = require("./common");
|
|
27
|
-
const file_1 = require("
|
|
28
|
-
const error_1 = require("
|
|
29
|
-
const exceptions_1 = require("
|
|
27
|
+
const file_1 = require("../../lib-common/exceptions/file");
|
|
28
|
+
const error_1 = require("../../lib-common/exceptions/error");
|
|
29
|
+
const exceptions_1 = require("./exceptions");
|
|
30
30
|
const rxjs_1 = require("rxjs");
|
|
31
31
|
const operators_1 = require("rxjs/operators");
|
|
32
32
|
const attrs_1 = require("./attrs");
|
|
33
|
-
const assert_1 = require("
|
|
34
|
-
const runtime_1 = require("
|
|
33
|
+
const assert_1 = require("../../lib-common/assert");
|
|
34
|
+
const runtime_1 = require("../../lib-common/exceptions/runtime");
|
|
35
35
|
class NodeInFS {
|
|
36
36
|
get version() {
|
|
37
37
|
return this.currentVersion;
|
|
@@ -22,10 +22,10 @@ exports.NodePersistance = void 0;
|
|
|
22
22
|
* reliance set.
|
|
23
23
|
*/
|
|
24
24
|
const xsp_files_1 = require("xsp-files");
|
|
25
|
-
const buffer_utils_1 = require("
|
|
26
|
-
const deferred_1 = require("
|
|
27
|
-
const random = require("
|
|
28
|
-
const cryptor_work_labels_1 = require("
|
|
25
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
26
|
+
const deferred_1 = require("../../lib-common/processes/deferred");
|
|
27
|
+
const random = require("../../lib-common/random-node");
|
|
28
|
+
const cryptor_work_labels_1 = require("../cryptor/cryptor-work-labels");
|
|
29
29
|
const pv1 = require("./xsp-payload-v1");
|
|
30
30
|
const pv2 = require("./xsp-payload-v2");
|
|
31
31
|
const SEG_SIZE = 16; // in 256-byte blocks = 4K in bytes
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
+
import { SingleProc } from '../../../lib-common/processes/synced';
|
|
1
2
|
type WritableFile = web3n.files.WritableFile;
|
|
2
3
|
type FileEvent = web3n.files.FileEvent;
|
|
3
4
|
type RemoteEvent = web3n.files.RemoteEvent;
|
|
4
|
-
export
|
|
5
|
+
export type FileEventHandler = (ev: FileEvent | RemoteEvent) => Promise<void>;
|
|
6
|
+
export declare class JsonFileProc<T> {
|
|
7
|
+
private readonly onFileEvent;
|
|
8
|
+
readonly order: SingleProc;
|
|
5
9
|
private proc;
|
|
6
10
|
private file;
|
|
11
|
+
constructor(onFileEvent: FileEventHandler, order?: SingleProc);
|
|
7
12
|
start(file: WritableFile, initVal: T | (() => T) | (() => Promise<T>)): Promise<void>;
|
|
8
|
-
protected abstract onFileEvent(ev: FileEvent | RemoteEvent): Promise<void>;
|
|
9
13
|
close(): Promise<void>;
|
|
10
14
|
private ensureActive;
|
|
15
|
+
writeFile(val: T): Promise<number>;
|
|
11
16
|
/**
|
|
12
17
|
* This saves a given json to file, returning a promise, resolvable to new
|
|
13
18
|
* file version.
|
|
14
19
|
* @param val is a json to be saved to file
|
|
15
20
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
save(val: T, orderOperation?: boolean): Promise<number>;
|
|
22
|
+
private readFile;
|
|
23
|
+
get(orderOperation?: boolean): Promise<{
|
|
18
24
|
json: T;
|
|
19
25
|
version: number;
|
|
20
26
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2017, 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2017, 2020, 2025 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -19,17 +19,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.JsonFileProc = void 0;
|
|
20
20
|
const rxjs_1 = require("rxjs");
|
|
21
21
|
const operators_1 = require("rxjs/operators");
|
|
22
|
+
const synced_1 = require("../../../lib-common/processes/synced");
|
|
23
|
+
// XXX File proc can have general flow for sync
|
|
22
24
|
class JsonFileProc {
|
|
23
|
-
constructor() {
|
|
25
|
+
constructor(onFileEvent, order = new synced_1.SingleProc()) {
|
|
26
|
+
this.onFileEvent = onFileEvent;
|
|
27
|
+
this.order = order;
|
|
24
28
|
this.proc = undefined;
|
|
25
29
|
this.file = undefined;
|
|
30
|
+
Object.seal(this);
|
|
26
31
|
}
|
|
27
32
|
async start(file, initVal) {
|
|
28
33
|
if (this.proc) {
|
|
29
34
|
throw new Error(`Json file process is already started`);
|
|
30
35
|
}
|
|
31
|
-
if (!file.writable || !file.v) {
|
|
32
|
-
throw new Error(`Given file is expected to be both writable and versioned.`);
|
|
36
|
+
if (!file.writable || !file.v || !file.v.sync) {
|
|
37
|
+
throw new Error(`Given file is expected to be both writable and versioned from a synchronized storage.`);
|
|
33
38
|
}
|
|
34
39
|
this.file = file;
|
|
35
40
|
if (this.file.isNew) {
|
|
@@ -42,32 +47,45 @@ class JsonFileProc {
|
|
|
42
47
|
.pipe((0, operators_1.mergeMap)(ev => this.onFileEvent(ev), 1))
|
|
43
48
|
.subscribe();
|
|
44
49
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
close() {
|
|
51
|
+
return this.order.startOrChain(async () => {
|
|
52
|
+
if (!this.proc) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.proc.unsubscribe();
|
|
56
|
+
this.proc = undefined;
|
|
57
|
+
this.file = undefined;
|
|
58
|
+
});
|
|
52
59
|
}
|
|
53
60
|
ensureActive() {
|
|
54
61
|
if (!this.proc) {
|
|
55
62
|
throw new Error(`Json file process is either not yet initialized, or already closed.`);
|
|
56
63
|
}
|
|
57
64
|
}
|
|
65
|
+
writeFile(val) {
|
|
66
|
+
this.ensureActive();
|
|
67
|
+
// XXX should we also add v.sync operation(s) ?
|
|
68
|
+
return this.file.v.writeJSON(val);
|
|
69
|
+
}
|
|
58
70
|
/**
|
|
59
71
|
* This saves a given json to file, returning a promise, resolvable to new
|
|
60
72
|
* file version.
|
|
61
73
|
* @param val is a json to be saved to file
|
|
62
74
|
*/
|
|
63
|
-
save(val) {
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
save(val, orderOperation = true) {
|
|
76
|
+
return (orderOperation ?
|
|
77
|
+
this.order.startOrChain(() => this.writeFile(val)) :
|
|
78
|
+
this.writeFile(val));
|
|
66
79
|
}
|
|
67
|
-
|
|
80
|
+
readFile() {
|
|
68
81
|
this.ensureActive();
|
|
69
82
|
return this.file.v.readJSON();
|
|
70
83
|
}
|
|
84
|
+
get(orderOperation = true) {
|
|
85
|
+
return (orderOperation ?
|
|
86
|
+
this.order.startOrChain(() => this.readFile()) :
|
|
87
|
+
this.readFile());
|
|
88
|
+
}
|
|
71
89
|
}
|
|
72
90
|
exports.JsonFileProc = JsonFileProc;
|
|
73
91
|
Object.freeze(JsonFileProc.prototype);
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.makeReadonlyPayload = makeReadonlyPayload;
|
|
20
|
-
const assert_1 = require("
|
|
21
|
-
const file_1 = require("
|
|
22
|
-
const synced_1 = require("
|
|
20
|
+
const assert_1 = require("../../lib-common/assert");
|
|
21
|
+
const file_1 = require("../../lib-common/exceptions/file");
|
|
22
|
+
const synced_1 = require("../../lib-common/processes/synced");
|
|
23
23
|
const attrs_1 = require("./attrs");
|
|
24
24
|
async function makeReadonlyPayload(src) {
|
|
25
25
|
const payload = await ReadonlyPayloadV1.makeFor(src);
|
|
@@ -19,12 +19,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.makeReadonlyPayload = makeReadonlyPayload;
|
|
20
20
|
exports.makeWritablePayload = makeWritablePayload;
|
|
21
21
|
exports.makeWritablePayloadFromBase = makeWritablePayloadFromBase;
|
|
22
|
-
const assert_1 = require("
|
|
23
|
-
const big_endian_1 = require("
|
|
22
|
+
const assert_1 = require("../../lib-common/assert");
|
|
23
|
+
const big_endian_1 = require("../../lib-common/big-endian");
|
|
24
24
|
const attrs_1 = require("./attrs");
|
|
25
|
-
const synced_1 = require("
|
|
26
|
-
const wrapping_1 = require("
|
|
27
|
-
const buffer_utils_1 = require("
|
|
25
|
+
const synced_1 = require("../../lib-common/processes/synced");
|
|
26
|
+
const wrapping_1 = require("../../lib-common/byte-streaming/wrapping");
|
|
27
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
28
28
|
async function makeReadonlyPayload(src) {
|
|
29
29
|
const payload = await ReadonlyPayloadV2.makeFor(src);
|
|
30
30
|
return payload;
|
|
@@ -1,104 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This is key's id.
|
|
8
|
-
*/
|
|
9
|
-
kid: string;
|
|
10
|
-
}
|
|
11
|
-
export interface JsonKey extends JsonKeyShort {
|
|
12
|
-
/**
|
|
13
|
-
* This field is indicates application's use of this key, for example,
|
|
14
|
-
* "private-mail-key". Notice that it has noting to do with crypto
|
|
15
|
-
* primitives, and everything to do with how key should be used by
|
|
16
|
-
* applications, that should check this field, so as to guard against
|
|
17
|
-
* miss-use of key material. Such strictness makes key reuse (bad security
|
|
18
|
-
* design) difficult.
|
|
19
|
-
*/
|
|
20
|
-
use: string;
|
|
21
|
-
/**
|
|
22
|
-
* This field indicates which crypto-box high level function should be used
|
|
23
|
-
* with this key, for example, "NaCl-xsp-box". Notice that, unlike initial
|
|
24
|
-
* JWK standard, alg is not for naming crypto primitive, because you,
|
|
25
|
-
* developer, should use complete functionality, like that provided by NaCl,
|
|
26
|
-
* and you should not be dealing with crypto primitives. Crypto primitives
|
|
27
|
-
* are for libs, that should be written by cryptographers. If cryptographer
|
|
28
|
-
* gives you only primitives, it is the same as car dealer giving you parts
|
|
29
|
-
* for the car instead of an actual car. Your would call dealer's bullshit,
|
|
30
|
-
* and you must call cryptographer's one as well. They, cryptographer, in a
|
|
31
|
-
* 2nd decade of the 21st centure have no excuse to give us, developers,
|
|
32
|
-
* incomplete libs with mere crypto primitives, which hurt, when assembled
|
|
33
|
-
* incorrectly.
|
|
34
|
-
*/
|
|
35
|
-
alg: string;
|
|
36
|
-
}
|
|
1
|
+
type JsonKey = web3n.keys.JsonKey;
|
|
2
|
+
type SignedLoad = web3n.keys.SignedLoad;
|
|
3
|
+
type Key = web3n.keys.Key;
|
|
4
|
+
type KeyCert = web3n.keys.KeyCert;
|
|
5
|
+
type MailerIdAssertionLoad = web3n.mailerid.MailerIdAssertionLoad;
|
|
37
6
|
export declare function isLikeJsonKey(jkey: JsonKey): boolean;
|
|
38
|
-
export interface Key {
|
|
39
|
-
/**
|
|
40
|
-
* This is key's bytes.
|
|
41
|
-
*/
|
|
42
|
-
k: Uint8Array;
|
|
43
|
-
/**
|
|
44
|
-
* This is key's id.
|
|
45
|
-
*/
|
|
46
|
-
kid: string;
|
|
47
|
-
/**
|
|
48
|
-
* This field is indicates application's use of this key, for example,
|
|
49
|
-
* "private-mail-key". Notice that it has noting to do with crypto
|
|
50
|
-
* primitives, and everything to do with how key should be used by
|
|
51
|
-
* applications, that should check this field, so as to guard against
|
|
52
|
-
* miss-use of key material. Such strictness makes key reuse (bad security
|
|
53
|
-
* design) difficult.
|
|
54
|
-
*/
|
|
55
|
-
use: string;
|
|
56
|
-
/**
|
|
57
|
-
* This field indicates which crypto-box high level function should be used
|
|
58
|
-
* with this key, for example, "NaCl-xsp-box". Notice that, unlike initial
|
|
59
|
-
* JWK standard, alg is not for naming crypto primitive, because you,
|
|
60
|
-
* developer, should use complete functionality, like that provided by NaCl,
|
|
61
|
-
* and you should not be dealing with crypto primitives. Crypto primitives
|
|
62
|
-
* are for libs, that should be written by cryptographers. If cryptographer
|
|
63
|
-
* gives you only primitives, it is the same as car dealer giving you parts
|
|
64
|
-
* for the car instead of an actual car. Your would call dealer's bullshit,
|
|
65
|
-
* and you must call cryptographer's one as well. They, cryptographer, in a
|
|
66
|
-
* 2nd decade of the 21st centure have no excuse to give us, developers,
|
|
67
|
-
* incomplete libs with mere crypto primitives, which hurt, when assembled
|
|
68
|
-
* incorrectly.
|
|
69
|
-
*/
|
|
70
|
-
alg: string;
|
|
71
|
-
}
|
|
72
|
-
export interface SignedLoad {
|
|
73
|
-
/**
|
|
74
|
-
* This is a function/algorithm, used to make signature.
|
|
75
|
-
*/
|
|
76
|
-
alg: string;
|
|
77
|
-
/**
|
|
78
|
-
* This is an id of a key that did the signature.
|
|
79
|
-
*/
|
|
80
|
-
kid: string;
|
|
81
|
-
/**
|
|
82
|
-
* This is signature bytes, packed into base64 string.
|
|
83
|
-
*/
|
|
84
|
-
sig: string;
|
|
85
|
-
/**
|
|
86
|
-
* This is bytes (packed into base64 string), on which signature was done.
|
|
87
|
-
*/
|
|
88
|
-
load: string;
|
|
89
|
-
}
|
|
90
7
|
export declare function isLikeSignedLoad(load: SignedLoad): boolean;
|
|
91
|
-
export interface KeyCert {
|
|
92
|
-
cert: {
|
|
93
|
-
publicKey: JsonKey;
|
|
94
|
-
principal: {
|
|
95
|
-
address: string;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
issuer: string;
|
|
99
|
-
issuedAt: number;
|
|
100
|
-
expiresAt: number;
|
|
101
|
-
}
|
|
102
8
|
export declare function isLikeKeyCert(cert: KeyCert): boolean;
|
|
103
9
|
export declare function isLikeSignedKeyCert(load: SignedLoad): boolean;
|
|
104
10
|
export declare function keyFromJson(key: JsonKey, use: string, alg: string, klen: number): Key;
|
|
@@ -109,12 +15,6 @@ export declare function getPrincipalAddress(signedCert: SignedLoad): string;
|
|
|
109
15
|
export declare namespace use {
|
|
110
16
|
const MID_PKLOGIN = "login-pub-key";
|
|
111
17
|
}
|
|
112
|
-
export interface MailerIdAssertionLoad {
|
|
113
|
-
user: string;
|
|
114
|
-
rpDomain: string;
|
|
115
|
-
sessionId: string;
|
|
116
|
-
issuedAt: number;
|
|
117
|
-
expiresAt: number;
|
|
118
|
-
}
|
|
119
18
|
export declare function isLikeMailerIdAssertion(assertLoad: MailerIdAssertionLoad): boolean;
|
|
120
19
|
export declare function isLikeSignedMailerIdAssertion(load: SignedLoad): boolean;
|
|
20
|
+
export {};
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* in MailerId.
|
|
4
4
|
*/
|
|
5
5
|
import { GetRandom, arrays } from "ecma-nacl";
|
|
6
|
-
|
|
6
|
+
type JsonKey = web3n.keys.JsonKey;
|
|
7
|
+
type Key = web3n.keys.Key;
|
|
8
|
+
type SignedLoad = web3n.keys.SignedLoad;
|
|
7
9
|
/**
|
|
8
10
|
* This enumerates MailerId's different use-roles of keys, involved in
|
|
9
11
|
* establishing a trust.
|
|
@@ -215,3 +217,4 @@ export declare namespace user {
|
|
|
215
217
|
*/
|
|
216
218
|
function makeMailerIdSigner(signKey: Key, userCert: SignedLoad, provCert: SignedLoad, assertionValidity?: number, arrFactory?: arrays.Factory): MailerIdSigner;
|
|
217
219
|
}
|
|
220
|
+
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* This defines interfaces for mail configuration requests.
|
|
3
|
-
*/
|
|
4
|
-
import * as jwk from '../../jwkeys';
|
|
1
|
+
type ASMailConfigParams = web3n.asmail.ASMailConfigParams;
|
|
5
2
|
export declare const ERR_SC: {
|
|
6
3
|
malformed: number;
|
|
7
4
|
needAuth: number;
|
|
@@ -24,52 +21,34 @@ export interface InvitesList {
|
|
|
24
21
|
export declare namespace p {
|
|
25
22
|
namespace initPubKey {
|
|
26
23
|
const URL_END = "param/init-pub-key";
|
|
27
|
-
|
|
28
|
-
pkeyCert: jwk.SignedLoad;
|
|
29
|
-
userCert: jwk.SignedLoad;
|
|
30
|
-
provCert: jwk.SignedLoad;
|
|
31
|
-
}
|
|
24
|
+
type Certs = ASMailConfigParams['init-pub-key'];
|
|
32
25
|
}
|
|
33
26
|
namespace authSenderPolicy {
|
|
34
27
|
const URL_END = "param/auth-sender/policy";
|
|
35
|
-
|
|
36
|
-
acceptWithInvitesOnly: boolean;
|
|
37
|
-
acceptFromWhiteListOnly: boolean;
|
|
38
|
-
applyBlackList: boolean;
|
|
39
|
-
defaultMsgSize: number;
|
|
40
|
-
}
|
|
28
|
+
type Policy = ASMailConfigParams['auth-sender/policy'];
|
|
41
29
|
}
|
|
42
30
|
namespace authSenderWhitelist {
|
|
43
31
|
const URL_END = "param/auth-sender/whitelist";
|
|
44
|
-
|
|
45
|
-
[address: string]: number;
|
|
46
|
-
}
|
|
32
|
+
type List = ASMailConfigParams['auth-sender/whitelist'];
|
|
47
33
|
}
|
|
48
34
|
namespace authSenderBlacklist {
|
|
49
35
|
const URL_END = "param/auth-sender/blacklist";
|
|
50
|
-
|
|
51
|
-
[address: string]: number;
|
|
52
|
-
}
|
|
36
|
+
type List = ASMailConfigParams['auth-sender/blacklist'];
|
|
53
37
|
}
|
|
54
38
|
namespace authSenderInvites {
|
|
55
39
|
const URL_END = "param/auth-sender/invites";
|
|
56
|
-
|
|
57
|
-
}
|
|
40
|
+
type List = ASMailConfigParams['auth-sender/invites'];
|
|
58
41
|
}
|
|
59
42
|
namespace anonSenderPolicy {
|
|
60
43
|
const URL_END = "param/anon-sender/policy";
|
|
61
|
-
|
|
62
|
-
accept: boolean;
|
|
63
|
-
acceptWithInvitesOnly: boolean;
|
|
64
|
-
defaultMsgSize: number;
|
|
65
|
-
}
|
|
44
|
+
type Policy = ASMailConfigParams['anon-sender/policy'];
|
|
66
45
|
}
|
|
67
46
|
namespace anonSenderInvites {
|
|
68
47
|
const URL_END = "param/anon-sender/invites";
|
|
69
|
-
|
|
70
|
-
}
|
|
48
|
+
type List = ASMailConfigParams['anon-sender/invites'];
|
|
71
49
|
}
|
|
72
50
|
}
|
|
73
51
|
export interface ErrorReply {
|
|
74
52
|
error: string;
|
|
75
53
|
}
|
|
54
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015, 2025 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
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.p = exports.closeSession = exports.midLogin = exports.PARAM_SC = exports.ERR_SC = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* This defines interfaces for mail configuration requests.
|
|
21
|
+
*/
|
|
19
22
|
const midApi = require("../mailer-id/login");
|
|
20
23
|
exports.ERR_SC = {
|
|
21
24
|
malformed: 400,
|