@fedify/fedify 1.7.10 → 1.7.12
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/dist/{actor-m_MgQ1Da.js → actor-GZRoTRqg.js} +1059 -2276
- package/dist/{actor-C9RnX-Fl.js → actor-TYqJGdVq.js} +6 -9
- package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
- package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
- package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
- package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
- package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
- package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
- package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
- package/dist/{authdocloader-cdK4XSRT.js → authdocloader-BopfyipD.js} +3 -3
- package/dist/{authdocloader-7OXAs5XI.js → authdocloader-hiFSyM7V.js} +4 -4
- package/dist/{builder-C7nJE1zO.js → builder-mi6RdzNE.js} +7 -10
- package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
- package/dist/{client-DXIsEekV.js → client-DuUKk4pk.js} +6 -6
- package/dist/compat/transformers.test.js +27 -28
- package/dist/{context-Bts52fbz.js → context-RMU32mk4.js} +2 -2
- package/dist/{docloader-BK2Fp3AJ.js → docloader-DJxET2fN.js} +5 -9
- package/dist/{docloader-CgkbWVNz.js → docloader-bgBm1Hd1.js} +4 -6
- package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
- package/dist/federation/builder.test.js +23 -29
- package/dist/federation/collection.test.js +9 -9
- package/dist/federation/handler.test.js +33 -33
- package/dist/federation/inbox.test.js +10 -10
- package/dist/federation/keycache.test.js +9 -9
- package/dist/federation/kv.test.js +10 -9
- package/dist/federation/middleware.test.js +76 -99
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +10 -11
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +22 -22
- package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
- package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +24 -0
- package/dist/{http-D1IBucdD.js → http-D2DkwsjA.js} +56 -17
- package/dist/{http-CwQqD0nE.js → http-vqMAvOVs.js} +56 -17
- package/dist/{inbox-BrMkm2b5.js → inbox-DAAZZl2k.js} +5 -7
- package/dist/key-5ssHQ67E.js +16 -0
- package/dist/{key-Do-Pud3s.js → key-DSJGnD10.js} +4 -4
- package/dist/{key-C6phFgFq.js → key-DmqJj57e.js} +5 -8
- package/dist/{key-DtQ4rLnr.js → key-KVhaUM92.js} +6 -9
- package/dist/{keycache-B_99o7Nj.js → keycache-C1pEuRyQ.js} +2 -2
- package/dist/{keys-BgLpfFXK.js → keys-C4XQHW5_.js} +1 -1
- package/dist/{ld-AzOj4-js.js → ld-DzlJ_IpT.js} +9 -16
- package/dist/{lookup-DJgGrigh.js → lookup-CSngxuWm.js} +2 -4
- package/dist/{lookup-CBbanOdu.js → lookup-D0je8AqR.js} +7 -11
- package/dist/{lookup-ChtUDlB-.js → lookup-DL62q3Xh.js} +3 -5
- package/dist/{middleware-BS_et69x.js → middleware-3wVT6S9E.js} +34 -52
- package/dist/middleware-CxFoFBD8.js +33 -0
- package/dist/{middleware-R0UobiAQ.js → middleware-DlDXugwZ.js} +34 -58
- package/dist/middleware-w7_U3fFi.js +17 -0
- package/dist/mod.js +11 -11
- package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
- package/dist/nodeinfo/client.test.js +20 -23
- package/dist/nodeinfo/handler.test.js +32 -32
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +23 -30
- package/dist/nodeinfo/types.test.js +11 -11
- package/dist/{owner-Ces3Cs3s.js → owner-81ey_76X.js} +3 -3
- package/dist/{proof-BOQF8Trx.js → proof-BlULDH4H.js} +8 -14
- package/dist/{proof-BKV4HiE8.js → proof-DlI7QNdn.js} +12 -25
- package/dist/runtime/authdocloader.test.js +21 -21
- package/dist/runtime/docloader.test.js +16 -18
- package/dist/runtime/key.test.js +17 -17
- package/dist/runtime/langstr.test.js +9 -9
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +11 -12
- package/dist/runtime/url.test.js +6 -6
- package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
- package/dist/{send-aAmnTqe8.js → send-DdxfTHo6.js} +3 -4
- package/dist/sig/http.test.js +56 -54
- package/dist/sig/key.test.js +18 -18
- package/dist/sig/ld.test.js +20 -22
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +20 -20
- package/dist/sig/proof.test.js +19 -19
- package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
- package/dist/testing/docloader.test.js +9 -9
- package/dist/testing/mod.js +1 -1
- package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
- package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
- package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
- package/dist/{types-DBIKpLqH.js → types-CmVV9LT1.js} +6 -8
- package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
- package/dist/vocab/actor.test.js +104 -156
- package/dist/vocab/lookup.test.js +17 -17
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +11 -15
- package/dist/vocab/vocab.test.js +45 -49
- package/dist/{vocab-F6vbRsQh.js → vocab-BebR0kAy.js} +6 -10
- package/dist/{vocab-BOerhowX.js → vocab-DFlq4Wa6.js} +1057 -2270
- package/dist/webfinger/handler.test.js +33 -34
- package/dist/webfinger/lookup.test.js +13 -13
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +9 -9
- package/package.json +1 -1
- package/dist/key-ZtjFeVO8.js +0 -16
- package/dist/middleware-BVMzYv1x.js +0 -33
- package/dist/middleware-CnpuCK_K.js +0 -17
package/dist/sig/http.test.js
CHANGED
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import "../multibase-
|
|
12
|
-
import { exportSpki } from "../vocab-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import { assert } from "../assert-LOEeCUK5.js";
|
|
8
|
+
import "../assert_instance_of-XtuFevV_.js";
|
|
9
|
+
import "../docloader-bgBm1Hd1.js";
|
|
10
|
+
import "../url-C2xuoQD1.js";
|
|
11
|
+
import "../multibase-CnLHszip.js";
|
|
12
|
+
import { exportSpki } from "../vocab-DFlq4Wa6.js";
|
|
13
13
|
import "../langstr-DbWheeIS.js";
|
|
14
|
-
import "../lookup-
|
|
15
|
-
import "../type-
|
|
16
|
-
import "../actor-
|
|
17
|
-
import { exportJwk } from "../key-
|
|
18
|
-
import { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest } from "../http-
|
|
19
|
-
import { test } from "../testing-
|
|
20
|
-
import { assertExists, assertStringIncludes } from "../std__assert-
|
|
21
|
-
import { assertFalse } from "../assert_rejects-
|
|
22
|
-
import "../assert_is_error-
|
|
23
|
-
import "../assert_not_equals-
|
|
24
|
-
import { assertThrows } from "../assert_throws-
|
|
14
|
+
import "../lookup-DL62q3Xh.js";
|
|
15
|
+
import "../type-CFuiGLz9.js";
|
|
16
|
+
import "../actor-TYqJGdVq.js";
|
|
17
|
+
import { exportJwk } from "../key-KVhaUM92.js";
|
|
18
|
+
import { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest } from "../http-D2DkwsjA.js";
|
|
19
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
20
|
+
import { assertExists, assertStringIncludes } from "../std__assert-o_r9vqm1.js";
|
|
21
|
+
import { assertFalse } from "../assert_rejects-DWQ4jaf9.js";
|
|
22
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
23
|
+
import "../assert_not_equals-C685gKx6.js";
|
|
24
|
+
import { assertThrows } from "../assert_throws-YetpVSc-.js";
|
|
25
25
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
26
|
-
import { rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey5 } from "../keys-
|
|
27
|
-
import { esm_default } from "../esm-
|
|
26
|
+
import { rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey5 } from "../keys-C4XQHW5_.js";
|
|
27
|
+
import { esm_default } from "../esm-DO9PrujO.js";
|
|
28
28
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
29
29
|
|
|
30
30
|
//#region sig/http.test.ts
|
|
@@ -153,6 +153,22 @@ test("verifyRequest() [draft-cavage]", async () => {
|
|
|
153
153
|
currentTime: Temporal.Instant.from("2025-01-01T00:00:00.0000Z"),
|
|
154
154
|
timeWindow: false
|
|
155
155
|
}), rsaPublicKey1);
|
|
156
|
+
const request2 = new Request("https://c27a97f98d5f.ngrok.app/i/inbox", {
|
|
157
|
+
method: "POST",
|
|
158
|
+
body: "{\"@context\":[\"https://www.w3.org/ns/activitystreams\",\"https://w3id.org/security/v1\"],\"actor\":\"https://oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd\",\"object\":{\"actor\":\"https://c27a97f98d5f.ngrok.app/i\",\"object\":\"https://oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd\",\"type\":\"Follow\",\"id\":\"https://c27a97f98d5f.ngrok.app/i#follows/https://oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd\"},\"type\":\"Accept\",\"id\":\"https://oeee.cafe/objects/0fc2608f-5660-4b91-b8c7-63c0c2ac2e20\"}",
|
|
159
|
+
headers: {
|
|
160
|
+
Host: "c27a97f98d5f.ngrok.app",
|
|
161
|
+
"Content-Type": "application/activity+json",
|
|
162
|
+
Date: "Mon, 25 Aug 2025 12:58:14 GMT",
|
|
163
|
+
Digest: "SHA-256=YZyjeVQW5GwliJowASkteBJhFBTq3eQk/AMqRETc//A=",
|
|
164
|
+
Signature: "keyId=\"https://oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd#main-key\",algorithm=\"hs2019\",created=\"1756126694\",expires=\"1756130294\",headers=\"(request-target) (created) (expires) content-type date digest host\",signature=\"XFb0jl2uMhE7RhbneE9sK9Zls2qZec8iy6+9O8UgDQeBGJThORFLjXKlps4QO1WAf1YSVB/i5aV6yF+h73Lm3ZiuAJDx1h+00iLsxoYuIw1CZvF0V2jELoo3sQ2/ZzqeoO6H5TbK7tKnU+ulFAPTuJgjIvPwYl11OMRouVS34NiaHP9Yx9pU813TLv37thG/hUKanyq8kk0IJWtDWteY/zxDvzoe7VOkBXVBHslMyrNAI/5JGulVQAQp/E61dJAhTHHIyGxkc/7iutWFZuqFXIiPJ9KR2OuKDj/B32hEzlsf5xH/CjqOJPIg1qMK8FzDiALCq6zjiKIBEnW8HQc/hQ==\""
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
const options2 = {
|
|
168
|
+
...options,
|
|
169
|
+
currentTime: Temporal.Instant.from("2025-08-25T12:58:14Z")
|
|
170
|
+
};
|
|
171
|
+
assert(await verifyRequest(request2, options2) != null);
|
|
156
172
|
});
|
|
157
173
|
test("signRequest() and verifyRequest() [rfc9421] implementation", async () => {
|
|
158
174
|
const currentTimestamp = 1709626184;
|
|
@@ -234,17 +250,15 @@ test("createRfc9421SignatureBase()", () => {
|
|
|
234
250
|
"Content-Type": "text/plain"
|
|
235
251
|
}
|
|
236
252
|
});
|
|
237
|
-
const
|
|
253
|
+
const signatureBase = createRfc9421SignatureBase(request, [
|
|
238
254
|
"@method",
|
|
239
255
|
"@target-uri",
|
|
240
256
|
"host",
|
|
241
257
|
"date"
|
|
242
|
-
]
|
|
243
|
-
const created = 1709626184;
|
|
244
|
-
const signatureBase = createRfc9421SignatureBase(request, components, formatRfc9421SignatureParameters({
|
|
258
|
+
], formatRfc9421SignatureParameters({
|
|
245
259
|
algorithm: "rsa-v1_5-sha256",
|
|
246
260
|
keyId: new URL("https://example.com/key"),
|
|
247
|
-
created
|
|
261
|
+
created: 1709626184
|
|
248
262
|
}));
|
|
249
263
|
const expected = [
|
|
250
264
|
`"@method": POST`,
|
|
@@ -263,24 +277,20 @@ test("formatRfc9421Signature()", () => {
|
|
|
263
277
|
4
|
|
264
278
|
]);
|
|
265
279
|
const keyId = new URL("https://example.com/key");
|
|
266
|
-
const
|
|
267
|
-
const components = [
|
|
280
|
+
const [signatureInput, signatureHeader] = formatRfc9421Signature(signature, [
|
|
268
281
|
"@method",
|
|
269
282
|
"@target-uri",
|
|
270
283
|
"host"
|
|
271
|
-
]
|
|
272
|
-
|
|
273
|
-
const [signatureInput, signatureHeader] = formatRfc9421Signature(signature, components, formatRfc9421SignatureParameters({
|
|
274
|
-
algorithm,
|
|
284
|
+
], formatRfc9421SignatureParameters({
|
|
285
|
+
algorithm: "rsa-v1_5-sha256",
|
|
275
286
|
keyId,
|
|
276
|
-
created
|
|
287
|
+
created: 1709626184
|
|
277
288
|
}));
|
|
278
289
|
assertEquals(signatureInput, `sig1=("@method" "@target-uri" "host");alg="rsa-v1_5-sha256";keyid="https://example.com/key";created=1709626184`);
|
|
279
290
|
assertEquals(signatureHeader, `sig1=:AQIDBA==:`);
|
|
280
291
|
});
|
|
281
292
|
test("parseRfc9421SignatureInput()", () => {
|
|
282
|
-
const
|
|
283
|
-
const parsed = parseRfc9421SignatureInput(signatureInput);
|
|
293
|
+
const parsed = parseRfc9421SignatureInput(`sig1=("@method" "@target-uri" "host" "date");keyid="https://example.com/key";alg="rsa-v1_5-sha256";created=1709626184`);
|
|
284
294
|
assertEquals(parsed.sig1.keyId, "https://example.com/key");
|
|
285
295
|
assertEquals(parsed.sig1.alg, "rsa-v1_5-sha256");
|
|
286
296
|
assertEquals(parsed.sig1.created, 1709626184);
|
|
@@ -293,8 +303,7 @@ test("parseRfc9421SignatureInput()", () => {
|
|
|
293
303
|
assertEquals(parsed.sig1.parameters, "keyid=\"https://example.com/key\";alg=\"rsa-v1_5-sha256\";created=1709626184");
|
|
294
304
|
});
|
|
295
305
|
test("parseRfc9421Signature()", () => {
|
|
296
|
-
const
|
|
297
|
-
const parsed = parseRfc9421Signature(signature);
|
|
306
|
+
const parsed = parseRfc9421Signature(`sig1=:AQIDBA==:,sig2=:Zm9vYmFy:`);
|
|
298
307
|
assertExists(parsed.sig1);
|
|
299
308
|
assertExists(parsed.sig2);
|
|
300
309
|
const sig1Bytes = new Uint8Array(parsed.sig1);
|
|
@@ -371,7 +380,7 @@ test("verifyRequest() [rfc9421] manual POST verification", async () => {
|
|
|
371
380
|
headers: new Headers(signedPostRequest.headers)
|
|
372
381
|
});
|
|
373
382
|
const signatureBase = createRfc9421SignatureBase(manualRequest, parsedInput.sig1.components, parsedInput.sig1.parameters);
|
|
374
|
-
const signatureVerified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", rsaPublicKey2.publicKey, parsedSignature.sig1, new TextEncoder().encode(signatureBase));
|
|
383
|
+
const signatureVerified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", rsaPublicKey2.publicKey, parsedSignature.sig1.slice(), new TextEncoder().encode(signatureBase));
|
|
375
384
|
assert(signatureVerified, "Manual verification of POST signature should succeed");
|
|
376
385
|
});
|
|
377
386
|
test("verifyRequest() [rfc9421] error cases and edge cases", async () => {
|
|
@@ -547,8 +556,7 @@ test("verifyRequest() [rfc9421] error cases and edge cases", async () => {
|
|
|
547
556
|
const parsedSig = parseRfc9421Signature(signature);
|
|
548
557
|
assertExists(parsedSig.sig1);
|
|
549
558
|
assert(new TextDecoder().decode(parsedSig.sig1).length > 0, "Signature base64 should decode to non-empty string");
|
|
550
|
-
const
|
|
551
|
-
const complexParsedInput = parseRfc9421SignatureInput(complexSignatureInput);
|
|
559
|
+
const complexParsedInput = parseRfc9421SignatureInput("sig1=(\"@method\" \"@target-uri\" \"host\" \"content-type\" \"value with \\\"quotes\\\" and spaces\");keyid=\"https://example.com/key with spaces\";alg=\"rsa-v1_5-sha256\";created=1709626184");
|
|
552
560
|
assertExists(complexParsedInput.sig1);
|
|
553
561
|
assertEquals(complexParsedInput.sig1.keyId, "https://example.com/key with spaces");
|
|
554
562
|
assertEquals(complexParsedInput.sig1.alg, "rsa-v1_5-sha256");
|
|
@@ -567,14 +575,11 @@ test("verifyRequest() [rfc9421] error cases and edge cases", async () => {
|
|
|
567
575
|
assertEquals(multiParsedInput.sig2.alg, "rsa-pss-sha512");
|
|
568
576
|
const multiParsedSig = parseRfc9421Signature(multiSigRequest.headers.get("Signature") || "");
|
|
569
577
|
assertEquals(Object.keys(multiParsedSig).length, 2, "Should parse multiple signature values");
|
|
570
|
-
const
|
|
571
|
-
const parsedInvalidInput = parseRfc9421SignatureInput(invalidInputFormat);
|
|
578
|
+
const parsedInvalidInput = parseRfc9421SignatureInput("this is not a valid signature-input format");
|
|
572
579
|
assertEquals(Object.keys(parsedInvalidInput).length, 0, "Should handle invalid Signature-Input format");
|
|
573
|
-
const
|
|
574
|
-
const parsedInvalidSig = parseRfc9421Signature(invalidSigFormat);
|
|
580
|
+
const parsedInvalidSig = parseRfc9421Signature("this is not a valid signature format");
|
|
575
581
|
assertEquals(Object.keys(parsedInvalidSig).length, 0, "Should handle invalid Signature format");
|
|
576
|
-
const
|
|
577
|
-
const parsedInvalidBase64 = parseRfc9421Signature(invalidBase64Sig);
|
|
582
|
+
const parsedInvalidBase64 = parseRfc9421Signature("sig1=:!@#$%%^&*():");
|
|
578
583
|
assertEquals(Object.keys(parsedInvalidBase64).length, 0, "Should handle invalid base64 in signature");
|
|
579
584
|
const mixedRequest = new Request("https://example.com/api/resource", {
|
|
580
585
|
method: "GET",
|
|
@@ -952,7 +957,7 @@ test("timingSafeEqual()", async (t) => {
|
|
|
952
957
|
assert(timingSafeEqual(arr, arr), "Array should be equal to itself by reference");
|
|
953
958
|
});
|
|
954
959
|
await t.step("should return false for arrays with same length but different content", async (t2) => {
|
|
955
|
-
const
|
|
960
|
+
for (const tc of [
|
|
956
961
|
{
|
|
957
962
|
a: [
|
|
958
963
|
1,
|
|
@@ -1010,13 +1015,12 @@ test("timingSafeEqual()", async (t) => {
|
|
|
1010
1015
|
],
|
|
1011
1016
|
name: "middle byte differs with edge values"
|
|
1012
1017
|
}
|
|
1013
|
-
]
|
|
1014
|
-
for (const tc of testCases) await t2.step(tc.name, () => {
|
|
1018
|
+
]) await t2.step(tc.name, () => {
|
|
1015
1019
|
assertFalse(timingSafeEqual(new Uint8Array(tc.a), new Uint8Array(tc.b)));
|
|
1016
1020
|
});
|
|
1017
1021
|
});
|
|
1018
1022
|
await t.step("should return false for arrays with different lengths", async (t2) => {
|
|
1019
|
-
const
|
|
1023
|
+
for (const tc of [
|
|
1020
1024
|
{
|
|
1021
1025
|
a: [
|
|
1022
1026
|
1,
|
|
@@ -1053,13 +1057,12 @@ test("timingSafeEqual()", async (t) => {
|
|
|
1053
1057
|
b: [],
|
|
1054
1058
|
name: "a non-empty, b empty"
|
|
1055
1059
|
}
|
|
1056
|
-
]
|
|
1057
|
-
for (const tc of testCases) await t2.step(tc.name, () => {
|
|
1060
|
+
]) await t2.step(tc.name, () => {
|
|
1058
1061
|
assertFalse(timingSafeEqual(new Uint8Array(tc.a), new Uint8Array(tc.b)));
|
|
1059
1062
|
});
|
|
1060
1063
|
});
|
|
1061
1064
|
await t.step("should return false where content matches up to shorter length", async (t2) => {
|
|
1062
|
-
const
|
|
1065
|
+
for (const tc of [
|
|
1063
1066
|
{
|
|
1064
1067
|
a: [1, 2],
|
|
1065
1068
|
b: [
|
|
@@ -1088,8 +1091,7 @@ test("timingSafeEqual()", async (t) => {
|
|
|
1088
1091
|
b: [0],
|
|
1089
1092
|
name: "two zeros vs single zero"
|
|
1090
1093
|
}
|
|
1091
|
-
]
|
|
1092
|
-
for (const tc of testCases) await t2.step(tc.name, () => {
|
|
1094
|
+
]) await t2.step(tc.name, () => {
|
|
1093
1095
|
assertFalse(timingSafeEqual(new Uint8Array(tc.a), new Uint8Array(tc.b)));
|
|
1094
1096
|
});
|
|
1095
1097
|
});
|
package/dist/sig/key.test.js
CHANGED
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import "../assert-
|
|
8
|
-
import "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import "../multibase-
|
|
12
|
-
import { CryptographicKey, Multikey } from "../vocab-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import "../assert-LOEeCUK5.js";
|
|
8
|
+
import "../assert_instance_of-XtuFevV_.js";
|
|
9
|
+
import "../docloader-bgBm1Hd1.js";
|
|
10
|
+
import "../url-C2xuoQD1.js";
|
|
11
|
+
import "../multibase-CnLHszip.js";
|
|
12
|
+
import { CryptographicKey, Multikey } from "../vocab-DFlq4Wa6.js";
|
|
13
13
|
import "../langstr-DbWheeIS.js";
|
|
14
|
-
import "../lookup-
|
|
15
|
-
import "../type-
|
|
16
|
-
import "../actor-
|
|
17
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "../key-
|
|
18
|
-
import { test } from "../testing-
|
|
19
|
-
import "../std__assert-
|
|
20
|
-
import { assertRejects } from "../assert_rejects-
|
|
21
|
-
import "../assert_is_error-
|
|
22
|
-
import "../assert_not_equals-
|
|
23
|
-
import { assertThrows } from "../assert_throws-
|
|
14
|
+
import "../lookup-DL62q3Xh.js";
|
|
15
|
+
import "../type-CFuiGLz9.js";
|
|
16
|
+
import "../actor-TYqJGdVq.js";
|
|
17
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "../key-KVhaUM92.js";
|
|
18
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
19
|
+
import "../std__assert-o_r9vqm1.js";
|
|
20
|
+
import { assertRejects } from "../assert_rejects-DWQ4jaf9.js";
|
|
21
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
22
|
+
import "../assert_not_equals-C685gKx6.js";
|
|
23
|
+
import { assertThrows } from "../assert_throws-YetpVSc-.js";
|
|
24
24
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
25
|
-
import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-
|
|
25
|
+
import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-C4XQHW5_.js";
|
|
26
26
|
|
|
27
27
|
//#region sig/key.test.ts
|
|
28
28
|
test("validateCryptoKey()", async () => {
|
package/dist/sig/ld.test.js
CHANGED
|
@@ -3,24 +3,24 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import "../docloader-
|
|
9
|
-
import "../url-
|
|
10
|
-
import "../multibase-
|
|
11
|
-
import { CryptographicKey } from "../vocab-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import { assert } from "../assert-LOEeCUK5.js";
|
|
8
|
+
import "../docloader-bgBm1Hd1.js";
|
|
9
|
+
import "../url-C2xuoQD1.js";
|
|
10
|
+
import "../multibase-CnLHszip.js";
|
|
11
|
+
import { CryptographicKey } from "../vocab-DFlq4Wa6.js";
|
|
12
12
|
import "../langstr-DbWheeIS.js";
|
|
13
|
-
import "../lookup-
|
|
14
|
-
import "../type-
|
|
15
|
-
import "../actor-
|
|
16
|
-
import { generateCryptoKeyPair } from "../key-
|
|
17
|
-
import { attachSignature, createSignature, detachSignature, signJsonLd, verifyJsonLd, verifySignature } from "../ld-
|
|
18
|
-
import { test } from "../testing-
|
|
19
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
|
20
|
-
import "../assert_is_error-
|
|
21
|
-
import { assertThrows } from "../assert_throws-
|
|
13
|
+
import "../lookup-DL62q3Xh.js";
|
|
14
|
+
import "../type-CFuiGLz9.js";
|
|
15
|
+
import "../actor-TYqJGdVq.js";
|
|
16
|
+
import { generateCryptoKeyPair } from "../key-KVhaUM92.js";
|
|
17
|
+
import { attachSignature, createSignature, detachSignature, signJsonLd, verifyJsonLd, verifySignature } from "../ld-DzlJ_IpT.js";
|
|
18
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
19
|
+
import { assertFalse, assertRejects } from "../assert_rejects-DWQ4jaf9.js";
|
|
20
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
21
|
+
import { assertThrows } from "../assert_throws-YetpVSc-.js";
|
|
22
22
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
23
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-
|
|
23
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-C4XQHW5_.js";
|
|
24
24
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
25
25
|
|
|
26
26
|
//#region sig/ld.test.ts
|
|
@@ -59,13 +59,12 @@ test("createSignature()", async () => {
|
|
|
59
59
|
assertRejects(() => createSignature(doc, ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader }), TypeError);
|
|
60
60
|
});
|
|
61
61
|
test("signJsonLd()", async () => {
|
|
62
|
-
const
|
|
62
|
+
const signed = await signJsonLd({
|
|
63
63
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
64
64
|
id: "https://example.com/1",
|
|
65
65
|
type: "Create",
|
|
66
66
|
actor: "https://example.com/person2"
|
|
67
|
-
};
|
|
68
|
-
const signed = await signJsonLd(doc, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader });
|
|
67
|
+
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader });
|
|
69
68
|
const verified = await verifyJsonLd(signed, {
|
|
70
69
|
documentLoader: mockDocumentLoader,
|
|
71
70
|
contextLoader: mockDocumentLoader
|
|
@@ -215,13 +214,12 @@ test("verifyJsonLd()", async () => {
|
|
|
215
214
|
contextLoader: mockDocumentLoader
|
|
216
215
|
});
|
|
217
216
|
assert(verified);
|
|
218
|
-
const
|
|
217
|
+
const signed = await signJsonLd({
|
|
219
218
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
220
219
|
id: "https://example.com/1",
|
|
221
220
|
type: "Create",
|
|
222
221
|
actor: "https://example.com/person2"
|
|
223
|
-
};
|
|
224
|
-
const signed = await signJsonLd(doc, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader });
|
|
222
|
+
}, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader });
|
|
225
223
|
const verified2 = await verifyJsonLd(signed, {
|
|
226
224
|
documentLoader: mockDocumentLoader,
|
|
227
225
|
contextLoader: mockDocumentLoader
|
package/dist/sig/mod.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../docloader-
|
|
6
|
-
import "../actor-
|
|
7
|
-
import "../lookup-
|
|
8
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "../key-
|
|
9
|
-
import { signRequest, verifyRequest } from "../http-
|
|
10
|
-
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../proof-
|
|
5
|
+
import "../docloader-DJxET2fN.js";
|
|
6
|
+
import "../actor-GZRoTRqg.js";
|
|
7
|
+
import "../lookup-CSngxuWm.js";
|
|
8
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "../key-DmqJj57e.js";
|
|
9
|
+
import { signRequest, verifyRequest } from "../http-vqMAvOVs.js";
|
|
10
|
+
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../proof-DlI7QNdn.js";
|
|
11
11
|
import "../sig-BXJO--F9.js";
|
|
12
12
|
|
|
13
13
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
package/dist/sig/owner.test.js
CHANGED
|
@@ -3,28 +3,28 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import "../multibase-
|
|
12
|
-
import { Create } from "../vocab-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import { assert } from "../assert-LOEeCUK5.js";
|
|
8
|
+
import "../assert_instance_of-XtuFevV_.js";
|
|
9
|
+
import "../docloader-bgBm1Hd1.js";
|
|
10
|
+
import "../url-C2xuoQD1.js";
|
|
11
|
+
import "../multibase-CnLHszip.js";
|
|
12
|
+
import { Create } from "../vocab-DFlq4Wa6.js";
|
|
13
13
|
import "../langstr-DbWheeIS.js";
|
|
14
|
-
import "../lookup-
|
|
15
|
-
import "../type-
|
|
16
|
-
import "../actor-
|
|
17
|
-
import "../key-
|
|
18
|
-
import { doesActorOwnKey, getKeyOwner } from "../owner-
|
|
19
|
-
import { lookupObject } from "../lookup-
|
|
20
|
-
import { test } from "../testing-
|
|
21
|
-
import "../std__assert-
|
|
22
|
-
import { assertFalse } from "../assert_rejects-
|
|
23
|
-
import "../assert_is_error-
|
|
24
|
-
import "../assert_not_equals-
|
|
25
|
-
import "../assert_throws-
|
|
14
|
+
import "../lookup-DL62q3Xh.js";
|
|
15
|
+
import "../type-CFuiGLz9.js";
|
|
16
|
+
import "../actor-TYqJGdVq.js";
|
|
17
|
+
import "../key-KVhaUM92.js";
|
|
18
|
+
import { doesActorOwnKey, getKeyOwner } from "../owner-81ey_76X.js";
|
|
19
|
+
import { lookupObject } from "../lookup-D0je8AqR.js";
|
|
20
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
21
|
+
import "../std__assert-o_r9vqm1.js";
|
|
22
|
+
import { assertFalse } from "../assert_rejects-DWQ4jaf9.js";
|
|
23
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
24
|
+
import "../assert_not_equals-C685gKx6.js";
|
|
25
|
+
import "../assert_throws-YetpVSc-.js";
|
|
26
26
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
27
|
-
import { rsaPublicKey1, rsaPublicKey2 } from "../keys-
|
|
27
|
+
import { rsaPublicKey1, rsaPublicKey2 } from "../keys-C4XQHW5_.js";
|
|
28
28
|
|
|
29
29
|
//#region sig/owner.test.ts
|
|
30
30
|
test("doesActorOwnKey()", async () => {
|
package/dist/sig/proof.test.js
CHANGED
|
@@ -3,27 +3,27 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import "../assert-
|
|
8
|
-
import { assertInstanceOf } from "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import { decode } from "../multibase-
|
|
12
|
-
import { Create, DataIntegrityProof, Multikey, Note, Place, importMultibaseKey } from "../vocab-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import "../assert-LOEeCUK5.js";
|
|
8
|
+
import { assertInstanceOf } from "../assert_instance_of-XtuFevV_.js";
|
|
9
|
+
import "../docloader-bgBm1Hd1.js";
|
|
10
|
+
import "../url-C2xuoQD1.js";
|
|
11
|
+
import { decode } from "../multibase-CnLHszip.js";
|
|
12
|
+
import { Create, DataIntegrityProof, Multikey, Note, Place, importMultibaseKey } from "../vocab-DFlq4Wa6.js";
|
|
13
13
|
import "../langstr-DbWheeIS.js";
|
|
14
|
-
import "../lookup-
|
|
15
|
-
import "../type-
|
|
16
|
-
import "../actor-
|
|
17
|
-
import "../key-
|
|
18
|
-
import { createProof, signObject, verifyObject, verifyProof } from "../proof-
|
|
19
|
-
import { test } from "../testing-
|
|
20
|
-
import "../std__assert-
|
|
21
|
-
import { assertRejects } from "../assert_rejects-
|
|
22
|
-
import "../assert_is_error-
|
|
23
|
-
import "../assert_not_equals-
|
|
24
|
-
import "../assert_throws-
|
|
14
|
+
import "../lookup-DL62q3Xh.js";
|
|
15
|
+
import "../type-CFuiGLz9.js";
|
|
16
|
+
import "../actor-TYqJGdVq.js";
|
|
17
|
+
import "../key-KVhaUM92.js";
|
|
18
|
+
import { createProof, signObject, verifyObject, verifyProof } from "../proof-BlULDH4H.js";
|
|
19
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
20
|
+
import "../std__assert-o_r9vqm1.js";
|
|
21
|
+
import { assertRejects } from "../assert_rejects-DWQ4jaf9.js";
|
|
22
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
23
|
+
import "../assert_not_equals-C685gKx6.js";
|
|
24
|
+
import "../assert_throws-YetpVSc-.js";
|
|
25
25
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
26
|
-
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
|
26
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-C4XQHW5_.js";
|
|
27
27
|
import { decodeHex, encodeHex } from "byte-encodings/hex";
|
|
28
28
|
|
|
29
29
|
//#region sig/proof.test.ts
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { AssertionError, buildMessage, diff, diffStr, format, red } from "./assert_equals-
|
|
6
|
+
import { AssertionError, buildMessage, diff, diffStr, format, red } from "./assert_equals-B44MxcIj.js";
|
|
7
7
|
|
|
8
8
|
//#region node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
|
|
9
9
|
/**
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import "../assert-
|
|
8
|
-
import "../assert_instance_of-
|
|
9
|
-
import { test } from "../testing-
|
|
10
|
-
import "../std__assert-
|
|
11
|
-
import "../assert_rejects-
|
|
12
|
-
import "../assert_is_error-
|
|
13
|
-
import "../assert_not_equals-
|
|
14
|
-
import "../assert_throws-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import "../assert-LOEeCUK5.js";
|
|
8
|
+
import "../assert_instance_of-XtuFevV_.js";
|
|
9
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
10
|
+
import "../std__assert-o_r9vqm1.js";
|
|
11
|
+
import "../assert_rejects-DWQ4jaf9.js";
|
|
12
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
13
|
+
import "../assert_not_equals-C685gKx6.js";
|
|
14
|
+
import "../assert_throws-YetpVSc-.js";
|
|
15
15
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
16
16
|
|
|
17
17
|
//#region testing/docloader.test.ts
|
package/dist/testing/mod.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { __require } from "./chunk-
|
|
6
|
+
import { __require } from "./chunk-Cx8LTkjm.js";
|
|
7
7
|
import { configure, getConsoleSink, reset } from "@logtape/logtape";
|
|
8
8
|
|
|
9
9
|
//#region testing/mod.ts
|
|
@@ -121,12 +121,11 @@ function intoDenoTestContext(name, ctx) {
|
|
|
121
121
|
});
|
|
122
122
|
return failed;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
return {
|
|
125
125
|
name,
|
|
126
126
|
origin: ctx.filePath ?? "",
|
|
127
127
|
step
|
|
128
128
|
};
|
|
129
|
-
return denoCtx;
|
|
130
129
|
}
|
|
131
130
|
/** Retrieve caller test file. */
|
|
132
131
|
function caller() {
|
|
@@ -135,8 +134,7 @@ function caller() {
|
|
|
135
134
|
Trace.prepareStackTrace = (_$1, stack$1) => stack$1;
|
|
136
135
|
const { stack } = /* @__PURE__ */ new Error();
|
|
137
136
|
Trace.prepareStackTrace = _;
|
|
138
|
-
|
|
139
|
-
return caller$1.getFileName().replaceAll("\\", "/");
|
|
137
|
+
return stack[2].getFileName().replaceAll("\\", "/");
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
//#endregion
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { getUserAgent } from "./docloader-
|
|
5
|
+
import { getUserAgent } from "./docloader-DJxET2fN.js";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
|
|
8
8
|
//#region nodeinfo/semver.ts
|
|
@@ -142,9 +142,7 @@ function formatSemVer(version) {
|
|
|
142
142
|
const patch = formatNumber(version.patch);
|
|
143
143
|
const pre = version.prerelease?.join(".") ?? "";
|
|
144
144
|
const build = version.build?.join(".") ?? "";
|
|
145
|
-
|
|
146
|
-
const release = [primary, pre].filter((v) => v).join("-");
|
|
147
|
-
return [release, build].filter((v) => v).join("+");
|
|
145
|
+
return [[`${major}.${minor}.${patch}`, pre].filter((v) => v).join("-"), build].filter((v) => v).join("+");
|
|
148
146
|
}
|
|
149
147
|
|
|
150
148
|
//#endregion
|
|
@@ -169,7 +167,7 @@ async function getNodeInfo(url, options = {}) {
|
|
|
169
167
|
status: wellKnownResponse.status,
|
|
170
168
|
statusText: wellKnownResponse.statusText
|
|
171
169
|
});
|
|
172
|
-
return
|
|
170
|
+
return;
|
|
173
171
|
}
|
|
174
172
|
const wellKnownRd = await wellKnownResponse.json();
|
|
175
173
|
const link = wellKnownRd?.links?.find((link$1) => link$1 != null && "rel" in link$1 && (link$1.rel === "http://nodeinfo.diaspora.software/ns/schema/2.0" || link$1.rel === "http://nodeinfo.diaspora.software/ns/schema/2.1") && "href" in link$1 && link$1.href != null);
|
|
@@ -178,7 +176,7 @@ async function getNodeInfo(url, options = {}) {
|
|
|
178
176
|
url: wellKnownUrl.href,
|
|
179
177
|
resourceDescriptor: wellKnownRd
|
|
180
178
|
});
|
|
181
|
-
return
|
|
179
|
+
return;
|
|
182
180
|
}
|
|
183
181
|
nodeInfoUrl = link.href;
|
|
184
182
|
}
|
|
@@ -192,7 +190,7 @@ async function getNodeInfo(url, options = {}) {
|
|
|
192
190
|
status: response.status,
|
|
193
191
|
statusText: response.statusText
|
|
194
192
|
});
|
|
195
|
-
return
|
|
193
|
+
return;
|
|
196
194
|
}
|
|
197
195
|
const data = await response.json();
|
|
198
196
|
if (options.parse === "none") return data;
|
|
@@ -202,7 +200,7 @@ async function getNodeInfo(url, options = {}) {
|
|
|
202
200
|
url: url.toString(),
|
|
203
201
|
error
|
|
204
202
|
});
|
|
205
|
-
return
|
|
203
|
+
return;
|
|
206
204
|
}
|
|
207
205
|
}
|
|
208
206
|
/**
|
|
@@ -23,8 +23,7 @@ async function validatePublicUrl(url) {
|
|
|
23
23
|
if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
|
|
24
24
|
if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
|
|
25
25
|
if ("Deno" in globalThis && !isIP(hostname)) {
|
|
26
|
-
|
|
27
|
-
if (netPermission.state !== "granted") return;
|
|
26
|
+
if ((await Deno.permissions.query({ name: "net" })).state !== "granted") return;
|
|
28
27
|
}
|
|
29
28
|
if ("Bun" in globalThis) {
|
|
30
29
|
if (hostname === "example.com" || hostname.endsWith(".example.com")) return;
|
|
@@ -60,8 +59,7 @@ function expandIPv6Address(address) {
|
|
|
60
59
|
if (address.startsWith("::")) address = "0000" + address;
|
|
61
60
|
if (address.endsWith("::")) address = address + "0000";
|
|
62
61
|
address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
|
|
63
|
-
|
|
64
|
-
return parts.map((part) => part.padStart(4, "0")).join(":");
|
|
62
|
+
return address.split(":").map((part) => part.padStart(4, "0")).join(":");
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
//#endregion
|