core-3nweb-client-lib 0.34.2 → 0.35.1
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 +54 -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 +64 -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 +197 -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 +5 -1
- 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/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 +6 -2
- 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 +3 -3
- 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,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
|
|
@@ -13,9 +13,13 @@
|
|
|
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.p = exports.closeSession = exports.midLogin = exports.PARAM_SC = exports.ERR_SC = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* This defines interfaces for mail configuration requests.
|
|
22
|
+
*/
|
|
19
23
|
const midApi = require("../mailer-id/login");
|
|
20
24
|
exports.ERR_SC = {
|
|
21
25
|
malformed: 400,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import * as jwk from '../../jwkeys';
|
|
5
|
-
import * as config from './config';
|
|
1
|
+
type MailerIdAssertion = web3n.keys.MailerIdAssertion;
|
|
2
|
+
type PKeyCertChain = web3n.keys.PKeyCertChain;
|
|
6
3
|
export declare const HTTP_HEADER: {
|
|
7
4
|
contentType: string;
|
|
8
5
|
contentLength: string;
|
|
@@ -77,11 +74,7 @@ export declare namespace sessionRestart {
|
|
|
77
74
|
}
|
|
78
75
|
export declare namespace authSender {
|
|
79
76
|
const URL_END = "authorize-sender";
|
|
80
|
-
|
|
81
|
-
assertion: jwk.SignedLoad;
|
|
82
|
-
userCert: jwk.SignedLoad;
|
|
83
|
-
provCert: jwk.SignedLoad;
|
|
84
|
-
}
|
|
77
|
+
type Request = MailerIdAssertion;
|
|
85
78
|
const SC: {
|
|
86
79
|
ok: number;
|
|
87
80
|
authFailed: number;
|
|
@@ -89,8 +82,7 @@ export declare namespace authSender {
|
|
|
89
82
|
}
|
|
90
83
|
export declare namespace initPubKey {
|
|
91
84
|
const URL_END = "init-pub-key";
|
|
92
|
-
|
|
93
|
-
}
|
|
85
|
+
type Reply = PKeyCertChain;
|
|
94
86
|
const SC: {
|
|
95
87
|
ok: number;
|
|
96
88
|
pkeyNotRegistered: number;
|
|
@@ -156,3 +148,4 @@ export declare namespace completion {
|
|
|
156
148
|
export interface ErrorReply {
|
|
157
149
|
error: string;
|
|
158
150
|
}
|
|
151
|
+
export {};
|
|
@@ -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.completion = exports.msgObj = exports.msgMeta = exports.initPubKey = exports.authSender = exports.sessionRestart = exports.sessionStart = exports.preFlight = exports.ERR_SC = exports.HTTP_HEADER = void 0;
|
|
19
|
+
/**
|
|
20
|
+
* This defines interfaces for mail delivery requests.
|
|
21
|
+
*/
|
|
19
22
|
const querystring_1 = require("querystring");
|
|
20
23
|
exports.HTTP_HEADER = {
|
|
21
24
|
contentType: 'Content-Type',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This defines request interfaces for mailerId-based login.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
type MailerIdAssertion = web3n.keys.MailerIdAssertion;
|
|
5
5
|
export declare const ERR_SC: {
|
|
6
6
|
duplicate: number;
|
|
7
7
|
malformed: number;
|
|
@@ -28,11 +28,7 @@ export declare namespace startSession {
|
|
|
28
28
|
export declare namespace authSession {
|
|
29
29
|
const URL_END = "authorize-session";
|
|
30
30
|
const method = "POST";
|
|
31
|
-
|
|
32
|
-
assertion: jwk.SignedLoad;
|
|
33
|
-
userCert: jwk.SignedLoad;
|
|
34
|
-
provCert: jwk.SignedLoad;
|
|
35
|
-
}
|
|
31
|
+
type Request = MailerIdAssertion;
|
|
36
32
|
const SC: {
|
|
37
33
|
authFailed: number;
|
|
38
34
|
ok: number;
|
|
@@ -41,3 +37,4 @@ export declare namespace authSession {
|
|
|
41
37
|
export interface ErrorReply {
|
|
42
38
|
error: string;
|
|
43
39
|
}
|
|
40
|
+
export {};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import * as jwk from '../../jwkeys';
|
|
1
|
+
type SignedLoad = web3n.keys.SignedLoad;
|
|
2
|
+
type JsonKey = web3n.keys.JsonKey;
|
|
5
3
|
export declare namespace pkl {
|
|
6
4
|
const START_URL_END = "start-login-exchange";
|
|
7
5
|
const COMPL_URL_END = "complete-login-exchange";
|
|
@@ -10,12 +8,12 @@ export declare namespace certify {
|
|
|
10
8
|
const URL_END = "certify";
|
|
11
9
|
const method = "POST";
|
|
12
10
|
interface Request {
|
|
13
|
-
pkey:
|
|
11
|
+
pkey: JsonKey;
|
|
14
12
|
duration: number;
|
|
15
13
|
}
|
|
16
14
|
interface Reply {
|
|
17
|
-
userCert:
|
|
18
|
-
provCert:
|
|
15
|
+
userCert: SignedLoad;
|
|
16
|
+
provCert: SignedLoad;
|
|
19
17
|
}
|
|
20
18
|
const SC: {
|
|
21
19
|
cryptoVerifFail: number;
|
|
@@ -23,3 +21,4 @@ export declare namespace certify {
|
|
|
23
21
|
ok: number;
|
|
24
22
|
};
|
|
25
23
|
}
|
|
24
|
+
export {};
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.certify = exports.pkl = void 0;
|
|
20
|
+
/**
|
|
21
|
+
* This defines request interfaces for MailerId certificate provisioning.
|
|
22
|
+
*/
|
|
20
23
|
const pklApi = require("../pub-key-login");
|
|
21
24
|
var pkl;
|
|
22
25
|
(function (pkl) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This defines interface for signup to 3NWeb services, but it is not part of
|
|
3
3
|
* 3NWeb utility protocols, like ASMail.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
type JsonKey = web3n.keys.JsonKey;
|
|
6
6
|
export declare const ERR_SC: {
|
|
7
7
|
duplicate: number;
|
|
8
8
|
malformed: number;
|
|
@@ -68,3 +68,4 @@ export declare namespace isActivated {
|
|
|
68
68
|
export interface ErrorReply {
|
|
69
69
|
error: string;
|
|
70
70
|
}
|
|
71
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StorageOwner as StorageOwnerClient } from './lib-client/3nstorage/
|
|
1
|
+
import { StorageOwner as StorageOwnerClient } from './lib-client/3nstorage/storage-owner';
|
|
2
2
|
import { MailRecipient as MailRecipientClient } from './lib-client/asmail/recipient';
|
|
3
3
|
import { MailSender as MailSenderClient } from './lib-client/asmail/sender';
|
|
4
4
|
import { MailerIdProvisioner as MailerIdProvisionerClient } from './lib-client/mailer-id/provisioner';
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.serviceLocationFuncs = exports.MailerIdProvisioner = exports.signupFuncs = exports.MailSender = exports.MailRecipient = exports.StorageOwner = void 0;
|
|
20
20
|
exports.getLibVersion = getLibVersion;
|
|
21
|
-
const
|
|
21
|
+
const storage_owner_1 = require("./lib-client/3nstorage/storage-owner");
|
|
22
22
|
const recipient_1 = require("./lib-client/asmail/recipient");
|
|
23
23
|
const sender_1 = require("./lib-client/asmail/sender");
|
|
24
24
|
const provisioner_1 = require("./lib-client/mailer-id/provisioner");
|
|
25
25
|
const signupClientFuncs = require("./lib-client/3nweb-signup");
|
|
26
26
|
const srvLocFuncs = require("./lib-client/service-locator");
|
|
27
|
-
exports.StorageOwner =
|
|
27
|
+
exports.StorageOwner = storage_owner_1.StorageOwner;
|
|
28
28
|
exports.MailRecipient = recipient_1.MailRecipient;
|
|
29
29
|
exports.MailSender = sender_1.MailSender;
|
|
30
30
|
exports.signupFuncs = signupClientFuncs;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-3nweb-client-lib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.1",
|
|
4
4
|
"description": "3NWeb client core library, embeddable into different environments",
|
|
5
5
|
"main": "build/lib-index.js",
|
|
6
6
|
"types": "build/lib-index.d.ts",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@types/ws": "^7.4.7",
|
|
42
42
|
"jasmine": "^3.9.0",
|
|
43
43
|
"protobufjs-cli": "^1.0.2",
|
|
44
|
-
"spec-3nweb-server": "^1.7.
|
|
45
|
-
"tsuml2": "^0.
|
|
44
|
+
"spec-3nweb-server": "^1.7.8",
|
|
45
|
+
"tsuml2": "^0.17.1",
|
|
46
46
|
"typescript": "^5.5.3"
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { MailConfigurator } from '../../../lib-client/asmail/service-config';
|
|
2
|
-
import { JsonFileProc } from '../../../lib-client/3nstorage/util/file-based-json';
|
|
3
|
-
type WritableFile = web3n.files.WritableFile;
|
|
4
|
-
type FileEvent = web3n.files.FileEvent;
|
|
5
|
-
export declare abstract class ParamOnFileAndServer<TF, TS> extends JsonFileProc<TF> {
|
|
6
|
-
private paramPath;
|
|
7
|
-
private serviceConf;
|
|
8
|
-
private changesProc;
|
|
9
|
-
constructor(paramPath: string, serviceConf: MailConfigurator);
|
|
10
|
-
start(file: WritableFile): Promise<void>;
|
|
11
|
-
private absorbChangesFromFile;
|
|
12
|
-
private syncServiceSetting;
|
|
13
|
-
protected onFileEvent(ev: FileEvent): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* This function updates values on ASMail configuration server.
|
|
16
|
-
* It also saves data to file, returning file's new version.
|
|
17
|
-
*/
|
|
18
|
-
protected save(): Promise<number>;
|
|
19
|
-
protected abstract setFromJSON(json: TF): void;
|
|
20
|
-
protected abstract toFileJSON(): TF;
|
|
21
|
-
protected abstract toServiceJSON(): TS;
|
|
22
|
-
protected abstract initStruct(): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export {};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (C) 2017 - 2018 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ParamOnFileAndServer = void 0;
|
|
19
|
-
const json_utils_1 = require("../../../lib-common/json-utils");
|
|
20
|
-
const file_based_json_1 = require("../../../lib-client/3nstorage/util/file-based-json");
|
|
21
|
-
const synced_1 = require("../../../lib-common/processes/synced");
|
|
22
|
-
class ParamOnFileAndServer extends file_based_json_1.JsonFileProc {
|
|
23
|
-
constructor(paramPath, serviceConf) {
|
|
24
|
-
super();
|
|
25
|
-
this.paramPath = paramPath;
|
|
26
|
-
this.serviceConf = serviceConf;
|
|
27
|
-
// XXX This should be done in a transactional style, with set on server
|
|
28
|
-
// first. FolderNode with its base class is an example of transactional
|
|
29
|
-
// mechanism implementation.
|
|
30
|
-
this.changesProc = new synced_1.SingleProc();
|
|
31
|
-
}
|
|
32
|
-
async start(file) {
|
|
33
|
-
await super.start(file, async () => {
|
|
34
|
-
await this.initStruct();
|
|
35
|
-
return this.toFileJSON();
|
|
36
|
-
});
|
|
37
|
-
await this.absorbChangesFromFile();
|
|
38
|
-
await this.syncServiceSetting();
|
|
39
|
-
}
|
|
40
|
-
async absorbChangesFromFile() {
|
|
41
|
-
const { json } = await this.get();
|
|
42
|
-
this.setFromJSON(json);
|
|
43
|
-
}
|
|
44
|
-
async syncServiceSetting() {
|
|
45
|
-
// XXX we may have the following bug here:
|
|
46
|
-
// Device with older version of param gets to this point, and sets older
|
|
47
|
-
// value.
|
|
48
|
-
// To protect aginst this case, absorbing from file must ensure highest
|
|
49
|
-
// synced version is read.
|
|
50
|
-
const infoOnServer = await this.serviceConf.getParam(this.paramPath)
|
|
51
|
-
.catch((exc) => {
|
|
52
|
-
if (exc.type === 'http-connect') {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
throw exc;
|
|
56
|
-
});
|
|
57
|
-
const currentVal = this.toServiceJSON();
|
|
58
|
-
if (!(0, json_utils_1.deepEqual)(infoOnServer, currentVal)) {
|
|
59
|
-
await this.serviceConf.setParam(this.paramPath, currentVal);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async onFileEvent(ev) {
|
|
63
|
-
if (ev.src === 'local') {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (ev.type === 'removed') {
|
|
67
|
-
throw new Error(`Unexpected removal of file with parameter ${this.paramPath}`);
|
|
68
|
-
}
|
|
69
|
-
if (ev.type !== 'file-change') {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
await this.changesProc.startOrChain(() => this.absorbChangesFromFile());
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* This function updates values on ASMail configuration server.
|
|
76
|
-
* It also saves data to file, returning file's new version.
|
|
77
|
-
*/
|
|
78
|
-
save() {
|
|
79
|
-
return this.changesProc.startOrChain(async () => {
|
|
80
|
-
await this.serviceConf.setParam(this.paramPath, this.toServiceJSON());
|
|
81
|
-
const version = await super.save(this.toFileJSON());
|
|
82
|
-
return version;
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.ParamOnFileAndServer = ParamOnFileAndServer;
|
|
87
|
-
Object.freeze(exports);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ServiceLocator } from '../../../lib-client/service-locator';
|
|
2
|
-
import { GetSigner } from '../../id-manager';
|
|
3
|
-
import { MsgKeyRole } from '../keyring';
|
|
4
|
-
import { JWKeyPair } from '../keyring/common';
|
|
5
|
-
import { NetClient } from '../../../lib-client/request-utils';
|
|
6
|
-
type WritableFS = web3n.files.WritableFS;
|
|
7
|
-
/**
|
|
8
|
-
* Instance of this class updates and checks setting of ASMail server.
|
|
9
|
-
*/
|
|
10
|
-
export declare class ConfigOfASMailServer {
|
|
11
|
-
private anonInvites;
|
|
12
|
-
private publishedIntroKeys;
|
|
13
|
-
anonSenderInvites: {
|
|
14
|
-
getAll: () => Map<string, {
|
|
15
|
-
invite: string;
|
|
16
|
-
msgMaxSize: number;
|
|
17
|
-
}>;
|
|
18
|
-
create: (label: string, msgMaxSize: number) => Promise<string>;
|
|
19
|
-
setMsgMaxSize: (label: string, msgMaxSize: number) => Promise<void>;
|
|
20
|
-
};
|
|
21
|
-
publishedKeys: {
|
|
22
|
-
/**
|
|
23
|
-
* This generates a new NaCl's box key pair, as a new introductory
|
|
24
|
-
* published key.
|
|
25
|
-
*/
|
|
26
|
-
update: () => Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* This looks for a published key with a given key id. If it is found, an
|
|
29
|
-
* object is returned with following fields:
|
|
30
|
-
* - pair is JWK key pair;
|
|
31
|
-
* - role of a found key pair;
|
|
32
|
-
* - replacedAt field is present for a previously published key pair,
|
|
33
|
-
* telling, in milliseconds, when this key was superseded a newer one.
|
|
34
|
-
* Undefined is returned, when a key is not found.
|
|
35
|
-
* @param kid
|
|
36
|
-
* @return if key is found, object with following fields is returned:
|
|
37
|
-
*/
|
|
38
|
-
find: (kid: string) => {
|
|
39
|
-
role: MsgKeyRole;
|
|
40
|
-
pair: JWKeyPair;
|
|
41
|
-
replacedAt?: number;
|
|
42
|
-
} | undefined;
|
|
43
|
-
};
|
|
44
|
-
private constructor();
|
|
45
|
-
static makeAndStart(address: string, getSigner: GetSigner, resolver: ServiceLocator, net: NetClient, fs: WritableFS): Promise<ConfigOfASMailServer>;
|
|
46
|
-
}
|
|
47
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (C) 2015 - 2018, 2021 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
|
-
const file_1 = require("../../../lib-common/exceptions/file");
|
|
22
|
-
const error_1 = require("../../../lib-common/exceptions/error");
|
|
23
|
-
const invitations_anon_1 = require("./invitations-anon");
|
|
24
|
-
const published_intro_key_1 = require("./published-intro-key");
|
|
25
|
-
const ANON_SENDER_INVITES_FILE = 'anonymous/invites.json';
|
|
26
|
-
const INTRO_KEY_FILE = 'introductory-key.json';
|
|
27
|
-
/**
|
|
28
|
-
* Instance of this class updates and checks setting of ASMail server.
|
|
29
|
-
*/
|
|
30
|
-
class ConfigOfASMailServer {
|
|
31
|
-
constructor(address, getSigner, resolver, net) {
|
|
32
|
-
const serviceConf = new service_config_1.MailConfigurator(address, getSigner, () => resolver(serviceConf.userId), net);
|
|
33
|
-
this.anonInvites = (0, invitations_anon_1.makeInvites)(serviceConf);
|
|
34
|
-
this.publishedIntroKeys = (0, published_intro_key_1.makePublishedIntroKey)(getSigner, serviceConf);
|
|
35
|
-
this.anonSenderInvites = {
|
|
36
|
-
getAll: this.anonInvites.getAll,
|
|
37
|
-
create: this.anonInvites.create,
|
|
38
|
-
setMsgMaxSize: this.anonInvites.setMsgMaxSize
|
|
39
|
-
};
|
|
40
|
-
Object.freeze(this.anonSenderInvites);
|
|
41
|
-
this.publishedKeys = {
|
|
42
|
-
update: this.publishedIntroKeys.update,
|
|
43
|
-
find: this.publishedIntroKeys.find
|
|
44
|
-
};
|
|
45
|
-
Object.freeze(this.publishedKeys);
|
|
46
|
-
Object.freeze(this);
|
|
47
|
-
}
|
|
48
|
-
static async makeAndStart(address, getSigner, resolver, net, fs) {
|
|
49
|
-
try {
|
|
50
|
-
(0, file_1.ensureCorrectFS)(fs, 'synced', true);
|
|
51
|
-
const conf = new ConfigOfASMailServer(address, getSigner, resolver, net);
|
|
52
|
-
await Promise.all([
|
|
53
|
-
fs.writableFile(ANON_SENDER_INVITES_FILE)
|
|
54
|
-
.then(f => conf.anonInvites.start(f)),
|
|
55
|
-
fs.writableFile(INTRO_KEY_FILE)
|
|
56
|
-
.then(f => conf.publishedIntroKeys.start(f)),
|
|
57
|
-
]);
|
|
58
|
-
await fs.close();
|
|
59
|
-
return conf;
|
|
60
|
-
}
|
|
61
|
-
catch (err) {
|
|
62
|
-
throw (0, error_1.errWithCause)(err, 'Failed to initialize ConfigOfASMailServer');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.ConfigOfASMailServer = ConfigOfASMailServer;
|
|
67
|
-
Object.freeze(ConfigOfASMailServer.prototype);
|
|
68
|
-
Object.freeze(ConfigOfASMailServer);
|
|
69
|
-
Object.freeze(exports);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MailConfigurator } from '../../../lib-client/asmail/service-config';
|
|
2
|
-
type WritableFile = web3n.files.WritableFile;
|
|
3
|
-
export interface Invites {
|
|
4
|
-
getAll: () => Map<string, {
|
|
5
|
-
invite: string;
|
|
6
|
-
msgMaxSize: number;
|
|
7
|
-
}>;
|
|
8
|
-
create: (label: string, msgMaxSize: number) => Promise<string>;
|
|
9
|
-
setMsgMaxSize: (label: string, msgMaxSize: number) => Promise<void>;
|
|
10
|
-
start: (file: WritableFile) => Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
export declare function makeInvites(serviceConf: MailConfigurator): Invites;
|
|
13
|
-
export {};
|