core-3nweb-client-lib 0.44.9 → 0.44.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/build/core/startup/sign-up.js +2 -3
- package/build/core/storage/synced/obj-files.js +1 -1
- package/build/core/storage/synced/upload-header-file.js +2 -2
- package/build/lib-client/3nstorage/storage-owner.js +2 -3
- package/build/lib-client/asmail/sender.js +3 -4
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/local-files/dev-file-sink.js +2 -3
- package/build/lib-client/mailer-id/login.js +2 -3
- package/build/lib-client/mailer-id/provisioner.js +2 -3
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +1 -1
- package/build/lib-client/objs-on-disk/obj-on-disk.js +2 -2
- package/build/lib-client/service-locator.js +7 -12
- package/build/lib-client/user-with-pkl-session.js +2 -3
- package/build/lib-client/xsp-fs/attrs.js +6 -6
- package/build/lib-common/async-fs-node.js +1 -1
- package/build/lib-common/canonical-address.js +2 -2
- package/build/lib-common/objs-on-disk/obj-version-file.d.ts +1 -1
- package/build/lib-common/objs-on-disk/obj-version-file.js +5 -6
- package/package.json +3 -2
|
Binary file
|
|
@@ -113,7 +113,7 @@ class DevFileByteSink {
|
|
|
113
113
|
let readPos = initFileLen;
|
|
114
114
|
let writePos = initFileLen + ins;
|
|
115
115
|
while (bytesLeft > 0) {
|
|
116
|
-
const chunk = ((buf.length <= bytesLeft) ? buf : buf.
|
|
116
|
+
const chunk = ((buf.length <= bytesLeft) ? buf : buf.subarray(0, bytesLeft));
|
|
117
117
|
readPos -= chunk.length;
|
|
118
118
|
writePos -= chunk.length;
|
|
119
119
|
await fs.readToBuf(fh, readPos, chunk);
|
|
@@ -140,8 +140,7 @@ class DevFileByteSink {
|
|
|
140
140
|
let readPos = pos + del;
|
|
141
141
|
let writePos = pos;
|
|
142
142
|
while (bytesLeft > 0) {
|
|
143
|
-
const chunk = ((buf.length <= bytesLeft) ?
|
|
144
|
-
buf : buf.slice(0, bytesLeft));
|
|
143
|
+
const chunk = ((buf.length <= bytesLeft) ? buf : buf.subarray(0, bytesLeft));
|
|
145
144
|
await fs.readToBuf(fh, readPos, chunk);
|
|
146
145
|
await fs.writeFromBuf(fh, writePos, chunk);
|
|
147
146
|
bytesLeft -= chunk.length;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015, 2017, 2020, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015, 2017, 2020, 2025 - 2026 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
|
|
@@ -20,7 +20,6 @@ exports.startMidSession = startMidSession;
|
|
|
20
20
|
exports.authenticateMidSession = authenticateMidSession;
|
|
21
21
|
const api = require("../../lib-common/service-api/mailer-id/login");
|
|
22
22
|
const http_1 = require("../../lib-common/exceptions/http");
|
|
23
|
-
const url_1 = require("url");
|
|
24
23
|
async function startMidSession(userId, net, loginUrl) {
|
|
25
24
|
const reqData = { userId };
|
|
26
25
|
if (!loginUrl.endsWith('/')) {
|
|
@@ -55,7 +54,7 @@ async function startMidSession(userId, net, loginUrl) {
|
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
async function authenticateMidSession(sessionId, midSigner, net, loginUrl) {
|
|
58
|
-
const domain = (
|
|
57
|
+
const domain = (new URL(loginUrl)).hostname;
|
|
59
58
|
const reqData = {
|
|
60
59
|
assertion: midSigner.generateAssertionFor(domain, sessionId),
|
|
61
60
|
userCert: midSigner.userCert,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2021, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2021, 2025 - 2026 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
|
|
@@ -24,7 +24,6 @@ const json_utils_1 = require("../../lib-common/json-utils");
|
|
|
24
24
|
const canonical_address_1 = require("../../lib-common/canonical-address");
|
|
25
25
|
const random = require("../../lib-common/random-node");
|
|
26
26
|
const api = require("../../lib-common/service-api/mailer-id/provisioning");
|
|
27
|
-
const url_1 = require("url");
|
|
28
27
|
const assert_1 = require("../../lib-common/assert");
|
|
29
28
|
const user_1 = require("../../lib-common/mailerid-sigs/user");
|
|
30
29
|
const relying_party_1 = require("../../lib-common/mailerid-sigs/relying-party");
|
|
@@ -59,7 +58,7 @@ class MailerIdProvisioner extends user_with_pkl_session_1.ServiceUser {
|
|
|
59
58
|
}
|
|
60
59
|
async setUrlAndDomain() {
|
|
61
60
|
const { currentCert, provisioning } = await (0, service_locator_1.mailerIdInfoAt)(this.net, this.entryURI);
|
|
62
|
-
this.midDomain = (
|
|
61
|
+
this.midDomain = (new URL(this.serviceURI)).hostname;
|
|
63
62
|
this.serviceURI = provisioning;
|
|
64
63
|
this.rootCert = currentCert;
|
|
65
64
|
}
|
|
@@ -35,7 +35,7 @@ export declare class ObjOnDisk {
|
|
|
35
35
|
private readBaseBytesFromOtherFilesOnDisk;
|
|
36
36
|
getSrc(): ObjSource;
|
|
37
37
|
getBaseVersion(): number | undefined;
|
|
38
|
-
absorbImmediateBaseVersion(baseVer: number,
|
|
38
|
+
absorbImmediateBaseVersion(baseVer: number, basePath: string): Promise<void>;
|
|
39
39
|
diffFromBase(): {
|
|
40
40
|
diff: DiffInfo;
|
|
41
41
|
newSegsPackOrder: FiniteChunk[];
|
|
@@ -195,8 +195,8 @@ class ObjOnDisk {
|
|
|
195
195
|
getBaseVersion() {
|
|
196
196
|
return this.objFile.getBaseVersion();
|
|
197
197
|
}
|
|
198
|
-
absorbImmediateBaseVersion(baseVer,
|
|
199
|
-
return this.objFile.absorbImmediateBaseVersion(baseVer,
|
|
198
|
+
absorbImmediateBaseVersion(baseVer, basePath) {
|
|
199
|
+
return this.objFile.absorbImmediateBaseVersion(baseVer, basePath);
|
|
200
200
|
}
|
|
201
201
|
diffFromBase() {
|
|
202
202
|
return this.objFile.diffFromBase();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2020 - 2021, 2024 -
|
|
3
|
+
Copyright (C) 2015 - 2017, 2020 - 2021, 2024 - 2026 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
|
|
@@ -22,11 +22,10 @@ exports.storageInfoAt = storageInfoAt;
|
|
|
22
22
|
exports.makeServiceLocator = makeServiceLocator;
|
|
23
23
|
exports.getMailerIdInfoFor = getMailerIdInfoFor;
|
|
24
24
|
const jwkeys_1 = require("../lib-common/jwkeys");
|
|
25
|
-
const url_1 = require("url");
|
|
26
25
|
const runtime_1 = require("../lib-common/exceptions/runtime");
|
|
27
26
|
const http_1 = require("../lib-common/exceptions/http");
|
|
28
27
|
async function readJSONLocatedAt(client, url) {
|
|
29
|
-
if ((
|
|
28
|
+
if ((new URL(url)).protocol !== 'https:') {
|
|
30
29
|
throw new Error("Url protocol must be https.");
|
|
31
30
|
}
|
|
32
31
|
const rep = await client.doBodylessRequest({
|
|
@@ -45,17 +44,13 @@ async function readJSONLocatedAt(client, url) {
|
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
function transformPathToCompleteUri(url, path, rep) {
|
|
48
|
-
const uInit =
|
|
47
|
+
const uInit = new URL(url);
|
|
49
48
|
const protoAndHost = `${uInit.protocol}//${uInit.host}`;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
throw (0, http_1.makeMalformedReplyHTTPException)(rep, { message: `Malformed path parameter ${path}` });
|
|
53
|
-
}
|
|
54
|
-
if (uPath.href.startsWith('/')) {
|
|
55
|
-
return `${protoAndHost}${uPath.href}`;
|
|
49
|
+
if (path.startsWith('/')) {
|
|
50
|
+
return `${protoAndHost}${path}`;
|
|
56
51
|
}
|
|
57
52
|
else {
|
|
58
|
-
return `${protoAndHost}/${
|
|
53
|
+
return `${protoAndHost}/${path}`;
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
56
|
/**
|
|
@@ -266,7 +261,7 @@ function makeServiceLocator(resolver) {
|
|
|
266
261
|
*/
|
|
267
262
|
async function getMailerIdInfoFor(resolver, client, address) {
|
|
268
263
|
const serviceURL = await resolver(address);
|
|
269
|
-
const rootAddr = (
|
|
264
|
+
const rootAddr = (new URL(serviceURL)).hostname;
|
|
270
265
|
const info = await mailerIdInfoAt(client, serviceURL);
|
|
271
266
|
return {
|
|
272
267
|
info: info,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2020 - 2021, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2020 - 2021, 2025 - 2026 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
|
|
@@ -22,14 +22,13 @@ const buffer_utils_1 = require("../lib-common/buffer-utils");
|
|
|
22
22
|
const ecma_nacl_1 = require("ecma-nacl");
|
|
23
23
|
const session_encryptor_1 = require("../lib-common/session-encryptor");
|
|
24
24
|
const loginApi = require("../lib-common/service-api/pub-key-login");
|
|
25
|
-
const url_1 = require("url");
|
|
26
25
|
const assert_1 = require("../lib-common/assert");
|
|
27
26
|
class ServiceUser {
|
|
28
27
|
get serviceURI() {
|
|
29
28
|
return this.uri;
|
|
30
29
|
}
|
|
31
30
|
set serviceURI(uriString) {
|
|
32
|
-
const u =
|
|
31
|
+
const u = new URL(uriString);
|
|
33
32
|
if (u.protocol !== 'https:') {
|
|
34
33
|
throw new Error("Url protocol must be https.");
|
|
35
34
|
}
|
|
@@ -164,29 +164,29 @@ var extAttrs;
|
|
|
164
164
|
ofs += t.nameLen;
|
|
165
165
|
const contentLen = readLenNum(bytes, ofs, t.contentLen);
|
|
166
166
|
ofs += t.contentLen;
|
|
167
|
-
const xaName = bytes.
|
|
167
|
+
const xaName = bytes.subarray(ofs, ofs + nameLen).toString('utf8');
|
|
168
168
|
ofs += nameLen;
|
|
169
169
|
const bytesRead = ofs - i + contentLen;
|
|
170
|
-
if (
|
|
171
|
-
throw parsingException(`
|
|
170
|
+
if (bytes.length < (i + bytesRead)) {
|
|
171
|
+
throw parsingException(`Bytes array is shorter than expected content that should be read from it`);
|
|
172
172
|
}
|
|
173
173
|
try {
|
|
174
174
|
if (t.type === NAMED_UTF8_STR) {
|
|
175
175
|
return {
|
|
176
176
|
bytesRead, xaName,
|
|
177
|
-
strVal: bytes.
|
|
177
|
+
strVal: bytes.subarray(ofs, ofs + contentLen).toString('utf8'),
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
180
|
else if (t.type === NAMED_JSON) {
|
|
181
181
|
return {
|
|
182
182
|
bytesRead, xaName,
|
|
183
|
-
jsonVal: JSON.parse((0, buffer_utils_1.toBuffer)(bytes).
|
|
183
|
+
jsonVal: JSON.parse((0, buffer_utils_1.toBuffer)(bytes).subarray(ofs, ofs + contentLen).toString('utf8')),
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
else if (t.type === NAMED_BINARY) {
|
|
187
187
|
return {
|
|
188
188
|
bytesRead, xaName,
|
|
189
|
-
binVal: bytes.
|
|
189
|
+
binVal: bytes.subarray(ofs, ofs + contentLen),
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
else {
|
|
@@ -478,7 +478,7 @@ async function streamFromFile(filePath, pos, len, sink, bufSize) {
|
|
|
478
478
|
while (byteCount < len) {
|
|
479
479
|
const bytesLeft = len - byteCount;
|
|
480
480
|
if (buf.length > bytesLeft) {
|
|
481
|
-
buf = buf.
|
|
481
|
+
buf = buf.subarray(0, bytesLeft);
|
|
482
482
|
}
|
|
483
483
|
await readFromFile(filePath, pos + byteCount, buf);
|
|
484
484
|
await sinkBytes(sink, buf);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2016, 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2016, 2020, 2026 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
|
|
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.toCanonicalAddress = toCanonicalAddress;
|
|
20
20
|
exports.areAddressesEqual = areAddressesEqual;
|
|
21
21
|
exports.checkAndTransformAddress = checkAndTransformAddress;
|
|
22
|
-
const punycode_1 = require("punycode");
|
|
22
|
+
const punycode_1 = require("punycode/");
|
|
23
23
|
/**
|
|
24
24
|
* @param address
|
|
25
25
|
* @return a canonical form of a given address.
|
|
@@ -34,7 +34,7 @@ export declare class ObjVersionFile {
|
|
|
34
34
|
setSegsLayout(layout: Layout, saveLayout: boolean): Promise<void>;
|
|
35
35
|
truncateEndlessLayout(): void;
|
|
36
36
|
isFileComplete(): boolean;
|
|
37
|
-
absorbImmediateBaseVersion(baseVer: number,
|
|
37
|
+
absorbImmediateBaseVersion(baseVer: number, basePath: string): Promise<void>;
|
|
38
38
|
diffFromBase(): {
|
|
39
39
|
diff: DiffInfo;
|
|
40
40
|
newSegsPackOrder: FiniteChunk[];
|
|
@@ -251,11 +251,11 @@ class ObjVersionFile {
|
|
|
251
251
|
isFileComplete() {
|
|
252
252
|
return this.layout.isFileComplete();
|
|
253
253
|
}
|
|
254
|
-
async absorbImmediateBaseVersion(baseVer,
|
|
254
|
+
async absorbImmediateBaseVersion(baseVer, basePath) {
|
|
255
255
|
(0, assert_1.assert)(Number.isInteger(baseVer) && (baseVer === this.layout.getBaseVersion()));
|
|
256
|
-
const baseLayout = await readLayoutFrom(
|
|
256
|
+
const baseLayout = await readLayoutFrom(basePath);
|
|
257
257
|
const absorptionParams = this.layout.calcBaseAbsorptionParams(baseLayout);
|
|
258
|
-
const src = await fs.open(
|
|
258
|
+
const src = await fs.open(basePath, 'r');
|
|
259
259
|
await this.withRWFile(async (fh) => {
|
|
260
260
|
if (absorptionParams.copyOps.length > 0) {
|
|
261
261
|
await this.recordLayout(fh, absorptionParams.newBytesEnd);
|
|
@@ -264,8 +264,7 @@ class ObjVersionFile {
|
|
|
264
264
|
if (buf.length < op.len) {
|
|
265
265
|
buf = Buffer.allocUnsafe(op.len);
|
|
266
266
|
}
|
|
267
|
-
const chunk = ((op.len < buf.length) ?
|
|
268
|
-
buf.slice(0, op.len) : buf);
|
|
267
|
+
const chunk = ((op.len < buf.length) ? buf.subarray(0, op.len) : buf);
|
|
269
268
|
await fs.readToBuf(src, op.ofsInSrcFile, chunk);
|
|
270
269
|
await fs.writeFromBuf(fh, op.ofsInDstFile, chunk);
|
|
271
270
|
}
|
|
@@ -320,7 +319,7 @@ async function parseObjVersionBytesLayout(fh) {
|
|
|
320
319
|
}
|
|
321
320
|
throw exc;
|
|
322
321
|
});
|
|
323
|
-
const fileStart = fstBytes.
|
|
322
|
+
const fileStart = fstBytes.subarray(0, 4);
|
|
324
323
|
if ((0, bytes_equal_1.bytesEqual)(fileStart, v1_obj_file_format_1.V1_FILE_START)) {
|
|
325
324
|
const layoutOfs = (0, big_endian_1.uintFrom8Bytes)(fstBytes, 4);
|
|
326
325
|
if (layoutOfs === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-3nweb-client-lib",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.11",
|
|
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",
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/jasmine": "^5.1.13",
|
|
40
40
|
"@types/node": "^22.13.14",
|
|
41
|
+
"@types/punycode": "^2.1.1",
|
|
41
42
|
"@types/ws": "^8.18.1",
|
|
42
43
|
"jasmine": "^5.13.0",
|
|
43
44
|
"protobufjs-cli": "^1.0.2",
|
|
44
|
-
"spec-3nweb-server": "^1.8.
|
|
45
|
+
"spec-3nweb-server": "^1.8.5",
|
|
45
46
|
"tsuml2": "^0.17.1",
|
|
46
47
|
"typescript": "^5.5.3"
|
|
47
48
|
}
|