spec-3nweb-server 1.7.1 → 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.js +2 -1
- package/build/3nstorage/resources/store.d.ts +5 -5
- package/build/3nstorage/resources/store.js +3 -12
- package/build/3nstorage/resources/users.d.ts +6 -6
- 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.js +1 -2
- package/build/asmail/resources/inbox.d.ts +17 -26
- package/build/asmail/resources/inbox.js +15 -59
- package/build/asmail/resources/recipients.d.ts +28 -10
- package/build/asmail/resources/recipients.js +62 -22
- package/build/asmail/retrieval.d.ts +2 -2
- package/build/asmail/retrieval.js +11 -18
- package/build/config/signup.d.ts +1 -1
- package/build/config/signup.js +1 -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.js +11 -11
- package/build/lib-common/bytes-equal.js +2 -1
- package/build/lib-common/exceptions/error.js +2 -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.js +14 -14
- 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.js +2 -1
- package/build/lib-common/objs-on-disk/obj-file.js +2 -1
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +2 -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.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.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/pkl-access.d.ts +4 -0
- package/build/lib-server/pkl-access.js +28 -0
- 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.js +7 -7
- package/build/lib-server/resources/user-files.d.ts +3 -3
- package/build/lib-server/resources/user-files.js +4 -2
- package/build/lib-server/routes/sessions/close.js +2 -1
- package/build/lib-server/web-sockets/app.js +2 -3
- package/build/lib-server/web-sockets/server-events.js +1 -2
- package/build/lib.d.ts +1 -1
- package/build/lib.js +2 -2
- 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/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.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.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/package.json +1 -1
- package/build/lib-common/binding.d.ts +0 -1
- /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}/resources/users.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.d.ts +0 -0
- /package/build/{admin → signup}/signup-tokens.js +0 -0
|
@@ -13,7 +13,8 @@
|
|
|
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.isLikeSignedMailerIdAssertion = exports.isLikeMailerIdAssertion = exports.use = exports.getPrincipalAddress = exports.getPubKey = exports.getKeyCert = exports.keyToJson = exports.keyFromJson = exports.isLikeSignedKeyCert = exports.isLikeKeyCert = exports.isLikeSignedLoad = exports.isLikeJsonKey = void 0;
|
|
19
20
|
/**
|
|
@@ -13,7 +13,8 @@
|
|
|
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.MapOfSets = void 0;
|
|
19
20
|
class MapOfSets {
|
|
@@ -13,7 +13,8 @@
|
|
|
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.user = exports.relyingParty = exports.idProvider = exports.makeMalformedCertsException = exports.exceptionType = exports.KEY_USE = void 0;
|
|
19
20
|
/**
|
|
@@ -13,7 +13,8 @@
|
|
|
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.ObjVersionBytesLayout = void 0;
|
|
19
20
|
const v1_obj_file_format_1 = require("./v1-obj-file-format");
|
|
@@ -13,7 +13,8 @@
|
|
|
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.ObjVersionFile = void 0;
|
|
19
20
|
const fs = require("../async-fs-node");
|
|
@@ -13,7 +13,8 @@
|
|
|
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.layoutV1 = exports.uintFrom8Bytes = exports.uintTo8Bytes = exports.V1_FILE_START = void 0;
|
|
19
20
|
exports.V1_FILE_START = Buffer.from('1xsp', 'utf8');
|
|
@@ -13,7 +13,8 @@
|
|
|
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.PressureValve = exports.defer = exports.makeReadWriteLock = exports.makeLock = exports.SingleCyclicProc = exports.makeSyncedFunc = exports.SingleProc = exports.NamedProcs = exports.finalizeAsync = exports.finalize = exports.sleep = void 0;
|
|
19
20
|
const error_1 = require("./exceptions/error");
|
|
@@ -13,7 +13,8 @@
|
|
|
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.stringOfB64Chars = exports.stringOfB64UrlSafeChars = exports.stringOfB64CharsSync = exports.stringOfB64UrlSafeCharsSync = exports.uint48 = exports.uint48Sync = exports.uint8 = exports.uint8Sync = exports.bytes = exports.bytesSync = void 0;
|
|
19
20
|
const buffer_utils_1 = require("./buffer-utils");
|
|
@@ -17,9 +17,7 @@ export declare const HTTP_HEADER: {
|
|
|
17
17
|
};
|
|
18
18
|
export declare const BIN_TYPE = "application/octet-stream";
|
|
19
19
|
export declare namespace midLogin {
|
|
20
|
-
const
|
|
21
|
-
const START_URL_END: string;
|
|
22
|
-
const AUTH_URL_END: string;
|
|
20
|
+
const URL_PART = "login/mailerid/";
|
|
23
21
|
}
|
|
24
22
|
export declare namespace closeSession {
|
|
25
23
|
const URL_END = "session/close";
|
|
@@ -44,11 +44,9 @@ Object.freeze(exports.HTTP_HEADER);
|
|
|
44
44
|
exports.BIN_TYPE = 'application/octet-stream';
|
|
45
45
|
var midLogin;
|
|
46
46
|
(function (midLogin) {
|
|
47
|
-
midLogin.
|
|
48
|
-
midLogin.START_URL_END = midLogin.MID_URL_PART + midApi.startSession.URL_END;
|
|
49
|
-
midLogin.AUTH_URL_END = midLogin.MID_URL_PART + midApi.authSession.URL_END;
|
|
47
|
+
midLogin.URL_PART = 'login/mailerid/';
|
|
50
48
|
})(midLogin = exports.midLogin || (exports.midLogin = {}));
|
|
51
|
-
Object.freeze(
|
|
49
|
+
Object.freeze(closeSession);
|
|
52
50
|
var closeSession;
|
|
53
51
|
(function (closeSession) {
|
|
54
52
|
closeSession.URL_END = 'session/close';
|
|
@@ -11,9 +11,7 @@ export declare const PARAM_SC: {
|
|
|
11
11
|
ok: number;
|
|
12
12
|
};
|
|
13
13
|
export declare namespace midLogin {
|
|
14
|
-
const
|
|
15
|
-
const START_URL_END: string;
|
|
16
|
-
const AUTH_URL_END: string;
|
|
14
|
+
const URL_PART = "login/mailerid/";
|
|
17
15
|
}
|
|
18
16
|
export declare namespace closeSession {
|
|
19
17
|
const URL_END = "close-session";
|
|
@@ -13,7 +13,8 @@
|
|
|
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;
|
|
19
20
|
const midApi = require("../mailer-id/login");
|
|
@@ -29,11 +30,9 @@ exports.PARAM_SC = {
|
|
|
29
30
|
Object.freeze(exports.PARAM_SC);
|
|
30
31
|
var midLogin;
|
|
31
32
|
(function (midLogin) {
|
|
32
|
-
midLogin.
|
|
33
|
-
midLogin.START_URL_END = midLogin.MID_URL_PART + midApi.startSession.URL_END;
|
|
34
|
-
midLogin.AUTH_URL_END = midLogin.MID_URL_PART + midApi.authSession.URL_END;
|
|
33
|
+
midLogin.URL_PART = 'login/mailerid/';
|
|
35
34
|
})(midLogin = exports.midLogin || (exports.midLogin = {}));
|
|
36
|
-
Object.freeze(
|
|
35
|
+
Object.freeze(closeSession);
|
|
37
36
|
var closeSession;
|
|
38
37
|
(function (closeSession) {
|
|
39
38
|
closeSession.URL_END = 'close-session';
|
|
@@ -13,7 +13,8 @@
|
|
|
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.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
|
const querystring_1 = require("querystring");
|
|
@@ -12,9 +12,7 @@ export declare const ERR_SC: {
|
|
|
12
12
|
server: number;
|
|
13
13
|
};
|
|
14
14
|
export declare namespace midLogin {
|
|
15
|
-
const
|
|
16
|
-
const START_URL_END: string;
|
|
17
|
-
const AUTH_URL_END: string;
|
|
15
|
+
const URL_PART = "login/mailerid/";
|
|
18
16
|
}
|
|
19
17
|
export declare namespace closeSession {
|
|
20
18
|
const URL_END = "close-session";
|
|
@@ -13,7 +13,8 @@
|
|
|
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.msgMainObjRecieved = exports.msgRecievedCompletely = exports.wsEventChannel = exports.msgObj = exports.sanitizedMeta = exports.msgMetadata = exports.rmMsg = exports.listMsgs = exports.closeSession = exports.midLogin = exports.ERR_SC = exports.HTTP_HEADER = exports.BIN_TYPE = void 0;
|
|
19
20
|
/**
|
|
@@ -37,9 +38,7 @@ exports.ERR_SC = {
|
|
|
37
38
|
Object.freeze(exports.ERR_SC);
|
|
38
39
|
var midLogin;
|
|
39
40
|
(function (midLogin) {
|
|
40
|
-
midLogin.
|
|
41
|
-
midLogin.START_URL_END = midLogin.MID_URL_PART + midApi.startSession.URL_END;
|
|
42
|
-
midLogin.AUTH_URL_END = midLogin.MID_URL_PART + midApi.authSession.URL_END;
|
|
41
|
+
midLogin.URL_PART = 'login/mailerid/';
|
|
43
42
|
})(midLogin = exports.midLogin || (exports.midLogin = {}));
|
|
44
43
|
Object.freeze(midLogin);
|
|
45
44
|
var closeSession;
|
|
@@ -13,7 +13,8 @@
|
|
|
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.events = void 0;
|
|
19
20
|
var events;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare namespace createLocker {
|
|
2
|
+
const URL_END = "create";
|
|
3
|
+
const method = "PUT";
|
|
4
|
+
interface Request {
|
|
5
|
+
token?: string;
|
|
6
|
+
}
|
|
7
|
+
interface Reply {
|
|
8
|
+
userId: string;
|
|
9
|
+
storageUri: string;
|
|
10
|
+
storageMBs: number;
|
|
11
|
+
willBeRemovedAt: number;
|
|
12
|
+
}
|
|
13
|
+
const SC: {
|
|
14
|
+
ok: number;
|
|
15
|
+
invalidToken: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2024 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.createLocker = void 0;
|
|
20
|
+
var createLocker;
|
|
21
|
+
(function (createLocker) {
|
|
22
|
+
createLocker.URL_END = 'create';
|
|
23
|
+
createLocker.method = 'PUT';
|
|
24
|
+
createLocker.SC = {
|
|
25
|
+
ok: 200,
|
|
26
|
+
invalidToken: 403
|
|
27
|
+
};
|
|
28
|
+
Object.freeze(createLocker.SC);
|
|
29
|
+
})(createLocker = exports.createLocker || (exports.createLocker = {}));
|
|
30
|
+
;
|
|
31
|
+
Object.freeze(createLocker);
|
|
@@ -13,7 +13,8 @@
|
|
|
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.authSession = exports.startSession = exports.ERR_SC = void 0;
|
|
19
20
|
exports.ERR_SC = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This defines request interfaces for MailerId certificate provisioning.
|
|
3
|
+
*/
|
|
1
4
|
import { JsonKey, SignedLoad } from '../../jwkeys';
|
|
2
|
-
export declare namespace pkl {
|
|
3
|
-
const START_URL_END = "start-login-exchange";
|
|
4
|
-
const COMPL_URL_END = "complete-login-exchange";
|
|
5
|
-
}
|
|
6
5
|
export declare namespace certify {
|
|
7
6
|
const URL_END = "certify";
|
|
8
7
|
interface Request {
|
|
@@ -13,19 +13,10 @@
|
|
|
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
|
-
exports.serviceRoot = exports.certify =
|
|
19
|
-
/**
|
|
20
|
-
* This defines request interfaces for MailerId certificate provisioning.
|
|
21
|
-
*/
|
|
22
|
-
const pklApi = require("../pub-key-login");
|
|
23
|
-
var pkl;
|
|
24
|
-
(function (pkl) {
|
|
25
|
-
pkl.START_URL_END = pklApi.start.URL_END;
|
|
26
|
-
pkl.COMPL_URL_END = pklApi.complete.URL_END;
|
|
27
|
-
})(pkl = exports.pkl || (exports.pkl = {}));
|
|
28
|
-
Object.freeze(pkl);
|
|
19
|
+
exports.serviceRoot = exports.certify = void 0;
|
|
29
20
|
var certify;
|
|
30
21
|
(function (certify) {
|
|
31
22
|
certify.URL_END = 'certify';
|
|
@@ -13,7 +13,8 @@
|
|
|
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.complete = exports.start = exports.ERR_SC = void 0;
|
|
19
20
|
/**
|
|
@@ -13,7 +13,8 @@
|
|
|
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.errorReplyTo = exports.events = void 0;
|
|
19
20
|
var events;
|
|
@@ -13,7 +13,8 @@
|
|
|
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.makeSessionEncryptor = void 0;
|
|
19
20
|
/**
|
|
@@ -13,7 +13,8 @@
|
|
|
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.TimeWindowCache = void 0;
|
|
19
20
|
class TimeWindowCache {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Factory as SessionsFactory, SessionParams } from './resources/sessions';
|
|
2
|
+
import { MidAuthorizer } from "./routes/sessions/mid-auth";
|
|
3
|
+
import { Express } from 'express';
|
|
4
|
+
export type AccountExists = (id: string) => Promise<boolean>;
|
|
5
|
+
export declare function addMailerIdLoginRoutes(app: Express, domain: string, urlPrefix: string, sessions: SessionsFactory<SessionParams>, accountExists: AccountExists, midAuthorizer: MidAuthorizer): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2024 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.addMailerIdLoginRoutes = void 0;
|
|
20
|
+
const body_parsers_1 = require("./middleware/body-parsers");
|
|
21
|
+
const start_1 = require("./routes/sessions/start");
|
|
22
|
+
const mid_auth_1 = require("./routes/sessions/mid-auth");
|
|
23
|
+
const api = require("../lib-common/service-api/mailer-id/login");
|
|
24
|
+
function addMailerIdLoginRoutes(app, domain, urlPrefix, sessions, accountExists, midAuthorizer) {
|
|
25
|
+
app.post(urlPrefix + api.startSession.URL_END, sessions.checkSession(), (0, body_parsers_1.json)('1kb'), (0, start_1.startSession)(accountExists, sessions.generate));
|
|
26
|
+
app.post(urlPrefix + api.authSession.URL_END, sessions.ensureOpenedSession(), (0, body_parsers_1.json)('4kb'), (0, mid_auth_1.midLogin)(domain, midAuthorizer));
|
|
27
|
+
}
|
|
28
|
+
exports.addMailerIdLoginRoutes = addMailerIdLoginRoutes;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare function attachByteDrainToRequest(req:
|
|
1
|
+
import { Request, RequestHandler } from 'express';
|
|
2
|
+
export declare function attachByteDrainToRequest(req: Request): void;
|
|
3
3
|
/**
|
|
4
4
|
* Use this for empty-body POST and PUT routes, as it does sanitization, and
|
|
5
5
|
* prevents hanging requests, because nothing drains data.
|
|
6
6
|
* @return a middleware function that ensures empty body in requests.
|
|
7
7
|
*/
|
|
8
|
-
export declare function emptyBody():
|
|
8
|
+
export declare function emptyBody(): RequestHandler;
|
|
9
9
|
/**
|
|
10
10
|
* @param req
|
|
11
11
|
* @param expectedLen is an expected non-zero length of a binary body.
|
|
@@ -13,14 +13,14 @@ export declare function emptyBody(): express.RequestHandler;
|
|
|
13
13
|
* @return a promise, resolvable to request's body bytes, parsed from a request
|
|
14
14
|
* object.
|
|
15
15
|
*/
|
|
16
|
-
export declare function parseBinaryBodyWithExpectedSize(req:
|
|
16
|
+
export declare function parseBinaryBodyWithExpectedSize(req: Request, expectedLen: number): Promise<Uint8Array>;
|
|
17
17
|
/**
|
|
18
18
|
* @param maxSize is a maximum allowed body length, given as number of bytes,
|
|
19
19
|
* or string parameter for kb/mb's.
|
|
20
20
|
* @return middleware function, that places all request bytes into Buffer,
|
|
21
21
|
* placed into usual body field of request object.
|
|
22
22
|
*/
|
|
23
|
-
export declare function binary(maxSize: string | number):
|
|
23
|
+
export declare function binary(maxSize: string | number): RequestHandler;
|
|
24
24
|
/**
|
|
25
25
|
* @param maxSize is a maximum allowed body length, given as number of bytes,
|
|
26
26
|
* or string parameter for kb/mb's.
|
|
@@ -29,11 +29,11 @@ export declare function binary(maxSize: string | number): express.RequestHandler
|
|
|
29
29
|
* @return middleware function, that parses all request bytes as JSON, placing
|
|
30
30
|
* result into usual body field of request object.
|
|
31
31
|
*/
|
|
32
|
-
export declare function json(maxSize: string | number, allowNonObject?: boolean):
|
|
32
|
+
export declare function json(maxSize: string | number, allowNonObject?: boolean): RequestHandler;
|
|
33
33
|
/**
|
|
34
34
|
* @param maxSize is a maximum allowed body length, given as number of bytes, or
|
|
35
35
|
* string parameter for kb/mb's.
|
|
36
36
|
* @return middleware function, that parses all request bytes as utf8 text,
|
|
37
37
|
* placing result into usual body field of request object.
|
|
38
38
|
*/
|
|
39
|
-
export declare function textPlain(maxSize: string | number):
|
|
39
|
+
export declare function textPlain(maxSize: string | number): RequestHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2016 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2016, 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,7 +13,8 @@
|
|
|
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.textPlain = exports.json = exports.binary = exports.parseBinaryBodyWithExpectedSize = exports.emptyBody = exports.attachByteDrainToRequest = void 0;
|
|
19
20
|
const conf_util_1 = require("../conf-util");
|
|
@@ -30,22 +31,19 @@ const TYPES = {
|
|
|
30
31
|
json: 'application/json',
|
|
31
32
|
bin: 'application/octet-stream'
|
|
32
33
|
};
|
|
33
|
-
const noop = {
|
|
34
|
-
onData: (chunk) => { },
|
|
35
|
-
onEnd: () => { }
|
|
36
|
-
};
|
|
37
34
|
function attachByteDrainToRequest(req) {
|
|
38
|
-
req.on('data', noop
|
|
39
|
-
req.on('end', noop
|
|
35
|
+
req.on('data', noop);
|
|
36
|
+
req.on('end', noop);
|
|
40
37
|
}
|
|
41
38
|
exports.attachByteDrainToRequest = attachByteDrainToRequest;
|
|
39
|
+
function noop() { }
|
|
42
40
|
/**
|
|
43
41
|
* Use this for empty-body POST and PUT routes, as it does sanitization, and
|
|
44
42
|
* prevents hanging requests, because nothing drains data.
|
|
45
43
|
* @return a middleware function that ensures empty body in requests.
|
|
46
44
|
*/
|
|
47
45
|
function emptyBody() {
|
|
48
|
-
return (req,
|
|
46
|
+
return (req, _res, next) => {
|
|
49
47
|
attachByteDrainToRequest(req);
|
|
50
48
|
// get and check Content-Length
|
|
51
49
|
const contentLength = parseInt(req.get(HTTP_HEADER.contentLength), 10);
|
|
@@ -195,16 +193,18 @@ exports.binary = binary;
|
|
|
195
193
|
* result into usual body field of request object.
|
|
196
194
|
*/
|
|
197
195
|
function json(maxSize, allowNonObject) {
|
|
198
|
-
return byteCollector(maxSize, TYPES.json, (req,
|
|
196
|
+
return byteCollector(maxSize, TYPES.json, (req, _res, next) => {
|
|
199
197
|
try {
|
|
200
198
|
const bodyAsStr = req.body.toString('utf8');
|
|
201
|
-
req.body =
|
|
199
|
+
req.body = ((bodyAsStr === '') ?
|
|
200
|
+
undefined :
|
|
201
|
+
JSON.parse(bodyAsStr));
|
|
202
202
|
}
|
|
203
203
|
catch (err) {
|
|
204
204
|
return next((0, error_handler_1.makeErr)(400, "Request body cannot be interpreted as JSON."));
|
|
205
205
|
}
|
|
206
|
-
if (!allowNonObject
|
|
207
|
-
(!req.body || (typeof req.body !== 'object'))) {
|
|
206
|
+
if (!allowNonObject
|
|
207
|
+
&& (!req.body || (typeof req.body !== 'object'))) {
|
|
208
208
|
return next((0, error_handler_1.makeErr)(400, "Request body is not a JSON object."));
|
|
209
209
|
}
|
|
210
210
|
next();
|
|
@@ -218,7 +218,7 @@ exports.json = json;
|
|
|
218
218
|
* placing result into usual body field of request object.
|
|
219
219
|
*/
|
|
220
220
|
function textPlain(maxSize) {
|
|
221
|
-
return byteCollector(maxSize, TYPES.plain, (req,
|
|
221
|
+
return byteCollector(maxSize, TYPES.plain, (req, _res, next) => {
|
|
222
222
|
try {
|
|
223
223
|
req.body = req.body.toString('utf8');
|
|
224
224
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Express } from 'express';
|
|
2
|
+
import { Factory as SessionsFactory } from './resources/sessions';
|
|
3
|
+
import { ComputeDHSharedKey, GetUserPKeyAndKeyGenParams, SessionParams } from './routes/pub-key-login/start-exchange';
|
|
4
|
+
export declare function addPKLLoginRoutes(app: Express, urlPrefix: string, getUserParamsAndKey: GetUserPKeyAndKeyGenParams, sessions: SessionsFactory<SessionParams>, computeDHSharedKey: ComputeDHSharedKey): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2024 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.addPKLLoginRoutes = void 0;
|
|
20
|
+
const body_parsers_1 = require("./middleware/body-parsers");
|
|
21
|
+
const start_exchange_1 = require("./routes/pub-key-login/start-exchange");
|
|
22
|
+
const complete_exchange_1 = require("./routes/pub-key-login/complete-exchange");
|
|
23
|
+
const api = require("../lib-common/service-api/pub-key-login");
|
|
24
|
+
function addPKLLoginRoutes(app, urlPrefix, getUserParamsAndKey, sessions, computeDHSharedKey) {
|
|
25
|
+
app.post(urlPrefix + api.start.URL_END, sessions.checkSession(), (0, body_parsers_1.json)('1kb'), (0, start_exchange_1.startPKLogin)(getUserParamsAndKey, sessions.generate, computeDHSharedKey));
|
|
26
|
+
app.post(urlPrefix + api.complete.URL_END, sessions.ensureOpenedSession(), (0, body_parsers_1.binary)('1kb'), (0, complete_exchange_1.completePKLogin)());
|
|
27
|
+
}
|
|
28
|
+
exports.addPKLLoginRoutes = addPKLLoginRoutes;
|
|
@@ -13,7 +13,8 @@
|
|
|
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.get3NWebRecords = exports.SC = void 0;
|
|
19
20
|
const dns = require("dns");
|
|
@@ -13,7 +13,8 @@
|
|
|
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.validator = void 0;
|
|
19
20
|
const https = require("https");
|
|
@@ -62,9 +63,7 @@ function getRootCert(serviceURL) {
|
|
|
62
63
|
// TODO need to add caching of certs using domain->(kid->cert)
|
|
63
64
|
// (this will speed things up)
|
|
64
65
|
function validator() {
|
|
65
|
-
return (rpDomain, sessionId, userId, assertion, userCert, provCert) =>
|
|
66
|
-
return validate(rpDomain, sessionId, userId, assertion, userCert, provCert);
|
|
67
|
-
};
|
|
66
|
+
return (rpDomain, sessionId, userId, assertion, userCert, provCert) => validate(rpDomain, sessionId, userId, assertion, userCert, provCert);
|
|
68
67
|
}
|
|
69
68
|
exports.validator = validator;
|
|
70
69
|
async function validate(rpDomain, sessionId, userId, assertion, userCert, provCert) {
|
|
@@ -86,8 +85,8 @@ async function validate(rpDomain, sessionId, userId, assertion, userCert, provCe
|
|
|
86
85
|
// get root certificate and check the whole chain
|
|
87
86
|
const rootCert = await getRootCert(serviceURL);
|
|
88
87
|
const assertInfo = mid.relyingParty.verifyAssertion(assertion, { user: userCert, prov: provCert, root: rootCert }, issuer, validAt);
|
|
89
|
-
if ((assertInfo.relyingPartyDomain === rpDomain)
|
|
90
|
-
(assertInfo.sessionId === sessionId)) {
|
|
88
|
+
if ((assertInfo.relyingPartyDomain === rpDomain)
|
|
89
|
+
&& (assertInfo.sessionId === sessionId)) {
|
|
91
90
|
return true;
|
|
92
91
|
}
|
|
93
92
|
else {
|
|
@@ -36,6 +36,7 @@ export interface UserDataTree {
|
|
|
36
36
|
export declare function treeInRootFolder(rootFolder: string): RootDataTree;
|
|
37
37
|
export declare function tokensInRootFolder(rootFolder: string): string;
|
|
38
38
|
export declare function userDataInRootFolder(root: string, userId: string): string;
|
|
39
|
+
export declare function lockerDataInRootFolder(root: string, lockerId: string): string;
|
|
39
40
|
export declare function treeInDefaultsFolder(defaults: string): DefaultsDataTree;
|
|
40
41
|
export declare function treeInUserFolder(userFoder: string): UserDataTree;
|
|
41
42
|
export declare function createFolderTree(structure: RootDataTree | UserDataTree | DefaultsDataTree | FolderDef): Promise<void>;
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.createFolderTreeSync = exports.createFolderTree = exports.treeInUserFolder = exports.treeInDefaultsFolder = exports.userDataInRootFolder = exports.tokensInRootFolder = exports.treeInRootFolder = exports.addressToFName = void 0;
|
|
19
|
+
exports.createFolderTreeSync = exports.createFolderTree = exports.treeInUserFolder = exports.treeInDefaultsFolder = exports.lockerDataInRootFolder = exports.userDataInRootFolder = exports.tokensInRootFolder = exports.treeInRootFolder = exports.addressToFName = void 0;
|
|
20
20
|
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
21
21
|
const canonical_address_1 = require("../../lib-common/canonical-address");
|
|
22
22
|
const path_1 = require("path");
|
|
23
23
|
const fs_1 = require("fs");
|
|
24
24
|
function addressToFName(address) {
|
|
25
|
-
return
|
|
25
|
+
return idStringToFName((0, canonical_address_1.toCanonicalAddress)(address));
|
|
26
26
|
}
|
|
27
27
|
exports.addressToFName = addressToFName;
|
|
28
|
-
function
|
|
29
|
-
return buffer_utils_1.base64urlSafe.pack(buffer_utils_1.utf8.pack(
|
|
28
|
+
function idStringToFName(id) {
|
|
29
|
+
return buffer_utils_1.base64urlSafe.pack(buffer_utils_1.utf8.pack(id));
|
|
30
30
|
}
|
|
31
31
|
function treeInRootFolder(rootFolder) {
|
|
32
32
|
const defaults = (0, path_1.join)(rootFolder, 'defaults');
|
|
@@ -47,6 +47,11 @@ function userDataInRootFolder(root, userId) {
|
|
|
47
47
|
return (0, path_1.join)(root, 'users', addressToFName(userId));
|
|
48
48
|
}
|
|
49
49
|
exports.userDataInRootFolder = userDataInRootFolder;
|
|
50
|
+
// XXX use this instead of userDataInRootFolder for locker storage
|
|
51
|
+
function lockerDataInRootFolder(root, lockerId) {
|
|
52
|
+
return (0, path_1.join)(root, 'lockers', idStringToFName(lockerId));
|
|
53
|
+
}
|
|
54
|
+
exports.lockerDataInRootFolder = lockerDataInRootFolder;
|
|
50
55
|
function treeInDefaultsFolder(defaults) {
|
|
51
56
|
const mail = (0, path_1.join)(defaults, 'mail');
|
|
52
57
|
const mailParams = (0, path_1.join)(mail, 'params');
|