@fedify/fedify 2.3.7 → 2.3.8

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.
Files changed (108) hide show
  1. package/dist/{assert_instance_of-DBC5X09g.mjs → assert-jSdZMYam.mjs} +19 -1
  2. package/dist/{builder-Bg7nkigw.mjs → builder-CDForRSL.mjs} +3 -3
  3. package/dist/{client-D1KuWxjH.mjs → client-DYDoDpMa.mjs} +78 -4
  4. package/dist/compat/mod.d.cts +1 -1
  5. package/dist/compat/mod.d.ts +1 -1
  6. package/dist/compat/outgoing-jsonld.test.mjs +1 -1
  7. package/dist/compat/public-audience.test.mjs +1 -1
  8. package/dist/compat/transformers.test.mjs +3 -4
  9. package/dist/{context-DVoTs_wM.mjs → context-BepjCFHN.mjs} +1 -0
  10. package/dist/{context-BxVVO5Ro.d.ts → context-CAKnQy1x.d.ts} +4 -3
  11. package/dist/{context-BpmLyiPx.d.cts → context-CSIggG9_.d.cts} +4 -3
  12. package/dist/{deno-CTdCdRmf.mjs → deno--DCBC7WG.mjs} +1 -1
  13. package/dist/{docloader-BVBWf8Bg.mjs → docloader-BAdp-ZeK.mjs} +2 -2
  14. package/dist/federation/builder.test.mjs +2 -2
  15. package/dist/federation/circuit-breaker.test.mjs +3 -3
  16. package/dist/federation/collection.test.mjs +1 -1
  17. package/dist/federation/handler.test.mjs +128 -11
  18. package/dist/federation/idempotency.test.mjs +4 -4
  19. package/dist/federation/inbox.test.mjs +1 -1
  20. package/dist/federation/keycache.test.mjs +44 -10
  21. package/dist/federation/kv.test.mjs +1 -1
  22. package/dist/federation/metrics.test.mjs +1 -1
  23. package/dist/federation/middleware.test.mjs +109 -19
  24. package/dist/federation/mod.cjs +1 -1
  25. package/dist/federation/mod.d.cts +2 -2
  26. package/dist/federation/mod.d.ts +2 -2
  27. package/dist/federation/mod.js +1 -1
  28. package/dist/federation/mq.test.mjs +1 -1
  29. package/dist/federation/negotiation.test.mjs +2 -2
  30. package/dist/federation/retry.test.mjs +1 -1
  31. package/dist/federation/router.test.mjs +1 -1
  32. package/dist/federation/send.test.mjs +141 -7
  33. package/dist/federation/temporal.test.mjs +2 -2
  34. package/dist/federation/webfinger.test.mjs +3 -3
  35. package/dist/{http-DRVY9K4R.js → http-BKJYj9oz.js} +155 -7
  36. package/dist/{http-BjV0BTWd.cjs → http-ChVf88XZ.cjs} +166 -6
  37. package/dist/{http-B3-zan5-.mjs → http-ClEDLGpr.mjs} +4 -4
  38. package/dist/{http-lf8Hsd91.d.ts → http-DQmNpfym.d.ts} +1 -1
  39. package/dist/{http-VyDTd4G3.d.cts → http-DiWQB8Mr.d.cts} +1 -1
  40. package/dist/{key-C_a6iE1-.mjs → key-C-7sqo8D.mjs} +155 -7
  41. package/dist/{keycache-BeU0LCII.mjs → keycache-B3qRQNLj.mjs} +12 -4
  42. package/dist/{kv-cache-BjjcmjtG.mjs → kv-cache-C5FK4PLG.mjs} +1 -1
  43. package/dist/{kv-cache-b1dJZHUx.js → kv-cache-C_w70bFh.js} +2 -2
  44. package/dist/{kv-cache-OzUoHKnZ.cjs → kv-cache-DFBOAyNj.cjs} +2 -2
  45. package/dist/{ld-COo05yJj.mjs → ld-CtFHB6rU.mjs} +3 -3
  46. package/dist/{metrics-V6vX0M13.mjs → metrics-FDcYXRP5.mjs} +1 -1
  47. package/dist/{middleware-EDVv6ewB.cjs → middleware-BdDtzhXb.cjs} +101 -25
  48. package/dist/{middleware-DRk6xiYo.mjs → middleware-COzI8bCL.mjs} +41 -30
  49. package/dist/{middleware-K13LhN5w.js → middleware-DunPXFJL.js} +101 -25
  50. package/dist/{middleware-DRGWEo0V.mjs → middleware-K7mJeIgT.mjs} +1 -1
  51. package/dist/{mod-yvIXFAEi.d.cts → mod-1TuoXkGs.d.cts} +1 -1
  52. package/dist/{mod-B0hW12_O.d.cts → mod-Bid79LFU.d.cts} +1 -1
  53. package/dist/{mod-Rpy4Uwkk.d.ts → mod-CFuyfw3c.d.ts} +1 -1
  54. package/dist/{mod-DFvNJcNb.d.ts → mod-DHgc4ygG.d.ts} +1 -1
  55. package/dist/{mod-CjERT09F.d.cts → mod-PVR75MeU.d.cts} +1 -1
  56. package/dist/{mod-COIAjwRS.d.ts → mod-TLEvgT1i.d.ts} +1 -1
  57. package/dist/mod.cjs +5 -5
  58. package/dist/mod.d.cts +6 -6
  59. package/dist/mod.d.ts +6 -6
  60. package/dist/mod.js +5 -5
  61. package/dist/nodeinfo/client.test.mjs +28 -1
  62. package/dist/nodeinfo/handler.test.mjs +3 -3
  63. package/dist/nodeinfo/mod.cjs +1 -1
  64. package/dist/nodeinfo/mod.js +1 -1
  65. package/dist/nodeinfo/types.test.mjs +1 -1
  66. package/dist/otel/exporter.test.mjs +1 -1
  67. package/dist/{outgoing-jsonld-OFoubetZ.mjs → outgoing-jsonld-HOAywiid.mjs} +1 -1
  68. package/dist/{owner-CnngXDNJ.d.ts → owner-B3hNQCG8.d.cts} +12 -1
  69. package/dist/owner-CGuS9lE7.mjs +175 -0
  70. package/dist/{owner-DEvZuyOE.d.cts → owner-CiBPcC6F.d.ts} +12 -1
  71. package/dist/{proof-kFq0IDK4.mjs → proof--56drUyt.mjs} +5 -5
  72. package/dist/{proof-Xk8lHNc0.cjs → proof-Dgozne0w.cjs} +112 -58
  73. package/dist/{proof-D6gZeewf.js → proof-tjbzynMa.js} +112 -58
  74. package/dist/{send-3lH63Nqf.mjs → send-CC1A7ATC.mjs} +68 -11
  75. package/dist/sig/accept.test.mjs +1 -1
  76. package/dist/sig/http.test.mjs +4 -4
  77. package/dist/sig/key.test.mjs +170 -3
  78. package/dist/sig/ld.test.mjs +56 -4
  79. package/dist/sig/mod.cjs +2 -2
  80. package/dist/sig/mod.d.cts +3 -3
  81. package/dist/sig/mod.d.ts +3 -3
  82. package/dist/sig/mod.js +2 -2
  83. package/dist/sig/owner.test.mjs +105 -6
  84. package/dist/sig/proof.test.mjs +73 -5
  85. package/dist/{temporal-Chwx9cEn.mjs → temporal-DvptXZ7V.mjs} +1 -1
  86. package/dist/testing/mod.mjs +1 -1
  87. package/dist/{types-m8u9L86X.cjs → types-DWs-qZaY.cjs} +94 -2
  88. package/dist/{types-DTONwNqL.js → types-sXITXcWa.js} +78 -4
  89. package/dist/utils/docloader.test.mjs +28 -4
  90. package/dist/utils/kv-cache.test.mjs +1 -1
  91. package/dist/utils/mod.cjs +1 -1
  92. package/dist/utils/mod.d.cts +1 -1
  93. package/dist/utils/mod.d.ts +1 -1
  94. package/dist/utils/mod.js +1 -1
  95. package/package.json +6 -6
  96. package/dist/assert-OguE97r2.mjs +0 -23
  97. package/dist/owner-B3720pz3.mjs +0 -120
  98. /package/dist/{accept-CPkZzmGN.mjs → accept-Dd__NiUL.mjs} +0 -0
  99. /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-ell7W1s9.mjs} +0 -0
  100. /package/dist/{circuit-breaker-D1fxthDI.mjs → circuit-breaker-CDABzqVf.mjs} +0 -0
  101. /package/dist/{circuit-breaker-test-utils-CAdwjgMi.mjs → circuit-breaker-test-utils-Dm5MM6l9.mjs} +0 -0
  102. /package/dist/{collection-Cc3DVAhE.mjs → collection-CA3V5zyK.mjs} +0 -0
  103. /package/dist/{keys-DGu1NFwu.mjs → keys-BAK-tUlf.mjs} +0 -0
  104. /package/dist/{kv-rV3vodCc.mjs → kv-CX8qfaad.mjs} +0 -0
  105. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-CDW-_gUU.mjs} +0 -0
  106. /package/dist/{public-audience-DZJAUUi8.mjs → public-audience-jwoSIGUw.mjs} +0 -0
  107. /package/dist/{retry-CXg_MBI-.mjs → retry-_VvV0h9f.mjs} +0 -0
  108. /package/dist/{types-J53Kw7so.mjs → types-s4mCTGkT.mjs} +0 -0
@@ -1,27 +1,27 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CTdCdRmf.mjs";
5
- import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-V6vX0M13.mjs";
6
- import { t as formatAcceptSignature } from "./accept-CPkZzmGN.mjs";
7
- import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-C_a6iE1-.mjs";
8
- import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-B3-zan5-.mjs";
9
- import { t as getAuthenticatedDocumentLoader } from "./docloader-BVBWf8Bg.mjs";
10
- import { n as kvCache } from "./kv-cache-BjjcmjtG.mjs";
11
- import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-COo05yJj.mjs";
12
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-B3720pz3.mjs";
13
- import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-OFoubetZ.mjs";
14
- import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-kFq0IDK4.mjs";
15
- import { t as getNodeInfo } from "./client-D1KuWxjH.mjs";
16
- import { t as nodeInfoToJson } from "./types-J53Kw7so.mjs";
17
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-3lH63Nqf.mjs";
18
- import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-Bg7nkigw.mjs";
19
- import { t as CircuitBreaker } from "./circuit-breaker-D1fxthDI.mjs";
20
- import { t as buildCollectionSynchronizationHeader } from "./collection-Cc3DVAhE.mjs";
21
- import { t as KvKeyCache } from "./keycache-BeU0LCII.mjs";
22
- import { t as acceptsJsonLd } from "./negotiation-DDstyBvc.mjs";
23
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-Chwx9cEn.mjs";
24
- import { t as createExponentialBackoffPolicy } from "./retry-CXg_MBI-.mjs";
4
+ import { n as version, t as name } from "./deno--DCBC7WG.mjs";
5
+ import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-FDcYXRP5.mjs";
6
+ import { t as formatAcceptSignature } from "./accept-Dd__NiUL.mjs";
7
+ import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-C-7sqo8D.mjs";
8
+ import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-ClEDLGpr.mjs";
9
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-BAdp-ZeK.mjs";
10
+ import { n as kvCache } from "./kv-cache-C5FK4PLG.mjs";
11
+ import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-CtFHB6rU.mjs";
12
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CGuS9lE7.mjs";
13
+ import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-HOAywiid.mjs";
14
+ import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof--56drUyt.mjs";
15
+ import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-DYDoDpMa.mjs";
16
+ import { t as nodeInfoToJson } from "./types-s4mCTGkT.mjs";
17
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-CC1A7ATC.mjs";
18
+ import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-CDForRSL.mjs";
19
+ import { t as CircuitBreaker } from "./circuit-breaker-CDABzqVf.mjs";
20
+ import { t as buildCollectionSynchronizationHeader } from "./collection-CA3V5zyK.mjs";
21
+ import { t as KvKeyCache } from "./keycache-B3qRQNLj.mjs";
22
+ import { t as acceptsJsonLd } from "./negotiation-CDW-_gUU.mjs";
23
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-DvptXZ7V.mjs";
24
+ import { t as createExponentialBackoffPolicy } from "./retry-_VvV0h9f.mjs";
25
25
  import { getLogger, withContext } from "@logtape/logtape";
26
26
  import { RouterError } from "@fedify/uri-template";
27
27
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
@@ -636,13 +636,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
636
636
  * @param parameters The parameters for handling the collection.
637
637
  * @returns A promise that resolves to an HTTP response.
638
638
  */
639
- async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
640
- const spanName = name$1.trim().replace(/\s+/g, "_");
639
+ async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
640
+ const spanName = name$2.trim().replace(/\s+/g, "_");
641
641
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
642
642
  const tracer = tracerProvider.getTracer(name, version);
643
643
  const cursor = new URL(request.url).searchParams.get("cursor");
644
644
  const metricBase = {
645
- kind: getCollectionMetricKind(name$1),
645
+ kind: getCollectionMetricKind(name$2),
646
646
  page: cursor != null,
647
647
  dispatcher: "built_in"
648
648
  };
@@ -683,7 +683,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
683
683
  span.setStatus({ code: SpanStatusCode.ERROR });
684
684
  return await onNotFound(request);
685
685
  }
686
- const items = filterCollectionItems(page.items, name$1, filterPredicate);
686
+ const items = filterCollectionItems(page.items, name$2, filterPredicate);
687
687
  itemCount = items.length;
688
688
  span.setAttribute("fedify.collection.items", itemCount);
689
689
  return items;
@@ -723,7 +723,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
723
723
  } else {
724
724
  const uri = new URL(baseUri);
725
725
  uri.searchParams.set("cursor", cursor);
726
- const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
726
+ const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
727
727
  kind: SpanKind.SERVER,
728
728
  attributes: {
729
729
  "activitypub.collection.id": uri.href,
@@ -739,7 +739,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
739
739
  span.setStatus({ code: SpanStatusCode.ERROR });
740
740
  return await onNotFound(request);
741
741
  }
742
- const items = filterCollectionItems(page.items, name$1, filterPredicate);
742
+ const items = filterCollectionItems(page.items, name$2, filterPredicate);
743
743
  itemCount = items.length;
744
744
  span.setAttribute("fedify.collection.items", itemCount);
745
745
  return {
@@ -1105,8 +1105,16 @@ async function handleInboxInternal(request, parameters, span) {
1105
1105
  }
1106
1106
  let json;
1107
1107
  try {
1108
- json = await request.clone().json();
1108
+ json = JSON.parse(await readBoundedText(request.clone(), MAX_BODY_SIZE, request.url));
1109
1109
  } catch (error) {
1110
+ if (error instanceof BodyTooLargeError) {
1111
+ request.body?.cancel(error).catch(() => {});
1112
+ span.setStatus({
1113
+ code: SpanStatusCode.ERROR,
1114
+ message: String(error)
1115
+ });
1116
+ return new Response("Inbox body too large.", { status: 413 });
1117
+ }
1110
1118
  logger.error("Failed to parse JSON:\n{error}", {
1111
1119
  recipient,
1112
1120
  error
@@ -1607,8 +1615,8 @@ var CustomCollectionHandler = class {
1607
1615
  * @param CollectionPage The CollectionPage constructor.
1608
1616
  * @param filterPredicate Optional filter predicate for items.
1609
1617
  */
1610
- constructor(name$2, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
1611
- this.name = name$2;
1618
+ constructor(name$1, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
1619
+ this.name = name$1;
1612
1620
  this.values = values;
1613
1621
  this.context = context;
1614
1622
  this.callbacks = callbacks;
@@ -2960,6 +2968,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2960
2968
  if (decision.stateChange != null) recordCircuitBreakerSpanEvent(span, remoteHost, decision.stateChange);
2961
2969
  }
2962
2970
  await sendActivity({
2971
+ allowPrivateAddress: this.allowPrivateAddress,
2963
2972
  keys,
2964
2973
  activity: message.activity,
2965
2974
  activityId: message.activityId,
@@ -3482,6 +3491,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3482
3491
  });
3483
3492
  const promises = [];
3484
3493
  for (const inbox in inboxes) promises.push(sendActivity({
3494
+ allowPrivateAddress: this.allowPrivateAddress,
3485
3495
  keys,
3486
3496
  activity: jsonLd,
3487
3497
  activityId: activity.id?.href,
@@ -4759,6 +4769,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
4759
4769
  else logger.debug("Forwarding activity immediately without queue since queue is not set.");
4760
4770
  const promises = [];
4761
4771
  for (const inbox in inboxes) promises.push(sendActivity({
4772
+ allowPrivateAddress: ctx.federation.allowPrivateAddress,
4762
4773
  keys,
4763
4774
  activity: ctx.activity,
4764
4775
  activityId: ctx.activityId,
@@ -2,17 +2,17 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./chunk-CRNNMoPX.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
5
- import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-DRVY9K4R.js";
6
- import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-D6gZeewf.js";
7
- import { n as getNodeInfo, t as nodeInfoToJson } from "./types-DTONwNqL.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-b1dJZHUx.js";
5
+ import { A as recordWebFingerHandle, C as recordCollectionRequest, D as recordInboxActivity, E as recordFanoutRecipients, I as name, L as version, M as formatAcceptSignature, O as recordOutboxActivity, S as recordCollectionPageItems, _ as instrumentDocumentLoader, a as verifyRequestDetailed, b as recordCircuitBreakerStateChange, d as importJwk, f as validateCryptoKey, g as getRemoteHost, h as getFederationMetrics, i as verifyRequest, j as registerQueueDepthGauge, k as recordOutboxEnqueue, m as getDurationMs, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-BKJYj9oz.js";
6
+ import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-sXITXcWa.js";
7
+ import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-tjbzynMa.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-C_w70bFh.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
11
11
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
12
12
  import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
13
13
  import { encodeHex } from "byte-encodings/hex";
14
+ import { FetchError, UrlError, getDocumentLoader, validatePublicUrl } from "@fedify/vocab-runtime";
14
15
  import { uniq } from "es-toolkit";
15
- import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
16
16
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
17
17
  import jsonld from "@fedify/vocab-runtime/jsonld";
18
18
  import { lookupWebFinger } from "@fedify/webfinger";
@@ -1413,6 +1413,7 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
1413
1413
  }
1414
1414
  //#endregion
1415
1415
  //#region src/federation/keycache.ts
1416
+ const KEY_CACHE_GENERATION = "2";
1416
1417
  var KvKeyCache = class {
1417
1418
  kv;
1418
1419
  prefix;
@@ -1433,13 +1434,20 @@ var KvKeyCache = class {
1433
1434
  keyId.href
1434
1435
  ];
1435
1436
  }
1437
+ #entryKey(keyId) {
1438
+ return [
1439
+ ...this.prefix,
1440
+ KEY_CACHE_GENERATION,
1441
+ keyId.href
1442
+ ];
1443
+ }
1436
1444
  async get(keyId) {
1437
1445
  const negativeExpiration = this.nullKeys.get(keyId.href);
1438
1446
  if (negativeExpiration != null) {
1439
1447
  if (Temporal.Now.instant().until(negativeExpiration).sign >= 0) return null;
1440
1448
  this.nullKeys.delete(keyId.href);
1441
1449
  }
1442
- const serialized = await this.kv.get([...this.prefix, keyId.href]);
1450
+ const serialized = await this.kv.get(this.#entryKey(keyId));
1443
1451
  if (serialized === void 0) return void 0;
1444
1452
  if (serialized === null) {
1445
1453
  this.nullKeys.set(keyId.href, Temporal.Now.instant().add(this.unavailableKeyTtl));
@@ -1451,7 +1459,7 @@ var KvKeyCache = class {
1451
1459
  try {
1452
1460
  return await Multikey.fromJsonLd(serialized, this.options);
1453
1461
  } catch {
1454
- await this.kv.delete([...this.prefix, keyId.href]);
1462
+ await this.kv.delete(this.#entryKey(keyId));
1455
1463
  return;
1456
1464
  }
1457
1465
  }
@@ -1459,12 +1467,12 @@ var KvKeyCache = class {
1459
1467
  async set(keyId, key) {
1460
1468
  if (key == null) {
1461
1469
  this.nullKeys.set(keyId.href, Temporal.Now.instant().add(this.unavailableKeyTtl));
1462
- await this.kv.set([...this.prefix, keyId.href], null, { ttl: this.unavailableKeyTtl });
1470
+ await this.kv.set(this.#entryKey(keyId), null, { ttl: this.unavailableKeyTtl });
1463
1471
  return;
1464
1472
  }
1465
1473
  this.nullKeys.delete(keyId.href);
1466
1474
  const serialized = await key.toJsonLd(this.options);
1467
- await this.kv.set([...this.prefix, keyId.href], serialized);
1475
+ await this.kv.set(this.#entryKey(keyId), serialized);
1468
1476
  }
1469
1477
  async getFetchError(keyId) {
1470
1478
  const cached = await this.kv.get(this.#getFetchErrorKey(keyId));
@@ -1811,13 +1819,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
1811
1819
  * @param parameters The parameters for handling the collection.
1812
1820
  * @returns A promise that resolves to an HTTP response.
1813
1821
  */
1814
- async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
1815
- const spanName = name$1.trim().replace(/\s+/g, "_");
1822
+ async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
1823
+ const spanName = name$2.trim().replace(/\s+/g, "_");
1816
1824
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
1817
1825
  const tracer = tracerProvider.getTracer(name, version);
1818
1826
  const cursor = new URL(request.url).searchParams.get("cursor");
1819
1827
  const metricBase = {
1820
- kind: getCollectionMetricKind(name$1),
1828
+ kind: getCollectionMetricKind(name$2),
1821
1829
  page: cursor != null,
1822
1830
  dispatcher: "built_in"
1823
1831
  };
@@ -1858,7 +1866,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
1858
1866
  span.setStatus({ code: SpanStatusCode.ERROR });
1859
1867
  return await onNotFound(request);
1860
1868
  }
1861
- const items = filterCollectionItems(page.items, name$1, filterPredicate);
1869
+ const items = filterCollectionItems(page.items, name$2, filterPredicate);
1862
1870
  itemCount = items.length;
1863
1871
  span.setAttribute("fedify.collection.items", itemCount);
1864
1872
  return items;
@@ -1898,7 +1906,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
1898
1906
  } else {
1899
1907
  const uri = new URL(baseUri);
1900
1908
  uri.searchParams.set("cursor", cursor);
1901
- const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
1909
+ const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
1902
1910
  kind: SpanKind.SERVER,
1903
1911
  attributes: {
1904
1912
  "activitypub.collection.id": uri.href,
@@ -1914,7 +1922,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
1914
1922
  span.setStatus({ code: SpanStatusCode.ERROR });
1915
1923
  return await onNotFound(request);
1916
1924
  }
1917
- const items = filterCollectionItems(page.items, name$1, filterPredicate);
1925
+ const items = filterCollectionItems(page.items, name$2, filterPredicate);
1918
1926
  itemCount = items.length;
1919
1927
  span.setAttribute("fedify.collection.items", itemCount);
1920
1928
  return {
@@ -2280,8 +2288,16 @@ async function handleInboxInternal(request, parameters, span) {
2280
2288
  }
2281
2289
  let json;
2282
2290
  try {
2283
- json = await request.clone().json();
2291
+ json = JSON.parse(await readBoundedText(request.clone(), MAX_BODY_SIZE, request.url));
2284
2292
  } catch (error) {
2293
+ if (error instanceof BodyTooLargeError) {
2294
+ request.body?.cancel(error).catch(() => {});
2295
+ span.setStatus({
2296
+ code: SpanStatusCode.ERROR,
2297
+ message: String(error)
2298
+ });
2299
+ return new Response("Inbox body too large.", { status: 413 });
2300
+ }
2285
2301
  logger.error("Failed to parse JSON:\n{error}", {
2286
2302
  recipient,
2287
2303
  error
@@ -2782,8 +2798,8 @@ var CustomCollectionHandler = class {
2782
2798
  * @param CollectionPage The CollectionPage constructor.
2783
2799
  * @param filterPredicate Optional filter predicate for items.
2784
2800
  */
2785
- constructor(name$2, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
2786
- this.name = name$2;
2801
+ constructor(name$1, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
2802
+ this.name = name$1;
2787
2803
  this.values = values;
2788
2804
  this.context = context;
2789
2805
  this.callbacks = callbacks;
@@ -3408,7 +3424,7 @@ async function readLimitedResponseBody(response, maxBytes) {
3408
3424
  if (truncated) result += "… (truncated)";
3409
3425
  return result;
3410
3426
  }
3411
- async function sendActivityInternal({ activity, activityId, activityType, keys, inbox, headers, specDeterminer, meterProvider, tracerProvider }, span) {
3427
+ async function sendActivityInternal({ activity, activityId, activityType, keys, inbox, allowPrivateAddress, headers, specDeterminer, meterProvider, tracerProvider }, span) {
3412
3428
  const logger = getLogger([
3413
3429
  "fedify",
3414
3430
  "federation",
@@ -3417,12 +3433,25 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3417
3433
  const federationMetrics = getFederationMetrics(meterProvider);
3418
3434
  const started = performance.now();
3419
3435
  let deliverySuccess = false;
3436
+ async function validateUrl(url) {
3437
+ if (!allowPrivateAddress) try {
3438
+ await validatePublicUrl(url);
3439
+ } catch (error) {
3440
+ if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
3441
+ url,
3442
+ error
3443
+ });
3444
+ throw error;
3445
+ }
3446
+ }
3447
+ await validateUrl(inbox.href);
3420
3448
  headers = new Headers(headers);
3421
3449
  headers.set("Content-Type", "application/activity+json");
3422
3450
  const request = new Request(inbox, {
3423
3451
  method: "POST",
3424
3452
  headers,
3425
- body: JSON.stringify(activity)
3453
+ body: JSON.stringify(activity),
3454
+ redirect: "manual"
3426
3455
  });
3427
3456
  let rsaKey = null;
3428
3457
  for (const key of keys) if (key.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
@@ -3438,19 +3467,20 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3438
3467
  });
3439
3468
  let response;
3440
3469
  try {
3441
- response = rsaKey == null ? await fetch(request) : await doubleKnock(request, rsaKey, {
3470
+ response = rsaKey == null ? await fetchWithValidatedRedirects(request, validateUrl) : await doubleKnock(request, rsaKey, {
3442
3471
  tracerProvider,
3443
- specDeterminer
3472
+ specDeterminer,
3473
+ validateRedirect: validateUrl
3444
3474
  });
3445
3475
  } catch (error) {
3446
- const transportError = error instanceof FetchError ? error : createFetchError(inbox.href, error);
3476
+ const failure = error instanceof FetchError || error instanceof UrlError ? error : createFetchError(inbox.href, error);
3447
3477
  logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
3448
3478
  activityId,
3449
3479
  inbox: inbox.href,
3450
- error: transportError
3480
+ error: failure
3451
3481
  });
3452
3482
  federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
3453
- throw transportError;
3483
+ throw failure;
3454
3484
  }
3455
3485
  try {
3456
3486
  if (!response.ok) {
@@ -3487,6 +3517,49 @@ function createFetchError(url, cause) {
3487
3517
  error.cause = cause;
3488
3518
  return error;
3489
3519
  }
3520
+ async function fetchWithValidatedRedirects(request, validateUrl) {
3521
+ let body = await request.clone().text();
3522
+ for (let redirects = 0;; redirects++) {
3523
+ const response = await fetch(request, { redirect: "manual" });
3524
+ const location = response.headers.get("Location");
3525
+ if (![
3526
+ 301,
3527
+ 302,
3528
+ 303,
3529
+ 307,
3530
+ 308
3531
+ ].includes(response.status) || location == null) return response;
3532
+ await response.body?.cancel();
3533
+ if (redirects >= 20) throw new TypeError("Too many redirects");
3534
+ const url = new URL(location, request.url);
3535
+ await validateUrl(url.href);
3536
+ const headers = new Headers(request.headers);
3537
+ if (url.origin !== new URL(request.url).origin) {
3538
+ headers.delete("Authorization");
3539
+ headers.delete("Proxy-Authorization");
3540
+ headers.delete("Cookie");
3541
+ headers.delete("Host");
3542
+ }
3543
+ let method = request.method;
3544
+ if ((response.status === 301 || response.status === 302) && method === "POST" || response.status === 303 && method !== "GET" && method !== "HEAD") {
3545
+ method = "GET";
3546
+ body = void 0;
3547
+ for (const name of [
3548
+ "Content-Encoding",
3549
+ "Content-Language",
3550
+ "Content-Length",
3551
+ "Content-Location",
3552
+ "Content-Type"
3553
+ ]) headers.delete(name);
3554
+ }
3555
+ request = new Request(url, {
3556
+ method,
3557
+ headers,
3558
+ body,
3559
+ redirect: "manual"
3560
+ });
3561
+ }
3562
+ }
3490
3563
  /**
3491
3564
  * An error that is thrown when an activity fails to send to a remote inbox.
3492
3565
  * It contains structured information about the failure, including the HTTP
@@ -4632,6 +4705,7 @@ var FederationImpl = class extends FederationBuilderImpl {
4632
4705
  if (decision.stateChange != null) recordCircuitBreakerSpanEvent(span, remoteHost, decision.stateChange);
4633
4706
  }
4634
4707
  await sendActivity({
4708
+ allowPrivateAddress: this.allowPrivateAddress,
4635
4709
  keys,
4636
4710
  activity: message.activity,
4637
4711
  activityId: message.activityId,
@@ -5154,6 +5228,7 @@ var FederationImpl = class extends FederationBuilderImpl {
5154
5228
  });
5155
5229
  const promises = [];
5156
5230
  for (const inbox in inboxes) promises.push(sendActivity({
5231
+ allowPrivateAddress: this.allowPrivateAddress,
5157
5232
  keys,
5158
5233
  activity: jsonLd,
5159
5234
  activityId: activity.id?.href,
@@ -6431,6 +6506,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
6431
6506
  else logger.debug("Forwarding activity immediately without queue since queue is not set.");
6432
6507
  const promises = [];
6433
6508
  for (const inbox in inboxes) promises.push(sendActivity({
6509
+ allowPrivateAddress: ctx.federation.allowPrivateAddress,
6434
6510
  keys,
6435
6511
  activity: ctx.activity,
6436
6512
  activityId: ctx.activityId,
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-DRk6xiYo.mjs";
4
+ import { n as FederationImpl } from "./middleware-COzI8bCL.mjs";
5
5
  export { FederationImpl };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as HttpMessageSignaturesSpecDeterminer } from "./http-VyDTd4G3.cjs";
2
+ import { n as HttpMessageSignaturesSpecDeterminer } from "./http-DiWQB8Mr.cjs";
3
3
  import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
4
4
  import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
5
5
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { S as KeyCache } from "./http-VyDTd4G3.cjs";
2
+ import { S as KeyCache } from "./http-DiWQB8Mr.cjs";
3
3
  import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
4
4
  import { DocumentLoader } from "@fedify/vocab-runtime";
5
5
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-BxVVO5Ro.js";
2
+ import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-CAKnQy1x.js";
3
3
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
4
4
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
5
5
 
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as HttpMessageSignaturesSpecDeterminer } from "./http-lf8Hsd91.js";
2
+ import { n as HttpMessageSignaturesSpecDeterminer } from "./http-DQmNpfym.js";
3
3
  import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
4
4
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
5
5
  import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-BpmLyiPx.cjs";
2
+ import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-CSIggG9_.cjs";
3
3
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
4
4
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
5
5
 
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { S as KeyCache } from "./http-lf8Hsd91.js";
2
+ import { S as KeyCache } from "./http-DQmNpfym.js";
3
3
  import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
4
4
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
5
5
  import { DocumentLoader } from "@fedify/vocab-runtime";
package/dist/mod.cjs CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-DDcVe30Y.cjs");
5
5
  const require_transformers = require("./transformers-NeAONrAq.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_http = require("./http-BjV0BTWd.cjs");
8
- const require_middleware = require("./middleware-EDVv6ewB.cjs");
9
- const require_proof = require("./proof-Xk8lHNc0.cjs");
10
- const require_types = require("./types-m8u9L86X.cjs");
11
- const require_kv_cache = require("./kv-cache-OzUoHKnZ.cjs");
7
+ const require_http = require("./http-ChVf88XZ.cjs");
8
+ const require_middleware = require("./middleware-BdDtzhXb.cjs");
9
+ const require_types = require("./types-DWs-qZaY.cjs");
10
+ const require_proof = require("./proof-Dgozne0w.cjs");
11
+ const require_kv_cache = require("./kv-cache-DFBOAyNj.cjs");
12
12
  const require_federation_mod = require("./federation/mod.cjs");
13
13
  require("./nodeinfo/mod.cjs");
14
14
  require("./runtime/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -1,14 +1,14 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CAM_bQXx.cjs";
3
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-VyDTd4G3.cjs";
4
- import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DEvZuyOE.cjs";
5
- import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-BpmLyiPx.cjs";
3
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-DiWQB8Mr.cjs";
4
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-B3hNQCG8.cjs";
5
+ import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-CSIggG9_.cjs";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-gJ8LYbxX.cjs";
7
7
  import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "./mq-D8uSFzxe.cjs";
8
8
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
9
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-CjERT09F.cjs";
10
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-B0hW12_O.cjs";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-yvIXFAEi.cjs";
9
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-PVR75MeU.cjs";
10
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-Bid79LFU.cjs";
11
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-1TuoXkGs.cjs";
12
12
  export * from "@fedify/vocab-runtime";
13
13
 
14
14
  //#region src/mod.d.ts
package/dist/mod.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CSddvgWN.js";
3
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-lf8Hsd91.js";
4
- import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CnngXDNJ.js";
5
- import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-BxVVO5Ro.js";
3
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-DQmNpfym.js";
4
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CiBPcC6F.js";
5
+ import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-CAKnQy1x.js";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-D6hNiMTK.js";
7
7
  import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "./mq-D-nlpY04.js";
8
8
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
9
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-Rpy4Uwkk.js";
10
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-COIAjwRS.js";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DFvNJcNb.js";
9
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-CFuyfw3c.js";
10
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-TLEvgT1i.js";
11
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DHgc4ygG.js";
12
12
  export * from "@fedify/vocab-runtime";
13
13
 
14
14
  //#region src/mod.d.ts
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./chunk-CRNNMoPX.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
5
5
  import "./compat/mod.js";
6
- import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "./http-DRVY9K4R.js";
7
- import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "./middleware-K13LhN5w.js";
8
- import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-D6gZeewf.js";
9
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-DTONwNqL.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-b1dJZHUx.js";
6
+ import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-BKJYj9oz.js";
7
+ import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "./middleware-DunPXFJL.js";
8
+ import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-sXITXcWa.js";
9
+ import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-tjbzynMa.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-C_w70bFh.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";