spec-3nweb-server 1.3.8 → 1.4.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/3nstorage/3nstorage-app.js +4 -4
- package/build/3nstorage/owner.js +21 -21
- package/build/3nstorage/resources/store.js +25 -24
- package/build/3nstorage/resources/users.js +2 -2
- package/build/3nstorage/routes/owner/archive-obj-version.d.ts +2 -2
- package/build/3nstorage/routes/owner/archive-obj-version.js +3 -2
- package/build/3nstorage/routes/owner/cancel-trans.js +1 -1
- package/build/3nstorage/routes/owner/delete-obj.js +1 -1
- package/build/3nstorage/routes/owner/get-archived-obj-ver.js +2 -2
- package/build/3nstorage/routes/owner/get-current-obj.js +2 -2
- package/build/3nstorage/routes/owner/list-obj-archive.js +3 -2
- package/build/3nstorage/routes/owner/param-getter.js +3 -2
- package/build/3nstorage/routes/owner/param-setter.js +3 -2
- package/build/3nstorage/routes/owner/put-current-obj.js +12 -10
- package/build/3nstorage/routes/owner/session-params.js +4 -3
- package/build/admin/admin-app.js +5 -5
- package/build/admin/resources/users.js +42 -42
- package/build/admin/routes/add.js +3 -3
- package/build/admin/signup-tokens.js +8 -8
- package/build/asmail/asmail-app.js +7 -7
- package/build/asmail/config.js +9 -8
- package/build/asmail/delivery.js +10 -9
- package/build/asmail/resources/delivery-sessions.js +4 -3
- package/build/asmail/resources/inbox.d.ts +1 -1
- package/build/asmail/resources/inbox.js +22 -22
- package/build/asmail/resources/recipients.d.ts +2 -1
- package/build/asmail/resources/recipients.js +4 -4
- package/build/asmail/resources/sessions.js +2 -1
- package/build/asmail/retrieval.js +13 -8
- package/build/asmail/routes/config/param-getter.js +3 -2
- package/build/asmail/routes/config/param-setter.js +3 -2
- package/build/asmail/routes/delivery/finalize-delivery.js +3 -2
- package/build/asmail/routes/delivery/pre-flight.js +5 -4
- package/build/asmail/routes/delivery/provide-recipient-pubkey.js +3 -2
- package/build/asmail/routes/delivery/put-metadata.js +3 -2
- package/build/asmail/routes/delivery/put-obj.js +4 -4
- package/build/asmail/routes/delivery/restart-session.js +4 -3
- package/build/asmail/routes/delivery/sender-authorization.d.ts +1 -3
- package/build/asmail/routes/delivery/sender-authorization.js +3 -2
- package/build/asmail/routes/delivery/start-session.js +5 -4
- package/build/asmail/routes/retrieval/get-message-meta.js +3 -2
- package/build/asmail/routes/retrieval/get-message-obj.js +4 -3
- package/build/asmail/routes/retrieval/list-messages.js +3 -2
- package/build/asmail/routes/retrieval/remove-message.js +3 -2
- package/build/lib-common/async-fs-node.js +13 -13
- package/build/lib-common/byte-streaming/common.js +9 -9
- package/build/lib-common/canonical-address.js +1 -1
- package/build/lib-common/ipc/generic-ipc.js +12 -12
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
- package/build/lib-common/objs-on-disk/file-layout.js +10 -10
- package/build/lib-common/objs-on-disk/obj-file.js +11 -11
- package/build/lib-common/objs-on-disk/utils.js +3 -3
- package/build/lib-common/processes.js +1 -1
- package/build/lib-common/random-node.js +7 -7
- package/build/lib-common/service-api/3nstorage/owner.d.ts +5 -4
- package/build/lib-common/service-api/3nstorage/owner.js +11 -10
- package/build/lib-common/service-api/asmail/delivery.js +2 -2
- package/build/lib-common/service-api/asmail/retrieval.js +1 -1
- package/build/lib-server/conf-util.js +2 -1
- package/build/lib-server/middleware/body-parsers.js +16 -16
- package/build/lib-server/middleware/error-handler.js +1 -1
- package/build/lib-server/resources/mailerid-authorizer.js +3 -3
- package/build/lib-server/resources/mem-backed-sessions-factory.js +3 -3
- package/build/lib-server/resources/server-data-folders.js +23 -23
- package/build/lib-server/resources/sessions.js +5 -5
- package/build/lib-server/resources/user-files.js +8 -8
- package/build/lib-server/routes/pub-key-login/complete-exchange.js +4 -3
- package/build/lib-server/routes/pub-key-login/start-exchange.js +7 -6
- package/build/lib-server/routes/sessions/mid-auth.js +6 -5
- package/build/lib-server/routes/sessions/start.js +4 -3
- package/build/lib-server/web-sockets/app.js +6 -5
- package/build/lib-server/web-sockets/server-events.js +5 -4
- package/build/mailerId/mailerId-app.js +7 -7
- package/build/mailerId/resources/certifier.d.ts +4 -6
- package/build/mailerId/resources/certifier.js +8 -7
- package/build/mailerId/resources/compute-login-dhshared-key.js +2 -1
- package/build/mailerId/resources/sessions.js +2 -1
- package/build/mailerId/resources/users.js +4 -4
- package/build/mailerId/routes/certify.js +1 -1
- package/build/main.js +10 -10
- package/build/mock/dns.js +1 -1
- package/build/mock/mock-as-child-proc.js +10 -10
- package/build/mock/node-child-ipc.js +2 -2
- package/build/mock/run-in-proc.js +7 -7
- package/build/run-config.js +10 -10
- package/build/run.js +4 -4
- package/build/services.js +5 -5
- package/package.json +7 -4
|
@@ -34,7 +34,7 @@ function commToChild(channel, child) {
|
|
|
34
34
|
child.send(env);
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
return generic_ipc_1.makeRequestingClient(channel, rawDuplex);
|
|
37
|
+
return (0, generic_ipc_1.makeRequestingClient)(channel, rawDuplex);
|
|
38
38
|
}
|
|
39
39
|
exports.commToChild = commToChild;
|
|
40
40
|
function commToParent(channel) {
|
|
@@ -57,7 +57,7 @@ function commToParent(channel) {
|
|
|
57
57
|
process.send(env);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
return generic_ipc_1.makeRequestServer(channel, commPoint);
|
|
60
|
+
return (0, generic_ipc_1.makeRequestServer)(channel, commPoint);
|
|
61
61
|
}
|
|
62
62
|
exports.commToParent = commToParent;
|
|
63
63
|
Object.freeze(exports);
|
|
@@ -47,7 +47,7 @@ function setTestCertsAndDNS(domains, thisSrvLoc) {
|
|
|
47
47
|
}
|
|
48
48
|
exports.setTestCertsAndDNS = setTestCertsAndDNS;
|
|
49
49
|
async function startOn(srvDomain, dataDir, port, domains) {
|
|
50
|
-
const noTokensFilePath = path_1.join(dataDir, 'no-tokens-signup.json');
|
|
50
|
+
const noTokensFilePath = (0, path_1.join)(dataDir, 'no-tokens-signup.json');
|
|
51
51
|
const conf = {
|
|
52
52
|
rootFolder: dataDir,
|
|
53
53
|
domain: srvDomain,
|
|
@@ -60,7 +60,7 @@ async function startOn(srvDomain, dataDir, port, domains) {
|
|
|
60
60
|
noTokenFile: noTokensFilePath
|
|
61
61
|
},
|
|
62
62
|
mailerId: {
|
|
63
|
-
certs: path_1.join(dataDir, 'mid-certs.json')
|
|
63
|
+
certs: (0, path_1.join)(dataDir, 'mid-certs.json')
|
|
64
64
|
},
|
|
65
65
|
servicesConnect: {
|
|
66
66
|
port,
|
|
@@ -68,22 +68,22 @@ async function startOn(srvDomain, dataDir, port, domains) {
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
// prepare data folders
|
|
71
|
-
await async_fs_node_1.mkdir(dataDir)
|
|
71
|
+
await (0, async_fs_node_1.mkdir)(dataDir)
|
|
72
72
|
.catch((exc) => {
|
|
73
73
|
if (!exc.alreadyExists) {
|
|
74
74
|
throw exc;
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
// write to-tokens signup file
|
|
78
|
-
const noTokenCtx = signup_tokens_1.makeMultiDomainSignupCtx(domains.noTokenSignup);
|
|
79
|
-
await async_fs_node_1.writeFile(noTokensFilePath, JSON.stringify(noTokenCtx), { encoding: 'utf8' });
|
|
78
|
+
const noTokenCtx = (0, signup_tokens_1.makeMultiDomainSignupCtx)(domains.noTokenSignup);
|
|
79
|
+
await (0, async_fs_node_1.writeFile)(noTokensFilePath, JSON.stringify(noTokenCtx), { encoding: 'utf8' });
|
|
80
80
|
// certs and DNS
|
|
81
81
|
const allDomains = domains.noTokenSignup.concat(domains.other);
|
|
82
82
|
const dnsMock = setTestCertsAndDNS(allDomains, `${srvDomain}:${port}`);
|
|
83
83
|
// setup services and start
|
|
84
84
|
const app = new app_1.AppWithWSs();
|
|
85
|
-
app.use(services_1.adminApp(conf));
|
|
86
|
-
app.use(services_1.servicesApp(conf));
|
|
85
|
+
app.use((0, services_1.adminApp)(conf));
|
|
86
|
+
app.use((0, services_1.servicesApp)(conf));
|
|
87
87
|
await app.start(conf.servicesConnect.sslOpts, conf.servicesConnect.port);
|
|
88
88
|
return { dnsMock, stop: () => app.stop() };
|
|
89
89
|
}
|
package/build/run-config.js
CHANGED
|
@@ -60,25 +60,25 @@ function getConfsFromEnv() {
|
|
|
60
60
|
}
|
|
61
61
|
// Make data folders
|
|
62
62
|
ensureFolderPresence(dataDir, true);
|
|
63
|
-
dataDir = fs_1.realpathSync(dataDir);
|
|
63
|
+
dataDir = (0, fs_1.realpathSync)(dataDir);
|
|
64
64
|
let midCerts = process.env[CERTS_FILE_VAR];
|
|
65
65
|
if (!midCerts) {
|
|
66
|
-
midCerts = path_1.join(dataDir, 'mid-certs.json');
|
|
66
|
+
midCerts = (0, path_1.join)(dataDir, 'mid-certs.json');
|
|
67
67
|
}
|
|
68
68
|
const noTokenFile = process.env[NO_TOKENS_FILE];
|
|
69
69
|
return makeConf(domain, dataDir, midCerts, noTokenFile);
|
|
70
70
|
}
|
|
71
71
|
exports.getConfsFromEnv = getConfsFromEnv;
|
|
72
72
|
function ensureFolderPresence(path, doLog) {
|
|
73
|
-
if (async_fs_node_1.existsFolderSync(path)) {
|
|
73
|
+
if ((0, async_fs_node_1.existsFolderSync)(path)) {
|
|
74
74
|
if (doLog) {
|
|
75
75
|
console.log(`Using existing data folder ${path}`);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
|
-
fs_1.mkdirSync(path);
|
|
79
|
+
(0, fs_1.mkdirSync)(path);
|
|
80
80
|
if (doLog) {
|
|
81
|
-
console.log(`Created ${fs_1.realpathSync(path)}`);
|
|
81
|
+
console.log(`Created ${(0, fs_1.realpathSync)(path)}`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -117,11 +117,11 @@ function getTLSParamsFromEnv() {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
async function addSingleUserSignup(rootFolder, userId) {
|
|
120
|
-
const token = await signup_tokens_1.generateToken();
|
|
121
|
-
const ctx = signup_tokens_1.makeSingleUserSignupCtx(token, userId);
|
|
122
|
-
const fPath = signup_tokens_1.tokenPath(rootFolder, token);
|
|
120
|
+
const token = await (0, signup_tokens_1.generateToken)();
|
|
121
|
+
const ctx = (0, signup_tokens_1.makeSingleUserSignupCtx)(token, userId);
|
|
122
|
+
const fPath = (0, signup_tokens_1.tokenPath)(rootFolder, token);
|
|
123
123
|
try {
|
|
124
|
-
await async_fs_node_1.writeFile(fPath, JSON.stringify(ctx), { encoding: 'utf8', flag: 'wx' });
|
|
124
|
+
await (0, async_fs_node_1.writeFile)(fPath, JSON.stringify(ctx), { encoding: 'utf8', flag: 'wx' });
|
|
125
125
|
return token;
|
|
126
126
|
}
|
|
127
127
|
catch (exc) {
|
|
@@ -129,7 +129,7 @@ async function addSingleUserSignup(rootFolder, userId) {
|
|
|
129
129
|
return addSingleUserSignup(rootFolder, userId);
|
|
130
130
|
}
|
|
131
131
|
else if (exc.notFound) {
|
|
132
|
-
await async_fs_node_1.mkdir(server_data_folders_1.tokensInRootFolder(rootFolder))
|
|
132
|
+
await (0, async_fs_node_1.mkdir)((0, server_data_folders_1.tokensInRootFolder)(rootFolder))
|
|
133
133
|
.catch((exc) => {
|
|
134
134
|
if (!exc.alreadyExists) {
|
|
135
135
|
throw exc;
|
package/build/run.js
CHANGED
|
@@ -20,11 +20,11 @@ const app_1 = require("./lib-server/web-sockets/app");
|
|
|
20
20
|
const run_config_1 = require("./run-config");
|
|
21
21
|
(async () => {
|
|
22
22
|
try {
|
|
23
|
-
const conf = run_config_1.getConfsFromEnv();
|
|
23
|
+
const conf = (0, run_config_1.getConfsFromEnv)();
|
|
24
24
|
const app = new app_1.AppWithWSs();
|
|
25
|
-
app.use(services_1.servicesApp(conf));
|
|
26
|
-
app.use(services_1.adminApp(conf));
|
|
27
|
-
const { address, port, sslOpts } = run_config_1.getBindParamsFromEnv();
|
|
25
|
+
app.use((0, services_1.servicesApp)(conf));
|
|
26
|
+
app.use((0, services_1.adminApp)(conf));
|
|
27
|
+
const { address, port, sslOpts } = (0, run_config_1.getBindParamsFromEnv)();
|
|
28
28
|
await app.start(sslOpts, port, address);
|
|
29
29
|
console.log(`Started 3NWeb server at address ${address}, port ${port}, ${sslOpts ? 'via TLS' : 'without TLS, and requiring TLS reverse proxy infront.'}`);
|
|
30
30
|
}
|
package/build/services.js
CHANGED
|
@@ -28,21 +28,21 @@ function servicesApp(conf) {
|
|
|
28
28
|
throw new Error('Missing enabled-services sections in confs.');
|
|
29
29
|
}
|
|
30
30
|
const app = new app_1.AppWithWSs();
|
|
31
|
-
const midAuthorizer = mailerid_authorizer_1.validator(); // share, allowing for caching of certs
|
|
31
|
+
const midAuthorizer = (0, mailerid_authorizer_1.validator)(); // share, allowing for caching of certs
|
|
32
32
|
if (conf.enabledServices.mailerId) {
|
|
33
|
-
app.http.use('/mailerid', mailerId_app_1.makeApp(conf.rootFolder, conf.domain, conf.mailerId.certs));
|
|
33
|
+
app.http.use('/mailerid', (0, mailerId_app_1.makeApp)(conf.rootFolder, conf.domain, conf.mailerId.certs));
|
|
34
34
|
}
|
|
35
35
|
if (conf.enabledServices.asmail) {
|
|
36
|
-
app.use('/asmail', asmail_app_1.makeApp(conf.rootFolder, conf.domain, midAuthorizer));
|
|
36
|
+
app.use('/asmail', (0, asmail_app_1.makeApp)(conf.rootFolder, conf.domain, midAuthorizer));
|
|
37
37
|
}
|
|
38
38
|
if (conf.enabledServices.storage) {
|
|
39
|
-
app.use('/3nstorage', _3nstorage_app_1.makeApp(conf.rootFolder, conf.domain, midAuthorizer));
|
|
39
|
+
app.use('/3nstorage', (0, _3nstorage_app_1.makeApp)(conf.rootFolder, conf.domain, midAuthorizer));
|
|
40
40
|
}
|
|
41
41
|
return app;
|
|
42
42
|
}
|
|
43
43
|
exports.servicesApp = servicesApp;
|
|
44
44
|
function adminApp(conf) {
|
|
45
|
-
return new app_1.AppWithWSs(admin_app_1.makeApp(conf));
|
|
45
|
+
return new app_1.AppWithWSs((0, admin_app_1.makeApp)(conf));
|
|
46
46
|
}
|
|
47
47
|
exports.adminApp = adminApp;
|
|
48
48
|
Object.freeze(exports);
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-3nweb-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "3NWeb spec server.",
|
|
5
5
|
"main": "build/lib.js",
|
|
6
6
|
"types": "build/lib.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"build": "tsc -p ts-code",
|
|
9
|
+
"test": "node build/tests/jasmine.js",
|
|
10
|
+
"clear-for-packing": "npm prune --production && bash -c \"rm -rf build/mock build/tests 'node_modules/ecma-nacl/c sources'\"",
|
|
11
|
+
"clear-for-packing-mock": "npm prune --production && bash -c \"rm -rf build/tests 'node_modules/ecma-nacl/c sources'\"",
|
|
12
|
+
"pack-deb": "npm run clear-for-packing && bash packing/deb/create-bin.sh"
|
|
10
13
|
},
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
|
@@ -39,7 +42,7 @@
|
|
|
39
42
|
"@types/ws": "^4.0.0",
|
|
40
43
|
"jasmine": "^2.5.3",
|
|
41
44
|
"rxjs": "^5.3.0",
|
|
42
|
-
"typescript": "^
|
|
45
|
+
"typescript": "^4.6.3",
|
|
43
46
|
"xhr2": "^0.1.3"
|
|
44
47
|
},
|
|
45
48
|
"readmeFilename": "README.md"
|