@fedify/fedify 1.10.3 → 1.10.5

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 (102) hide show
  1. package/dist/{actor-jvzet8bO.js → actor-CQdxP8N-.js} +187 -187
  2. package/dist/{actor-BdLqN1gg.js → actor-Ch9BTg3N.js} +1 -1
  3. package/dist/{actor-DOYpLAOc.cjs → actor-CjkHF7Cj.cjs} +187 -187
  4. package/dist/{authdocloader-CLAhEwIS.js → authdocloader-COFZT9Wh.js} +3 -3
  5. package/dist/{authdocloader-Ddqc8DWD.js → authdocloader-fR-Fqcpa.js} +3 -3
  6. package/dist/{authdocloader-B1zJPoS6.cjs → authdocloader-zc5ibOmU.cjs} +3 -3
  7. package/dist/{builder-4kTkpLYJ.js → builder-YD0q32nG.js} +4 -4
  8. package/dist/{client-BTEYHgMp.js → client-BgCucCG7.js} +1 -1
  9. package/dist/compat/transformers.test.js +16 -16
  10. package/dist/{docloader-BRNFZnTb.js → docloader-BETPdM09.js} +109 -13
  11. package/dist/{docloader-CNsCwkxG.cjs → docloader-irBWMSOZ.cjs} +109 -13
  12. package/dist/{esm-gCncx4Xn.js → esm-iGH0sRsE.js} +1 -1
  13. package/dist/federation/builder.test.js +5 -5
  14. package/dist/federation/collection.test.js +3 -3
  15. package/dist/federation/handler.test.js +17 -17
  16. package/dist/federation/idempotency.test.js +17 -17
  17. package/dist/federation/inbox.test.js +4 -4
  18. package/dist/federation/keycache.test.js +8 -4
  19. package/dist/federation/kv.test.js +3 -3
  20. package/dist/federation/middleware.test.js +18 -18
  21. package/dist/federation/mod.cjs +10 -10
  22. package/dist/federation/mod.js +10 -10
  23. package/dist/federation/mq.test.js +3 -3
  24. package/dist/federation/retry.test.js +3 -3
  25. package/dist/federation/router.test.js +3 -3
  26. package/dist/federation/send.test.js +10 -10
  27. package/dist/{http-CcPpEG46.cjs → http-CQAqR_vx.cjs} +18 -7
  28. package/dist/{http-DplZ1SHu.js → http-CxiIW4rD.js} +17 -6
  29. package/dist/{http-C3_5amY1.js → http-PgdBoDIj.js} +18 -7
  30. package/dist/{inbox-BxnmUryw.js → inbox-DcDIqTbR.js} +1 -1
  31. package/dist/{key-MUjY4i2E.js → key-Bnod5wJl.js} +4 -4
  32. package/dist/{key-Kt3kKq85.js → key-C6swTX71.js} +3 -3
  33. package/dist/{key-DrXt0cYP.js → key-Cg0kO4dA.js} +2 -2
  34. package/dist/{key-gldrk_5Z.js → key-I-ibyaZH.js} +2 -2
  35. package/dist/key-_Uq8gkmM.cjs +10 -0
  36. package/dist/{key-Cdysd1b9.cjs → key-dNFkodH5.cjs} +2 -2
  37. package/dist/{keycache-Cm9Ke5JM.js → keycache-hSs_XFSb.js} +11 -2
  38. package/dist/{keys-C6gRMT25.js → keys-CElJez9H.js} +1 -1
  39. package/dist/{ld-DzleVPgo.js → ld-b16r91YS.js} +2 -2
  40. package/dist/{lookup-4na242fe.cjs → lookup-Bfq9Jpm0.cjs} +1 -1
  41. package/dist/{lookup-CKEj5FWO.js → lookup-CiSAeWJl.js} +1 -1
  42. package/dist/{lookup-CyI7sF0p.js → lookup-CySNcNcC.js} +1 -1
  43. package/dist/middleware-BWsOtDIF.cjs +17 -0
  44. package/dist/middleware-Bm4bJzjg.js +26 -0
  45. package/dist/{middleware-BXUQTcBK.js → middleware-Bs4xDuXR.js} +20 -11
  46. package/dist/middleware-BvODpE_U.js +17 -0
  47. package/dist/{middleware-CmaZY01E.js → middleware-C5emnCh-.js} +13 -13
  48. package/dist/{middleware-xSPzx3UI.cjs → middleware-Dxo56yae.cjs} +20 -11
  49. package/dist/mod.cjs +10 -10
  50. package/dist/mod.js +10 -10
  51. package/dist/nodeinfo/client.test.js +5 -5
  52. package/dist/nodeinfo/handler.test.js +16 -16
  53. package/dist/nodeinfo/mod.cjs +2 -2
  54. package/dist/nodeinfo/mod.js +2 -2
  55. package/dist/nodeinfo/semver.test.js +3 -3
  56. package/dist/nodeinfo/types.test.js +3 -3
  57. package/dist/otel/exporter.test.js +3 -3
  58. package/dist/{owner-n8GJaHF9.js → owner-Bs-sPbHX.js} +2 -2
  59. package/dist/{proof-tEhbsByx.cjs → proof-BvQS195q.cjs} +3 -3
  60. package/dist/{proof-D7qegtQm.js → proof-SgRikE_Y.js} +2 -2
  61. package/dist/{proof-Bx8lj3_m.js → proof-flD2DeA-.js} +3 -3
  62. package/dist/runtime/authdocloader.test.js +9 -9
  63. package/dist/runtime/docloader.test.js +51 -4
  64. package/dist/runtime/key.test.js +5 -5
  65. package/dist/runtime/langstr.test.js +3 -3
  66. package/dist/runtime/link.test.js +3 -3
  67. package/dist/runtime/mod.cjs +6 -6
  68. package/dist/runtime/mod.js +6 -6
  69. package/dist/runtime/multibase/multibase.test.js +3 -3
  70. package/dist/runtime/url.test.js +3 -3
  71. package/dist/{send-CcNf5O--.js → send-C0gFHa2i.js} +2 -2
  72. package/dist/sig/http.test.js +51 -8
  73. package/dist/sig/key.test.js +6 -6
  74. package/dist/sig/ld.test.js +7 -7
  75. package/dist/sig/mod.cjs +6 -6
  76. package/dist/sig/mod.js +6 -6
  77. package/dist/sig/owner.test.js +7 -7
  78. package/dist/sig/proof.test.js +7 -7
  79. package/dist/testing/docloader.test.js +3 -3
  80. package/dist/testing/mod.js +3 -3
  81. package/dist/{testing-DoQEBY_a.js → testing-C1GIraJh.js} +2 -2
  82. package/dist/{type-BVpqRkFR.js → type-DUhon7qK.js} +294 -198
  83. package/dist/{types-oz5uR2vt.cjs → types-BgUCCngg.cjs} +1 -1
  84. package/dist/{types-BsFw6XaG.js → types-Bu-epI-z.js} +1 -1
  85. package/dist/vocab/actor.test.js +5 -5
  86. package/dist/vocab/lookup.test.js +4 -4
  87. package/dist/vocab/mod.cjs +4 -4
  88. package/dist/vocab/mod.js +4 -4
  89. package/dist/vocab/type.test.js +3 -3
  90. package/dist/vocab/vocab.test.js +4 -4
  91. package/dist/{vocab-i1kbdwbr.cjs → vocab-5i6DEIi6.cjs} +3 -3
  92. package/dist/{vocab-qsTMTRUj.js → vocab-CBavAdew.js} +3 -3
  93. package/dist/webfinger/handler.test.js +16 -16
  94. package/dist/webfinger/lookup.test.js +4 -4
  95. package/dist/webfinger/mod.cjs +2 -2
  96. package/dist/webfinger/mod.js +2 -2
  97. package/dist/x/cfworkers.test.js +3 -3
  98. package/package.json +1 -1
  99. package/dist/key-DLbxU2E5.cjs +0 -10
  100. package/dist/middleware-BNRSbI5u.js +0 -26
  101. package/dist/middleware-BSSmSsSS.cjs +0 -17
  102. package/dist/middleware-CiCT_xe3.js +0 -17
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-BVpqRkFR.js";
7
- import { validateCryptoKey } from "./key-DrXt0cYP.js";
8
- import { doubleKnock } from "./http-DplZ1SHu.js";
6
+ import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./type-DUhon7qK.js";
7
+ import { validateCryptoKey } from "./key-Cg0kO4dA.js";
8
+ import { doubleKnock } from "./http-CxiIW4rD.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
 
11
11
  //#region src/runtime/authdocloader.ts
@@ -2,9 +2,9 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-BRNFZnTb.js";
6
- import { validateCryptoKey } from "./key-gldrk_5Z.js";
7
- import { doubleKnock } from "./http-C3_5amY1.js";
5
+ import { UrlError, createRequest, getRemoteDocument, logRequest, validatePublicUrl } from "./docloader-BETPdM09.js";
6
+ import { validateCryptoKey } from "./key-I-ibyaZH.js";
7
+ import { doubleKnock } from "./http-PgdBoDIj.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
 
10
10
  //#region src/runtime/authdocloader.ts
@@ -3,9 +3,9 @@
3
3
  const { URLPattern } = require("urlpattern-polyfill");
4
4
 
5
5
  const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
- const require_docloader = require('./docloader-CNsCwkxG.cjs');
7
- const require_key = require('./key-Cdysd1b9.cjs');
8
- const require_http = require('./http-CcPpEG46.cjs');
6
+ const require_docloader = require('./docloader-irBWMSOZ.cjs');
7
+ const require_key = require('./key-dNFkodH5.cjs');
8
+ const require_http = require('./http-CQAqR_vx.cjs');
9
9
  const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
10
10
 
11
11
  //#region src/runtime/authdocloader.ts
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getTypeId } from "./type-BVpqRkFR.js";
7
- import { Router, RouterError } from "./lookup-CyI7sF0p.js";
8
- import { InboxListenerSet } from "./inbox-BxnmUryw.js";
6
+ import { deno_default, getTypeId } from "./type-DUhon7qK.js";
7
+ import { Router, RouterError } from "./lookup-CySNcNcC.js";
8
+ import { InboxListenerSet } from "./inbox-DcDIqTbR.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
11
11
 
@@ -43,7 +43,7 @@ var FederationBuilderImpl = class {
43
43
  this.collectionTypeIds = {};
44
44
  }
45
45
  async build(options) {
46
- const { FederationImpl } = await import("./middleware-BNRSbI5u.js");
46
+ const { FederationImpl } = await import("./middleware-Bm4bJzjg.js");
47
47
  const f = new FederationImpl(options);
48
48
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
49
49
  f.router = this.router.clone();
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { getUserAgent } from "./type-BVpqRkFR.js";
6
+ import { getUserAgent } from "./type-DUhon7qK.js";
7
7
  import { parseSemVer } from "./semver-dArNLkR9.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
 
@@ -3,30 +3,30 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Follow, Person } from "../type-BVpqRkFR.js";
6
+ import { Follow, Person } from "../type-DUhon7qK.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
- import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-CmaZY01E.js";
11
+ import { FederationImpl, actorDehydrator, autoIdAssigner } from "../middleware-C5emnCh-.js";
12
12
  import "../semver-dArNLkR9.js";
13
- import "../client-BTEYHgMp.js";
14
- import "../lookup-CyI7sF0p.js";
13
+ import "../client-BgCucCG7.js";
14
+ import "../lookup-CySNcNcC.js";
15
15
  import "../types-BIgY6c-l.js";
16
- import "../actor-BdLqN1gg.js";
17
- import "../key-DrXt0cYP.js";
18
- import "../http-DplZ1SHu.js";
19
- import "../authdocloader-CLAhEwIS.js";
20
- import "../ld-DzleVPgo.js";
21
- import "../owner-n8GJaHF9.js";
22
- import "../proof-D7qegtQm.js";
23
- import "../inbox-BxnmUryw.js";
24
- import "../builder-4kTkpLYJ.js";
16
+ import "../actor-Ch9BTg3N.js";
17
+ import "../key-Cg0kO4dA.js";
18
+ import "../http-CxiIW4rD.js";
19
+ import "../authdocloader-COFZT9Wh.js";
20
+ import "../ld-b16r91YS.js";
21
+ import "../owner-Bs-sPbHX.js";
22
+ import "../proof-SgRikE_Y.js";
23
+ import "../inbox-DcDIqTbR.js";
24
+ import "../builder-YD0q32nG.js";
25
25
  import "../collection-CSzG2j1P.js";
26
- import "../keycache-Cm9Ke5JM.js";
26
+ import "../keycache-hSs_XFSb.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-CcNf5O--.js";
29
- import { test } from "../testing-DoQEBY_a.js";
28
+ import "../send-C0gFHa2i.js";
29
+ import { test } from "../testing-C1GIraJh.js";
30
30
 
31
31
  //#region src/compat/transformers.test.ts
32
32
  const federation = new FederationImpl({ kv: new MemoryKvStore() });
@@ -10,7 +10,7 @@ import { isIP } from "node:net";
10
10
 
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "1.10.3";
13
+ var version = "1.10.5";
14
14
  var license = "MIT";
15
15
  var exports = {
16
16
  ".": "./src/mod.ts",
@@ -663,6 +663,85 @@ const preloadedContexts = {
663
663
  }
664
664
  }
665
665
  } },
666
+ "https://w3id.org/security/data-integrity/v2": { "@context": {
667
+ "id": "@id",
668
+ "type": "@type",
669
+ "@protected": true,
670
+ "proof": {
671
+ "@id": "https://w3id.org/security#proof",
672
+ "@type": "@id",
673
+ "@container": "@graph"
674
+ },
675
+ "DataIntegrityProof": {
676
+ "@id": "https://w3id.org/security#DataIntegrityProof",
677
+ "@context": {
678
+ "@protected": true,
679
+ "id": "@id",
680
+ "type": "@type",
681
+ "challenge": "https://w3id.org/security#challenge",
682
+ "created": {
683
+ "@id": "http://purl.org/dc/terms/created",
684
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
685
+ },
686
+ "domain": "https://w3id.org/security#domain",
687
+ "expires": {
688
+ "@id": "https://w3id.org/security#expiration",
689
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
690
+ },
691
+ "nonce": "https://w3id.org/security#nonce",
692
+ "previousProof": {
693
+ "@id": "https://w3id.org/security#previousProof",
694
+ "@type": "@id"
695
+ },
696
+ "proofPurpose": {
697
+ "@id": "https://w3id.org/security#proofPurpose",
698
+ "@type": "@vocab",
699
+ "@context": {
700
+ "@protected": true,
701
+ "id": "@id",
702
+ "type": "@type",
703
+ "assertionMethod": {
704
+ "@id": "https://w3id.org/security#assertionMethod",
705
+ "@type": "@id",
706
+ "@container": "@set"
707
+ },
708
+ "authentication": {
709
+ "@id": "https://w3id.org/security#authenticationMethod",
710
+ "@type": "@id",
711
+ "@container": "@set"
712
+ },
713
+ "capabilityInvocation": {
714
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
715
+ "@type": "@id",
716
+ "@container": "@set"
717
+ },
718
+ "capabilityDelegation": {
719
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
720
+ "@type": "@id",
721
+ "@container": "@set"
722
+ },
723
+ "keyAgreement": {
724
+ "@id": "https://w3id.org/security#keyAgreementMethod",
725
+ "@type": "@id",
726
+ "@container": "@set"
727
+ }
728
+ }
729
+ },
730
+ "cryptosuite": {
731
+ "@id": "https://w3id.org/security#cryptosuite",
732
+ "@type": "https://w3id.org/security#cryptosuiteString"
733
+ },
734
+ "proofValue": {
735
+ "@id": "https://w3id.org/security#proofValue",
736
+ "@type": "https://w3id.org/security#multibase"
737
+ },
738
+ "verificationMethod": {
739
+ "@id": "https://w3id.org/security#verificationMethod",
740
+ "@type": "@id"
741
+ }
742
+ }
743
+ }
744
+ } },
666
745
  "https://www.w3.org/ns/did/v1": { "@context": {
667
746
  "@protected": true,
668
747
  "id": "@id",
@@ -4528,6 +4607,7 @@ const logger = getLogger([
4528
4607
  "runtime",
4529
4608
  "docloader"
4530
4609
  ]);
4610
+ const DEFAULT_MAX_REDIRECTION = 20;
4531
4611
  /**
4532
4612
  * Error thrown when fetching a JSON-LD document failed.
4533
4613
  */
@@ -4694,31 +4774,33 @@ async function getRemoteDocument(url, response, fetch$1) {
4694
4774
  function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAgent } = {}) {
4695
4775
  const tracerProvider = trace.getTracerProvider();
4696
4776
  const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
4697
- async function load(url, options) {
4777
+ async function load(url, options, redirected = 0, visited = /* @__PURE__ */ new Set()) {
4698
4778
  options?.signal?.throwIfAborted();
4699
- if (!skipPreloadedContexts && url in contexts_default) {
4700
- logger.debug("Using preloaded context: {url}.", { url });
4779
+ const currentUrl = new URL(url).href;
4780
+ if (!skipPreloadedContexts && currentUrl in contexts_default) {
4781
+ logger.debug("Using preloaded context: {url}.", { url: currentUrl });
4701
4782
  return {
4702
4783
  contextUrl: null,
4703
- document: contexts_default[url],
4704
- documentUrl: url
4784
+ document: contexts_default[currentUrl],
4785
+ documentUrl: currentUrl
4705
4786
  };
4706
4787
  }
4707
4788
  if (!allowPrivateAddress) try {
4708
- await validatePublicUrl(url);
4789
+ await validatePublicUrl(currentUrl);
4709
4790
  } catch (error) {
4710
4791
  if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
4711
- url,
4792
+ url: currentUrl,
4712
4793
  error
4713
4794
  });
4714
4795
  throw error;
4715
4796
  }
4797
+ visited.add(currentUrl);
4716
4798
  return await tracer.startActiveSpan("activitypub.fetch_document", {
4717
4799
  kind: SpanKind.CLIENT,
4718
- attributes: { "url.full": url }
4800
+ attributes: { "url.full": currentUrl }
4719
4801
  }, async (span) => {
4720
4802
  try {
4721
- const request = createRequest(url, { userAgent });
4803
+ const request = createRequest(currentUrl, { userAgent });
4722
4804
  logRequest(request);
4723
4805
  const response = await fetch(request, {
4724
4806
  redirect: "manual",
@@ -4726,11 +4808,25 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
4726
4808
  });
4727
4809
  span.setAttribute("http.response.status_code", response.status);
4728
4810
  if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
4729
- const redirectUrl = response.headers.get("Location");
4811
+ if (redirected >= DEFAULT_MAX_REDIRECTION) {
4812
+ logger.error("Too many redirections ({redirections}) while fetching document.", {
4813
+ redirections: redirected + 1,
4814
+ url: currentUrl
4815
+ });
4816
+ throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
4817
+ }
4818
+ const redirectUrl = new URL(response.headers.get("Location"), response.url === "" ? currentUrl : response.url).href;
4730
4819
  span.setAttribute("http.redirect.url", redirectUrl);
4731
- return await load(redirectUrl, options);
4820
+ if (visited.has(redirectUrl)) {
4821
+ logger.error("Detected a redirect loop while fetching document: {url} -> {redirectUrl}", {
4822
+ url: currentUrl,
4823
+ redirectUrl
4824
+ });
4825
+ throw new FetchError(currentUrl, `Redirect loop detected: ${redirectUrl}`);
4826
+ }
4827
+ return await load(redirectUrl, options, redirected + 1, visited);
4732
4828
  }
4733
- const result = await getRemoteDocument(url, response, load);
4829
+ const result = await getRemoteDocument(currentUrl, response, load);
4734
4830
  span.setAttribute("docloader.document_url", result.documentUrl);
4735
4831
  if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
4736
4832
  return result;
@@ -11,7 +11,7 @@ const node_net = require_chunk.__toESM(require("node:net"));
11
11
 
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "1.10.3";
14
+ var version = "1.10.5";
15
15
  var license = "MIT";
16
16
  var exports$1 = {
17
17
  ".": "./src/mod.ts",
@@ -664,6 +664,85 @@ const preloadedContexts = {
664
664
  }
665
665
  }
666
666
  } },
667
+ "https://w3id.org/security/data-integrity/v2": { "@context": {
668
+ "id": "@id",
669
+ "type": "@type",
670
+ "@protected": true,
671
+ "proof": {
672
+ "@id": "https://w3id.org/security#proof",
673
+ "@type": "@id",
674
+ "@container": "@graph"
675
+ },
676
+ "DataIntegrityProof": {
677
+ "@id": "https://w3id.org/security#DataIntegrityProof",
678
+ "@context": {
679
+ "@protected": true,
680
+ "id": "@id",
681
+ "type": "@type",
682
+ "challenge": "https://w3id.org/security#challenge",
683
+ "created": {
684
+ "@id": "http://purl.org/dc/terms/created",
685
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
686
+ },
687
+ "domain": "https://w3id.org/security#domain",
688
+ "expires": {
689
+ "@id": "https://w3id.org/security#expiration",
690
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
691
+ },
692
+ "nonce": "https://w3id.org/security#nonce",
693
+ "previousProof": {
694
+ "@id": "https://w3id.org/security#previousProof",
695
+ "@type": "@id"
696
+ },
697
+ "proofPurpose": {
698
+ "@id": "https://w3id.org/security#proofPurpose",
699
+ "@type": "@vocab",
700
+ "@context": {
701
+ "@protected": true,
702
+ "id": "@id",
703
+ "type": "@type",
704
+ "assertionMethod": {
705
+ "@id": "https://w3id.org/security#assertionMethod",
706
+ "@type": "@id",
707
+ "@container": "@set"
708
+ },
709
+ "authentication": {
710
+ "@id": "https://w3id.org/security#authenticationMethod",
711
+ "@type": "@id",
712
+ "@container": "@set"
713
+ },
714
+ "capabilityInvocation": {
715
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
716
+ "@type": "@id",
717
+ "@container": "@set"
718
+ },
719
+ "capabilityDelegation": {
720
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
721
+ "@type": "@id",
722
+ "@container": "@set"
723
+ },
724
+ "keyAgreement": {
725
+ "@id": "https://w3id.org/security#keyAgreementMethod",
726
+ "@type": "@id",
727
+ "@container": "@set"
728
+ }
729
+ }
730
+ },
731
+ "cryptosuite": {
732
+ "@id": "https://w3id.org/security#cryptosuite",
733
+ "@type": "https://w3id.org/security#cryptosuiteString"
734
+ },
735
+ "proofValue": {
736
+ "@id": "https://w3id.org/security#proofValue",
737
+ "@type": "https://w3id.org/security#multibase"
738
+ },
739
+ "verificationMethod": {
740
+ "@id": "https://w3id.org/security#verificationMethod",
741
+ "@type": "@id"
742
+ }
743
+ }
744
+ }
745
+ } },
667
746
  "https://www.w3.org/ns/did/v1": { "@context": {
668
747
  "@protected": true,
669
748
  "id": "@id",
@@ -4529,6 +4608,7 @@ const logger = (0, __logtape_logtape.getLogger)([
4529
4608
  "runtime",
4530
4609
  "docloader"
4531
4610
  ]);
4611
+ const DEFAULT_MAX_REDIRECTION = 20;
4532
4612
  /**
4533
4613
  * Error thrown when fetching a JSON-LD document failed.
4534
4614
  */
@@ -4695,31 +4775,33 @@ async function getRemoteDocument(url, response, fetch$1) {
4695
4775
  function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAgent } = {}) {
4696
4776
  const tracerProvider = __opentelemetry_api.trace.getTracerProvider();
4697
4777
  const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
4698
- async function load(url, options) {
4778
+ async function load(url, options, redirected = 0, visited = /* @__PURE__ */ new Set()) {
4699
4779
  options?.signal?.throwIfAborted();
4700
- if (!skipPreloadedContexts && url in contexts_default) {
4701
- logger.debug("Using preloaded context: {url}.", { url });
4780
+ const currentUrl = new URL(url).href;
4781
+ if (!skipPreloadedContexts && currentUrl in contexts_default) {
4782
+ logger.debug("Using preloaded context: {url}.", { url: currentUrl });
4702
4783
  return {
4703
4784
  contextUrl: null,
4704
- document: contexts_default[url],
4705
- documentUrl: url
4785
+ document: contexts_default[currentUrl],
4786
+ documentUrl: currentUrl
4706
4787
  };
4707
4788
  }
4708
4789
  if (!allowPrivateAddress) try {
4709
- await validatePublicUrl(url);
4790
+ await validatePublicUrl(currentUrl);
4710
4791
  } catch (error) {
4711
4792
  if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
4712
- url,
4793
+ url: currentUrl,
4713
4794
  error
4714
4795
  });
4715
4796
  throw error;
4716
4797
  }
4798
+ visited.add(currentUrl);
4717
4799
  return await tracer.startActiveSpan("activitypub.fetch_document", {
4718
4800
  kind: __opentelemetry_api.SpanKind.CLIENT,
4719
- attributes: { "url.full": url }
4801
+ attributes: { "url.full": currentUrl }
4720
4802
  }, async (span) => {
4721
4803
  try {
4722
- const request = createRequest(url, { userAgent });
4804
+ const request = createRequest(currentUrl, { userAgent });
4723
4805
  logRequest(request);
4724
4806
  const response = await fetch(request, {
4725
4807
  redirect: "manual",
@@ -4727,11 +4809,25 @@ function getDocumentLoader({ allowPrivateAddress, skipPreloadedContexts, userAge
4727
4809
  });
4728
4810
  span.setAttribute("http.response.status_code", response.status);
4729
4811
  if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
4730
- const redirectUrl = response.headers.get("Location");
4812
+ if (redirected >= DEFAULT_MAX_REDIRECTION) {
4813
+ logger.error("Too many redirections ({redirections}) while fetching document.", {
4814
+ redirections: redirected + 1,
4815
+ url: currentUrl
4816
+ });
4817
+ throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
4818
+ }
4819
+ const redirectUrl = new URL(response.headers.get("Location"), response.url === "" ? currentUrl : response.url).href;
4731
4820
  span.setAttribute("http.redirect.url", redirectUrl);
4732
- return await load(redirectUrl, options);
4821
+ if (visited.has(redirectUrl)) {
4822
+ logger.error("Detected a redirect loop while fetching document: {url} -> {redirectUrl}", {
4823
+ url: currentUrl,
4824
+ redirectUrl
4825
+ });
4826
+ throw new FetchError(currentUrl, `Redirect loop detected: ${redirectUrl}`);
4827
+ }
4828
+ return await load(redirectUrl, options, redirected + 1, visited);
4733
4829
  }
4734
- const result = await getRemoteDocument(url, response, load);
4830
+ const result = await getRemoteDocument(currentUrl, response, load);
4735
4831
  span.setAttribute("docloader.document_url", result.documentUrl);
4736
4832
  if (result.contextUrl != null) span.setAttribute("docloader.context_url", result.contextUrl);
4737
4833
  return result;
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { __commonJS, __toESM } from "./type-BVpqRkFR.js";
6
+ import { __commonJS, __toESM } from "./type-DUhon7qK.js";
7
7
 
8
8
  //#region ../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js
9
9
  var require_glob_to_regexp = __commonJS({ "../../node_modules/.pnpm/glob-to-regexp@0.4.1/node_modules/glob-to-regexp/index.js"(exports, module) {
@@ -3,16 +3,16 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Note, Person } from "../type-BVpqRkFR.js";
6
+ import { Activity, Note, Person } from "../type-DUhon7qK.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
11
  import { parseSemVer } from "../semver-dArNLkR9.js";
12
- import "../lookup-CyI7sF0p.js";
13
- import "../inbox-BxnmUryw.js";
14
- import { createFederationBuilder } from "../builder-4kTkpLYJ.js";
15
- import { test } from "../testing-DoQEBY_a.js";
12
+ import "../lookup-CySNcNcC.js";
13
+ import "../inbox-DcDIqTbR.js";
14
+ import { createFederationBuilder } from "../builder-YD0q32nG.js";
15
+ import { test } from "../testing-C1GIraJh.js";
16
16
  import { assertExists } from "../std__assert-X-_kMxKM.js";
17
17
  import "../assert_rejects-DiIiJbZn.js";
18
18
  import "../assert_is_error-BPGph1Jx.js";
@@ -3,13 +3,13 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "../type-BVpqRkFR.js";
6
+ import "../type-DUhon7qK.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
- import "../lookup-CyI7sF0p.js";
10
+ import "../lookup-CySNcNcC.js";
11
11
  import { buildCollectionSynchronizationHeader, digest } from "../collection-CSzG2j1P.js";
12
- import { test } from "../testing-DoQEBY_a.js";
12
+ import { test } from "../testing-C1GIraJh.js";
13
13
  import "../std__assert-X-_kMxKM.js";
14
14
  import "../assert_rejects-DiIiJbZn.js";
15
15
  import "../assert_is_error-BPGph1Jx.js";
@@ -3,36 +3,36 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Create, Note, Person } from "../type-BVpqRkFR.js";
6
+ import { Create, Note, Person } from "../type-DUhon7qK.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import { assert } from "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
- import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-CmaZY01E.js";
11
+ import { acceptsJsonLd, createFederation, handleActor, handleCollection, handleCustomCollection, handleInbox, handleObject, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-C5emnCh-.js";
12
12
  import "../semver-dArNLkR9.js";
13
- import "../client-BTEYHgMp.js";
14
- import "../lookup-CyI7sF0p.js";
13
+ import "../client-BgCucCG7.js";
14
+ import "../lookup-CySNcNcC.js";
15
15
  import "../types-BIgY6c-l.js";
16
- import "../actor-BdLqN1gg.js";
17
- import "../key-DrXt0cYP.js";
18
- import { signRequest } from "../http-DplZ1SHu.js";
19
- import "../authdocloader-CLAhEwIS.js";
20
- import "../ld-DzleVPgo.js";
21
- import "../owner-n8GJaHF9.js";
22
- import "../proof-D7qegtQm.js";
23
- import { InboxListenerSet } from "../inbox-BxnmUryw.js";
24
- import "../builder-4kTkpLYJ.js";
16
+ import "../actor-Ch9BTg3N.js";
17
+ import "../key-Cg0kO4dA.js";
18
+ import { signRequest } from "../http-CxiIW4rD.js";
19
+ import "../authdocloader-COFZT9Wh.js";
20
+ import "../ld-b16r91YS.js";
21
+ import "../owner-Bs-sPbHX.js";
22
+ import "../proof-SgRikE_Y.js";
23
+ import { InboxListenerSet } from "../inbox-DcDIqTbR.js";
24
+ import "../builder-YD0q32nG.js";
25
25
  import "../collection-CSzG2j1P.js";
26
- import "../keycache-Cm9Ke5JM.js";
26
+ import "../keycache-hSs_XFSb.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-CcNf5O--.js";
29
- import { createInboxContext, createRequestContext, mockDocumentLoader, test } from "../testing-DoQEBY_a.js";
28
+ import "../send-C0gFHa2i.js";
29
+ import { createInboxContext, createRequestContext, mockDocumentLoader, test } from "../testing-C1GIraJh.js";
30
30
  import "../std__assert-X-_kMxKM.js";
31
31
  import { assertFalse } from "../assert_rejects-DiIiJbZn.js";
32
32
  import "../assert_is_error-BPGph1Jx.js";
33
33
  import "../assert_not_equals-f3m3epl3.js";
34
34
  import "../assert_throws-BOO88avQ.js";
35
- import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-C6gRMT25.js";
35
+ import { rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-CElJez9H.js";
36
36
  import { createTestTracerProvider } from "../otel-Chy5T2Xh.js";
37
37
 
38
38
  //#region src/federation/handler.test.ts
@@ -3,36 +3,36 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Create, Follow, Person } from "../type-BVpqRkFR.js";
6
+ import { Create, Follow, Person } from "../type-DUhon7qK.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
8
  import "../assert-MZs1qjMx.js";
9
9
  import "../assert_instance_of-DHz7EHNU.js";
10
10
  import { MemoryKvStore } from "../kv-QzKcOQgP.js";
11
- import { createFederation } from "../middleware-CmaZY01E.js";
11
+ import { createFederation } from "../middleware-C5emnCh-.js";
12
12
  import "../semver-dArNLkR9.js";
13
- import "../client-BTEYHgMp.js";
14
- import "../lookup-CyI7sF0p.js";
13
+ import "../client-BgCucCG7.js";
14
+ import "../lookup-CySNcNcC.js";
15
15
  import "../types-BIgY6c-l.js";
16
- import "../actor-BdLqN1gg.js";
17
- import "../key-DrXt0cYP.js";
18
- import "../http-DplZ1SHu.js";
19
- import "../authdocloader-CLAhEwIS.js";
20
- import "../ld-DzleVPgo.js";
21
- import "../owner-n8GJaHF9.js";
22
- import { signObject } from "../proof-D7qegtQm.js";
23
- import "../inbox-BxnmUryw.js";
24
- import "../builder-4kTkpLYJ.js";
16
+ import "../actor-Ch9BTg3N.js";
17
+ import "../key-Cg0kO4dA.js";
18
+ import "../http-CxiIW4rD.js";
19
+ import "../authdocloader-COFZT9Wh.js";
20
+ import "../ld-b16r91YS.js";
21
+ import "../owner-Bs-sPbHX.js";
22
+ import { signObject } from "../proof-SgRikE_Y.js";
23
+ import "../inbox-DcDIqTbR.js";
24
+ import "../builder-YD0q32nG.js";
25
25
  import "../collection-CSzG2j1P.js";
26
- import "../keycache-Cm9Ke5JM.js";
26
+ import "../keycache-hSs_XFSb.js";
27
27
  import "../retry-D4GJ670a.js";
28
- import "../send-CcNf5O--.js";
29
- import { mockDocumentLoader, test } from "../testing-DoQEBY_a.js";
28
+ import "../send-C0gFHa2i.js";
29
+ import { mockDocumentLoader, test } from "../testing-C1GIraJh.js";
30
30
  import "../std__assert-X-_kMxKM.js";
31
31
  import "../assert_rejects-DiIiJbZn.js";
32
32
  import "../assert_is_error-BPGph1Jx.js";
33
33
  import "../assert_not_equals-f3m3epl3.js";
34
34
  import "../assert_throws-BOO88avQ.js";
35
- import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey } from "../keys-C6gRMT25.js";
35
+ import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey } from "../keys-CElJez9H.js";
36
36
 
37
37
  //#region src/federation/idempotency.test.ts
38
38
  const kv = new MemoryKvStore();
@@ -3,11 +3,11 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { Activity, Create, Invite, Offer, Update } from "../type-BVpqRkFR.js";
6
+ import { Activity, Create, Invite, Offer, Update } from "../type-DUhon7qK.js";
7
7
  import { assertEquals } from "../assert_equals-DSbWqCm3.js";
8
- import "../lookup-CyI7sF0p.js";
9
- import { InboxListenerSet } from "../inbox-BxnmUryw.js";
10
- import { test } from "../testing-DoQEBY_a.js";
8
+ import "../lookup-CySNcNcC.js";
9
+ import { InboxListenerSet } from "../inbox-DcDIqTbR.js";
10
+ import { test } from "../testing-C1GIraJh.js";
11
11
  import "../assert_is_error-BPGph1Jx.js";
12
12
  import { assertThrows } from "../assert_throws-BOO88avQ.js";
13
13