core-3nweb-client-lib 0.34.1 → 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 +20 -10
- 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/cryptor-wasm.js +1 -1
- 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 +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/jwkeys.js +4 -6
- 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,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright (C) 2016, 2020, 2022, 2024 3NSoft Inc.
|
|
2
|
+
Copyright (C) 2016, 2020, 2022, 2024 - 2025 3NSoft Inc.
|
|
3
3
|
|
|
4
4
|
This program is free software: you can redistribute it and/or modify it under
|
|
5
5
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
* This is a namespace for things used by mail functionality.
|
|
20
20
|
*/
|
|
21
21
|
declare namespace web3n.asmail {
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
interface Service {
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
/**
|
|
26
26
|
* This returns a promise resolvable to id (address) of a current signed
|
|
27
27
|
* user.
|
|
@@ -29,9 +29,11 @@ declare namespace web3n.asmail {
|
|
|
29
29
|
getUserId(): Promise<string>;
|
|
30
30
|
|
|
31
31
|
inbox: InboxService;
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
delivery: DeliveryService;
|
|
34
34
|
|
|
35
|
+
config: ASMailConfigService;
|
|
36
|
+
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
interface DeliveryProgress {
|
|
@@ -56,7 +58,7 @@ declare namespace web3n.asmail {
|
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
type DeliveryException = ASMailSendException | ServLocException
|
|
61
|
+
type DeliveryException = ASMailSendException | ServLocException;
|
|
60
62
|
|
|
61
63
|
interface DeliveryOptions {
|
|
62
64
|
/**
|
|
@@ -319,4 +321,67 @@ declare namespace web3n.asmail {
|
|
|
319
321
|
msgCancelled?: true;
|
|
320
322
|
}
|
|
321
323
|
|
|
324
|
+
interface ASMailConfigService {
|
|
325
|
+
getOnServer<P extends keyof ASMailConfigParams>(
|
|
326
|
+
param: P
|
|
327
|
+
): Promise<ASMailConfigParams[P]|null>;
|
|
328
|
+
setOnServer<P extends keyof ASMailConfigParams>(
|
|
329
|
+
param: P,
|
|
330
|
+
value: ASMailConfigParams[P]|null
|
|
331
|
+
): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface ASMailConfigParams {
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Introductory public key certificate chain, published on ASMail server for
|
|
338
|
+
* anyone to initiate messaging with the user.
|
|
339
|
+
*/
|
|
340
|
+
"init-pub-key": keys.PKeyCertChain;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Policy that ASMail server should follow with messages from senders
|
|
344
|
+
* authenticated to server.
|
|
345
|
+
*/
|
|
346
|
+
"auth-sender/policy": {
|
|
347
|
+
acceptWithInvitesOnly: boolean;
|
|
348
|
+
acceptFromWhiteListOnly: boolean;
|
|
349
|
+
applyBlackList: boolean;
|
|
350
|
+
defaultMsgSize: number;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
"auth-sender/whitelist": AddressesList;
|
|
354
|
+
"auth-sender/blacklist": AddressesList;
|
|
355
|
+
"auth-sender/invites": InvitesList;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Policy that ASMail server should follow with messages from senders
|
|
359
|
+
* anonymous to server.
|
|
360
|
+
*/
|
|
361
|
+
"anon-sender/policy": {
|
|
362
|
+
accept: boolean;
|
|
363
|
+
acceptWithInvitesOnly: boolean;
|
|
364
|
+
defaultMsgSize: number;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
"anon-sender/invites": InvitesList;
|
|
368
|
+
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Addresses list is a map from addresses to respective maximum message size
|
|
373
|
+
* in bytes.
|
|
374
|
+
*/
|
|
375
|
+
interface AddressesList {
|
|
376
|
+
[address: string]: number;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Invites list is a map from invites to respective maximum message size in
|
|
381
|
+
* bytes.
|
|
382
|
+
*/
|
|
383
|
+
interface InvitesList {
|
|
384
|
+
[invite: string]: number;
|
|
385
|
+
}
|
|
386
|
+
|
|
322
387
|
}
|
|
@@ -29,6 +29,7 @@ declare namespace web3n.caps.common {
|
|
|
29
29
|
type DevPathChecker = (path: string) => 'w'|'r'|false;
|
|
30
30
|
|
|
31
31
|
interface RequestedCAPs {
|
|
32
|
+
keyrings?: 'all';
|
|
32
33
|
mail?: MailCAPSetting;
|
|
33
34
|
storage?: StorageCAPSetting;
|
|
34
35
|
mailerid?: true;
|
|
@@ -63,6 +64,7 @@ declare namespace web3n.caps.common {
|
|
|
63
64
|
interface MailCAPSetting {
|
|
64
65
|
sendingTo?: 'all' | { whitelist: string[]; };
|
|
65
66
|
receivingFrom?: 'all' | { whitelist: string[]; };
|
|
67
|
+
config?: 'all';
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
interface W3N {
|
|
@@ -70,6 +72,7 @@ declare namespace web3n.caps.common {
|
|
|
70
72
|
mail?: asmail.Service;
|
|
71
73
|
storage?: storage.Service;
|
|
72
74
|
mailerid?: mailerid.Service;
|
|
75
|
+
keyrings?: keys.Keyrings;
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
type Logger = (
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2025 3NSoft Inc.
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
7
|
+
version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful, but
|
|
10
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
See the GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License along with
|
|
15
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
declare namespace web3n.keys {
|
|
19
|
+
|
|
20
|
+
interface JsonKeyShort {
|
|
21
|
+
/**
|
|
22
|
+
* This is a base64 representation of key's bytes.
|
|
23
|
+
*/
|
|
24
|
+
k: string;
|
|
25
|
+
/**
|
|
26
|
+
* This is key's id.
|
|
27
|
+
*/
|
|
28
|
+
kid: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface JsonKey extends JsonKeyShort {
|
|
32
|
+
/**
|
|
33
|
+
* This field is indicates application's use of this key, for example,
|
|
34
|
+
* "private-mail-key". Notice that it has noting to do with crypto
|
|
35
|
+
* primitives, and everything to do with how key should be used by
|
|
36
|
+
* applications, that should check this field, so as to guard against
|
|
37
|
+
* miss-use of key material. Such strictness makes key reuse (bad security
|
|
38
|
+
* design) difficult.
|
|
39
|
+
*/
|
|
40
|
+
use: string;
|
|
41
|
+
/**
|
|
42
|
+
* This field indicates which crypto-box high level function should be used
|
|
43
|
+
* with this key, for example, "NaCl-xsp-box". Notice that, unlike initial
|
|
44
|
+
* JWK standard, alg is not for naming crypto primitive, because you,
|
|
45
|
+
* developer, should use complete functionality, like that provided by NaCl,
|
|
46
|
+
* and you should not be dealing with crypto primitives. Crypto primitives
|
|
47
|
+
* are for libs, that should be written by cryptographers. If cryptographer
|
|
48
|
+
* gives you only primitives, it is the same as car dealer giving you parts
|
|
49
|
+
* for the car instead of an actual car. Your would call dealer's bullshit,
|
|
50
|
+
* and you must call cryptographer's one as well. They, cryptographer, in a
|
|
51
|
+
* 2nd decade of the 21st centure have no excuse to give us, developers,
|
|
52
|
+
* incomplete libs with mere crypto primitives, which hurt, when assembled
|
|
53
|
+
* incorrectly.
|
|
54
|
+
*/
|
|
55
|
+
alg: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface Key {
|
|
59
|
+
/**
|
|
60
|
+
* This is key's bytes.
|
|
61
|
+
*/
|
|
62
|
+
k: Uint8Array;
|
|
63
|
+
/**
|
|
64
|
+
* This is key's id.
|
|
65
|
+
*/
|
|
66
|
+
kid: string;
|
|
67
|
+
/**
|
|
68
|
+
* This field is indicates application's use of this key, for example,
|
|
69
|
+
* "private-mail-key". Notice that it has noting to do with crypto
|
|
70
|
+
* primitives, and everything to do with how key should be used by
|
|
71
|
+
* applications, that should check this field, so as to guard against
|
|
72
|
+
* miss-use of key material. Such strictness makes key reuse (bad security
|
|
73
|
+
* design) difficult.
|
|
74
|
+
*/
|
|
75
|
+
use: string;
|
|
76
|
+
/**
|
|
77
|
+
* This field indicates which crypto-box high level function should be used
|
|
78
|
+
* with this key, for example, "NaCl-xsp-box". Notice that, unlike initial
|
|
79
|
+
* JWK standard, alg is not for naming crypto primitive, because you,
|
|
80
|
+
* developer, should use complete functionality, like that provided by NaCl,
|
|
81
|
+
* and you should not be dealing with crypto primitives. Crypto primitives
|
|
82
|
+
* are for libs, that should be written by cryptographers. If cryptographer
|
|
83
|
+
* gives you only primitives, it is the same as car dealer giving you parts
|
|
84
|
+
* for the car instead of an actual car. Your would call dealer's bullshit,
|
|
85
|
+
* and you must call cryptographer's one as well. They, cryptographer, in a
|
|
86
|
+
* 2nd decade of the 21st centure have no excuse to give us, developers,
|
|
87
|
+
* incomplete libs with mere crypto primitives, which hurt, when assembled
|
|
88
|
+
* incorrectly.
|
|
89
|
+
*/
|
|
90
|
+
alg: string;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface SignedLoad {
|
|
94
|
+
/**
|
|
95
|
+
* This is a function/algorithm, used to make signature.
|
|
96
|
+
*/
|
|
97
|
+
alg: string;
|
|
98
|
+
/**
|
|
99
|
+
* This is an id of a key that did the signature.
|
|
100
|
+
*/
|
|
101
|
+
kid: string;
|
|
102
|
+
/**
|
|
103
|
+
* This is signature bytes, packed into base64 string.
|
|
104
|
+
*/
|
|
105
|
+
sig: string;
|
|
106
|
+
/**
|
|
107
|
+
* This is bytes (packed into base64 string), on which signature was done.
|
|
108
|
+
*/
|
|
109
|
+
load: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface KeyCert {
|
|
113
|
+
cert: {
|
|
114
|
+
publicKey: JsonKey;
|
|
115
|
+
principal: { address: string };
|
|
116
|
+
};
|
|
117
|
+
issuer: string;
|
|
118
|
+
issuedAt: number;
|
|
119
|
+
expiresAt: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface Keyrings {
|
|
123
|
+
|
|
124
|
+
introKeyToPublishOnASMailServer: IntroKeyOnASMailServer;
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface IntroKeyOnASMailServer {
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns introductory key certificates chain that should be published on
|
|
132
|
+
* ASMail server, and undefined, if there should be nothing on the server.
|
|
133
|
+
*/
|
|
134
|
+
getCurrent(): Promise<PKeyCertChain|undefined>;
|
|
135
|
+
|
|
136
|
+
remove(): Promise<void>;
|
|
137
|
+
|
|
138
|
+
makeNew(): Promise<PKeyCertChain>;
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface PKeyCertChain {
|
|
143
|
+
pkeyCert: keys.SignedLoad;
|
|
144
|
+
userCert: keys.SignedLoad;
|
|
145
|
+
provCert: keys.SignedLoad;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface MailerIdAssertion {
|
|
149
|
+
assertion: keys.SignedLoad;
|
|
150
|
+
userCert: keys.SignedLoad;
|
|
151
|
+
provCert: keys.SignedLoad;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2020 - 2023 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2020 - 2023, 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
|
|
@@ -26,6 +26,8 @@ const rxjs_1 = require("rxjs");
|
|
|
26
26
|
const operators_1 = require("rxjs/operators");
|
|
27
27
|
const fs_1 = require("../../core-ipc/fs");
|
|
28
28
|
const utils_for_observables_1 = require("../../lib-common/utils-for-observables");
|
|
29
|
+
const caller_side_wrap_1 = require("../../core-ipc/json-ipc-wrapping/caller-side-wrap");
|
|
30
|
+
const service_side_wrap_1 = require("../../core-ipc/json-ipc-wrapping/service-side-wrap");
|
|
29
31
|
function exposeASMailCAP(cap, expServices) {
|
|
30
32
|
const out = cap.delivery;
|
|
31
33
|
const box = cap.inbox;
|
|
@@ -46,6 +48,7 @@ function exposeASMailCAP(cap, expServices) {
|
|
|
46
48
|
removeMsg: removeMsg.wrapService(box.removeMsg),
|
|
47
49
|
subscribe: inboxSubscribe.wrapService(box.subscribe, expServices)
|
|
48
50
|
},
|
|
51
|
+
config: exposeCofigCAP(cap.config)
|
|
49
52
|
};
|
|
50
53
|
}
|
|
51
54
|
function makeASMailCaller(caller, objPath) {
|
|
@@ -68,6 +71,7 @@ function makeASMailCaller(caller, objPath) {
|
|
|
68
71
|
removeMsg: removeMsg.makeCaller(caller, inboxPath),
|
|
69
72
|
subscribe: inboxSubscribe.makeCaller(caller, inboxPath)
|
|
70
73
|
},
|
|
74
|
+
config: makeConfigCaller(caller, objPath.concat('config'))
|
|
71
75
|
};
|
|
72
76
|
}
|
|
73
77
|
var getUserId;
|
|
@@ -553,4 +557,19 @@ var observeDelivery;
|
|
|
553
557
|
observeDelivery.makeCaller = makeCaller;
|
|
554
558
|
})(observeDelivery || (observeDelivery = {}));
|
|
555
559
|
Object.freeze(observeDelivery);
|
|
560
|
+
function exposeCofigCAP(cap) {
|
|
561
|
+
return {
|
|
562
|
+
getOnServer: (0, service_side_wrap_1.wrapReqReplySrvMethod)(cap, 'getOnServer'),
|
|
563
|
+
setOnServer: (0, service_side_wrap_1.wrapReqReplySrvMethod)(cap, 'setOnServer')
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function callConfig(caller, objPath, method) {
|
|
567
|
+
return (0, caller_side_wrap_1.makeReqRepObjCaller)(caller, objPath, method);
|
|
568
|
+
}
|
|
569
|
+
function makeConfigCaller(caller, objPath) {
|
|
570
|
+
return {
|
|
571
|
+
getOnServer: callConfig(caller, objPath.concat('getOnServer'), 'getOnServer'),
|
|
572
|
+
setOnServer: callConfig(caller, objPath.concat('setOnServer'), 'setOnServer')
|
|
573
|
+
};
|
|
574
|
+
}
|
|
556
575
|
Object.freeze(exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ServiceLocator } from '../../lib-client/service-locator';
|
|
2
|
+
import { ParamOnServer } from '../../lib-client/asmail/service-config';
|
|
3
|
+
import { GetSigner } from '../id-manager';
|
|
4
|
+
import { NetClient } from '../../lib-client/request-utils';
|
|
5
|
+
type Service = web3n.asmail.ASMailConfigService;
|
|
6
|
+
type ASMailConfigParams = web3n.asmail.ASMailConfigParams;
|
|
7
|
+
/**
|
|
8
|
+
* Instance of this class updates and checks setting of ASMail server.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ConfigOfASMailServer {
|
|
11
|
+
private readonly serverConfig;
|
|
12
|
+
constructor(address: string, getSigner: GetSigner, resolver: ServiceLocator, net: NetClient);
|
|
13
|
+
makeParamSetterAndGetter<P extends keyof ASMailConfigParams>(param: P): ParamOnServer<P>;
|
|
14
|
+
makeCAP(): Service;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2025 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.ConfigOfASMailServer = void 0;
|
|
20
|
+
const service_config_1 = require("../../lib-client/asmail/service-config");
|
|
21
|
+
/**
|
|
22
|
+
* Instance of this class updates and checks setting of ASMail server.
|
|
23
|
+
*/
|
|
24
|
+
class ConfigOfASMailServer {
|
|
25
|
+
constructor(address, getSigner, resolver, net) {
|
|
26
|
+
this.serverConfig = new service_config_1.MailConfigurator(address, getSigner, () => resolver(this.serverConfig.userId), net);
|
|
27
|
+
Object.freeze(this);
|
|
28
|
+
}
|
|
29
|
+
makeParamSetterAndGetter(param) {
|
|
30
|
+
return this.serverConfig.makeParamSetterAndGetter(param);
|
|
31
|
+
}
|
|
32
|
+
makeCAP() {
|
|
33
|
+
const w = {
|
|
34
|
+
getOnServer: this.serverConfig.getParam.bind(this.serverConfig),
|
|
35
|
+
setOnServer: this.serverConfig.setParam.bind(this.serverConfig)
|
|
36
|
+
};
|
|
37
|
+
return Object.freeze(w);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.ConfigOfASMailServer = ConfigOfASMailServer;
|
|
41
|
+
Object.freeze(ConfigOfASMailServer.prototype);
|
|
42
|
+
Object.freeze(ConfigOfASMailServer);
|
|
43
|
+
Object.freeze(exports);
|
|
@@ -2,8 +2,7 @@ import { GetSigner } from '../../id-manager';
|
|
|
2
2
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
3
3
|
import { SendingParams, SuggestedNextKeyPair } from '../msg/common';
|
|
4
4
|
import { Encryptor } from '../../../lib-common/async-cryptor-wrap';
|
|
5
|
-
import {
|
|
6
|
-
import { ASMailKeyPair } from '../keyring/common';
|
|
5
|
+
import { ASMailKeyPair } from '../../keyring/common';
|
|
7
6
|
import { NetClient } from '../../../lib-client/request-utils';
|
|
8
7
|
import { LogWarning, LogError } from '../../../lib-client/logging/log-to-file';
|
|
9
8
|
import { ServiceLocator } from '../../../lib-client/service-locator';
|
|
@@ -13,6 +12,7 @@ type DeliveryOptions = web3n.asmail.DeliveryOptions;
|
|
|
13
12
|
type AttachmentsContainer = web3n.asmail.AttachmentsContainer;
|
|
14
13
|
type FS = web3n.files.FS;
|
|
15
14
|
type WritableFS = web3n.files.WritableFS;
|
|
15
|
+
type JsonKey = web3n.keys.JsonKey;
|
|
16
16
|
export declare class Attachments {
|
|
17
17
|
container: AttachmentsContainer | undefined;
|
|
18
18
|
fs: FS | undefined;
|
|
@@ -13,7 +13,8 @@
|
|
|
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
19
|
exports.SEG_SIZE_IN_K_QUATS = exports.Attachments = void 0;
|
|
19
20
|
exports.estimatePackedSizeOf = estimatePackedSizeOf;
|
|
@@ -23,7 +23,7 @@ export declare class Delivery {
|
|
|
23
23
|
private readonly allDeliveries$;
|
|
24
24
|
private constructor();
|
|
25
25
|
static makeAndStart(fs: WritableFS, r: ResourcesForSending): Promise<Delivery>;
|
|
26
|
-
|
|
26
|
+
makeCAP(): DeliveryService;
|
|
27
27
|
private restartDeliveryOfMsgsAtStartup;
|
|
28
28
|
observeDelivery(id: string, observer: Observer<DeliveryProgress>): () => void;
|
|
29
29
|
observeAllDeliveries(observer: Observer<{
|
|
@@ -38,5 +38,6 @@ export declare class Delivery {
|
|
|
38
38
|
private listMsgs;
|
|
39
39
|
private rmMsg;
|
|
40
40
|
private currentState;
|
|
41
|
+
close(): Promise<void>;
|
|
41
42
|
}
|
|
42
43
|
export {};
|
|
@@ -63,7 +63,7 @@ class Delivery {
|
|
|
63
63
|
await delivery.restartDeliveryOfMsgsAtStartup();
|
|
64
64
|
return delivery;
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
makeCAP() {
|
|
67
67
|
const service = {
|
|
68
68
|
addMsg: this.addMsg.bind(this),
|
|
69
69
|
currentState: this.currentState.bind(this),
|
|
@@ -261,6 +261,9 @@ class Delivery {
|
|
|
261
261
|
}
|
|
262
262
|
return msg.progress;
|
|
263
263
|
}
|
|
264
|
+
async close() {
|
|
265
|
+
// XXX what should we have here, with potentially still running sending ?
|
|
266
|
+
}
|
|
264
267
|
}
|
|
265
268
|
exports.Delivery = Delivery;
|
|
266
269
|
Object.freeze(Delivery.prototype);
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
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
|
+
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.WIP = void 0;
|
|
20
20
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StorageGetter, FolderInJSON } from '../../../../lib-client/
|
|
1
|
+
import { StorageGetter, FolderInJSON } from '../../../../lib-client/xsp-fs/common';
|
|
2
2
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
3
3
|
import { MsgOnDisk } from '../msg-on-disk';
|
|
4
4
|
import { LogError } from '../../../../lib-client/logging/log-to-file';
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.fsForAttachments = fsForAttachments;
|
|
20
|
-
const common_1 = require("../../../../lib-client/
|
|
21
|
-
const fs_1 = require("../../../../lib-client/
|
|
20
|
+
const common_1 = require("../../../../lib-client/xsp-fs/common");
|
|
21
|
+
const fs_1 = require("../../../../lib-client/xsp-fs/fs");
|
|
22
22
|
class AttachmentStore {
|
|
23
23
|
constructor(msg, getStorages, cryptor, logError) {
|
|
24
24
|
this.msg = msg;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { StorageGetter } from '../../../lib-client/
|
|
1
|
+
import { StorageGetter } from '../../../lib-client/xsp-fs/common';
|
|
2
2
|
import { ServiceLocator } from '../../../lib-client/service-locator';
|
|
3
3
|
import { OpenedMsg } from '../msg/opener';
|
|
4
|
-
import { MsgKeyInfo } from '
|
|
5
|
-
import * as confApi from '../../../lib-common/service-api/asmail/config';
|
|
4
|
+
import { MsgKeyInfo } from '../../keyring';
|
|
6
5
|
import * as delivApi from '../../../lib-common/service-api/asmail/delivery';
|
|
7
|
-
import { JsonKey } from '../../../lib-common/jwkeys';
|
|
8
6
|
import { GetSigner } from '../../id-manager';
|
|
9
7
|
import { LogError } from '../../../lib-client/logging/log-to-file';
|
|
10
8
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
@@ -12,6 +10,8 @@ import { SendingParams } from '../msg/common';
|
|
|
12
10
|
import { NetClient } from '../../../lib-client/request-utils';
|
|
13
11
|
type WritableFS = web3n.files.WritableFS;
|
|
14
12
|
type InboxService = web3n.asmail.InboxService;
|
|
13
|
+
type JsonKey = web3n.keys.JsonKey;
|
|
14
|
+
type PKeyCertChain = web3n.keys.PKeyCertChain;
|
|
15
15
|
export interface ResourcesForReceiving {
|
|
16
16
|
address: string;
|
|
17
17
|
getSigner: GetSigner;
|
|
@@ -38,7 +38,7 @@ export interface ResourcesForReceiving {
|
|
|
38
38
|
* object.
|
|
39
39
|
* @param checkMidKeyCerts is a certifying function for MailerId certs.
|
|
40
40
|
*/
|
|
41
|
-
msgDecryptor: (msgMeta: delivApi.msgMeta.CryptoInfo, getMainObjHeader: () => Promise<Uint8Array>, getOpenedMsg: (mainObjFileKey: Uint8Array, msgKeyPackLen: number) => Promise<OpenedMsg>, checkMidKeyCerts: (certs:
|
|
41
|
+
msgDecryptor: (msgMeta: delivApi.msgMeta.CryptoInfo, getMainObjHeader: () => Promise<Uint8Array>, getOpenedMsg: (mainObjFileKey: Uint8Array, msgKeyPackLen: number) => Promise<OpenedMsg>, checkMidKeyCerts: (certs: PKeyCertChain) => Promise<{
|
|
42
42
|
pkey: JsonKey;
|
|
43
43
|
address: string;
|
|
44
44
|
}>) => Promise<{
|
|
@@ -85,7 +85,7 @@ export declare class InboxOnServer {
|
|
|
85
85
|
private constructor();
|
|
86
86
|
static makeAndStart(cachePath: string, syncedFS: WritableFS, r: ResourcesForReceiving): Promise<InboxOnServer>;
|
|
87
87
|
close(): Promise<void>;
|
|
88
|
-
|
|
88
|
+
makeCAP(): InboxService;
|
|
89
89
|
private removeMsg;
|
|
90
90
|
private removeMsgFromServerAndCache;
|
|
91
91
|
private msgFromDiskOrDownload;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { KeyringForASMail } from '../keyring';
|
|
2
|
+
import { ConfigOfASMailServer } from './config';
|
|
1
3
|
import { InboxPathForUser } from '../app-files';
|
|
2
|
-
import { StorageGetter } from '../../lib-client/
|
|
4
|
+
import { StorageGetter } from '../../lib-client/xsp-fs/common';
|
|
3
5
|
import { GetSigner } from '../id-manager';
|
|
4
6
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
5
7
|
import { Logger } from '../../lib-client/logging/log-to-file';
|
|
@@ -20,9 +22,7 @@ export declare class ASMail {
|
|
|
20
22
|
private config;
|
|
21
23
|
private sendingParams;
|
|
22
24
|
constructor(cryptor: AsyncSBoxCryptor, makeNet: MakeNet, inboxPathForUser: InboxPathForUser, logger: Logger);
|
|
23
|
-
init(address: string, getSigner: GetSigner, syncedFS: WritableFS, localFS: WritableFS, getStorages: StorageGetter, makeResolver: ServiceLocatorMaker): Promise<void>;
|
|
24
|
-
private setupConfig;
|
|
25
|
-
private setupKeyring;
|
|
25
|
+
init(address: string, getSigner: GetSigner, syncedFS: WritableFS, localFS: WritableFS, getStorages: StorageGetter, makeResolver: ServiceLocatorMaker, config: ConfigOfASMailServer, keyring: KeyringForASMail): Promise<void>;
|
|
26
26
|
private setupSendingParams;
|
|
27
27
|
private setupDelivery;
|
|
28
28
|
private setupInbox;
|