core-3nweb-client-lib 0.24.1 → 0.24.2
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 +292 -0
- package/build/api-defs/common-caps.d.ts +81 -0
- package/build/api-defs/files.d.ts +1037 -0
- package/build/api-defs/mailerid.d.ts +29 -0
- package/build/api-defs/startup.d.ts +121 -0
- package/build/api-defs/storage.d.ts +69 -0
- package/build/api-defs/web3n.d.ts +50 -0
- package/build/lib-index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 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
|
+
|
|
19
|
+
declare namespace web3n.mailerid {
|
|
20
|
+
|
|
21
|
+
interface Service {
|
|
22
|
+
|
|
23
|
+
getUserId(): Promise<string>;
|
|
24
|
+
|
|
25
|
+
login(serviceUrl: string): Promise<string>;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2016 - 2017, 2020 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
|
+
|
|
19
|
+
declare namespace web3n.startup {
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* This is a collection of functions, that are are used by startup
|
|
23
|
+
* functionality, when user creates new account in 3NWeb domains.
|
|
24
|
+
*/
|
|
25
|
+
interface SignUpService {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @param name is a part of address that comes before @domain
|
|
29
|
+
* @param signupToken
|
|
30
|
+
* @return a promise, resolvable to an array of available 3NWeb addresses
|
|
31
|
+
* with a given name part of the address.
|
|
32
|
+
* Array will be empty, when there are no available addresses for a given
|
|
33
|
+
* name.
|
|
34
|
+
*/
|
|
35
|
+
getAvailableAddresses(
|
|
36
|
+
name: string, signupToken?: string
|
|
37
|
+
): Promise<string[]>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param userId
|
|
41
|
+
* @param signupToken
|
|
42
|
+
* @return a promise, resolvable to flag that indicates whether an account
|
|
43
|
+
* for given user has been created (true value), or not (false value).
|
|
44
|
+
*/
|
|
45
|
+
addUser(userId: string, signupToken?: string): Promise<boolean>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @param userId
|
|
49
|
+
* @return a promise, resolvable to flag that indicates whether given user
|
|
50
|
+
* account is active (true value), or not (false value).
|
|
51
|
+
*/
|
|
52
|
+
isActivated(userId: string): Promise<boolean>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* This returns a promise, resolvable when MailerId login and storage
|
|
56
|
+
* secret keys, have been derived from a password.
|
|
57
|
+
* @param pass
|
|
58
|
+
* @param progressCB is a callback for progress notification
|
|
59
|
+
*/
|
|
60
|
+
createUserParams(
|
|
61
|
+
pass: string,
|
|
62
|
+
progressCB: (progress: number) => void
|
|
63
|
+
): Promise<void>;
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* This is a collection of functions, that are are used by startup
|
|
69
|
+
* functionality, when user signs into existing account, whether already
|
|
70
|
+
* cached on this device, or not.
|
|
71
|
+
*/
|
|
72
|
+
interface SignInService {
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* This returns an array of users, whose storages are found on a disk.
|
|
76
|
+
*/
|
|
77
|
+
getUsersOnDisk(): Promise<string[]>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* This starts a login process, when application is started without user
|
|
81
|
+
* storage on a disk.
|
|
82
|
+
* It returns a promise, resolvable either to true, if provisioning has
|
|
83
|
+
* started, or to false, if given address is not known to the MailerId
|
|
84
|
+
* server.
|
|
85
|
+
* @param address
|
|
86
|
+
*/
|
|
87
|
+
startLoginToRemoteStorage(address: string): Promise<boolean>;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* This completes login and setup of user's storage on a disk.
|
|
91
|
+
* It returns a promise, resolvable either to true, when provisioning is
|
|
92
|
+
* done, or to false, when given password is incorrect.
|
|
93
|
+
* @param pass is a MailerId login password
|
|
94
|
+
* @param progressCB is a callback for progress notification
|
|
95
|
+
*/
|
|
96
|
+
completeLoginAndLocalSetup(
|
|
97
|
+
pass: string,
|
|
98
|
+
progressCB: (progress: number) => void
|
|
99
|
+
): Promise<boolean>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* This method initializes core to run from an existing on a disk storage.
|
|
103
|
+
* It returns a promise, resolvable either to true, when password opens
|
|
104
|
+
* storage, and to false, when given password is incorrect.
|
|
105
|
+
* @param address is user' address.
|
|
106
|
+
* @param pass is user's password.
|
|
107
|
+
* @param progressCB is a callback for progress notification
|
|
108
|
+
*/
|
|
109
|
+
useExistingStorage(
|
|
110
|
+
address: string, pass: string,
|
|
111
|
+
progressCB: (progress: number) => void
|
|
112
|
+
): Promise<boolean>;
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface W3N {
|
|
117
|
+
signIn: startup.SignInService;
|
|
118
|
+
signUp: startup.SignUpService;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2016 - 2017, 2021 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
|
+
/**
|
|
19
|
+
* This is a namespace for things used by storage and any file functionality.
|
|
20
|
+
*/
|
|
21
|
+
declare namespace web3n.storage {
|
|
22
|
+
|
|
23
|
+
interface Service {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* This returns a promise of an app's fs in local storage.
|
|
27
|
+
* @param appName is a reversed domain. If omitted, this app's main
|
|
28
|
+
* domain is assumed.
|
|
29
|
+
*/
|
|
30
|
+
getAppLocalFS(appName?: string): Promise<files.WritableFS>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* This returns a promise of an app's fs in synced storage.
|
|
34
|
+
* @param appName is a reversed domain. If omitted, this app's main
|
|
35
|
+
* domain is assumed.
|
|
36
|
+
*/
|
|
37
|
+
getAppSyncedFS(appName?: string): Promise<files.WritableFS>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* This returns a promise, resolvable to user fs. It will be either
|
|
41
|
+
* writable or readonly, depending on app's manifest setting.
|
|
42
|
+
* @param type is a type of fs requested, like synced, local, or device.
|
|
43
|
+
* @param path is an optional to get more specific fs.
|
|
44
|
+
*/
|
|
45
|
+
getUserFS?: (type: StorageType, path?: string) => Promise<files.FSItem>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* This returns a promise, resolvable to system fs. It will be either
|
|
49
|
+
* writable or readonly, depending on app's manifest setting.
|
|
50
|
+
* @param type is a type of fs requested, like synced, local, or device.
|
|
51
|
+
* @param path is an optional to get more specific fs.
|
|
52
|
+
*/
|
|
53
|
+
getSysFS?: (type: StorageType, path?: string) => Promise<files.FSItem>;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type StorageType = 'device'|'synced'|'local';
|
|
58
|
+
type StorageUse = 'user'|'system'|'app';
|
|
59
|
+
|
|
60
|
+
interface StorageException extends web3n.RuntimeException {
|
|
61
|
+
type: 'storage';
|
|
62
|
+
appName?: string;
|
|
63
|
+
badAppName?: boolean;
|
|
64
|
+
notAllowedToOpenFS?: boolean;
|
|
65
|
+
storageType?: StorageType;
|
|
66
|
+
storageSegment: StorageUse;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2016 - 2018, 2020 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
|
+
/// <reference path="asmail.d.ts" />
|
|
19
|
+
/// <reference path="common-caps.d.ts" />
|
|
20
|
+
/// <reference path="files.d.ts" />
|
|
21
|
+
/// <reference path="mailerid.d.ts" />
|
|
22
|
+
/// <reference path="startup.d.ts" />
|
|
23
|
+
/// <reference path="storage.d.ts" />
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
declare namespace web3n {
|
|
27
|
+
|
|
28
|
+
interface RuntimeException {
|
|
29
|
+
runtimeException: true;
|
|
30
|
+
type?: string;
|
|
31
|
+
cause?: any;
|
|
32
|
+
message?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface EncryptionException {
|
|
36
|
+
failedCipherVerification?: true;
|
|
37
|
+
failedSignatureVerification?: true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface AsyncIterator<T> {
|
|
41
|
+
next(): Promise<IteratorResult<T>>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface Observer<T> {
|
|
45
|
+
next?: (value: T) => void;
|
|
46
|
+
error?: (err: any) => void;
|
|
47
|
+
complete?: () => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
package/build/lib-index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-3nweb-client-lib",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.2",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "bash packing/protos-to-node-module.sh && tsc -p ts-code && bash packing/build-wasm-cryptor.sh",
|
|
8
|
+
"build": "bash packing/protos-to-node-module.sh && tsc -p ts-code && bash packing/copy-api.sh && bash packing/build-wasm-cryptor.sh",
|
|
9
9
|
"test": "node build/tests/jasmine.js"
|
|
10
10
|
},
|
|
11
11
|
"repository": {
|