@fedify/fedify 1.8.0-dev.909 → 1.8.0-dev.913
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/LICENSE +20 -0
- package/dist/{actor-CPpvuBKU.d.ts → actor-B4TBtqRP.d.ts} +2 -2
- package/dist/{actor-CyOLxmqe.js → actor-DkCkjAdQ.js} +3 -3
- package/dist/{actor-BITBdkks.js → actor-Dn_sijns.js} +179 -179
- package/dist/{assert-YJk-1DlZ.js → assert-DwEa6glZ.js} +2 -2
- package/dist/{assert_equals-Dnj7ejjL.js → assert_equals-C5gKCm6A.js} +9 -9
- package/dist/{assert_instance_of-DBIoG5k7.js → assert_instance_of-C9QtN-X9.js} +2 -2
- package/dist/{assert_is_error-jyzqjHud.js → assert_is_error-DQdKoRgb.js} +2 -2
- package/dist/{assert_not_equals-wx-SRs4i.js → assert_not_equals-7pyUM3Ib.js} +2 -2
- package/dist/{assert_rejects-BZjUwo62.js → assert_rejects-DceVjUlD.js} +4 -4
- package/dist/{assert_throws-gBPv3v2V.js → assert_throws-DTDC_gwN.js} +3 -3
- package/dist/{authdocloader-C5uOgSX0.js → authdocloader-D1PjZbiV.js} +3 -3
- package/dist/{authdocloader-CR4ReBEM.js → authdocloader-D99lbDL5.js} +3 -3
- package/dist/{builder-Cn_dEFUY.js → builder-BMwn_1aw.js} +4 -4
- package/dist/{client-DvtwXO7t.d.ts → client-BQ4AQGKo.d.ts} +1 -1
- package/dist/{client-CMFozQ9u.js → client-BrWndEgd.js} +1 -1
- package/dist/compat/mod.d.ts +11 -11
- package/dist/compat/transformers.test.js +22 -22
- package/dist/{context-C5QfN69i.js → context-BWzB3-Ek.js} +3 -3
- package/dist/{context-DPggmpB4.d.ts → context-y90aX3KP.d.ts} +9 -9
- package/dist/{denokv-CvROlGYX.js → denokv-QWKsIqML.js} +2 -0
- package/dist/{docloader-B8LwWSQH.js → docloader-BMbAXtsR.js} +2 -2
- package/dist/{docloader-Q42SMRIB.d.ts → docloader-BeCtcTOJ.d.ts} +1 -1
- package/dist/{docloader-BGrugaWu.js → docloader-CKZLh5zr.js} +2 -2
- package/dist/{esm-CASHO3OR.js → esm-d-9EVGaP.js} +14 -14
- package/dist/federation/builder.test.js +14 -14
- package/dist/federation/collection.test.js +8 -8
- package/dist/federation/handler.test.js +29 -29
- package/dist/federation/inbox.test.js +6 -6
- package/dist/federation/keycache.test.js +7 -7
- package/dist/federation/kv.test.js +21 -9
- package/dist/federation/middleware.test.js +29 -29
- package/dist/federation/mod.d.ts +10 -10
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +11 -11
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +18 -18
- package/dist/{federation-BRIQn-GV.js → federation-C44ekWNP.js} +28 -6
- package/dist/{http-Bw-KypWQ.js → http-7hwyNK4S.js} +22 -8
- package/dist/{http-B8EiSgi2.d.ts → http-CP2ZUALI.d.ts} +2 -2
- package/dist/{http-LxMzqv6Y.js → http-DID05rI5.js} +22 -8
- package/dist/{inbox-B3KrAg1n.js → inbox-BRlPSRHq.js} +2 -2
- package/dist/{key-Bd0PZBDK.js → key-Bfw6GMkj.js} +2 -2
- package/dist/{key-CC7vZuiT.js → key-DxQbezr3.js} +5 -5
- package/dist/{key-CTBNGHFy.js → key-oPj7d_pr.js} +3 -3
- package/dist/{key-c8XWz3r4.js → key-uTFb_2Hb.js} +4 -4
- package/dist/{keycache-BUHOqfY2.js → keycache-mmqnDCTI.js} +1 -1
- package/dist/{keys-DUTOB0Cy.js → keys-CEk9oIPH.js} +1 -1
- package/dist/{kv-BMY6Qf_A.js → kv-D7Yt6pnB.js} +22 -0
- package/dist/{kv-DRaeSXco.d.ts → kv-DDdb1hMa.d.ts} +14 -0
- package/dist/{ld-C_ovlkZL.js → ld-DwlCvzBq.js} +3 -3
- package/dist/{lookup-CI7otoDD.js → lookup-BKjhgqwT.js} +4 -4
- package/dist/{lookup-DtBlAJy1.js → lookup-BZ_3Oeio.js} +1 -1
- package/dist/{lookup-Br1lrdl-.js → lookup-BpUDsNL6.js} +1 -1
- package/dist/{lookup-Bf-K85bV.d.ts → lookup-DHNtuVcT.d.ts} +1 -1
- package/dist/{middleware-yeyGostM.js → middleware-BCp-1jqa.js} +11 -11
- package/dist/middleware-BO2wNbAY.js +33 -0
- package/dist/{middleware-CMWhjpuL.js → middleware-DTn_Zmc0.js} +16 -16
- package/dist/middleware-DskqUHjh.js +17 -0
- package/dist/{mod-CDzlVCUF.d.ts → mod-BzLUzgBJ.d.ts} +2 -2
- package/dist/{mod-CbjCOiVh.d.ts → mod-CaGwZaei.d.ts} +2 -2
- package/dist/{mod-C2drFqH8.d.ts → mod-CytXBx8A.d.ts} +2 -2
- package/dist/{mod-sEI6_uZ2.d.ts → mod-D2uPZuP-.d.ts} +3 -3
- package/dist/mod.d.ts +13 -13
- package/dist/mod.js +11 -11
- package/dist/nodeinfo/client.test.js +11 -11
- package/dist/nodeinfo/handler.test.js +28 -28
- package/dist/nodeinfo/mod.d.ts +3 -3
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +8 -8
- package/dist/nodeinfo/types.test.js +8 -8
- package/dist/{owner-D0cOz8R5.d.ts → owner-CEv_PfyK.d.ts} +3 -3
- package/dist/{owner-CkLDJKtn.js → owner-UV7CHEMi.js} +3 -3
- package/dist/{proof-C1975Dmq.js → proof-B-gH6Z03.js} +3 -3
- package/dist/{proof-C0PGy60K.js → proof-CMT24M0v.js} +3 -3
- package/dist/{router-D_aVZZUc.js → router-D3UybECj.js} +1 -1
- package/dist/runtime/authdocloader.test.js +17 -17
- package/dist/runtime/docloader.test.js +11 -11
- package/dist/runtime/key.test.js +13 -13
- package/dist/runtime/langstr.test.js +8 -8
- package/dist/runtime/mod.d.ts +5 -5
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +8 -8
- package/dist/runtime/url.test.js +4 -4
- package/dist/{send-QHgSClXu.js → send-CCjabLw9.js} +2 -2
- package/dist/sig/http.test.js +44 -16
- package/dist/sig/key.test.js +14 -14
- package/dist/sig/ld.test.js +12 -12
- package/dist/sig/mod.d.ts +7 -7
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +16 -16
- package/dist/sig/proof.test.js +15 -15
- package/dist/{std__assert-CHXwj7zk.js → std__assert-B3iAixc-.js} +6 -6
- package/dist/testing/docloader.test.js +8 -8
- package/dist/{types-C1PZR_wN.js → types-CwXOHRsC.js} +1 -1
- package/dist/vocab/actor.test.js +142 -142
- package/dist/vocab/lookup.test.js +13 -13
- package/dist/vocab/mod.d.ts +5 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +50 -50
- package/dist/{vocab-CzEfWQk2.d.ts → vocab-By6mpzr-.d.ts} +1 -1
- package/dist/{vocab-CDmoyB_X.js → vocab-Cb4TGq4-.js} +178 -178
- package/dist/{vocab-caJ0egxJ.js → vocab-V5P0w1-2.js} +4 -4
- package/dist/webfinger/handler.test.js +28 -28
- package/dist/webfinger/lookup.test.js +12 -12
- package/dist/webfinger/mod.d.ts +3 -3
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.d.ts +6 -1
- package/dist/x/cfworkers.js +5 -0
- package/dist/x/cfworkers.test.js +14 -9
- package/dist/x/hono.d.ts +10 -10
- package/dist/x/sveltekit.d.ts +10 -10
- package/package.json +3 -3
- package/dist/middleware-D-pC2m-d.js +0 -17
- package/dist/middleware-DhHXwhPP.js +0 -33
@@ -3,45 +3,45 @@
|
|
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 { MemoryKvStore } from "../kv-
|
10
|
-
import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
11
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import { MemoryKvStore } from "../kv-D7Yt6pnB.js";
|
10
|
+
import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-DTn_Zmc0.js";
|
11
|
+
import "../docloader-BMbAXtsR.js";
|
12
12
|
import "../url-kTAI6_KP.js";
|
13
13
|
import "../semver-DWClQt_5.js";
|
14
|
-
import "../client-
|
15
|
-
import "../router-
|
14
|
+
import "../client-BrWndEgd.js";
|
15
|
+
import "../router-D3UybECj.js";
|
16
16
|
import "../types-C7C_l-jz.js";
|
17
17
|
import "../multibase-DeCHcK8L.js";
|
18
|
-
import { Create, Note, Person } from "../vocab-
|
18
|
+
import { Create, Note, Person } from "../vocab-Cb4TGq4-.js";
|
19
19
|
import "../langstr-DbWheeIS.js";
|
20
|
-
import "../lookup-
|
20
|
+
import "../lookup-BZ_3Oeio.js";
|
21
21
|
import "../type-D2s5lmbZ.js";
|
22
|
-
import "../actor-
|
23
|
-
import "../key-
|
24
|
-
import { signRequest } from "../http-
|
25
|
-
import "../authdocloader-
|
26
|
-
import "../ld-
|
27
|
-
import "../owner-
|
28
|
-
import "../proof-
|
29
|
-
import "../lookup-
|
30
|
-
import "../inbox-
|
31
|
-
import "../builder-
|
22
|
+
import "../actor-DkCkjAdQ.js";
|
23
|
+
import "../key-oPj7d_pr.js";
|
24
|
+
import { signRequest } from "../http-7hwyNK4S.js";
|
25
|
+
import "../authdocloader-D99lbDL5.js";
|
26
|
+
import "../ld-DwlCvzBq.js";
|
27
|
+
import "../owner-UV7CHEMi.js";
|
28
|
+
import "../proof-CMT24M0v.js";
|
29
|
+
import "../lookup-BKjhgqwT.js";
|
30
|
+
import "../inbox-BRlPSRHq.js";
|
31
|
+
import "../builder-BMwn_1aw.js";
|
32
32
|
import "../collection-Dfb0TPno.js";
|
33
|
-
import "../keycache-
|
33
|
+
import "../keycache-mmqnDCTI.js";
|
34
34
|
import "../retry-BiIhZWgD.js";
|
35
|
-
import "../send-
|
35
|
+
import "../send-CCjabLw9.js";
|
36
36
|
import { test } from "../testing-BZ0dJ4qn.js";
|
37
|
-
import "../std__assert-
|
38
|
-
import { assertFalse } from "../assert_rejects-
|
39
|
-
import "../assert_is_error-
|
40
|
-
import "../assert_not_equals-
|
41
|
-
import "../assert_throws-
|
37
|
+
import "../std__assert-B3iAixc-.js";
|
38
|
+
import { assertFalse } from "../assert_rejects-DceVjUlD.js";
|
39
|
+
import "../assert_is_error-DQdKoRgb.js";
|
40
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
41
|
+
import "../assert_throws-DTDC_gwN.js";
|
42
42
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
43
|
-
import { createInboxContext, createRequestContext } from "../context-
|
44
|
-
import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-
|
43
|
+
import { createInboxContext, createRequestContext } from "../context-BWzB3-Ek.js";
|
44
|
+
import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-CEk9oIPH.js";
|
45
45
|
|
46
46
|
//#region federation/handler.test.ts
|
47
47
|
test("acceptsJsonLd()", () => {
|
@@ -3,17 +3,17 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import "../docloader-BMbAXtsR.js";
|
8
8
|
import "../url-kTAI6_KP.js";
|
9
9
|
import "../multibase-DeCHcK8L.js";
|
10
|
-
import { Activity, Create, Invite, Offer, Update } from "../vocab-
|
10
|
+
import { Activity, Create, Invite, Offer, Update } from "../vocab-Cb4TGq4-.js";
|
11
11
|
import "../langstr-DbWheeIS.js";
|
12
12
|
import "../type-D2s5lmbZ.js";
|
13
|
-
import { InboxListenerSet } from "../inbox-
|
13
|
+
import { InboxListenerSet } from "../inbox-BRlPSRHq.js";
|
14
14
|
import { test } from "../testing-BZ0dJ4qn.js";
|
15
|
-
import "../assert_is_error-
|
16
|
-
import { assertThrows } from "../assert_throws-
|
15
|
+
import "../assert_is_error-DQdKoRgb.js";
|
16
|
+
import { assertThrows } from "../assert_throws-DTDC_gwN.js";
|
17
17
|
|
18
18
|
//#region federation/inbox.test.ts
|
19
19
|
test("InboxListenerSet", () => {
|
@@ -3,16 +3,16 @@
|
|
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 { assertInstanceOf } from "../assert_instance_of-
|
9
|
-
import { MemoryKvStore } from "../kv-
|
10
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import { assertInstanceOf } from "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import { MemoryKvStore } from "../kv-D7Yt6pnB.js";
|
10
|
+
import "../docloader-BMbAXtsR.js";
|
11
11
|
import "../url-kTAI6_KP.js";
|
12
12
|
import "../multibase-DeCHcK8L.js";
|
13
|
-
import { CryptographicKey, Multikey } from "../vocab-
|
13
|
+
import { CryptographicKey, Multikey } from "../vocab-Cb4TGq4-.js";
|
14
14
|
import "../langstr-DbWheeIS.js";
|
15
|
-
import { KvKeyCache } from "../keycache-
|
15
|
+
import { KvKeyCache } from "../keycache-mmqnDCTI.js";
|
16
16
|
import { test } from "../testing-BZ0dJ4qn.js";
|
17
17
|
|
18
18
|
//#region federation/keycache.test.ts
|
@@ -3,16 +3,16 @@
|
|
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 { MemoryKvStore } from "../kv-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import { MemoryKvStore } from "../kv-D7Yt6pnB.js";
|
10
10
|
import { test } from "../testing-BZ0dJ4qn.js";
|
11
|
-
import "../std__assert-
|
12
|
-
import "../assert_rejects-
|
13
|
-
import "../assert_is_error-
|
14
|
-
import "../assert_not_equals-
|
15
|
-
import "../assert_throws-
|
11
|
+
import "../std__assert-B3iAixc-.js";
|
12
|
+
import "../assert_rejects-DceVjUlD.js";
|
13
|
+
import "../assert_is_error-DQdKoRgb.js";
|
14
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
15
|
+
import "../assert_throws-DTDC_gwN.js";
|
16
16
|
|
17
17
|
//#region federation/kv.test.ts
|
18
18
|
test("MemoryKvStore", async (t) => {
|
@@ -28,6 +28,18 @@ test("MemoryKvStore", async (t) => {
|
|
28
28
|
await store.delete(["foo", "bar"]);
|
29
29
|
assertEquals(await store.get(["foo", "bar"]), void 0);
|
30
30
|
});
|
31
|
+
await t.step("cas()", async () => {
|
32
|
+
await store.set(["foo", "bar"], "foobar");
|
33
|
+
assertEquals(await store.cas(["foo", "bar"], "bar", "baz"), false);
|
34
|
+
assertEquals(await store.get(["foo", "bar"]), "foobar");
|
35
|
+
assertEquals(await store.cas(["foo", "bar"], "foobar", "baz"), true);
|
36
|
+
assertEquals(await store.get(["foo", "bar"]), "baz");
|
37
|
+
await store.delete(["foo", "bar"]);
|
38
|
+
assertEquals(await store.cas(["foo", "bar"], "foobar", "baz"), false);
|
39
|
+
assertEquals(await store.get(["foo", "bar"]), void 0);
|
40
|
+
assertEquals(await store.cas(["foo", "bar"], void 0, "baz"), true);
|
41
|
+
assertEquals(await store.get(["foo", "bar"]), "baz");
|
42
|
+
});
|
31
43
|
});
|
32
44
|
|
33
45
|
//#endregion
|
@@ -3,45 +3,45 @@
|
|
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 { assertInstanceOf } from "../assert_instance_of-
|
9
|
-
import { MemoryKvStore } from "../kv-
|
10
|
-
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-
|
11
|
-
import { FetchError, fetchDocumentLoader } from "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import { assertInstanceOf } from "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import { MemoryKvStore } from "../kv-D7Yt6pnB.js";
|
10
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-DTn_Zmc0.js";
|
11
|
+
import { FetchError, fetchDocumentLoader } from "../docloader-BMbAXtsR.js";
|
12
12
|
import "../url-kTAI6_KP.js";
|
13
13
|
import "../semver-DWClQt_5.js";
|
14
|
-
import "../client-
|
15
|
-
import { RouterError } from "../router-
|
14
|
+
import "../client-BrWndEgd.js";
|
15
|
+
import { RouterError } from "../router-D3UybECj.js";
|
16
16
|
import "../types-C7C_l-jz.js";
|
17
17
|
import "../multibase-DeCHcK8L.js";
|
18
|
-
import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person } from "../vocab-
|
18
|
+
import { Activity, Announce, Create, Invite, Multikey, Note, Object as Object$1, Offer, Person } from "../vocab-Cb4TGq4-.js";
|
19
19
|
import "../langstr-DbWheeIS.js";
|
20
|
-
import "../lookup-
|
20
|
+
import "../lookup-BZ_3Oeio.js";
|
21
21
|
import { getTypeId } from "../type-D2s5lmbZ.js";
|
22
|
-
import "../actor-
|
23
|
-
import "../key-
|
24
|
-
import { signRequest, verifyRequest } from "../http-
|
25
|
-
import { getAuthenticatedDocumentLoader } from "../authdocloader-
|
26
|
-
import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-
|
27
|
-
import { doesActorOwnKey } from "../owner-
|
28
|
-
import { signObject, verifyObject } from "../proof-
|
29
|
-
import { lookupObject } from "../lookup-
|
30
|
-
import "../inbox-
|
31
|
-
import "../builder-
|
22
|
+
import "../actor-DkCkjAdQ.js";
|
23
|
+
import "../key-oPj7d_pr.js";
|
24
|
+
import { signRequest, verifyRequest } from "../http-7hwyNK4S.js";
|
25
|
+
import { getAuthenticatedDocumentLoader } from "../authdocloader-D99lbDL5.js";
|
26
|
+
import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-DwlCvzBq.js";
|
27
|
+
import { doesActorOwnKey } from "../owner-UV7CHEMi.js";
|
28
|
+
import { signObject, verifyObject } from "../proof-CMT24M0v.js";
|
29
|
+
import { lookupObject } from "../lookup-BKjhgqwT.js";
|
30
|
+
import "../inbox-BRlPSRHq.js";
|
31
|
+
import "../builder-BMwn_1aw.js";
|
32
32
|
import "../collection-Dfb0TPno.js";
|
33
|
-
import "../keycache-
|
33
|
+
import "../keycache-mmqnDCTI.js";
|
34
34
|
import "../retry-BiIhZWgD.js";
|
35
|
-
import "../send-
|
35
|
+
import "../send-CCjabLw9.js";
|
36
36
|
import { test } from "../testing-BZ0dJ4qn.js";
|
37
|
-
import { assertStrictEquals } from "../std__assert-
|
38
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
39
|
-
import "../assert_is_error-
|
40
|
-
import { assertNotEquals } from "../assert_not_equals-
|
41
|
-
import { assertThrows } from "../assert_throws-
|
37
|
+
import { assertStrictEquals } from "../std__assert-B3iAixc-.js";
|
38
|
+
import { assertFalse, assertRejects } from "../assert_rejects-DceVjUlD.js";
|
39
|
+
import "../assert_is_error-DQdKoRgb.js";
|
40
|
+
import { assertNotEquals } from "../assert_not_equals-7pyUM3Ib.js";
|
41
|
+
import { assertThrows } from "../assert_throws-DTDC_gwN.js";
|
42
42
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
43
|
-
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-
|
44
|
-
import { esm_default } from "../esm-
|
43
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-CEk9oIPH.js";
|
44
|
+
import { esm_default } from "../esm-d-9EVGaP.js";
|
45
45
|
|
46
46
|
//#region testing/fixtures/example.com/person.json
|
47
47
|
var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
|
package/dist/federation/mod.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-
|
4
|
-
import "../docloader-
|
5
|
-
import "../client-
|
6
|
-
import "../vocab-
|
7
|
-
import "../actor-
|
8
|
-
import "../http-
|
9
|
-
import "../owner-
|
10
|
-
import "../mod-
|
11
|
-
import "../lookup-
|
12
|
-
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-
|
3
|
+
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-DDdb1hMa.js";
|
4
|
+
import "../docloader-BeCtcTOJ.js";
|
5
|
+
import "../client-BQ4AQGKo.js";
|
6
|
+
import "../vocab-By6mpzr-.js";
|
7
|
+
import "../actor-B4TBtqRP.js";
|
8
|
+
import "../http-CP2ZUALI.js";
|
9
|
+
import "../owner-CEv_PfyK.js";
|
10
|
+
import "../mod-BzLUzgBJ.js";
|
11
|
+
import "../lookup-DHNtuVcT.js";
|
12
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-y90aX3KP.js";
|
13
13
|
import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-DYKDDJmp.js";
|
14
14
|
import "../mod-g0xFzAP9.js";
|
15
15
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import "../transformers-ghwJuzGY.js";
|
6
|
-
import "../docloader-
|
7
|
-
import "../actor-
|
8
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
9
|
-
import "../lookup-
|
10
|
-
import "../key-
|
11
|
-
import "../http-
|
12
|
-
import "../proof-
|
13
|
-
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-
|
14
|
-
import "../types-
|
15
|
-
import "../authdocloader-
|
16
|
-
import "../vocab-
|
6
|
+
import "../docloader-CKZLh5zr.js";
|
7
|
+
import "../actor-Dn_sijns.js";
|
8
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BCp-1jqa.js";
|
9
|
+
import "../lookup-BpUDsNL6.js";
|
10
|
+
import "../key-Bfw6GMkj.js";
|
11
|
+
import "../http-DID05rI5.js";
|
12
|
+
import "../proof-B-gH6Z03.js";
|
13
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-C44ekWNP.js";
|
14
|
+
import "../types-CwXOHRsC.js";
|
15
|
+
import "../authdocloader-D1PjZbiV.js";
|
16
|
+
import "../vocab-V5P0w1-2.js";
|
17
17
|
|
18
18
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
@@ -3,16 +3,16 @@
|
|
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-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
9
|
import { test } from "../testing-BZ0dJ4qn.js";
|
10
|
-
import { assertGreater, assertGreaterOrEqual } from "../std__assert-
|
11
|
-
import { assertFalse } from "../assert_rejects-
|
12
|
-
import "../assert_is_error-
|
13
|
-
import "../assert_not_equals-
|
14
|
-
import "../assert_throws-
|
15
|
-
import { delay } from "
|
10
|
+
import { assertGreater, assertGreaterOrEqual } from "../std__assert-B3iAixc-.js";
|
11
|
+
import { assertFalse } from "../assert_rejects-DceVjUlD.js";
|
12
|
+
import "../assert_is_error-DQdKoRgb.js";
|
13
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
14
|
+
import "../assert_throws-DTDC_gwN.js";
|
15
|
+
import { delay } from "es-toolkit";
|
16
16
|
|
17
17
|
//#region federation/mq.ts
|
18
18
|
/**
|
@@ -225,7 +225,7 @@ test("InProcessMessageQueue", async (t) => {
|
|
225
225
|
});
|
226
226
|
test("MessageQueue.nativeRetrial", async (t) => {
|
227
227
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
|
228
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
228
|
+
const { DenoKvMessageQueue } = await import("../denokv-QWKsIqML.js");
|
229
229
|
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
230
230
|
assert(mq.nativeRetrial);
|
231
231
|
if (Symbol.dispose in mq) {
|
@@ -264,7 +264,7 @@ test("MessageQueue.nativeRetrial", async (t) => {
|
|
264
264
|
});
|
265
265
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
266
266
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
267
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
267
|
+
const { DenoKvMessageQueue } = await import("../denokv-QWKsIqML.js");
|
268
268
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
269
269
|
}
|
270
270
|
for (const mqName in queues) test({
|
@@ -3,10 +3,10 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { AssertionError, assertEquals } from "../assert_equals-
|
6
|
+
import { AssertionError, assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
7
|
import { createExponentialBackoffPolicy } from "../retry-BiIhZWgD.js";
|
8
8
|
import { test } from "../testing-BZ0dJ4qn.js";
|
9
|
-
import { assertNotEquals } from "../assert_not_equals-
|
9
|
+
import { assertNotEquals } from "../assert_not_equals-7pyUM3Ib.js";
|
10
10
|
|
11
11
|
//#region federation/retry.test.ts
|
12
12
|
test("createExponentialBackoffPolicy()", () => {
|
@@ -3,16 +3,16 @@
|
|
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 { Router, RouterError } from "../router-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import { Router, RouterError } from "../router-D3UybECj.js";
|
10
10
|
import { test } from "../testing-BZ0dJ4qn.js";
|
11
|
-
import "../std__assert-
|
12
|
-
import { assertFalse } from "../assert_rejects-
|
13
|
-
import "../assert_is_error-
|
14
|
-
import "../assert_not_equals-
|
15
|
-
import { assertThrows } from "../assert_throws-
|
11
|
+
import "../std__assert-B3iAixc-.js";
|
12
|
+
import { assertFalse } from "../assert_rejects-DceVjUlD.js";
|
13
|
+
import "../assert_is_error-DQdKoRgb.js";
|
14
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
15
|
+
import { assertThrows } from "../assert_throws-DTDC_gwN.js";
|
16
16
|
|
17
17
|
//#region federation/router.test.ts
|
18
18
|
function setUp(options = {}) {
|
@@ -3,30 +3,30 @@
|
|
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-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import "../docloader-BMbAXtsR.js";
|
10
10
|
import "../url-kTAI6_KP.js";
|
11
11
|
import "../multibase-DeCHcK8L.js";
|
12
|
-
import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-
|
12
|
+
import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-Cb4TGq4-.js";
|
13
13
|
import "../langstr-DbWheeIS.js";
|
14
|
-
import "../lookup-
|
14
|
+
import "../lookup-BZ_3Oeio.js";
|
15
15
|
import "../type-D2s5lmbZ.js";
|
16
|
-
import "../actor-
|
17
|
-
import "../key-
|
18
|
-
import { verifyRequest } from "../http-
|
19
|
-
import { doesActorOwnKey } from "../owner-
|
20
|
-
import { extractInboxes, sendActivity } from "../send-
|
16
|
+
import "../actor-DkCkjAdQ.js";
|
17
|
+
import "../key-oPj7d_pr.js";
|
18
|
+
import { verifyRequest } from "../http-7hwyNK4S.js";
|
19
|
+
import { doesActorOwnKey } from "../owner-UV7CHEMi.js";
|
20
|
+
import { extractInboxes, sendActivity } from "../send-CCjabLw9.js";
|
21
21
|
import { test } from "../testing-BZ0dJ4qn.js";
|
22
|
-
import "../std__assert-
|
23
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
24
|
-
import "../assert_is_error-
|
25
|
-
import { assertNotEquals } from "../assert_not_equals-
|
26
|
-
import "../assert_throws-
|
22
|
+
import "../std__assert-B3iAixc-.js";
|
23
|
+
import { assertFalse, assertRejects } from "../assert_rejects-DceVjUlD.js";
|
24
|
+
import "../assert_is_error-DQdKoRgb.js";
|
25
|
+
import { assertNotEquals } from "../assert_not_equals-7pyUM3Ib.js";
|
26
|
+
import "../assert_throws-DTDC_gwN.js";
|
27
27
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
28
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
29
|
-
import { esm_default } from "../esm-
|
28
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-CEk9oIPH.js";
|
29
|
+
import { esm_default } from "../esm-d-9EVGaP.js";
|
30
30
|
|
31
31
|
//#region federation/send.test.ts
|
32
32
|
test("extractInboxes()", () => {
|
@@ -2,6 +2,8 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
+
import { isEqual } from "es-toolkit";
|
6
|
+
|
5
7
|
//#region federation/kv.ts
|
6
8
|
/**
|
7
9
|
* A key–value store that stores values in memory.
|
@@ -45,6 +47,26 @@ var MemoryKvStore = class {
|
|
45
47
|
delete this.#values[encodedKey];
|
46
48
|
return Promise.resolve();
|
47
49
|
}
|
50
|
+
/**
|
51
|
+
* {@inheritDoc KvStore.cas}
|
52
|
+
*/
|
53
|
+
cas(key, expectedValue, newValue, options) {
|
54
|
+
const encodedKey = this.#encodeKey(key);
|
55
|
+
const entry = this.#values[encodedKey];
|
56
|
+
let currentValue;
|
57
|
+
if (entry == null) currentValue = void 0;
|
58
|
+
else {
|
59
|
+
const [value, expiration$1] = entry;
|
60
|
+
if (expiration$1 != null && Temporal.Now.instant().until(expiration$1).sign < 0) {
|
61
|
+
delete this.#values[encodedKey];
|
62
|
+
currentValue = void 0;
|
63
|
+
} else currentValue = value;
|
64
|
+
}
|
65
|
+
if (!isEqual(currentValue, expectedValue)) return Promise.resolve(false);
|
66
|
+
const expiration = options?.ttl == null ? null : Temporal.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
|
67
|
+
this.#values[encodedKey] = [newValue, expiration];
|
68
|
+
return Promise.resolve(true);
|
69
|
+
}
|
48
70
|
};
|
49
71
|
|
50
72
|
//#endregion
|
@@ -75,12 +97,12 @@ var InProcessMessageQueue = class {
|
|
75
97
|
this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
|
76
98
|
}
|
77
99
|
enqueue(message, options) {
|
78
|
-
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
79
|
-
if (delay > 0) {
|
100
|
+
const delay$1 = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
101
|
+
if (delay$1 > 0) {
|
80
102
|
setTimeout(() => this.enqueue(message, {
|
81
103
|
...options,
|
82
104
|
delay: void 0
|
83
|
-
}), delay);
|
105
|
+
}), delay$1);
|
84
106
|
return Promise.resolve();
|
85
107
|
}
|
86
108
|
this.#messages.push(message);
|
@@ -89,12 +111,12 @@ var InProcessMessageQueue = class {
|
|
89
111
|
}
|
90
112
|
enqueueMany(messages, options) {
|
91
113
|
if (messages.length === 0) return Promise.resolve();
|
92
|
-
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
93
|
-
if (delay > 0) {
|
114
|
+
const delay$1 = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
115
|
+
if (delay$1 > 0) {
|
94
116
|
setTimeout(() => this.enqueueMany(messages, {
|
95
117
|
...options,
|
96
118
|
delay: void 0
|
97
|
-
}), delay);
|
119
|
+
}), delay$1);
|
98
120
|
return Promise.resolve();
|
99
121
|
}
|
100
122
|
this.#messages.push(...messages);
|
@@ -3,9 +3,9 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default } from "./docloader-
|
7
|
-
import { CryptographicKey } from "./vocab-
|
8
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
6
|
+
import { deno_default } from "./docloader-BMbAXtsR.js";
|
7
|
+
import { CryptographicKey } from "./vocab-Cb4TGq4-.js";
|
8
|
+
import { fetchKey, validateCryptoKey } from "./key-oPj7d_pr.js";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
11
11
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
@@ -212,10 +212,15 @@ async function signRequestRfc9421(request, privateKey, keyId, span, currentTime)
|
|
212
212
|
keyId,
|
213
213
|
created
|
214
214
|
});
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
215
|
+
let signatureBase;
|
216
|
+
try {
|
217
|
+
signatureBase = createRfc9421SignatureBase(new Request(request.url, {
|
218
|
+
method: request.method,
|
219
|
+
headers
|
220
|
+
}), components, signatureParams);
|
221
|
+
} catch (error) {
|
222
|
+
throw new TypeError(`Failed to create signature base: ${String(error)}; it is probably a bug in the implementation. Please report it at Fedify's issue tracker.`);
|
223
|
+
}
|
219
224
|
const signatureBytes = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(signatureBase));
|
220
225
|
const [signatureInput, signature] = formatRfc9421Signature(signatureBytes, components, signatureParams);
|
221
226
|
headers.set("Signature-Input", signatureInput);
|
@@ -595,7 +600,16 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
595
600
|
});
|
596
601
|
continue;
|
597
602
|
}
|
598
|
-
|
603
|
+
let signatureBase;
|
604
|
+
try {
|
605
|
+
signatureBase = createRfc9421SignatureBase(request, sigInput.components, sigInput.parameters);
|
606
|
+
} catch (error) {
|
607
|
+
logger.debug("Failed to create signature base for verification: {error}", {
|
608
|
+
error,
|
609
|
+
signatureInput: sigInput
|
610
|
+
});
|
611
|
+
continue;
|
612
|
+
}
|
599
613
|
const signatureBaseBytes = new TextEncoder().encode(signatureBase);
|
600
614
|
span?.setAttribute("http_signatures.signature", encodeHex(sigBytes));
|
601
615
|
try {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { DocumentLoader } from "./docloader-
|
4
|
-
import { CryptographicKey, Multikey } from "./vocab-
|
3
|
+
import { DocumentLoader } from "./docloader-BeCtcTOJ.js";
|
4
|
+
import { CryptographicKey, Multikey } from "./vocab-By6mpzr-.js";
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
6
6
|
|
7
7
|
//#region sig/key.d.ts
|
@@ -2,9 +2,9 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { deno_default } from "./docloader-
|
6
|
-
import { CryptographicKey } from "./actor-
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
5
|
+
import { deno_default } from "./docloader-CKZLh5zr.js";
|
6
|
+
import { CryptographicKey } from "./actor-Dn_sijns.js";
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-Bfw6GMkj.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
@@ -211,10 +211,15 @@ async function signRequestRfc9421(request, privateKey, keyId, span, currentTime)
|
|
211
211
|
keyId,
|
212
212
|
created
|
213
213
|
});
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
214
|
+
let signatureBase;
|
215
|
+
try {
|
216
|
+
signatureBase = createRfc9421SignatureBase(new Request(request.url, {
|
217
|
+
method: request.method,
|
218
|
+
headers
|
219
|
+
}), components, signatureParams);
|
220
|
+
} catch (error) {
|
221
|
+
throw new TypeError(`Failed to create signature base: ${String(error)}; it is probably a bug in the implementation. Please report it at Fedify's issue tracker.`);
|
222
|
+
}
|
218
223
|
const signatureBytes = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(signatureBase));
|
219
224
|
const [signatureInput, signature] = formatRfc9421Signature(signatureBytes, components, signatureParams);
|
220
225
|
headers.set("Signature-Input", signatureInput);
|
@@ -594,7 +599,16 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
594
599
|
});
|
595
600
|
continue;
|
596
601
|
}
|
597
|
-
|
602
|
+
let signatureBase;
|
603
|
+
try {
|
604
|
+
signatureBase = createRfc9421SignatureBase(request, sigInput.components, sigInput.parameters);
|
605
|
+
} catch (error) {
|
606
|
+
logger.debug("Failed to create signature base for verification: {error}", {
|
607
|
+
error,
|
608
|
+
signatureInput: sigInput
|
609
|
+
});
|
610
|
+
continue;
|
611
|
+
}
|
598
612
|
const signatureBaseBytes = new TextEncoder().encode(signatureBase);
|
599
613
|
span?.setAttribute("http_signatures.signature", encodeHex(sigBytes));
|
600
614
|
try {
|