@fedify/fedify 1.9.10 → 1.9.12-dev.2265

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 (118) hide show
  1. package/dist/{actor-BCmFER1x.js → actor-BJj7NAV7.js} +187 -187
  2. package/dist/{actor-CGzgm5oD.cjs → actor-BxUB2vBw.cjs} +187 -187
  3. package/dist/{actor-Dk8QQxfb.mjs → actor-DKEb3nb2.mjs} +1 -1
  4. package/dist/{authdocloader-C0oFDv-u.cjs → authdocloader-BkG-kREl.cjs} +3 -3
  5. package/dist/{authdocloader-BlqYxYyU.mjs → authdocloader-DVWlfdZ9.mjs} +3 -3
  6. package/dist/{authdocloader-C4Km7IX-.js → authdocloader-_m5yqwLt.js} +3 -3
  7. package/dist/{builder-Dy69enN4.mjs → builder-Dhm6irl1.mjs} +4 -4
  8. package/dist/{client-BVxHrCKU.mjs → client-CIvLnEyN.mjs} +1 -1
  9. package/dist/compat/mod.cjs +1 -1
  10. package/dist/compat/mod.d.cts +1 -1
  11. package/dist/compat/mod.d.ts +1 -1
  12. package/dist/compat/transformers.test.mjs +3 -3
  13. package/dist/{context-Cf8s07xm.d.ts → context-CNkTuNIm.d.ts} +48 -6
  14. package/dist/{context-Crmwowsw.d.cts → context-jX79cwCB.d.cts} +48 -6
  15. package/dist/{docloader-CJRlqHTE.js → docloader-CFM5B9fd.js} +121 -13
  16. package/dist/{docloader-L_Yv0SO1.cjs → docloader-ojCZeNsS.cjs} +121 -13
  17. package/dist/{esm-Bl5QZ7fr.mjs → esm-DpYRgHio.mjs} +1 -1
  18. package/dist/federation/builder.test.mjs +3 -3
  19. package/dist/federation/collection.test.mjs +1 -1
  20. package/dist/federation/handler.test.mjs +1361 -45
  21. package/dist/federation/idempotency.test.mjs +5 -5
  22. package/dist/federation/inbox.test.mjs +3 -3
  23. package/dist/federation/keycache.test.mjs +3 -3
  24. package/dist/federation/kv.test.mjs +1 -1
  25. package/dist/federation/middleware.test.mjs +1586 -82
  26. package/dist/federation/mod.cjs +2 -2
  27. package/dist/federation/mod.d.cts +1 -1
  28. package/dist/federation/mod.d.ts +1 -1
  29. package/dist/federation/mod.js +1 -1
  30. package/dist/federation/mq.test.mjs +3 -3
  31. package/dist/federation/retry.test.mjs +2 -2
  32. package/dist/federation/router.test.mjs +2 -2
  33. package/dist/federation/send.test.mjs +7 -7
  34. package/dist/federation/temporal.test.d.mts +2 -0
  35. package/dist/federation/temporal.test.mjs +71 -0
  36. package/dist/{http-ChxLPxfJ.cjs → http-B7su-Fmy.cjs} +3 -3
  37. package/dist/{http-lEtFJ9QZ.mjs → http-ChKbuD-B.mjs} +2 -2
  38. package/dist/{http-CEocuLno.js → http-DdMd8CPw.js} +3 -3
  39. package/dist/{inbox-f2JhwcoC.mjs → inbox-Du7n_Tcq.mjs} +7 -4
  40. package/dist/{key-DL1K1oFv.cjs → key-AD7NWK_B.cjs} +2 -2
  41. package/dist/{key-CcFvjYSE.mjs → key-Bd3kgBIA.mjs} +2 -2
  42. package/dist/{key-GSxkNZYW.cjs → key-COEspOg4.cjs} +1 -1
  43. package/dist/{key-DXRa1vj8.mjs → key-DINKM8mV.mjs} +1 -1
  44. package/dist/{key-CfQiiCFY.js → key-DvsZ4r4J.js} +2 -2
  45. package/dist/{keycache-Car3vCR8.mjs → keycache-DYpvtScH.mjs} +1 -1
  46. package/dist/{keys-BPA70FRA.mjs → keys-CJPe6iTW.mjs} +1 -1
  47. package/dist/ld-C51F-FdC.mjs +548 -0
  48. package/dist/{lookup-BZCRNz7r.cjs → lookup-DrAw0WK4.cjs} +1 -1
  49. package/dist/{lookup-MjsiCtwV.js → lookup-avek91qK.js} +1 -1
  50. package/dist/{lookup-ByZEGrUD.mjs → lookup-jTLErl5g.mjs} +1 -1
  51. package/dist/{middleware-D23J06Wi.js → middleware-B_5QXY9T.js} +401 -76
  52. package/dist/{middleware-DwelHV2a.cjs → middleware-BxPRXIp2.cjs} +404 -78
  53. package/dist/{middleware-DzVgR5WN.cjs → middleware-CoZn3Vmd.cjs} +1 -1
  54. package/dist/{middleware-DT1q8p2_.mjs → middleware-ScXtn6SX.mjs} +313 -80
  55. package/dist/{middleware-DQF9aAWg.mjs → middleware-ySLVbIpY.mjs} +1 -1
  56. package/dist/mod.cjs +10 -10
  57. package/dist/mod.d.cts +1 -1
  58. package/dist/mod.d.ts +1 -1
  59. package/dist/mod.js +9 -9
  60. package/dist/nodeinfo/client.test.mjs +3 -3
  61. package/dist/nodeinfo/handler.test.mjs +2 -2
  62. package/dist/nodeinfo/mod.cjs +1 -1
  63. package/dist/nodeinfo/mod.js +1 -1
  64. package/dist/nodeinfo/semver.test.mjs +1 -1
  65. package/dist/nodeinfo/types.test.mjs +1 -1
  66. package/dist/{owner-2Hw80SWJ.mjs → owner-Ul_H1ZhA.mjs} +3 -3
  67. package/dist/{proof-B6709oyL.mjs → proof-CGXr6kyw.mjs} +2 -2
  68. package/dist/{proof-DoJnUD_A.js → proof-CO1rdWN1.js} +300 -6
  69. package/dist/{proof-DOwB_RsW.cjs → proof-CpHpOx4z.cjs} +347 -5
  70. package/dist/runtime/authdocloader.test.mjs +6 -6
  71. package/dist/runtime/docloader.test.mjs +3 -3
  72. package/dist/runtime/key.test.mjs +3 -3
  73. package/dist/runtime/langstr.test.mjs +2 -2
  74. package/dist/runtime/link.test.mjs +2 -2
  75. package/dist/runtime/mod.cjs +3 -3
  76. package/dist/runtime/mod.js +3 -3
  77. package/dist/runtime/multibase/multibase.test.mjs +2 -2
  78. package/dist/runtime/url.test.mjs +53 -2
  79. package/dist/{send-CaI0XRhr.mjs → send-BktZN-8x.mjs} +2 -2
  80. package/dist/sig/http.test.mjs +6 -6
  81. package/dist/sig/key.test.mjs +4 -4
  82. package/dist/sig/ld.test.mjs +561 -5
  83. package/dist/sig/mod.cjs +3 -3
  84. package/dist/sig/mod.js +3 -3
  85. package/dist/sig/owner.test.mjs +5 -5
  86. package/dist/sig/proof.test.mjs +4 -4
  87. package/dist/temporal-DG3PUHrG.mjs +95 -0
  88. package/dist/testing/docloader.test.mjs +1 -1
  89. package/dist/testing/mod.d.mts +48 -6
  90. package/dist/testing/mod.mjs +1 -1
  91. package/dist/{testing-2hgRVgOJ.mjs → testing-Dbq3x7rR.mjs} +2 -2
  92. package/dist/{transformers-BZ3mYJ1P.cjs → transformers-ZXV8xoFH.cjs} +1 -1
  93. package/dist/{types-36cPcbK8.js → types-CysnskTc.js} +1 -1
  94. package/dist/{types-DXy2Djgl.cjs → types-kNVIK9BX.cjs} +1 -1
  95. package/dist/vocab/actor.test.mjs +4 -4
  96. package/dist/vocab/cjs.test.mjs +1 -1
  97. package/dist/vocab/lookup.test.mjs +4 -4
  98. package/dist/vocab/mod.cjs +3 -3
  99. package/dist/vocab/mod.js +3 -3
  100. package/dist/vocab/type.test.mjs +2 -2
  101. package/dist/vocab/vocab.test.mjs +3 -3
  102. package/dist/{vocab-BPE_99_6.mjs → vocab-BmWZ5Z8b.mjs} +306 -198
  103. package/dist/webfinger/handler.test.mjs +3 -3
  104. package/dist/webfinger/lookup.test.mjs +3 -3
  105. package/dist/webfinger/mod.cjs +1 -1
  106. package/dist/webfinger/mod.js +1 -1
  107. package/dist/x/cfworkers.cjs +1 -1
  108. package/dist/x/cfworkers.test.mjs +1 -1
  109. package/dist/x/hono.cjs +1 -1
  110. package/dist/x/hono.d.cts +1 -1
  111. package/dist/x/hono.d.ts +1 -1
  112. package/dist/x/sveltekit.cjs +1 -1
  113. package/dist/x/sveltekit.d.cts +1 -1
  114. package/dist/x/sveltekit.d.ts +1 -1
  115. package/package.json +1 -1
  116. package/dist/ld-C5izJRbw.mjs +0 -254
  117. /package/dist/{denokv-CoSB_Eps.mjs → denokv-NJPMXyK0.mjs} +0 -0
  118. /package/dist/{retry-Ddbq3AcK.mjs → retry-B_E3V_Dx.mjs} +0 -0
@@ -1,23 +1,24 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, Z as kvCache, a as CollectionPage, b as OrderedCollection, g as Multikey, h as Link, i as Collection, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1, x as OrderedCollectionPage } from "./vocab-BPE_99_6.mjs";
5
- import { i as RouterError, n as traverseCollection, t as lookupObject } from "./lookup-ByZEGrUD.mjs";
6
- import { t as getNodeInfo } from "./client-BVxHrCKU.mjs";
4
+ import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, Z as kvCache, a as CollectionPage, b as OrderedCollection, g as Multikey, h as Link, i as Collection, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1, x as OrderedCollectionPage } from "./vocab-BmWZ5Z8b.mjs";
5
+ import { i as RouterError, n as traverseCollection, t as lookupObject } from "./lookup-jTLErl5g.mjs";
6
+ import { t as getNodeInfo } from "./client-CIvLnEyN.mjs";
7
7
  import { t as nodeInfoToJson } from "./types-CAnkAQGM.mjs";
8
- import "./actor-Dk8QQxfb.mjs";
9
- import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-CcFvjYSE.mjs";
10
- import { l as verifyRequest } from "./http-lEtFJ9QZ.mjs";
11
- import { t as getAuthenticatedDocumentLoader } from "./authdocloader-BlqYxYyU.mjs";
12
- import { a as signJsonLd, i as hasSignature, o as verifyJsonLd, r as detachSignature } from "./ld-C5izJRbw.mjs";
13
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-2Hw80SWJ.mjs";
14
- import { n as signObject, r as verifyObject } from "./proof-B6709oyL.mjs";
15
- import { n as routeActivity } from "./inbox-f2JhwcoC.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-Dy69enN4.mjs";
8
+ import "./actor-DKEb3nb2.mjs";
9
+ import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-Bd3kgBIA.mjs";
10
+ import { l as verifyRequest } from "./http-ChKbuD-B.mjs";
11
+ import { t as getAuthenticatedDocumentLoader } from "./authdocloader-DVWlfdZ9.mjs";
12
+ import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-C51F-FdC.mjs";
13
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-Ul_H1ZhA.mjs";
14
+ import { n as signObject, r as verifyObject } from "./proof-CGXr6kyw.mjs";
15
+ import { n as routeActivity } from "./inbox-Du7n_Tcq.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-Dhm6irl1.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-BD6-SZ6O.mjs";
18
- import { t as KvKeyCache } from "./keycache-Car3vCR8.mjs";
19
- import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
20
- import { n as sendActivity, t as extractInboxes } from "./send-CaI0XRhr.mjs";
18
+ import { t as KvKeyCache } from "./keycache-DYpvtScH.mjs";
19
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-DG3PUHrG.mjs";
20
+ import { t as createExponentialBackoffPolicy } from "./retry-B_E3V_Dx.mjs";
21
+ import { n as sendActivity, t as extractInboxes } from "./send-BktZN-8x.mjs";
21
22
  import { getLogger, withContext } from "@logtape/logtape";
22
23
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
23
24
  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";
@@ -337,6 +338,33 @@ function preferredMediaTypes(accept) {
337
338
  }
338
339
  //#endregion
339
340
  //#region src/federation/handler.ts
341
+ const rawInboxContextFactorySymbol = Symbol("fedify.rawInboxContextFactory");
342
+ function isRemoteContextLoadingFailure$1(error) {
343
+ return error instanceof Error && typeof error.details === "object" && error.details != null && error.details.code === "loading remote context failed";
344
+ }
345
+ function isPermanentRemoteContextError$1(error) {
346
+ if (!(error instanceof Error) || error.name !== "jsonld.InvalidUrl") return false;
347
+ const details = error.details;
348
+ if (details?.code === "invalid remote context") return true;
349
+ return isRemoteContextLoadingFailure$1(error) && typeof details?.url === "string" && !URL.canParse(details.url) && isClearlyMalformedContextReference(details.url);
350
+ }
351
+ function isInvalidJsonLdError(error) {
352
+ if (!(error instanceof Error)) return false;
353
+ const name = error.name;
354
+ return name === "UnsafeJsonLdError" || error instanceof InvalidContextReferenceError || isPermanentRemoteContextError$1(error) || name === "jsonld.SyntaxError" && !isRemoteContextLoadingFailure$1(error);
355
+ }
356
+ function isValidationTypeError(error) {
357
+ return error instanceof TypeError && (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:)/.test(error.message) || isInvalidUrlTypeError(error));
358
+ }
359
+ function isPermanentActivityParseError(error) {
360
+ return isInvalidJsonLdError(error) || isValidationTypeError(error);
361
+ }
362
+ function hasHttpSignatureHeaders(request) {
363
+ return request.headers.has("Signature") || request.headers.has("Signature-Input");
364
+ }
365
+ function hasObjectIntegrityProof(json) {
366
+ return typeof json === "object" && json != null && "proof" in json;
367
+ }
340
368
  function acceptsJsonLd(request) {
341
369
  const accept = request.headers.get("Accept");
342
370
  const types = accept ? preferredMediaTypes(accept) : ["*/*"];
@@ -720,35 +748,120 @@ async function handleInboxInternal(request, parameters, span) {
720
748
  });
721
749
  }
722
750
  const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey, ctx);
723
- let ldSigVerified;
724
- try {
725
- ldSigVerified = await verifyJsonLd(json, {
726
- contextLoader: ctx.contextLoader,
727
- documentLoader: ctx.documentLoader,
728
- keyCache,
729
- tracerProvider
751
+ const jsonWithoutSig = detachSignature(json);
752
+ const hasLdSignature = hasSignature(json);
753
+ const canAttemptAlternateAuthAfterLdSignatureFailure = skipSignatureVerification || hasHttpSignatureHeaders(request) || hasObjectIntegrityProof(jsonWithoutSig);
754
+ let deferredLdSignatureError = void 0;
755
+ const respondInvalidActivity = async (error) => {
756
+ logger.error("Failed to parse activity:\n{error}", {
757
+ recipient,
758
+ activity: json,
759
+ error
730
760
  });
731
- } catch (error) {
732
- if (error instanceof Error && error.name === "jsonld.SyntaxError") {
733
- logger.error("Failed to parse JSON-LD:\n{error}", {
761
+ try {
762
+ await inboxErrorHandler?.(ctx, error);
763
+ } catch (error) {
764
+ logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
765
+ error,
766
+ activity: json,
767
+ recipient
768
+ });
769
+ }
770
+ span.setStatus({
771
+ code: SpanStatusCode.ERROR,
772
+ message: `Failed to parse activity:\n${error}`
773
+ });
774
+ return new Response("Invalid activity.", {
775
+ status: 400,
776
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
777
+ });
778
+ };
779
+ let compactedJson = json;
780
+ let compactedJsonWithoutSig = jsonWithoutSig;
781
+ let ldSigVerified = false;
782
+ if (hasLdSignature) {
783
+ try {
784
+ compactedJson = await compactJsonLd(json, ctx.contextLoader);
785
+ } catch (error) {
786
+ if (isInvalidJsonLdError(error)) {
787
+ logger.error("Failed to parse JSON-LD:\n{error}", {
788
+ recipient,
789
+ error
790
+ });
791
+ return new Response("Invalid JSON-LD.", {
792
+ status: 400,
793
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
794
+ });
795
+ }
796
+ if (!canAttemptAlternateAuthAfterLdSignatureFailure) throw error;
797
+ if (!skipSignatureVerification) deferredLdSignatureError = error;
798
+ logger.debug("Failed to normalize JSON-LD for Linked Data Signatures; deferring to another authentication path only if it verifies:\n{error}", {
734
799
  recipient,
735
800
  error
736
801
  });
737
- return new Response("Invalid JSON-LD.", {
738
- status: 400,
739
- headers: { "Content-Type": "text/plain; charset=utf-8" }
740
- });
741
802
  }
742
- ldSigVerified = false;
803
+ if (compactedJson !== json) {
804
+ compactedJsonWithoutSig = detachSignature(compactedJson);
805
+ try {
806
+ ldSigVerified = await verifyCompactJsonLd(compactedJson, {
807
+ contextLoader: ctx.contextLoader,
808
+ documentLoader: ctx.documentLoader,
809
+ keyCache,
810
+ tracerProvider
811
+ });
812
+ } catch (error) {
813
+ if (error instanceof RangeError && await hasMalformedKnownTemporalLiteral(compactedJsonWithoutSig, ctx.contextLoader)) return await respondInvalidActivity(error);
814
+ if (isInvalidJsonLdError(error)) {
815
+ logger.error("Failed to parse JSON-LD:\n{error}", {
816
+ recipient,
817
+ error
818
+ });
819
+ return new Response("Invalid JSON-LD.", {
820
+ status: 400,
821
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
822
+ });
823
+ }
824
+ if (!canAttemptAlternateAuthAfterLdSignatureFailure) throw error;
825
+ if (!skipSignatureVerification) try {
826
+ await Object$1.fromJsonLd(compactedJson, {
827
+ contextLoader: getNormalizationContextLoader(ctx.contextLoader),
828
+ documentLoader: ctx.documentLoader,
829
+ tracerProvider
830
+ });
831
+ } catch (parseError) {
832
+ if (parseError instanceof RangeError && await hasMalformedKnownTemporalLiteral(compactedJsonWithoutSig, ctx.contextLoader)) return await respondInvalidActivity(parseError);
833
+ if (isInvalidJsonLdError(parseError)) {
834
+ logger.error("Failed to parse JSON-LD:\n{error}", {
835
+ recipient,
836
+ error: parseError
837
+ });
838
+ return new Response("Invalid JSON-LD.", {
839
+ status: 400,
840
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
841
+ });
842
+ }
843
+ deferredLdSignatureError = parseError;
844
+ }
845
+ ldSigVerified = false;
846
+ }
847
+ }
743
848
  }
744
- const jsonWithoutSig = detachSignature(json);
745
849
  let activity = null;
746
850
  if (ldSigVerified) {
747
851
  logger.debug("Linked Data Signatures are verified.", {
748
852
  recipient,
749
853
  json
750
854
  });
751
- activity = await Activity.fromJsonLd(jsonWithoutSig, ctx);
855
+ try {
856
+ activity = await Activity.fromJsonLd(compactedJsonWithoutSig, {
857
+ ...ctx,
858
+ contextLoader: getNormalizationContextLoader(ctx.contextLoader)
859
+ });
860
+ } catch (error) {
861
+ if (error instanceof RangeError && await hasMalformedKnownTemporalLiteral(compactedJsonWithoutSig, ctx.contextLoader)) return await respondInvalidActivity(error);
862
+ if (!isPermanentActivityParseError(error)) throw error;
863
+ return await respondInvalidActivity(error);
864
+ }
752
865
  } else {
753
866
  logger.debug("Linked Data Signatures are not verified.", {
754
867
  recipient,
@@ -756,12 +869,21 @@ async function handleInboxInternal(request, parameters, span) {
756
869
  });
757
870
  try {
758
871
  activity = await verifyObject(Activity, jsonWithoutSig, {
759
- contextLoader: ctx.contextLoader,
872
+ contextLoader: wrapContextLoaderForJsonLd(ctx.contextLoader),
760
873
  documentLoader: ctx.documentLoader,
761
874
  keyCache,
762
875
  tracerProvider
763
876
  });
764
877
  } catch (error) {
878
+ if (error instanceof RangeError && await hasMalformedKnownTemporalLiteral(jsonWithoutSig, ctx.contextLoader)) return await respondInvalidActivity(error);
879
+ if (deferredLdSignatureError != null) {
880
+ logger.debug("Object Integrity Proof fallback did not supersede a deferred Linked Data Signature failure:\n{error}", {
881
+ recipient,
882
+ error
883
+ });
884
+ activity = null;
885
+ }
886
+ if (!isPermanentActivityParseError(error)) throw error;
765
887
  logger.error("Failed to parse activity:\n{error}", {
766
888
  recipient,
767
889
  activity: json,
@@ -805,6 +927,7 @@ async function handleInboxInternal(request, parameters, span) {
805
927
  tracerProvider
806
928
  });
807
929
  if (key == null) {
930
+ if (deferredLdSignatureError != null) throw deferredLdSignatureError;
808
931
  logger.error("Failed to verify the request's HTTP Signatures.", { recipient });
809
932
  span.setStatus({
810
933
  code: SpanStatusCode.ERROR,
@@ -817,11 +940,20 @@ async function handleInboxInternal(request, parameters, span) {
817
940
  } else logger.debug("HTTP Signatures are verified.", { recipient });
818
941
  httpSigKey = key;
819
942
  }
820
- activity = await Activity.fromJsonLd(jsonWithoutSig, ctx);
943
+ try {
944
+ activity = await Activity.fromJsonLd(jsonWithoutSig, {
945
+ ...ctx,
946
+ contextLoader: wrapContextLoaderForJsonLd(ctx.contextLoader)
947
+ });
948
+ } catch (error) {
949
+ if (!isPermanentActivityParseError(error)) throw error;
950
+ return await respondInvalidActivity(error);
951
+ }
821
952
  }
822
953
  if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
823
954
  span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
824
955
  if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
956
+ if (deferredLdSignatureError != null) throw deferredLdSignatureError;
825
957
  logger.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
826
958
  activity: json,
827
959
  recipient,
@@ -840,10 +972,14 @@ async function handleInboxInternal(request, parameters, span) {
840
972
  const routeResult = await routeActivity({
841
973
  context: ctx,
842
974
  json,
975
+ originalJson: json,
976
+ normalizedActivity: hasLdSignature && compactedJson !== json ? compactedJson : void 0,
977
+ ldSignatureVerified: hasLdSignature ? ldSigVerified : void 0,
843
978
  activity,
844
979
  recipient,
845
980
  inboxListeners,
846
981
  inboxContextFactory,
982
+ listenerInboxContextFactory: ldSigVerified ? inboxContextFactory[rawInboxContextFactorySymbol] : void 0,
847
983
  inboxErrorHandler,
848
984
  kv,
849
985
  kvPrefixes,
@@ -1343,6 +1479,18 @@ async function respondWithObjectIfAcceptable(object, request, options) {
1343
1479
  }
1344
1480
  //#endregion
1345
1481
  //#region src/federation/middleware.ts
1482
+ function isRemoteContextLoadingFailure(error) {
1483
+ return error instanceof Error && typeof error.details === "object" && error.details != null && error.details.code === "loading remote context failed";
1484
+ }
1485
+ function isPermanentRemoteContextError(error) {
1486
+ if (!(error instanceof Error) || error.name !== "jsonld.InvalidUrl") return false;
1487
+ const details = error.details;
1488
+ if (details?.code === "invalid remote context") return true;
1489
+ return isRemoteContextLoadingFailure(error) && typeof details?.url === "string" && !URL.canParse(details.url) && isClearlyMalformedContextReference(details.url);
1490
+ }
1491
+ function isPermanentInboxParseError(error) {
1492
+ return error instanceof Error && (error.name === "UnsafeJsonLdError" || error instanceof InvalidContextReferenceError || isPermanentRemoteContextError(error) || error.name === "jsonld.SyntaxError" && !isRemoteContextLoadingFailure(error)) || error instanceof TypeError && (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:)/.test(error.message) || isInvalidUrlTypeError(error));
1493
+ }
1346
1494
  /**
1347
1495
  * Create a new {@link Federation} instance.
1348
1496
  * @param parameters Parameters for initializing the instance.
@@ -1674,7 +1822,7 @@ var FederationImpl = class extends FederationBuilderImpl {
1674
1822
  }
1675
1823
  logger.info("Successfully sent activity {activityId} to {inbox}.", { ...logData });
1676
1824
  }
1677
- async #listenInboxMessage(ctxData, message, span) {
1825
+ async #listenInboxMessage(ctxData, message, _span) {
1678
1826
  const logger = getLogger([
1679
1827
  "fedify",
1680
1828
  "federation",
@@ -1687,60 +1835,28 @@ var FederationImpl = class extends FederationBuilderImpl {
1687
1835
  const identity = await this.sharedInboxKeyDispatcher(context);
1688
1836
  if (identity != null) context = this.#createContext(baseUrl, ctxData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context.getDocumentLoader(identity) : context.getDocumentLoader(identity) });
1689
1837
  }
1690
- const activity = await Activity.fromJsonLd(message.activity, context);
1691
- span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
1692
- if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
1693
- const cacheKey = activity.id == null ? null : [
1694
- ...this.kvPrefixes.activityIdempotence,
1695
- context.origin,
1696
- activity.id.href
1697
- ];
1698
- if (cacheKey != null) {
1699
- if (await this.kv.get(cacheKey) === true) {
1700
- logger.debug("Activity {activityId} has already been processed.", {
1701
- activityId: activity.id?.href,
1702
- activity: message.activity,
1703
- recipient: message.identifier
1704
- });
1705
- return;
1706
- }
1707
- }
1708
1838
  await this._getTracer().startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span) => {
1709
- const dispatched = this.inboxListeners?.dispatchWithClass(activity);
1710
- if (dispatched == null) {
1711
- logger.error("Unsupported activity type:\n{activity}", {
1712
- activityId: activity.id?.href,
1713
- activity: message.activity,
1714
- recipient: message.identifier,
1715
- trial: message.attempt
1716
- });
1717
- span.setStatus({
1718
- code: SpanStatusCode.ERROR,
1719
- message: `Unsupported activity type: ${getTypeId(activity).href}`
1720
- });
1721
- span.end();
1722
- return;
1723
- }
1724
- const { class: cls, listener } = dispatched;
1725
- span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
1726
- try {
1727
- await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, getTypeId(activity).href), activity);
1728
- } catch (error) {
1839
+ let activity = null;
1840
+ let cacheKey = null;
1841
+ const reportInboxError = async (error) => {
1729
1842
  try {
1730
1843
  await this.inboxErrorHandler?.(context, error);
1731
1844
  } catch (error) {
1732
1845
  logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
1733
1846
  error,
1734
1847
  trial: message.attempt,
1735
- activityId: activity.id?.href,
1848
+ activityId: activity?.id?.href,
1736
1849
  activity: message.activity,
1737
1850
  recipient: message.identifier
1738
1851
  });
1739
1852
  }
1853
+ };
1854
+ const handleRetriableFailure = async (error) => {
1855
+ await reportInboxError(error);
1740
1856
  if (this.inboxQueue?.nativeRetrial) {
1741
1857
  logger.error("Failed to process the incoming activity {activityId}; backend will handle retry:\n{error}", {
1742
1858
  error,
1743
- activityId: activity.id?.href,
1859
+ activityId: activity?.id?.href,
1744
1860
  activity: message.activity,
1745
1861
  recipient: message.identifier
1746
1862
  });
@@ -1759,17 +1875,25 @@ var FederationImpl = class extends FederationBuilderImpl {
1759
1875
  logger.error("Failed to process the incoming activity {activityId} (attempt #{attempt}); retry...:\n{error}", {
1760
1876
  error,
1761
1877
  attempt: message.attempt,
1762
- activityId: activity.id?.href,
1878
+ activityId: activity?.id?.href,
1763
1879
  activity: message.activity,
1764
1880
  recipient: message.identifier
1765
1881
  });
1882
+ if (this.inboxQueue == null) {
1883
+ span.setStatus({
1884
+ code: SpanStatusCode.ERROR,
1885
+ message: String(error)
1886
+ });
1887
+ span.end();
1888
+ throw error;
1889
+ }
1766
1890
  await this.inboxQueue?.enqueue({
1767
1891
  ...message,
1768
1892
  attempt: message.attempt + 1
1769
1893
  }, { delay: Temporal.Duration.compare(delay, { seconds: 0 }) < 0 ? Temporal.Duration.from({ seconds: 0 }) : delay });
1770
1894
  } else logger.error("Failed to process the incoming activity {activityId} after {trial} attempts; giving up:\n{error}", {
1771
1895
  error,
1772
- activityId: activity.id?.href,
1896
+ activityId: activity?.id?.href,
1773
1897
  activity: message.activity,
1774
1898
  recipient: message.identifier
1775
1899
  });
@@ -1778,11 +1902,108 @@ var FederationImpl = class extends FederationBuilderImpl {
1778
1902
  message: String(error)
1779
1903
  });
1780
1904
  span.end();
1905
+ };
1906
+ let dispatched;
1907
+ let parseInput = void 0;
1908
+ let parseContextLoader = context.contextLoader;
1909
+ try {
1910
+ const hasSignatureField = hasSignature(message.activity);
1911
+ const shouldParseFromNormalizedSignedPayload = message.ldSignatureVerified === true || message.normalizedActivity != null || message.ldSignatureVerified == null && hasSignatureField;
1912
+ const parseContext = hasSignatureField ? {
1913
+ ...context,
1914
+ contextLoader: getNormalizationContextLoader(context.contextLoader)
1915
+ } : {
1916
+ ...context,
1917
+ contextLoader: wrapContextLoaderForJsonLd(context.contextLoader)
1918
+ };
1919
+ parseContextLoader = parseContext.contextLoader;
1920
+ let normalizedActivity;
1921
+ if (shouldParseFromNormalizedSignedPayload) {
1922
+ normalizedActivity = message.normalizedActivity ?? await compactJsonLd(message.activity, context.contextLoader);
1923
+ assertSafeJsonLd(normalizedActivity);
1924
+ }
1925
+ parseInput = shouldParseFromNormalizedSignedPayload ? detachSignature(normalizedActivity) : hasSignatureField ? detachSignature(message.activity) : message.activity;
1926
+ activity = await Activity.fromJsonLd(parseInput, parseContext);
1927
+ span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
1928
+ if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
1929
+ cacheKey = activity.id == null ? null : [
1930
+ ...this.kvPrefixes.activityIdempotence,
1931
+ context.origin,
1932
+ activity.id.href
1933
+ ];
1934
+ if (cacheKey != null) {
1935
+ if (await this.kv.get(cacheKey) === true) {
1936
+ logger.debug("Activity {activityId} has already been processed.", {
1937
+ activityId: activity.id?.href,
1938
+ activity: message.activity,
1939
+ recipient: message.identifier
1940
+ });
1941
+ span.end();
1942
+ return;
1943
+ }
1944
+ }
1945
+ dispatched = this.inboxListeners?.dispatchWithClass(activity);
1946
+ } catch (error) {
1947
+ if (activity == null && error instanceof RangeError && await hasMalformedKnownTemporalLiteral(parseInput, parseContextLoader)) {
1948
+ await reportInboxError(error);
1949
+ logger.error("Failed to parse the queued incoming activity {activityId}:\n{error}", {
1950
+ error,
1951
+ trial: message.attempt,
1952
+ activityId: null,
1953
+ activity: message.activity,
1954
+ recipient: message.identifier
1955
+ });
1956
+ span.setStatus({
1957
+ code: SpanStatusCode.ERROR,
1958
+ message: String(error)
1959
+ });
1960
+ span.end();
1961
+ return;
1962
+ }
1963
+ if (isPermanentInboxParseError(error)) {
1964
+ await reportInboxError(error);
1965
+ logger.error("Failed to parse the queued incoming activity {activityId}:\n{error}", {
1966
+ error,
1967
+ trial: message.attempt,
1968
+ activityId: activity?.id?.href,
1969
+ activity: message.activity,
1970
+ recipient: message.identifier
1971
+ });
1972
+ span.setStatus({
1973
+ code: SpanStatusCode.ERROR,
1974
+ message: String(error)
1975
+ });
1976
+ span.end();
1977
+ return;
1978
+ }
1979
+ await handleRetriableFailure(error);
1980
+ return;
1981
+ }
1982
+ if (dispatched == null) {
1983
+ logger.error("Unsupported activity type:\n{activity}", {
1984
+ activityId: activity.id?.href,
1985
+ activity: message.activity,
1986
+ recipient: message.identifier,
1987
+ trial: message.attempt
1988
+ });
1989
+ span.setStatus({
1990
+ code: SpanStatusCode.ERROR,
1991
+ message: `Unsupported activity type: ${getTypeId(activity).href}`
1992
+ });
1993
+ span.end();
1994
+ return;
1995
+ }
1996
+ const { class: cls, listener } = dispatched;
1997
+ span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
1998
+ try {
1999
+ await listener(context.toInboxContext(message.identifier, message.activity, activity.id?.href, getTypeId(activity).href), activity);
2000
+ } catch (error) {
2001
+ await handleRetriableFailure(error);
1781
2002
  return;
1782
2003
  }
1783
2004
  if (cacheKey != null) await this.kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
1784
2005
  logger.info("Activity {activityId} has been processed.", {
1785
- activityId: activity.id?.href,
2006
+ activityId: activity?.id?.href,
1786
2007
  activity: message.activity,
1787
2008
  recipient: message.identifier
1788
2009
  });
@@ -2104,16 +2325,18 @@ var FederationImpl = class extends FederationBuilderImpl {
2104
2325
  onNotAcceptable
2105
2326
  });
2106
2327
  context = this.#createContext(request, contextData, { documentLoader: await context.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
2107
- case "sharedInbox":
2328
+ case "sharedInbox": {
2108
2329
  if (routeName !== "inbox" && this.sharedInboxKeyDispatcher != null) {
2109
2330
  const identity = await this.sharedInboxKeyDispatcher(context);
2110
2331
  if (identity != null) context = this.#createContext(request, contextData, { documentLoader: "identifier" in identity || "username" in identity || "handle" in identity ? await context.getDocumentLoader(identity) : context.getDocumentLoader(identity) });
2111
2332
  }
2112
2333
  if (!this.manuallyStartQueue) this._startQueueInternal(contextData);
2334
+ const inboxContextFactory = context.toInboxContext.bind(context);
2335
+ inboxContextFactory[rawInboxContextFactorySymbol] = context.toInboxContext.bind(context);
2113
2336
  return await handleInbox(request, {
2114
2337
  recipient: route.values.identifier ?? route.values.handle ?? null,
2115
2338
  context,
2116
- inboxContextFactory: context.toInboxContext.bind(context),
2339
+ inboxContextFactory,
2117
2340
  kv: this.kv,
2118
2341
  kvPrefixes: this.kvPrefixes,
2119
2342
  queue: this.inboxQueue,
@@ -2126,6 +2349,7 @@ var FederationImpl = class extends FederationBuilderImpl {
2126
2349
  tracerProvider: this.tracerProvider,
2127
2350
  idempotencyStrategy: this.idempotencyStrategy
2128
2351
  });
2352
+ }
2129
2353
  case "following": return await handleCollection(request, {
2130
2354
  name: "following",
2131
2355
  identifier: route.values.identifier ?? route.values.handle,
@@ -2876,6 +3100,7 @@ var ContextImpl = class ContextImpl {
2876
3100
  const routeResult = await routeActivity({
2877
3101
  context: this,
2878
3102
  json,
3103
+ ldSignatureVerified: false,
2879
3104
  activity,
2880
3105
  recipient,
2881
3106
  inboxListeners: this.federation.inboxListeners,
@@ -2974,6 +3199,14 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
2974
3199
  };
2975
3200
  var InboxContextImpl = class InboxContextImpl extends ContextImpl {
2976
3201
  recipient;
3202
+ /**
3203
+ * The original received activity payload.
3204
+ *
3205
+ * Fedify may normalize a Linked Data Signature payload internally for safe
3206
+ * parsing, but forwarding must keep the sender's payload unchanged so
3207
+ * third-party signatures/proofs remain intact.
3208
+ * @internal
3209
+ */
2977
3210
  activity;
2978
3211
  activityId;
2979
3212
  activityType;
@@ -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-DT1q8p2_.mjs";
4
+ import { n as FederationImpl } from "./middleware-ScXtn6SX.mjs";
5
5
  export { FederationImpl };
package/dist/mod.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_docloader = require("./docloader-L_Yv0SO1.cjs");
5
- const require_transformers = require("./transformers-BZ3mYJ1P.cjs");
4
+ const require_docloader = require("./docloader-ojCZeNsS.cjs");
5
+ const require_transformers = require("./transformers-ZXV8xoFH.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_actor = require("./actor-CGzgm5oD.cjs");
8
- const require_middleware = require("./middleware-DwelHV2a.cjs");
9
- const require_lookup = require("./lookup-BZCRNz7r.cjs");
10
- const require_key = require("./key-DL1K1oFv.cjs");
11
- const require_http = require("./http-ChxLPxfJ.cjs");
12
- const require_proof = require("./proof-DOwB_RsW.cjs");
13
- const require_types = require("./types-DXy2Djgl.cjs");
14
- const require_authdocloader = require("./authdocloader-C0oFDv-u.cjs");
7
+ const require_actor = require("./actor-BxUB2vBw.cjs");
8
+ const require_middleware = require("./middleware-BxPRXIp2.cjs");
9
+ const require_lookup = require("./lookup-DrAw0WK4.cjs");
10
+ const require_key = require("./key-AD7NWK_B.cjs");
11
+ const require_http = require("./http-B7su-Fmy.cjs");
12
+ const require_proof = require("./proof-CpHpOx4z.cjs");
13
+ const require_types = require("./types-kNVIK9BX.cjs");
14
+ const require_authdocloader = require("./authdocloader-BkG-kREl.cjs");
15
15
  const require_vocab_mod = require("./vocab/mod.cjs");
16
16
  const require_federation_mod = require("./federation/mod.cjs");
17
17
  require("./nodeinfo/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -7,7 +7,7 @@ import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryp
7
7
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-_rFs0ik_.cjs";
8
8
  import { a as toAcctUrl, c as TraverseCollectionOptions, i as parseFediverseHandle, l as lookupObject, n as FediverseHandle, o as PUBLIC_COLLECTION, r as isFediverseHandle, s as LookupObjectOptions, t as getTypeId, u as traverseCollection } from "./mod-HElaq2UB.cjs";
9
9
  import { i as ResourceDescriptor, n as lookupWebFinger } from "./mod-DIMx6YjJ.cjs";
10
- import { $ as CustomCollectionCursor, A as createFederation, B as RouterRouteResult, C as InboxListenerSetters, D as FederationKvPrefixes, E as CreateFederationOptions, F as Message, G as ActorDispatcher, H as respondWithObject, I as createFederationBuilder, J as AuthorizePredicate, K as ActorHandleMapper, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as CustomCollectionCounter, R as RouterError, S as IdempotencyStrategy, T as Rfc6570Expression, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as FederationBuilder, a as InboxContext, at as ObjectDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as WebFingerLinksDispatcher, d as ActorCallbackSetters, dt as buildCollectionSynchronizationHeader, et as CustomCollectionDispatcher, f as CollectionCallbackSetters, ft as digest, g as Federation, h as Federatable, i as GetSignedKeyOptions, it as ObjectAuthorizePredicate, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as SenderKeyPair, m as CustomCollectionCallbackSetters, n as Context, nt as InboxListener, o as ParseUriResult, ot as OutboxErrorHandler, p as ConstructorWithTypeId, pt as ActivityTransformer, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as RequestContext, st as SharedInboxKeyDispatcher, t as ActorKeyPair, tt as InboxErrorHandler, u as SendActivityOptionsForCollection, ut as PageItems, v as FederationFetchOptions, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, z as RouterOptions } from "./context-Crmwowsw.cjs";
10
+ import { $ as CustomCollectionCursor, A as createFederation, B as RouterRouteResult, C as InboxListenerSetters, D as FederationKvPrefixes, E as CreateFederationOptions, F as Message, G as ActorDispatcher, H as respondWithObject, I as createFederationBuilder, J as AuthorizePredicate, K as ActorHandleMapper, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as CustomCollectionCounter, R as RouterError, S as IdempotencyStrategy, T as Rfc6570Expression, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as FederationBuilder, a as InboxContext, at as ObjectDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as WebFingerLinksDispatcher, d as ActorCallbackSetters, dt as buildCollectionSynchronizationHeader, et as CustomCollectionDispatcher, f as CollectionCallbackSetters, ft as digest, g as Federation, h as Federatable, i as GetSignedKeyOptions, it as ObjectAuthorizePredicate, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as SenderKeyPair, m as CustomCollectionCallbackSetters, n as Context, nt as InboxListener, o as ParseUriResult, ot as OutboxErrorHandler, p as ConstructorWithTypeId, pt as ActivityTransformer, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as RequestContext, st as SharedInboxKeyDispatcher, t as ActorKeyPair, tt as InboxErrorHandler, u as SendActivityOptionsForCollection, ut as PageItems, v as FederationFetchOptions, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, z as RouterOptions } from "./context-jX79cwCB.cjs";
11
11
  import { a as MessageQueueListenOptions, i as MessageQueueEnqueueOptions, n as InProcessMessageQueueOptions, o as ParallelMessageQueue, r as MessageQueue, t as InProcessMessageQueue } from "./mq-CrItclRD.cjs";
12
12
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
13
13
  import { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki } from "./runtime/mod.cjs";
package/dist/mod.d.ts CHANGED
@@ -9,7 +9,7 @@ import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryp
9
9
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DPAPnB0R.js";
10
10
  import { a as toAcctUrl, c as TraverseCollectionOptions, i as parseFediverseHandle, l as lookupObject, n as FediverseHandle, o as PUBLIC_COLLECTION, r as isFediverseHandle, s as LookupObjectOptions, t as getTypeId, u as traverseCollection } from "./mod-BSwc3_rD.js";
11
11
  import { i as ResourceDescriptor, n as lookupWebFinger } from "./mod-BTNpXcPj.js";
12
- import { $ as CustomCollectionCursor, A as createFederation, B as RouterRouteResult, C as InboxListenerSetters, D as FederationKvPrefixes, E as CreateFederationOptions, F as Message, G as ActorDispatcher, H as respondWithObject, I as createFederationBuilder, J as AuthorizePredicate, K as ActorHandleMapper, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as CustomCollectionCounter, R as RouterError, S as IdempotencyStrategy, T as Rfc6570Expression, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as FederationBuilder, a as InboxContext, at as ObjectDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as WebFingerLinksDispatcher, d as ActorCallbackSetters, dt as buildCollectionSynchronizationHeader, et as CustomCollectionDispatcher, f as CollectionCallbackSetters, ft as digest, g as Federation, h as Federatable, i as GetSignedKeyOptions, it as ObjectAuthorizePredicate, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as SenderKeyPair, m as CustomCollectionCallbackSetters, n as Context, nt as InboxListener, o as ParseUriResult, ot as OutboxErrorHandler, p as ConstructorWithTypeId, pt as ActivityTransformer, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as RequestContext, st as SharedInboxKeyDispatcher, t as ActorKeyPair, tt as InboxErrorHandler, u as SendActivityOptionsForCollection, ut as PageItems, v as FederationFetchOptions, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, z as RouterOptions } from "./context-Cf8s07xm.js";
12
+ import { $ as CustomCollectionCursor, A as createFederation, B as RouterRouteResult, C as InboxListenerSetters, D as FederationKvPrefixes, E as CreateFederationOptions, F as Message, G as ActorDispatcher, H as respondWithObject, I as createFederationBuilder, J as AuthorizePredicate, K as ActorHandleMapper, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as CustomCollectionCounter, R as RouterError, S as IdempotencyStrategy, T as Rfc6570Expression, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as FederationBuilder, a as InboxContext, at as ObjectDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as WebFingerLinksDispatcher, d as ActorCallbackSetters, dt as buildCollectionSynchronizationHeader, et as CustomCollectionDispatcher, f as CollectionCallbackSetters, ft as digest, g as Federation, h as Federatable, i as GetSignedKeyOptions, it as ObjectAuthorizePredicate, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as SenderKeyPair, m as CustomCollectionCallbackSetters, n as Context, nt as InboxListener, o as ParseUriResult, ot as OutboxErrorHandler, p as ConstructorWithTypeId, pt as ActivityTransformer, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as RequestContext, st as SharedInboxKeyDispatcher, t as ActorKeyPair, tt as InboxErrorHandler, u as SendActivityOptionsForCollection, ut as PageItems, v as FederationFetchOptions, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, z as RouterOptions } from "./context-CNkTuNIm.js";
13
13
  import { a as MessageQueueListenOptions, i as MessageQueueEnqueueOptions, n as InProcessMessageQueueOptions, o as ParallelMessageQueue, r as MessageQueue, t as InProcessMessageQueue } from "./mq-D_ZZRdby.js";
14
14
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
15
15
  import { GetAuthenticatedDocumentLoaderOptions, exportMultibaseKey, exportSpki, getAuthenticatedDocumentLoader, importMultibaseKey, importPem, importPkcs1, importSpki } from "./runtime/mod.js";