spec-3nweb-server 1.7.0 → 1.7.5
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.d.ts +4 -1
- package/build/3nstorage/3nstorage-app.js +18 -9
- package/build/3nstorage/owner.d.ts +3 -2
- package/build/3nstorage/owner.js +39 -32
- package/build/3nstorage/resources/sessions.d.ts +2 -2
- package/build/3nstorage/resources/sessions.js +2 -1
- package/build/3nstorage/resources/store.d.ts +6 -6
- package/build/3nstorage/resources/store.js +3 -12
- package/build/3nstorage/resources/users.d.ts +16 -16
- package/build/3nstorage/resources/users.js +13 -16
- package/build/3nstorage/shared.d.ts +2 -6
- package/build/3nstorage/shared.js +5 -9
- package/build/asmail/asmail-app.d.ts +1 -1
- package/build/asmail/asmail-app.js +3 -3
- package/build/asmail/config.d.ts +2 -6
- package/build/asmail/config.js +20 -12
- package/build/asmail/delivery.d.ts +2 -6
- package/build/asmail/delivery.js +0 -6
- package/build/asmail/resources/delivery-sessions.d.ts +3 -3
- package/build/asmail/resources/delivery-sessions.js +1 -2
- package/build/asmail/resources/inbox.d.ts +26 -35
- package/build/asmail/resources/inbox.js +15 -59
- package/build/asmail/resources/recipients.d.ts +39 -21
- package/build/asmail/resources/recipients.js +62 -22
- package/build/asmail/resources/sessions.d.ts +2 -2
- package/build/asmail/retrieval.d.ts +2 -2
- package/build/asmail/retrieval.js +11 -18
- package/build/asmail/routes/delivery/sender-authorization.d.ts +1 -1
- package/build/asmail/routes/delivery/start-session.d.ts +1 -1
- package/build/config/letsencrypt.d.ts +1 -1
- package/build/config/signup.d.ts +1 -1
- package/build/config/signup.js +2 -1
- package/build/lib-common/assert.js +2 -1
- package/build/lib-common/buffer-utils.js +2 -1
- package/build/lib-common/byte-streaming/common.d.ts +2 -2
- package/build/lib-common/byte-streaming/common.js +16 -16
- package/build/lib-common/bytes-equal.js +2 -1
- package/build/lib-common/exceptions/error.js +2 -1
- package/build/lib-common/exceptions/file.d.ts +1 -1
- package/build/lib-common/exceptions/file.js +2 -1
- package/build/lib-common/exceptions/http.js +2 -1
- package/build/lib-common/ipc/generic-ipc.d.ts +7 -7
- package/build/lib-common/ipc/generic-ipc.js +20 -20
- package/build/lib-common/ipc/ws-ipc.js +2 -1
- package/build/lib-common/json-equal.js +2 -1
- package/build/lib-common/json-utils.js +2 -1
- package/build/lib-common/jwkeys.js +2 -1
- package/build/lib-common/map-of-sets.js +2 -1
- package/build/lib-common/mid-sigs-NaCl-Ed.js +2 -1
- package/build/lib-common/objs-on-disk/file-layout.d.ts +4 -4
- package/build/lib-common/objs-on-disk/file-layout.js +2 -1
- package/build/lib-common/objs-on-disk/obj-file.js +2 -1
- package/build/lib-common/objs-on-disk/utils.d.ts +3 -3
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +2 -1
- package/build/lib-common/processes.d.ts +1 -1
- package/build/lib-common/processes.js +2 -1
- package/build/lib-common/random-node.js +2 -1
- package/build/lib-common/service-api/3nstorage/owner.d.ts +1 -3
- package/build/lib-common/service-api/3nstorage/owner.js +2 -4
- package/build/lib-common/service-api/asmail/config.d.ts +1 -3
- package/build/lib-common/service-api/asmail/config.js +4 -5
- package/build/lib-common/service-api/asmail/delivery.js +2 -1
- package/build/lib-common/service-api/asmail/retrieval.d.ts +1 -3
- package/build/lib-common/service-api/asmail/retrieval.js +3 -4
- package/build/lib-common/service-api/ipc-api.d.ts +6 -6
- package/build/lib-common/service-api/ipc-api.js +2 -1
- package/build/lib-common/service-api/locker.d.ts +17 -0
- package/build/lib-common/service-api/locker.js +31 -0
- package/build/lib-common/service-api/mailer-id/login.js +2 -1
- package/build/lib-common/service-api/mailer-id/provisioning.d.ts +3 -4
- package/build/lib-common/service-api/mailer-id/provisioning.js +3 -12
- package/build/lib-common/service-api/pub-key-login.js +2 -1
- package/build/lib-common/service-api/web-socket-base.d.ts +1 -1
- package/build/lib-common/service-api/web-socket-base.js +2 -1
- package/build/lib-common/session-encryptor.js +2 -1
- package/build/lib-common/time-window-cache.js +2 -1
- package/build/lib-server/mid-access.d.ts +5 -0
- package/build/lib-server/mid-access.js +28 -0
- package/build/lib-server/middleware/body-parsers.d.ts +7 -7
- package/build/lib-server/middleware/body-parsers.js +14 -14
- package/build/lib-server/middleware/error-handler.d.ts +1 -1
- package/build/lib-server/pkl-access.d.ts +4 -0
- package/build/lib-server/pkl-access.js +28 -0
- package/build/lib-server/resources/dns.d.ts +1 -1
- package/build/lib-server/resources/dns.js +2 -1
- package/build/lib-server/resources/mailerid-authorizer.js +5 -6
- package/build/lib-server/resources/server-data-folders.d.ts +1 -0
- package/build/lib-server/resources/server-data-folders.js +9 -4
- package/build/{mailerId/resources/compute-login-dhshared-key.js → lib-server/resources/server-key-for-pkl-challenge.js} +5 -5
- package/build/lib-server/resources/sessions.d.ts +2 -2
- package/build/lib-server/resources/sessions.js +7 -7
- package/build/lib-server/resources/user-files.d.ts +4 -4
- package/build/lib-server/resources/user-files.js +4 -2
- package/build/lib-server/routes/pub-key-login/start-exchange.d.ts +4 -4
- package/build/lib-server/routes/sessions/close.js +2 -1
- package/build/lib-server/routes/sessions/mid-auth.d.ts +1 -1
- package/build/lib-server/routes/sessions/start.d.ts +4 -4
- package/build/lib-server/web-sockets/app.d.ts +1 -1
- package/build/lib-server/web-sockets/app.js +8 -9
- package/build/lib-server/web-sockets/server-events.d.ts +1 -1
- package/build/lib-server/web-sockets/server-events.js +1 -2
- package/build/lib.d.ts +1 -2
- package/build/lib.js +2 -5
- package/build/locker/locker-app.d.ts +3 -0
- package/build/locker/locker-app.js +41 -0
- package/build/locker/resources/lockers.d.ts +0 -0
- package/build/{lib-common/binding.js → locker/resources/lockers.js} +3 -10
- package/build/locker/resources/sessions.d.ts +9 -0
- package/build/locker/resources/sessions.js +33 -0
- package/build/locker/routes/create-locker.d.ts +4 -0
- package/build/locker/routes/create-locker.js +37 -0
- package/build/mailerId/mailerId-app.d.ts +1 -1
- package/build/mailerId/mailerId-app.js +12 -11
- package/build/mailerId/resources/certifier.d.ts +1 -1
- package/build/mailerId/resources/sessions.d.ts +1 -1
- package/build/mailerId/routes/certify.js +2 -1
- package/build/main.js +1 -1
- package/build/mock/dns.js +3 -4
- package/build/mock/mock-as-child-proc.js +2 -2
- package/build/mock/node-child-ipc.d.ts +2 -2
- package/build/mock/node-child-ipc.js +2 -1
- package/build/mock/run-in-proc.js +2 -2
- package/build/mock/tls-options.js +2 -1
- package/build/services.d.ts +2 -1
- package/build/services.js +22 -11
- package/build/{admin → signup}/resources/users.d.ts +3 -3
- package/build/{admin → signup}/resources/users.js +3 -4
- package/build/{admin/admin-app.d.ts → signup/signup-app.d.ts} +1 -1
- package/build/{admin/admin-app.js → signup/signup-app.js} +6 -16
- package/build/{admin → signup}/signup-tokens.d.ts +1 -1
- package/package.json +3 -3
- package/build/config/from-env.d.ts +0 -9
- package/build/config/from-env.js +0 -117
- package/build/lib-common/binding.d.ts +0 -1
- package/build/run.d.ts +0 -1
- package/build/run.js +0 -45
- /package/build/{mailerId/resources/compute-login-dhshared-key.d.ts → lib-server/resources/server-key-for-pkl-challenge.d.ts} +0 -0
- /package/build/{admin → signup}/routes/add.d.ts +0 -0
- /package/build/{admin → signup}/routes/add.js +0 -0
- /package/build/{admin → signup}/routes/get-available-addresses.d.ts +0 -0
- /package/build/{admin → signup}/routes/get-available-addresses.js +0 -0
- /package/build/{admin → signup}/routes/get-available-domains.d.ts +0 -0
- /package/build/{admin → signup}/routes/get-available-domains.js +0 -0
- /package/build/{admin → signup}/signup-tokens.js +0 -0
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Configurations } from "../services";
|
|
3
|
-
import { ServerOptions } from "https";
|
|
4
|
-
export declare function getConfsFromEnv(): Configurations;
|
|
5
|
-
export declare function getBindParamsFromEnv(): {
|
|
6
|
-
address?: string;
|
|
7
|
-
port: number;
|
|
8
|
-
sslOpts?: ServerOptions;
|
|
9
|
-
};
|
package/build/config/from-env.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (C) 2019 - 2020 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.getBindParamsFromEnv = exports.getConfsFromEnv = void 0;
|
|
20
|
-
const async_fs_node_1 = require("../lib-common/async-fs-node");
|
|
21
|
-
const path_1 = require("path");
|
|
22
|
-
const fs_1 = require("fs");
|
|
23
|
-
const DOMAIN_VAR = 'W3N_DOMAIN';
|
|
24
|
-
const DATA_DIR_VAR = 'W3N_DATA_DIR';
|
|
25
|
-
const NO_TOKENS_FILE = 'NO_TOKENS_FILE';
|
|
26
|
-
const CERTS_FILE_VAR = 'W3N_MID_CERTS_FILE';
|
|
27
|
-
const ADDRESS_VAR = 'W3N_SERICE_ADDRESS';
|
|
28
|
-
const PORT_VAR = 'W3N_SERICE_PORT';
|
|
29
|
-
const TLS_KEY_VAR = 'W3N_SERICE_TLS_KEY';
|
|
30
|
-
const TLS_CERT_VAR = 'W3N_SERICE_TLS_CERT';
|
|
31
|
-
const TLS_PFX_VAR = 'W3N_SERICE_TLS_PFX';
|
|
32
|
-
const DEFAULT_PORT = 8080;
|
|
33
|
-
function makeConf(domain, rootFolder, midCertsFile, noTokenFile) {
|
|
34
|
-
return {
|
|
35
|
-
enabledServices: {
|
|
36
|
-
asmail: true,
|
|
37
|
-
storage: true,
|
|
38
|
-
mailerId: true
|
|
39
|
-
},
|
|
40
|
-
rootFolder,
|
|
41
|
-
domain,
|
|
42
|
-
mailerId: {
|
|
43
|
-
certs: midCertsFile
|
|
44
|
-
},
|
|
45
|
-
signup: {
|
|
46
|
-
noTokenFile
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function getConfsFromEnv() {
|
|
51
|
-
const domain = process.env[DOMAIN_VAR];
|
|
52
|
-
if (!domain) {
|
|
53
|
-
throw new Error(`Environment variable ${DOMAIN_VAR} is not set with domain name, for which 3NWeb processes are served.`);
|
|
54
|
-
}
|
|
55
|
-
let dataDir = process.env[DATA_DIR_VAR];
|
|
56
|
-
if (!dataDir) {
|
|
57
|
-
dataDir = '/var/local/3nweb';
|
|
58
|
-
}
|
|
59
|
-
// Make data folders
|
|
60
|
-
ensureFolderPresence(dataDir, true);
|
|
61
|
-
dataDir = (0, fs_1.realpathSync)(dataDir);
|
|
62
|
-
let midCerts = process.env[CERTS_FILE_VAR];
|
|
63
|
-
if (!midCerts) {
|
|
64
|
-
midCerts = (0, path_1.join)(dataDir, 'mid-certs.json');
|
|
65
|
-
}
|
|
66
|
-
const noTokenFile = process.env[NO_TOKENS_FILE];
|
|
67
|
-
return makeConf(domain, dataDir, midCerts, noTokenFile);
|
|
68
|
-
}
|
|
69
|
-
exports.getConfsFromEnv = getConfsFromEnv;
|
|
70
|
-
function ensureFolderPresence(path, doLog) {
|
|
71
|
-
if ((0, async_fs_node_1.existsFolderSync)(path)) {
|
|
72
|
-
if (doLog) {
|
|
73
|
-
console.log(`Using existing data folder ${path}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
(0, fs_1.mkdirSync)(path);
|
|
78
|
-
if (doLog) {
|
|
79
|
-
console.log(`Created ${(0, fs_1.realpathSync)(path)}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function getBindParamsFromEnv() {
|
|
84
|
-
const address = process.env[ADDRESS_VAR];
|
|
85
|
-
const portStr = process.env[PORT_VAR];
|
|
86
|
-
let port;
|
|
87
|
-
if (portStr) {
|
|
88
|
-
port = Number.parseInt(portStr);
|
|
89
|
-
if (!Number.isInteger(port)) {
|
|
90
|
-
port = DEFAULT_PORT;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
port = DEFAULT_PORT;
|
|
95
|
-
}
|
|
96
|
-
const sslOpts = getTLSParamsFromEnv();
|
|
97
|
-
return { address, port, sslOpts };
|
|
98
|
-
}
|
|
99
|
-
exports.getBindParamsFromEnv = getBindParamsFromEnv;
|
|
100
|
-
function getTLSParamsFromEnv() {
|
|
101
|
-
const pfx = process.env[TLS_PFX_VAR];
|
|
102
|
-
if (pfx) {
|
|
103
|
-
return { pfx };
|
|
104
|
-
}
|
|
105
|
-
const cert = process.env[TLS_CERT_VAR];
|
|
106
|
-
const key = process.env[TLS_KEY_VAR];
|
|
107
|
-
if (cert && key) {
|
|
108
|
-
return { cert, key };
|
|
109
|
-
}
|
|
110
|
-
else if (!cert && !key) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
throw new Error(`Both ${TLS_CERT_VAR} and ${TLS_KEY_VAR} environment parameters should be present, but one is missing.`);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
Object.freeze(exports);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function bind<T extends Function>(thisArg: any, func: T): T;
|
package/build/run.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/run.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Copyright (C) 2015 - 2019 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
|
-
const lib_1 = require("./lib");
|
|
20
|
-
(async () => {
|
|
21
|
-
let app = undefined;
|
|
22
|
-
async function stopProcess() {
|
|
23
|
-
if (!app) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
app.stop().then(err => console.log(err));
|
|
27
|
-
app = undefined;
|
|
28
|
-
}
|
|
29
|
-
try {
|
|
30
|
-
const conf = (0, lib_1.getConfsFromEnv)();
|
|
31
|
-
app = new lib_1.AppWithWSs();
|
|
32
|
-
app.use((0, lib_1.servicesApp)(conf));
|
|
33
|
-
app.use((0, lib_1.adminApp)(conf));
|
|
34
|
-
const { address, port, sslOpts } = (0, lib_1.getBindParamsFromEnv)();
|
|
35
|
-
await app.start(sslOpts, port, address);
|
|
36
|
-
console.log(`Started 3NWeb server at address ${address}, port ${port}, ${sslOpts ? 'via TLS' : 'without TLS, and requiring TLS reverse proxy infront.'}`);
|
|
37
|
-
process.on('SIGINT', stopProcess);
|
|
38
|
-
process.on('SIGTERM', stopProcess);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
stopProcess();
|
|
42
|
-
console.error(err);
|
|
43
|
-
process.exit(-500);
|
|
44
|
-
}
|
|
45
|
-
})();
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|