spec-3nweb-server 1.7.9 → 1.7.11
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/README.md +16 -2
- package/build/asmail/resources/inbox.js +2 -2
- package/build/asmail/resources/recipients.js +16 -12
- package/build/lib-common/async-fs-node.d.ts +1 -0
- package/build/lib-common/buffer-utils.d.ts +1 -0
- package/build/lib-common/objs-on-disk/file-layout.d.ts +1 -0
- package/build/lib-common/objs-on-disk/v1-obj-file-format.d.ts +1 -0
- package/build/signup/signup-tokens.d.ts +1 -0
- package/package.json +6 -9
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ Thus, we call it a spec server.
|
|
|
7
7
|
Main purpose of this server is to ensure that 3NWeb protocols are implementable, and to be a testbed for possible new features.
|
|
8
8
|
Secondary purpose of this server is to be packagable into a home-class server, i.e. server that can be run from a single machine.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Build & Test
|
|
11
11
|
|
|
12
|
-
To use this repo, you need [Node.js](https://nodejs.org/)
|
|
12
|
+
To use this repo, you need [Node.js](https://nodejs.org/).
|
|
13
13
|
|
|
14
14
|
When in the project's folder, run
|
|
15
15
|
```
|
|
@@ -32,6 +32,20 @@ Config file is `src/tests/jasmine.ts`.
|
|
|
32
32
|
|
|
33
33
|
Please note, that support for running server on windows hasn't been introduced, yet.
|
|
34
34
|
|
|
35
|
+
## ASMail (Authenticated Secure Mail) protocol overview
|
|
36
|
+
|
|
37
|
+
```mermaid
|
|
38
|
+
flowchart LR
|
|
39
|
+
C@{ shape: hex, label: "customer#64;x.y.z" } -- anonymous <br> connection --> VS@{ shape: lin-cyl, label: "ASMail service for a.b.c" }
|
|
40
|
+
V@{ shape: hex, label: "vendor#64;a.b.c" } -- anonymous <br> connection --> CS@{ shape: lin-cyl, label: "ASMail service for x.y.z" }
|
|
41
|
+
subgraph cg[" "]
|
|
42
|
+
CS -- owner <br> connection --> C
|
|
43
|
+
end
|
|
44
|
+
subgraph vg[" "]
|
|
45
|
+
VS -- owner <br> connection --> V
|
|
46
|
+
end
|
|
47
|
+
```
|
|
48
|
+
|
|
35
49
|
# License
|
|
36
50
|
|
|
37
51
|
Code is provided here under GNU General Public License, version 3.
|
|
@@ -370,7 +370,7 @@ class Inbox extends user_files_1.UserFiles {
|
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
async setAuthSenderBlacklist(lst) {
|
|
373
|
-
if (
|
|
373
|
+
if (isValidBlacklist(lst)) {
|
|
374
374
|
await this.setParam('authenticated/blacklist', lst);
|
|
375
375
|
return true;
|
|
376
376
|
}
|
|
@@ -435,7 +435,7 @@ function isValidListWithMsgMaxSizes(lst) {
|
|
|
435
435
|
}
|
|
436
436
|
return true;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function isValidBlacklist(lst) {
|
|
439
439
|
return ('object' === typeof lst) && !!lst;
|
|
440
440
|
}
|
|
441
441
|
class ObjFiles {
|
|
@@ -86,22 +86,26 @@ async function adaptToFreeSpaceLeft(inbox, msgSize) {
|
|
|
86
86
|
*/
|
|
87
87
|
async function allowedMsgSizeForAnonSender(inbox, invitation) {
|
|
88
88
|
const policy = await inbox.getParam('anonymous/policy');
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!invitation) {
|
|
89
|
+
if (policy.accept) {
|
|
90
|
+
// XXX this misses case when invite allows for bigger messages,
|
|
91
|
+
// while without invite messages are also allowed.
|
|
93
92
|
if (policy.acceptWithInvitesOnly) {
|
|
94
|
-
|
|
93
|
+
if (invitation) {
|
|
94
|
+
const invites = await inbox.getParam('anonymous/invites');
|
|
95
|
+
const sizeForInvite = invites[invitation];
|
|
96
|
+
return ((typeof sizeForInvite === 'number') ?
|
|
97
|
+
adaptToFreeSpaceLeft(inbox, sizeForInvite) : 0);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return await adaptToFreeSpaceLeft(inbox, policy.defaultMsgSize);
|
|
95
105
|
}
|
|
96
|
-
return await adaptToFreeSpaceLeft(inbox, policy.defaultMsgSize);
|
|
97
106
|
}
|
|
98
107
|
else {
|
|
99
|
-
|
|
100
|
-
const sizeForInvite = invites[invitation];
|
|
101
|
-
if (typeof sizeForInvite !== 'number') {
|
|
102
|
-
return 0;
|
|
103
|
-
}
|
|
104
|
-
return adaptToFreeSpaceLeft(inbox, sizeForInvite);
|
|
108
|
+
return 0;
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
/**
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-3nweb-server",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11",
|
|
4
4
|
"description": "3NWeb spec server.",
|
|
5
5
|
"main": "build/lib.js",
|
|
6
6
|
"types": "build/lib.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"3nweb": "node build/main.js"
|
|
9
|
+
},
|
|
7
10
|
"scripts": {
|
|
8
11
|
"build": "tsc -p ts-code",
|
|
12
|
+
"server": "node build/main.js",
|
|
9
13
|
"test": "node build/tests/jasmine.js",
|
|
10
14
|
"clear-for-packing": "npm prune --production && bash -c \"rm -rf build/mock build/tests 'node_modules/ecma-nacl/c sources'\"",
|
|
11
15
|
"clear-for-packing-mock": "npm prune --production && bash -c \"rm -rf build/tests 'node_modules/ecma-nacl/c sources'\"",
|
|
12
|
-
"pack": "
|
|
16
|
+
"pack": "echo unimplemented",
|
|
13
17
|
"pack-deb": "npm run pack && bash packing/create-deb.sh",
|
|
14
18
|
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
|
|
15
19
|
},
|
|
@@ -47,16 +51,9 @@
|
|
|
47
51
|
"@types/node": "^16.11.7",
|
|
48
52
|
"@types/ws": "^4.0.0",
|
|
49
53
|
"jasmine": "^3.9.0",
|
|
50
|
-
"pkg": "^5.8.1",
|
|
51
54
|
"rxjs": "^5.3.0",
|
|
52
55
|
"typescript": "^4.7.4",
|
|
53
56
|
"xhr2": "^0.1.3"
|
|
54
57
|
},
|
|
55
|
-
"pkg": {
|
|
56
|
-
"targets": [
|
|
57
|
-
"node18-linux-x64"
|
|
58
|
-
],
|
|
59
|
-
"outputPath": "dist"
|
|
60
|
-
},
|
|
61
58
|
"readmeFilename": "README.md"
|
|
62
59
|
}
|