@fedify/fedify 1.9.6-dev.2118 → 1.9.7
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-CCg-pZae.js → actor-B3mkavdq.js} +1205 -2768
- package/dist/{actor-Ydzhc8dj.d.cts → actor-Be-68iJP.d.cts} +3 -3
- package/dist/{actor-C1Euqngb.d.ts → actor-C5AY0Tno.d.ts} +3 -3
- package/dist/{actor-C71CIMfC.cjs → actor-CsvteFj1.cjs} +3112 -4674
- package/dist/{actor-CNWkxCrC.js → actor-DeUOMMMQ.mjs} +8 -15
- package/dist/{assert-MZs1qjMx.js → assert-DikXweDx.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-C50x8tnw.mjs} +5 -9
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-CJC9ThS-.mjs} +6 -11
- package/dist/{assert_throws-BOO88avQ.js → assert_throws-BIL7gChy.mjs} +6 -10
- package/dist/{authdocloader-DEGiIEaL.js → authdocloader-BKq994CV.mjs} +9 -14
- package/dist/{authdocloader-wQk3e7Ag.js → authdocloader-C3_-i4Zk.js} +8 -15
- package/dist/{authdocloader-CT1cPj97.cjs → authdocloader-tagnJZ6u.cjs} +14 -22
- package/dist/{builder-D0mOpo0N.js → builder-CnVAhip1.mjs} +31 -40
- package/dist/{client-BSRRCCF9.js → client-Bza9SeZS.mjs} +11 -15
- package/dist/{client-DF8anIB5.d.ts → client-D8OSiPBT.d.ts} +2 -2
- package/dist/{client-DjT_tegg.d.cts → client-T0VFOdMw.d.cts} +2 -2
- package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -12
- package/dist/compat/mod.d.ts +78 -12
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-CwUAkopp.d.cts → context-CACMqDzl.d.cts} +33 -26
- package/dist/{context-CXUibY4L.d.ts → context-K4cCphQj.d.ts} +33 -26
- package/dist/{denokv-Bv33Xxea.js → denokv-CoSB_Eps.mjs} +22 -11
- package/dist/{docloader-OWdVzt6R.cjs → docloader-Co-tW1B6.cjs} +112 -212
- package/dist/{docloader-CxWcuWqQ.d.ts → docloader-DSaLRXEA.d.ts} +2 -7
- package/dist/{docloader-ENN4YgIF.js → docloader-Dlo9EMTn.js} +17 -151
- package/dist/{docloader-D-MrRyHl.d.cts → docloader-DpGRDZrn.d.cts} +2 -7
- package/dist/{esm-rU2ogNNz.js → esm-BLERAZrI.mjs} +49 -85
- package/dist/federation/{builder.test.js → builder.test.mjs} +22 -41
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +22 -49
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +29 -59
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +10 -15
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -18
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +9 -20
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +128 -197
- package/dist/federation/mod.cjs +223 -21
- package/dist/federation/mod.d.cts +4 -13
- package/dist/federation/mod.d.ts +4 -13
- package/dist/federation/mod.js +218 -18
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +23 -38
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +9 -14
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +12 -19
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +17 -26
- package/dist/{http-wsGR6KkT.d.ts → http-BZpls--H.d.ts} +5 -9
- package/dist/{http-B1_DzfAU.d.cts → http-C7WoprmE.d.cts} +5 -9
- package/dist/{http-Bmn4CXIM.cjs → http-cvQMgiFd.cjs} +51 -68
- package/dist/{http-DAz2fpwK.js → http-hFXuPP4j.mjs} +16 -32
- package/dist/{http-LDjZxhgJ.js → http-z-J6i29D.js} +17 -33
- package/dist/{inbox-CLgNEczc.js → inbox-B0NdZv6Q.mjs} +17 -25
- package/dist/{key-C45K8q1u.cjs → key-B2ZqbGDP.cjs} +42 -50
- package/dist/key-BfH9JUMQ.cjs +4 -0
- package/dist/{key-VDAxfcre.js → key-ByblW_7f.mjs} +12 -18
- package/dist/{key-kD68vuX_.js → key-DPg0mibt.js} +19 -19
- package/dist/key-USCeSjWo.mjs +5 -0
- package/dist/{keycache-DtWOiAMc.js → keycache-qGjtNwWK.mjs} +6 -10
- package/dist/{keys-CJezjcJ9.js → keys-D48z4zQE.mjs} +6 -10
- package/dist/{kv-C7sopW2E.d.ts → kv-Bq9QLKm5.d.ts} +1 -1
- package/dist/{kv-CRZrzyXm.js → kv-DM1zFCtL.mjs} +6 -10
- package/dist/{kv-63Cil1MD.d.cts → kv-GIrOktyG.d.cts} +1 -1
- package/dist/{ld-DSD_uqio.js → ld-Bk-CiTUe.mjs} +17 -31
- package/dist/{lookup-B0Qds1Mq.js → lookup-B-LJhUtc.mjs} +8 -17
- package/dist/{lookup-Brpn8XFF.cjs → lookup-C6EHvNN7.cjs} +16 -23
- package/dist/{lookup-Dkw6PUQT.js → lookup-CuDOZqcB.js} +5 -11
- package/dist/{middleware-Cfia6iC-.js → middleware-Cns1QUI8.js} +348 -392
- package/dist/middleware-DYNDkDz7.mjs +5 -0
- package/dist/middleware-SP7rhp6I.cjs +4 -0
- package/dist/{middleware-DQ1ijTAg.cjs → middleware-UNqaTRBe.cjs} +493 -546
- package/dist/{middleware-Bn5wceGF.js → middleware-xIvAtsQ9.mjs} +275 -320
- package/dist/{mod-CDObsV1d.d.ts → mod-BSwc3_rD.d.ts} +3 -3
- package/dist/{mod-DBzN0aCM.d.ts → mod-BTNpXcPj.d.ts} +2 -2
- package/dist/{mod-fjqfsrty.d.cts → mod-Chb_NKPp.d.cts} +4 -4
- package/dist/{mod-DgcYoyZK.d.ts → mod-DHoc3toL.d.ts} +4 -4
- package/dist/{mod-jQ4OODsl.d.cts → mod-DIMx6YjJ.d.cts} +2 -2
- package/dist/{mod-BUbqxBev.d.cts → mod-HElaq2UB.d.cts} +3 -3
- package/dist/mod.cjs +31 -33
- package/dist/mod.d.cts +15 -17
- package/dist/mod.d.ts +15 -17
- package/dist/mod.js +20 -23
- package/dist/{mq-B7R1Q-M5.d.cts → mq-CrItclRD.d.cts} +1 -1
- package/dist/{mq-CRGm1e_F.d.ts → mq-D_ZZRdby.d.ts} +1 -1
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +23 -45
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +14 -43
- package/dist/nodeinfo/mod.cjs +5 -9
- package/dist/nodeinfo/mod.d.cts +2 -5
- package/dist/nodeinfo/mod.d.ts +2 -5
- package/dist/nodeinfo/mod.js +4 -9
- package/dist/nodeinfo/semver.test.d.mts +2 -0
- package/dist/nodeinfo/{semver.test.js → semver.test.mjs} +28 -51
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +10 -21
- package/dist/{owner-CD3PoJME.js → owner-CkmuWs8s.mjs} +10 -13
- package/dist/{owner-BbeUDvOu.d.ts → owner-DPAPnB0R.d.ts} +4 -4
- package/dist/{owner-6KSEp9eV.d.cts → owner-_rFs0ik_.d.cts} +4 -4
- package/dist/{proof-Qv3fs4TE.js → proof-BBEQdN7B.js} +33 -57
- package/dist/{proof-fJIJMt-0.js → proof-DVFzuYOq.mjs} +20 -32
- package/dist/{proof-CKkQu1BL.cjs → proof-DiFRNymC.cjs} +112 -135
- package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
- package/dist/rolldown-runtime-C7fyD9f2.js +15 -0
- package/dist/runtime/authdocloader.test.d.mts +2 -0
- package/dist/runtime/{authdocloader.test.js → authdocloader.test.mjs} +16 -28
- package/dist/runtime/docloader.test.d.mts +2 -0
- package/dist/runtime/{docloader.test.js → docloader.test.mjs} +52 -72
- package/dist/runtime/key.test.d.mts +2 -0
- package/dist/runtime/{key.test.js → key.test.mjs} +27 -57
- package/dist/runtime/langstr.test.d.mts +2 -0
- package/dist/runtime/{langstr.test.js → langstr.test.mjs} +9 -19
- package/dist/runtime/link.test.d.mts +2 -0
- package/dist/runtime/{link.test.js → link.test.mjs} +7 -11
- package/dist/runtime/mod.cjs +7 -13
- package/dist/runtime/mod.d.cts +103 -6
- package/dist/runtime/mod.d.ts +103 -6
- package/dist/runtime/mod.js +6 -13
- package/dist/runtime/multibase/multibase.test.d.mts +2 -0
- package/dist/runtime/multibase/{multibase.test.js → multibase.test.mjs} +16 -33
- package/dist/runtime/url.test.d.mts +2 -0
- package/dist/runtime/{url.test.js → url.test.mjs} +10 -15
- package/dist/{semver-dArNLkR9.js → semver-CgD82xxg.mjs} +13 -28
- package/dist/{send-KX74JBzu.js → send-BsKuGBh0.mjs} +7 -12
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +119 -203
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +13 -22
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +24 -39
- package/dist/sig/mod.cjs +7 -13
- package/dist/sig/mod.d.cts +3 -7
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +6 -13
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/owner.test.mjs +39 -0
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +18 -31
- package/dist/{std__assert-X-_kMxKM.js → std__assert-2v7gYiZp.mjs} +13 -24
- package/dist/testing/docloader.test.d.mts +2 -0
- package/dist/testing/docloader.test.mjs +12 -0
- package/dist/testing/{mod.d.ts → mod.d.mts} +371 -541
- package/dist/testing/mod.mjs +5 -0
- package/dist/{testing-DlM9L2qY.js → testing-8TvaN83G.mjs} +27 -35
- package/dist/{transformers-BFT6d7J5.js → transformers-BV4OeK9o.js} +3 -7
- package/dist/{transformers-CoBS-oFG.cjs → transformers-C2P5eKUT.cjs} +20 -25
- package/dist/{types-CfuEksTX.js → types-BK9bojU0.js} +18 -36
- package/dist/{types-BIgY6c-l.js → types-CAnkAQGM.mjs} +5 -9
- package/dist/{types-Bq8MUNvK.cjs → types-D4VM3B7I.cjs} +45 -64
- package/dist/vocab/actor.test.d.mts +2 -0
- package/dist/vocab/{actor.test.js → actor.test.mjs} +308 -550
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/lookup.test.d.mts +2 -0
- package/dist/vocab/{lookup.test.js → lookup.test.mjs} +29 -45
- package/dist/vocab/mod.cjs +251 -16
- package/dist/vocab/mod.d.cts +3 -5
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +244 -10
- package/dist/vocab/type.test.d.mts +2 -0
- package/dist/vocab/type.test.mjs +16 -0
- package/dist/vocab/vocab.test.d.mts +2 -0
- package/dist/vocab/{vocab.test.js → vocab.test.mjs} +178 -311
- package/dist/{vocab-CDHNj5zp.d.ts → vocab-BLvSEtuz.d.cts} +2 -4
- package/dist/{type-kdsaa4c5.js → vocab-DuJO9k13.mjs} +1177 -2871
- package/dist/{vocab-Cfs0937i.d.cts → vocab-lhCS9lzq.d.ts} +4 -2
- package/dist/webfinger/handler.test.d.mts +2 -0
- package/dist/webfinger/{handler.test.js → handler.test.mjs} +23 -56
- package/dist/webfinger/lookup.test.d.mts +2 -0
- package/dist/webfinger/{lookup.test.js → lookup.test.mjs} +13 -27
- package/dist/webfinger/mod.cjs +5 -9
- package/dist/webfinger/mod.d.cts +1 -3
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +4 -9
- package/dist/x/cfworkers.cjs +25 -14
- package/dist/x/cfworkers.d.cts +33 -6
- package/dist/x/cfworkers.d.ts +33 -6
- package/dist/x/cfworkers.js +22 -12
- package/dist/x/cfworkers.test.d.mts +2 -0
- package/dist/x/{cfworkers.test.js → cfworkers.test.mjs} +28 -26
- package/dist/x/hono.cjs +25 -14
- package/dist/x/hono.d.cts +1 -11
- package/dist/x/hono.d.ts +1 -11
- package/dist/x/hono.js +22 -12
- package/dist/x/sveltekit.cjs +23 -12
- package/dist/x/sveltekit.d.cts +1 -11
- package/dist/x/sveltekit.d.ts +1 -11
- package/dist/x/sveltekit.js +20 -10
- package/package.json +2 -2
- package/dist/chunk-DqRYRqnO.cjs +0 -34
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -86
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/compat-nxUqe4Z-.js +0 -4
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -35
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation-D1U8YY9t.js +0 -226
- package/dist/federation-H2_En3j5.cjs +0 -244
- package/dist/key-Bsm-uoaE.js +0 -10
- package/dist/key-Bv9soVGW.cjs +0 -10
- package/dist/key-C6dA6KgH.js +0 -10
- package/dist/middleware-BJbqjuUV.js +0 -17
- package/dist/middleware-BVltQrGG.cjs +0 -17
- package/dist/middleware-NDh5Vgwn.js +0 -26
- package/dist/mod-BcObK1Lz.d.ts +0 -82
- package/dist/mod-C2tOeRkN.d.cts +0 -1
- package/dist/mod-CIbqfZW0.d.ts +0 -104
- package/dist/mod-Dt-G9ZOS.d.cts +0 -102
- package/dist/mod-FZd39qVq.d.cts +0 -1
- package/dist/mod-mXx9V0q5.d.cts +0 -80
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/semver.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-Co9lJrWl.cjs +0 -4
- package/dist/nodeinfo-DfycQ8Wf.js +0 -4
- package/dist/runtime/authdocloader.test.d.ts +0 -3
- package/dist/runtime/docloader.test.d.ts +0 -3
- package/dist/runtime/key.test.d.ts +0 -3
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime-C58AJWSv.cjs +0 -4
- package/dist/runtime-DPYEDf-o.js +0 -4
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/owner.test.js +0 -52
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-ByHXzqUi.cjs +0 -4
- package/dist/sig-Cj3tk-ig.js +0 -4
- package/dist/testing/docloader.test.d.ts +0 -3
- package/dist/testing/docloader.test.js +0 -24
- package/dist/testing/mod.js +0 -10
- package/dist/vocab/actor.test.d.ts +0 -3
- package/dist/vocab/lookup.test.d.ts +0 -3
- package/dist/vocab/type.test.d.ts +0 -3
- package/dist/vocab/type.test.js +0 -25
- package/dist/vocab/vocab.test.d.ts +0 -3
- package/dist/vocab-DBzzAvtf.cjs +0 -289
- package/dist/vocab-cxfw8FFj.js +0 -253
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger-BjOEdFPs.cjs +0 -4
- package/dist/webfinger-De_bU0iE.js +0 -4
- package/dist/x/cfworkers.test.d.ts +0 -3
- /package/dist/{mod-1pDWKvUL.d.ts → compat/transformers.test.d.mts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → federation/builder.test.d.mts} +0 -0
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../
|
|
7
|
-
import {
|
|
8
|
-
import { assert } from "../assert-
|
|
9
|
-
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import "../lookup-B0Qds1Mq.js";
|
|
11
|
-
import { test } from "../testing-DlM9L2qY.js";
|
|
12
|
-
import { assertGreater, assertGreaterOrEqual } from "../std__assert-X-_kMxKM.js";
|
|
13
|
-
import { assertFalse } from "../assert_rejects-DiIiJbZn.js";
|
|
14
|
-
import "../assert_is_error-BPGph1Jx.js";
|
|
15
|
-
import "../assert_not_equals-f3m3epl3.js";
|
|
16
|
-
import "../assert_throws-BOO88avQ.js";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as test } from "../testing-8TvaN83G.mjs";
|
|
5
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
+
import { i as assertGreaterOrEqual, r as assertGreater } from "../std__assert-2v7gYiZp.mjs";
|
|
7
|
+
import { n as assertFalse } from "../assert_rejects-CJC9ThS-.mjs";
|
|
8
|
+
import { t as assert } from "../assert-DikXweDx.mjs";
|
|
17
9
|
import { delay } from "es-toolkit";
|
|
18
|
-
|
|
19
10
|
//#region src/federation/mq.ts
|
|
20
11
|
/**
|
|
21
12
|
* A message queue that processes messages in the same process.
|
|
@@ -43,12 +34,12 @@ var InProcessMessageQueue = class {
|
|
|
43
34
|
this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
|
|
44
35
|
}
|
|
45
36
|
enqueue(message, options) {
|
|
46
|
-
const delay
|
|
47
|
-
if (delay
|
|
37
|
+
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
38
|
+
if (delay > 0) {
|
|
48
39
|
setTimeout(() => this.enqueue(message, {
|
|
49
40
|
...options,
|
|
50
41
|
delay: void 0
|
|
51
|
-
}), delay
|
|
42
|
+
}), delay);
|
|
52
43
|
return Promise.resolve();
|
|
53
44
|
}
|
|
54
45
|
this.#messages.push(message);
|
|
@@ -57,12 +48,12 @@ var InProcessMessageQueue = class {
|
|
|
57
48
|
}
|
|
58
49
|
enqueueMany(messages, options) {
|
|
59
50
|
if (messages.length === 0) return Promise.resolve();
|
|
60
|
-
const delay
|
|
61
|
-
if (delay
|
|
51
|
+
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
|
52
|
+
if (delay > 0) {
|
|
62
53
|
setTimeout(() => this.enqueueMany(messages, {
|
|
63
54
|
...options,
|
|
64
55
|
delay: void 0
|
|
65
|
-
}), delay
|
|
56
|
+
}), delay);
|
|
66
57
|
return Promise.resolve();
|
|
67
58
|
}
|
|
68
59
|
this.#messages.push(...messages);
|
|
@@ -72,10 +63,7 @@ var InProcessMessageQueue = class {
|
|
|
72
63
|
async listen(handler, options = {}) {
|
|
73
64
|
const signal = options.signal;
|
|
74
65
|
while (signal == null || !signal.aborted) {
|
|
75
|
-
while (this.#messages.length > 0)
|
|
76
|
-
const message = this.#messages.shift();
|
|
77
|
-
await handler(message);
|
|
78
|
-
}
|
|
66
|
+
while (this.#messages.length > 0) await handler(this.#messages.shift());
|
|
79
67
|
await this.#wait(this.#pollIntervalMs, signal);
|
|
80
68
|
}
|
|
81
69
|
}
|
|
@@ -138,8 +126,7 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
138
126
|
}
|
|
139
127
|
async enqueueMany(messages, options) {
|
|
140
128
|
if (this.queue.enqueueMany == null) {
|
|
141
|
-
const
|
|
142
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
129
|
+
const errors = (await Promise.allSettled(messages.map((message) => this.queue.enqueue(message, options)))).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
143
130
|
if (errors.length > 1) throw new AggregateError(errors, "Failed to enqueue messages.");
|
|
144
131
|
else if (errors.length === 1) throw errors[0];
|
|
145
132
|
return;
|
|
@@ -167,7 +154,6 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
167
154
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
168
155
|
}
|
|
169
156
|
};
|
|
170
|
-
|
|
171
157
|
//#endregion
|
|
172
158
|
//#region src/federation/mq.test.ts
|
|
173
159
|
test("InProcessMessageQueue", async (t) => {
|
|
@@ -227,7 +213,7 @@ test("InProcessMessageQueue", async (t) => {
|
|
|
227
213
|
});
|
|
228
214
|
test("MessageQueue.nativeRetrial", async (t) => {
|
|
229
215
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
|
|
230
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
|
216
|
+
const { DenoKvMessageQueue } = await import("../denokv-CoSB_Eps.mjs");
|
|
231
217
|
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
|
232
218
|
assert(mq.nativeRetrial);
|
|
233
219
|
if (Symbol.dispose in mq) {
|
|
@@ -260,13 +246,12 @@ test("MessageQueue.nativeRetrial", async (t) => {
|
|
|
260
246
|
throw new TypeError("WorkersMessageQueue does not support listen()");
|
|
261
247
|
}
|
|
262
248
|
}
|
|
263
|
-
|
|
264
|
-
assert(mq.nativeRetrial);
|
|
249
|
+
assert(new TestWorkersMessageQueue(new MockQueue()).nativeRetrial);
|
|
265
250
|
});
|
|
266
251
|
});
|
|
267
252
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
|
268
253
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
|
269
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
|
254
|
+
const { DenoKvMessageQueue } = await import("../denokv-CoSB_Eps.mjs");
|
|
270
255
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
|
271
256
|
}
|
|
272
257
|
for (const mqName in queues) test({
|
|
@@ -304,8 +289,8 @@ for (const mqName in queues) test({
|
|
|
304
289
|
await waitFor(() => messages.length >= 20, 15e3);
|
|
305
290
|
while (messages.length > 0) messages.pop();
|
|
306
291
|
await t.step("enqueueMany()", async () => {
|
|
307
|
-
const messages
|
|
308
|
-
await workers.enqueueMany(messages
|
|
292
|
+
const messages = Array.from({ length: 20 }, (_, i) => `Hello, ${i}!`);
|
|
293
|
+
await workers.enqueueMany(messages);
|
|
309
294
|
});
|
|
310
295
|
await t.step("listen() [multiple]", async () => {
|
|
311
296
|
await delay(3e3);
|
|
@@ -329,5 +314,5 @@ async function waitFor(predicate, timeoutMs) {
|
|
|
329
314
|
if (Date.now() - started > timeoutMs) throw new Error("Timeout");
|
|
330
315
|
}
|
|
331
316
|
}
|
|
332
|
-
|
|
333
|
-
|
|
317
|
+
//#endregion
|
|
318
|
+
export {};
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../
|
|
7
|
-
import {
|
|
8
|
-
import "../lookup-B0Qds1Mq.js";
|
|
9
|
-
import { createExponentialBackoffPolicy } from "../retry-D4GJ670a.js";
|
|
10
|
-
import { test } from "../testing-DlM9L2qY.js";
|
|
11
|
-
import { assertNotEquals } from "../assert_not_equals-f3m3epl3.js";
|
|
12
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as test } from "../testing-8TvaN83G.mjs";
|
|
5
|
+
import { l as AssertionError, t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
+
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
7
|
+
import { t as createExponentialBackoffPolicy } from "../retry-Ddbq3AcK.mjs";
|
|
13
8
|
//#region src/federation/retry.test.ts
|
|
14
9
|
test("createExponentialBackoffPolicy()", () => {
|
|
15
10
|
const policy = createExponentialBackoffPolicy({ maxAttempts: 4 });
|
|
@@ -42,5 +37,5 @@ function assertDurationRange(actual, min, max) {
|
|
|
42
37
|
const maxDuration = Temporal.Duration.from(max);
|
|
43
38
|
if (Temporal.Duration.compare(actual, minDuration) < 0 || Temporal.Duration.compare(actual, maxDuration) > 0) throw new AssertionError(`Expected ${actual} to be between ${min} and ${max}`);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
//#endregion
|
|
41
|
+
export {};
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import "../
|
|
10
|
-
import {
|
|
11
|
-
import { test } from "../testing-DlM9L2qY.js";
|
|
12
|
-
import "../std__assert-X-_kMxKM.js";
|
|
13
|
-
import { assertFalse } from "../assert_rejects-DiIiJbZn.js";
|
|
14
|
-
import "../assert_is_error-BPGph1Jx.js";
|
|
15
|
-
import "../assert_not_equals-f3m3epl3.js";
|
|
16
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
|
17
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { i as RouterError, r as Router } from "../lookup-B-LJhUtc.mjs";
|
|
5
|
+
import { t as test } from "../testing-8TvaN83G.mjs";
|
|
6
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
7
|
+
import "../std__assert-2v7gYiZp.mjs";
|
|
8
|
+
import { n as assertFalse } from "../assert_rejects-CJC9ThS-.mjs";
|
|
9
|
+
import { t as assertThrows } from "../assert_throws-BIL7gChy.mjs";
|
|
10
|
+
import { t as assert } from "../assert-DikXweDx.mjs";
|
|
18
11
|
//#region src/federation/router.test.ts
|
|
19
12
|
function setUp(options = {}) {
|
|
20
13
|
const router = new Router(options);
|
|
@@ -95,5 +88,5 @@ test("Router.build()", () => {
|
|
|
95
88
|
postId: "123"
|
|
96
89
|
}), "/users/alice/posts/123");
|
|
97
90
|
});
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
export {};
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { mockDocumentLoader, test } from "../testing-DlM9L2qY.js";
|
|
17
|
-
import "../std__assert-X-_kMxKM.js";
|
|
18
|
-
import { assertFalse, assertRejects } from "../assert_rejects-DiIiJbZn.js";
|
|
19
|
-
import "../assert_is_error-BPGph1Jx.js";
|
|
20
|
-
import { assertNotEquals } from "../assert_not_equals-f3m3epl3.js";
|
|
21
|
-
import "../assert_throws-BOO88avQ.js";
|
|
22
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-CJezjcJ9.js";
|
|
23
|
-
import { esm_default } from "../esm-rU2ogNNz.js";
|
|
24
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { C as Person, E as Service, d as Group, l as Endpoints, r as Application, t as Activity } from "../vocab-DuJO9k13.mjs";
|
|
5
|
+
import { a as mockDocumentLoader, t as test } from "../testing-8TvaN83G.mjs";
|
|
6
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
7
|
+
import "../std__assert-2v7gYiZp.mjs";
|
|
8
|
+
import { n as assertFalse, t as assertRejects } from "../assert_rejects-CJC9ThS-.mjs";
|
|
9
|
+
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
10
|
+
import { t as assert } from "../assert-DikXweDx.mjs";
|
|
11
|
+
import { l as verifyRequest } from "../http-hFXuPP4j.mjs";
|
|
12
|
+
import { t as doesActorOwnKey } from "../owner-CkmuWs8s.mjs";
|
|
13
|
+
import { n as sendActivity, t as extractInboxes } from "../send-BsKuGBh0.mjs";
|
|
14
|
+
import { t as esm_default } from "../esm-BLERAZrI.mjs";
|
|
15
|
+
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-D48z4zQE.mjs";
|
|
25
16
|
//#region src/federation/send.test.ts
|
|
26
17
|
test("extractInboxes()", () => {
|
|
27
18
|
const recipients = [
|
|
@@ -214,5 +205,5 @@ test("sendActivity()", async (t) => {
|
|
|
214
205
|
});
|
|
215
206
|
esm_default.hardReset();
|
|
216
207
|
});
|
|
217
|
-
|
|
218
|
-
|
|
208
|
+
//#endregion
|
|
209
|
+
export {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { DocumentLoader } from "./docloader-
|
|
4
|
-
import {
|
|
3
|
+
import { n as DocumentLoader } from "./docloader-DSaLRXEA.js";
|
|
4
|
+
import { B as Multikey, m as CryptographicKey } from "./vocab-lhCS9lzq.js";
|
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region src/sig/key.d.ts
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* Generates a key pair which is appropriate for Fedify.
|
|
11
10
|
* @param algorithm The algorithm to use. Currently only RSASSA-PKCS1-v1_5 and
|
|
@@ -130,7 +129,8 @@ type HttpMessageSignaturesSpec =
|
|
|
130
129
|
/**
|
|
131
130
|
* The HTTP Message Signatures (RFC 9421) specification, which is the
|
|
132
131
|
* finalized standard but not widely adopted yet (as of May 2025).
|
|
133
|
-
*/
|
|
132
|
+
*/
|
|
133
|
+
| "rfc9421";
|
|
134
134
|
/**
|
|
135
135
|
* Options for {@link signRequest}.
|
|
136
136
|
* @since 1.3.0
|
|
@@ -247,9 +247,5 @@ interface HttpMessageSignaturesSpecDeterminer {
|
|
|
247
247
|
*/
|
|
248
248
|
rememberSpec(origin: string, spec: HttpMessageSignaturesSpec): void | Promise<void>;
|
|
249
249
|
}
|
|
250
|
-
/**
|
|
251
|
-
* The options for double-knock requests.
|
|
252
|
-
* @since 1.6.0
|
|
253
|
-
*/
|
|
254
250
|
//#endregion
|
|
255
|
-
export {
|
|
251
|
+
export { signRequest as a, FetchKeyResult as c, fetchKey as d, generateCryptoKeyPair as f, VerifyRequestOptions as i, KeyCache as l, HttpMessageSignaturesSpecDeterminer as n, verifyRequest as o, importJwk as p, SignRequestOptions as r, FetchKeyOptions as s, HttpMessageSignaturesSpec as t, exportJwk as u };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { DocumentLoader } from "./docloader-
|
|
2
|
-
import {
|
|
1
|
+
import { n as DocumentLoader } from "./docloader-DpGRDZrn.cjs";
|
|
2
|
+
import { B as Multikey, m as CryptographicKey } from "./vocab-BLvSEtuz.cjs";
|
|
3
3
|
import { TracerProvider } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/sig/key.d.ts
|
|
6
|
-
|
|
7
6
|
/**
|
|
8
7
|
* Generates a key pair which is appropriate for Fedify.
|
|
9
8
|
* @param algorithm The algorithm to use. Currently only RSASSA-PKCS1-v1_5 and
|
|
@@ -128,7 +127,8 @@ type HttpMessageSignaturesSpec =
|
|
|
128
127
|
/**
|
|
129
128
|
* The HTTP Message Signatures (RFC 9421) specification, which is the
|
|
130
129
|
* finalized standard but not widely adopted yet (as of May 2025).
|
|
131
|
-
*/
|
|
130
|
+
*/
|
|
131
|
+
| "rfc9421";
|
|
132
132
|
/**
|
|
133
133
|
* Options for {@link signRequest}.
|
|
134
134
|
* @since 1.3.0
|
|
@@ -245,9 +245,5 @@ interface HttpMessageSignaturesSpecDeterminer {
|
|
|
245
245
|
*/
|
|
246
246
|
rememberSpec(origin: string, spec: HttpMessageSignaturesSpec): void | Promise<void>;
|
|
247
247
|
}
|
|
248
|
-
/**
|
|
249
|
-
* The options for double-knock requests.
|
|
250
|
-
* @since 1.6.0
|
|
251
|
-
*/
|
|
252
248
|
//#endregion
|
|
253
|
-
export {
|
|
249
|
+
export { signRequest as a, FetchKeyResult as c, fetchKey as d, generateCryptoKeyPair as f, VerifyRequestOptions as i, KeyCache as l, HttpMessageSignaturesSpecDeterminer as n, verifyRequest as o, importJwk as p, SignRequestOptions as r, FetchKeyOptions as s, HttpMessageSignaturesSpec as t, exportJwk as u };
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
|
13
|
-
const __opentelemetry_semantic_conventions = require_chunk.__toESM(require("@opentelemetry/semantic-conventions"));
|
|
14
|
-
const structured_field_values = require_chunk.__toESM(require("structured-field-values"));
|
|
15
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
+
const require_docloader = require("./docloader-Co-tW1B6.cjs");
|
|
4
|
+
const require_actor = require("./actor-CsvteFj1.cjs");
|
|
5
|
+
const require_key = require("./key-B2ZqbGDP.cjs");
|
|
6
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
7
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
8
|
+
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
9
|
+
let byte_encodings_hex = require("byte-encodings/hex");
|
|
10
|
+
let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
11
|
+
let structured_field_values = require("structured-field-values");
|
|
16
12
|
//#region src/sig/http.ts
|
|
17
13
|
const DEFAULT_MAX_REDIRECTION = 20;
|
|
18
14
|
/**
|
|
@@ -26,24 +22,22 @@ const DEFAULT_MAX_REDIRECTION = 20;
|
|
|
26
22
|
*/
|
|
27
23
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
28
24
|
require_key.validateCryptoKey(privateKey, "private");
|
|
29
|
-
|
|
30
|
-
const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
|
|
31
|
-
return await tracer.startActiveSpan("http_signatures.sign", async (span) => {
|
|
25
|
+
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_docloader.name, require_docloader.version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
32
26
|
try {
|
|
33
27
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
34
28
|
let signed;
|
|
35
29
|
if (spec === "rfc9421") signed = await signRequestRfc9421(request, privateKey, keyId, span, options.currentTime, options.body);
|
|
36
30
|
else signed = await signRequestDraft(request, privateKey, keyId, span, options.currentTime, options.body);
|
|
37
31
|
if (span.isRecording()) {
|
|
38
|
-
span.setAttribute(
|
|
39
|
-
span.setAttribute(
|
|
40
|
-
for (const [name, value] of signed.headers) span.setAttribute((0,
|
|
32
|
+
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
33
|
+
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_URL_FULL, signed.url);
|
|
34
|
+
for (const [name, value] of signed.headers) span.setAttribute((0, _opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_HEADER)(name), value);
|
|
41
35
|
span.setAttribute("http_signatures.key_id", keyId.href);
|
|
42
36
|
}
|
|
43
37
|
return signed;
|
|
44
38
|
} catch (error) {
|
|
45
39
|
span.setStatus({
|
|
46
|
-
code:
|
|
40
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
47
41
|
message: String(error)
|
|
48
42
|
});
|
|
49
43
|
throw error;
|
|
@@ -123,9 +117,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
|
|
|
123
117
|
* @returns The formatted signature string.
|
|
124
118
|
*/
|
|
125
119
|
function formatRfc9421Signature(signature, components, parameters) {
|
|
126
|
-
|
|
127
|
-
const signatureValue = `sig1=:${(0, byte_encodings_base64.encodeBase64)(signature)}:`;
|
|
128
|
-
return [signatureInputValue, signatureValue];
|
|
120
|
+
return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${(0, byte_encodings_base64.encodeBase64)(signature)}:`];
|
|
129
121
|
}
|
|
130
122
|
/**
|
|
131
123
|
* Parse RFC 9421 Signature-Input header.
|
|
@@ -137,7 +129,7 @@ function parseRfc9421SignatureInput(signatureInput) {
|
|
|
137
129
|
try {
|
|
138
130
|
dict = (0, structured_field_values.decodeDict)(signatureInput);
|
|
139
131
|
} catch (error) {
|
|
140
|
-
(0,
|
|
132
|
+
(0, _logtape_logtape.getLogger)([
|
|
141
133
|
"fedify",
|
|
142
134
|
"sig",
|
|
143
135
|
"http"
|
|
@@ -172,7 +164,7 @@ function parseRfc9421Signature(signature) {
|
|
|
172
164
|
try {
|
|
173
165
|
dict = (0, structured_field_values.decodeDict)(signature);
|
|
174
166
|
} catch (error) {
|
|
175
|
-
(0,
|
|
167
|
+
(0, _logtape_logtape.getLogger)([
|
|
176
168
|
"fedify",
|
|
177
169
|
"sig",
|
|
178
170
|
"http"
|
|
@@ -255,13 +247,11 @@ const supportedHashAlgorithms = {
|
|
|
255
247
|
* could not be verified.
|
|
256
248
|
*/
|
|
257
249
|
async function verifyRequest(request, options = {}) {
|
|
258
|
-
|
|
259
|
-
const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
|
|
260
|
-
return await tracer.startActiveSpan("http_signatures.verify", async (span) => {
|
|
250
|
+
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_docloader.name, require_docloader.version).startActiveSpan("http_signatures.verify", async (span) => {
|
|
261
251
|
if (span.isRecording()) {
|
|
262
|
-
span.setAttribute(
|
|
263
|
-
span.setAttribute(
|
|
264
|
-
for (const [name, value] of request.headers) span.setAttribute((0,
|
|
252
|
+
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD, request.method);
|
|
253
|
+
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_URL_FULL, request.url);
|
|
254
|
+
for (const [name, value] of request.headers) span.setAttribute((0, _opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_HEADER)(name), value);
|
|
265
255
|
}
|
|
266
256
|
try {
|
|
267
257
|
let spec = options.spec;
|
|
@@ -269,11 +259,11 @@ async function verifyRequest(request, options = {}) {
|
|
|
269
259
|
let key;
|
|
270
260
|
if (spec === "rfc9421") key = await verifyRequestRfc9421(request, span, options);
|
|
271
261
|
else key = await verifyRequestDraft(request, span, options);
|
|
272
|
-
if (key == null) span.setStatus({ code:
|
|
262
|
+
if (key == null) span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
273
263
|
return key;
|
|
274
264
|
} catch (error) {
|
|
275
265
|
span.setStatus({
|
|
276
|
-
code:
|
|
266
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
277
267
|
message: String(error)
|
|
278
268
|
});
|
|
279
269
|
throw error;
|
|
@@ -283,7 +273,7 @@ async function verifyRequest(request, options = {}) {
|
|
|
283
273
|
});
|
|
284
274
|
}
|
|
285
275
|
async function verifyRequestDraft(request, span, { documentLoader, contextLoader, timeWindow, currentTime, keyCache, tracerProvider } = {}) {
|
|
286
|
-
const logger = (0,
|
|
276
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
287
277
|
"fedify",
|
|
288
278
|
"sig",
|
|
289
279
|
"http"
|
|
@@ -447,8 +437,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
447
437
|
const message = headerNames.map((name) => `${name}: ` + (name === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name === "(created)" ? sigValues.created ?? "" : name === "(expires)" ? sigValues.expires ?? "" : name === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name))).join("\n");
|
|
448
438
|
const sig = (0, byte_encodings_base64.decodeBase64)(signature);
|
|
449
439
|
span?.setAttribute("http_signatures.signature", (0, byte_encodings_hex.encodeHex)(sig));
|
|
450
|
-
|
|
451
|
-
if (!verified) {
|
|
440
|
+
if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
|
|
452
441
|
if (cached) {
|
|
453
442
|
logger.debug("Failed to verify with the cached key {keyId}; signature {signature} is invalid. Retrying with the freshly fetched key...", {
|
|
454
443
|
keyId,
|
|
@@ -462,7 +451,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
462
451
|
currentTime,
|
|
463
452
|
keyCache: {
|
|
464
453
|
get: () => Promise.resolve(void 0),
|
|
465
|
-
set: async (keyId
|
|
454
|
+
set: async (keyId, key) => await keyCache?.set(keyId, key)
|
|
466
455
|
}
|
|
467
456
|
});
|
|
468
457
|
}
|
|
@@ -537,7 +526,7 @@ async function verifyRfc9421ContentDigest(digestHeader, body) {
|
|
|
537
526
|
return false;
|
|
538
527
|
}
|
|
539
528
|
async function verifyRequestRfc9421(request, span, { documentLoader, contextLoader, timeWindow, currentTime, keyCache, tracerProvider } = {}) {
|
|
540
|
-
const logger = (0,
|
|
529
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
541
530
|
"fedify",
|
|
542
531
|
"sig",
|
|
543
532
|
"http"
|
|
@@ -612,9 +601,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
612
601
|
logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
|
|
613
602
|
continue;
|
|
614
603
|
}
|
|
615
|
-
|
|
616
|
-
const digestValid = await verifyRfc9421ContentDigest(contentDigestHeader, body);
|
|
617
|
-
if (!digestValid) {
|
|
604
|
+
if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
|
|
618
605
|
logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
|
|
619
606
|
continue;
|
|
620
607
|
}
|
|
@@ -660,8 +647,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
660
647
|
const signatureBaseBytes = new TextEncoder().encode(signatureBase);
|
|
661
648
|
span?.setAttribute("http_signatures.signature", (0, byte_encodings_hex.encodeHex)(sigBytes));
|
|
662
649
|
try {
|
|
663
|
-
|
|
664
|
-
if (verified) {
|
|
650
|
+
if (await crypto.subtle.verify(algorithm, key.publicKey, sigBytes.slice(), signatureBaseBytes)) {
|
|
665
651
|
validKey = key;
|
|
666
652
|
break;
|
|
667
653
|
} else if (cached) {
|
|
@@ -673,7 +659,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
673
659
|
currentTime,
|
|
674
660
|
keyCache: {
|
|
675
661
|
get: () => Promise.resolve(void 0),
|
|
676
|
-
set: async (keyId, key
|
|
662
|
+
set: async (keyId, key) => await keyCache?.set(keyId, key)
|
|
677
663
|
},
|
|
678
664
|
spec: "rfc9421"
|
|
679
665
|
});
|
|
@@ -746,8 +732,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
|
|
|
746
732
|
});
|
|
747
733
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
748
734
|
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new require_docloader.FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
749
|
-
const
|
|
750
|
-
const redirectRequest = createRedirectRequest(request, location, body);
|
|
735
|
+
const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
|
|
751
736
|
if (visited.has(redirectRequest.url)) throw new require_docloader.FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
752
737
|
return doubleKnockInternal(redirectRequest, identity, {
|
|
753
738
|
...options,
|
|
@@ -755,7 +740,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
|
|
|
755
740
|
}, redirected + 1, visited);
|
|
756
741
|
} else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
757
742
|
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
758
|
-
(0,
|
|
743
|
+
(0, _logtape_logtape.getLogger)([
|
|
759
744
|
"fedify",
|
|
760
745
|
"sig",
|
|
761
746
|
"http"
|
|
@@ -777,8 +762,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
|
|
|
777
762
|
});
|
|
778
763
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
779
764
|
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new require_docloader.FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
780
|
-
const
|
|
781
|
-
const redirectRequest = createRedirectRequest(request, location, body);
|
|
765
|
+
const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
|
|
782
766
|
if (visited.has(redirectRequest.url)) throw new require_docloader.FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
783
767
|
return doubleKnockInternal(redirectRequest, identity, {
|
|
784
768
|
...options,
|
|
@@ -815,23 +799,22 @@ function timingSafeEqual(a, b) {
|
|
|
815
799
|
result |= lenA ^ lenB;
|
|
816
800
|
return result === 0;
|
|
817
801
|
}
|
|
818
|
-
|
|
819
802
|
//#endregion
|
|
820
|
-
Object.defineProperty(exports,
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
803
|
+
Object.defineProperty(exports, "doubleKnock", {
|
|
804
|
+
enumerable: true,
|
|
805
|
+
get: function() {
|
|
806
|
+
return doubleKnock;
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
Object.defineProperty(exports, "signRequest", {
|
|
810
|
+
enumerable: true,
|
|
811
|
+
get: function() {
|
|
812
|
+
return signRequest;
|
|
813
|
+
}
|
|
825
814
|
});
|
|
826
|
-
Object.defineProperty(exports,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
815
|
+
Object.defineProperty(exports, "verifyRequest", {
|
|
816
|
+
enumerable: true,
|
|
817
|
+
get: function() {
|
|
818
|
+
return verifyRequest;
|
|
819
|
+
}
|
|
831
820
|
});
|
|
832
|
-
Object.defineProperty(exports, 'verifyRequest', {
|
|
833
|
-
enumerable: true,
|
|
834
|
-
get: function () {
|
|
835
|
-
return verifyRequest;
|
|
836
|
-
}
|
|
837
|
-
});
|