@fedify/fedify 2.5.0-dev.2446 → 2.5.0-dev.2492

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 (141) hide show
  1. package/README.md +3 -0
  2. package/dist/{activity-listener-C-BSbKI7.mjs → activity-listener-CELFAodc.mjs} +8 -4
  3. package/dist/{builder-Da8b9O6v.mjs → builder-DphK9v7f.mjs} +5 -5
  4. package/dist/{client-D-XP_Ccb.d.ts → client-3InDZbba.d.cts} +0 -1
  5. package/dist/{client-D-XP_Ccb.d.cts → client-3InDZbba.d.ts} +0 -1
  6. package/dist/{client-CEnNz8O7.mjs → client-5SIFzW3q.mjs} +113 -64
  7. package/dist/compat/mod.d.cts +1 -1
  8. package/dist/compat/mod.d.ts +1 -1
  9. package/dist/compat/transformers.test.mjs +1 -1
  10. package/dist/{compound-proof-D1djO5fa.mjs → compound-proof-cYtvlTgF.mjs} +2 -2
  11. package/dist/{context-8Tu9kea0.mjs → context-COHd1Rsh.mjs} +2 -0
  12. package/dist/{context-BdB54V-A.d.ts → context-DQJE9YfH.d.ts} +332 -6
  13. package/dist/{context-CQ9H8vNW.d.cts → context-DSuL3YWx.d.cts} +332 -6
  14. package/dist/{deno-eNpfj4oR.mjs → deno-iOAA7iRN.mjs} +1 -1
  15. package/dist/docloader-DCZkiTeF.mjs +136 -0
  16. package/dist/{exporter-DThFfe7P.mjs → exporter-DVG68ozH.mjs} +36 -30
  17. package/dist/federation/builder.test.mjs +1 -1
  18. package/dist/federation/compound-fanout.test.mjs +6 -3
  19. package/dist/federation/handler-compound-proof.test.mjs +5 -5
  20. package/dist/federation/handler.test.mjs +22 -7
  21. package/dist/federation/hashlink-media.test.mjs +2 -2
  22. package/dist/federation/idempotency.test.mjs +2 -2
  23. package/dist/federation/inbox-actorless.test.d.mts +2 -0
  24. package/dist/federation/inbox-actorless.test.mjs +487 -0
  25. package/dist/federation/inbox-authentication.test.d.mts +2 -0
  26. package/dist/federation/inbox-authentication.test.mjs +116 -0
  27. package/dist/federation/inbox-report.test.mjs +5 -5
  28. package/dist/federation/inbox-view.test.d.mts +2 -0
  29. package/dist/federation/inbox-view.test.mjs +369 -0
  30. package/dist/federation/inbox.test.mjs +22 -12
  31. package/dist/federation/metrics.test.mjs +1 -1
  32. package/dist/federation/middleware.test.mjs +470 -35
  33. package/dist/federation/mod.cjs +2 -1
  34. package/dist/federation/mod.d.cts +4 -4
  35. package/dist/federation/mod.d.ts +4 -4
  36. package/dist/federation/mod.js +8 -2
  37. package/dist/federation/mq.test.mjs +36 -1
  38. package/dist/federation/outgoing-proof.test.mjs +9 -6
  39. package/dist/federation/portable-actor.test.mjs +3 -3
  40. package/dist/federation/portable-chain.test.mjs +3 -3
  41. package/dist/federation/portable-collection.test.mjs +4 -4
  42. package/dist/federation/portable-delivery.test.mjs +2 -2
  43. package/dist/federation/portable-gateway-keys.test.mjs +13 -7
  44. package/dist/federation/portable-inbox.test.mjs +4 -4
  45. package/dist/federation/portable-parse-uri.test.mjs +1 -1
  46. package/dist/federation/portable-route-activity.test.mjs +2 -2
  47. package/dist/federation/portable.test.mjs +3 -3
  48. package/dist/federation/send.test.mjs +502 -93
  49. package/dist/federation/tasks/enqueue.test.mjs +3 -3
  50. package/dist/federation/tasks/tasks.test.mjs +4 -4
  51. package/dist/federation/temporal.test.mjs +1 -1
  52. package/dist/federation/webfinger.test.mjs +2 -2
  53. package/dist/{federation-BVH7drJA.cjs → federation-D0AZw_aw.cjs} +1415 -236
  54. package/dist/{http-BUJ5SFh6.mjs → http-BoJCMnjY.mjs} +204 -106
  55. package/dist/{http-DlNxxW_5.js → http-ChXUU_3c.js} +319 -123
  56. package/dist/{http-BfW3wyQ4.cjs → http-kv1LZw-r.cjs} +339 -125
  57. package/dist/inbox-BjihTKLo.mjs +312 -0
  58. package/dist/inbox-authentication-DflPYlLL.mjs +171 -0
  59. package/dist/inbox-view-D-skypg-.mjs +385 -0
  60. package/dist/{key-nYGY4QB9.d.cts → key-DbLNT-vA.d.ts} +1 -2
  61. package/dist/{key-DhsBxxZN.d.ts → key-DlHT4R6k.d.cts} +1 -2
  62. package/dist/{kv-cache-D_m3A241.mjs → kv-cache-Cmsyke4d.mjs} +1 -1
  63. package/dist/{kv-cache-7015lbrx.js → kv-cache-DQcte7ES.js} +73 -28
  64. package/dist/{kv-cache-kkBB0vbI.cjs → kv-cache-Ddh5sMxH.cjs} +72 -27
  65. package/dist/ld-CWVpo_NM.d.cts +250 -0
  66. package/dist/{ld-CD2CsPxq.mjs → ld-CdvcOEXQ.mjs} +52 -9
  67. package/dist/ld-Inagww4R.d.ts +250 -0
  68. package/dist/{metrics-D3LHk6Z4.mjs → metrics-CpxvUrBz.mjs} +1 -1
  69. package/dist/{middleware-N9eM16XE.js → middleware-BHb5toqA.js} +1413 -247
  70. package/dist/{middleware-CCDXvXOG.mjs → middleware-BKs2DLUF.mjs} +1 -1
  71. package/dist/{middleware-CzoWvrdZ.mjs → middleware-CoBLrTKX.mjs} +533 -132
  72. package/dist/{mod-B0dGgQsg.d.cts → mod-6TQ4UQZb.d.cts} +1 -1
  73. package/dist/mod-B4kBw1-8.d.ts +154 -0
  74. package/dist/{mod-DkhfZC1u.d.ts → mod-B7j30IQf.d.ts} +2 -9
  75. package/dist/mod-C1nT74IG.d.cts +154 -0
  76. package/dist/{mod-D0bxB8jS.d.ts → mod-CIeBgsOC.d.ts} +1 -1
  77. package/dist/{mod-B5-wdzmJ.d.cts → mod-YvA4Rk8J.d.cts} +2 -9
  78. package/dist/mod.cjs +6 -5
  79. package/dist/mod.d.cts +9 -9
  80. package/dist/mod.d.ts +9 -9
  81. package/dist/mod.js +6 -6
  82. package/dist/{mq-Dm1Wmtm-.mjs → mq-eF96QxUT.mjs} +6 -0
  83. package/dist/nodeinfo/client.test.mjs +337 -19
  84. package/dist/nodeinfo/handler.test.mjs +2 -2
  85. package/dist/nodeinfo/mod.cjs +1 -1
  86. package/dist/nodeinfo/mod.d.cts +1 -1
  87. package/dist/nodeinfo/mod.d.ts +1 -1
  88. package/dist/nodeinfo/mod.js +1 -1
  89. package/dist/otel/exporter.test.mjs +257 -1
  90. package/dist/otel/mod.cjs +36 -30
  91. package/dist/otel/mod.d.cts +13 -0
  92. package/dist/otel/mod.d.ts +13 -0
  93. package/dist/otel/mod.js +36 -30
  94. package/dist/{owner-C5-FVX6t.mjs → owner-DTnVpUKA.mjs} +3 -3
  95. package/dist/{portable-collection-Cony3_LC.mjs → portable-collection-CJeYTL61.mjs} +2 -2
  96. package/dist/{portable-collection-C-Z1SKDy.cjs → portable-collection-DciwBIia.cjs} +1 -1
  97. package/dist/{portable-collection-CC2zNAje.js → portable-collection-TmtpzD4E.js} +1 -1
  98. package/dist/{portable-key-DNc_flH-.mjs → portable-key-DcYok4ki.mjs} +1 -1
  99. package/dist/{proof-Cryb1c70.mjs → proof-GH7Poos_.mjs} +98 -10
  100. package/dist/{send-AF25pWaJ.mjs → send-BgGJh6pv.mjs} +174 -76
  101. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  102. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  103. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  104. package/dist/sig/compound-proof.test.mjs +2 -2
  105. package/dist/sig/http.test.mjs +553 -2
  106. package/dist/sig/key.test.mjs +1 -1
  107. package/dist/sig/ld.test.mjs +1 -1
  108. package/dist/sig/mitra-receive-interop.test.mjs +4 -4
  109. package/dist/sig/mitra-send-interop.test.mjs +3 -3
  110. package/dist/sig/mod.cjs +2 -2
  111. package/dist/sig/mod.d.cts +3 -3
  112. package/dist/sig/mod.d.ts +3 -3
  113. package/dist/sig/mod.js +2 -2
  114. package/dist/sig/owner.test.mjs +1 -1
  115. package/dist/sig/portable-collection.test.mjs +1 -1
  116. package/dist/sig/portable-interop.test.mjs +3 -3
  117. package/dist/sig/portable-key.test.mjs +5 -5
  118. package/dist/sig/proof.test.mjs +45 -5
  119. package/dist/sig/tootik-request-interop.test.mjs +4 -4
  120. package/dist/sig/tootik-send-interop.test.mjs +3 -3
  121. package/dist/sig/verification.test.mjs +3 -3
  122. package/dist/{temporal-BsAeuUJj.mjs → temporal-gJINzcL4.mjs} +1 -1
  123. package/dist/testing/kv.test.mjs +1 -1
  124. package/dist/testing/mod.d.mts +288 -2
  125. package/dist/testing/mod.mjs +2 -2
  126. package/dist/{testing-t8xDeJZ5.mjs → testing-Dbr21vZk.mjs} +1 -1
  127. package/dist/{types-_S2_MeLF.js → types-DUjZb4i6.js} +112 -63
  128. package/dist/{types-poIao40f.cjs → types-hKCCjii0.cjs} +111 -62
  129. package/dist/utils/docloader.test.mjs +344 -36
  130. package/dist/utils/kv-cache.test.mjs +1 -1
  131. package/dist/utils/mod.cjs +1 -1
  132. package/dist/utils/mod.d.cts +1 -1
  133. package/dist/utils/mod.d.ts +1 -1
  134. package/dist/utils/mod.js +1 -1
  135. package/package.json +7 -7
  136. package/dist/docloader-B-0nqOB1.mjs +0 -91
  137. package/dist/inbox-CHvMaIFX.mjs +0 -188
  138. package/dist/mod-BRpER-B0.d.ts +0 -320
  139. package/dist/mod-xAfaLS4T.d.cts +0 -320
  140. package/dist/owner-BF0L9cMt.d.cts +0 -78
  141. package/dist/owner-BSzr5-I8.d.ts +0 -78
package/README.md CHANGED
@@ -15,6 +15,9 @@ It aims to eliminate the complexity and boilerplate code when
15
15
  building a federated server app, so that you can focus on your business logic
16
16
  and user experience.
17
17
 
18
+ Fedify supports Node.js, Bun, and Deno. We recommend using the latest
19
+ version of Node.js for the best experience.
20
+
18
21
  Currently, Fedify provides the following features out of the box:
19
22
 
20
23
  - Type-safe objects for [Activity Vocabulary] (including some vendor-specific
@@ -14,9 +14,12 @@ var ActivityListenerSet = class {
14
14
  clone.#listeners = new Map(this.#listeners);
15
15
  return clone;
16
16
  }
17
- add(type, listener) {
17
+ add(type, listener, options = {}) {
18
18
  if (this.#listeners.has(type)) throw new TypeError("Listener already set for this type.");
19
- this.#listeners.set(type, listener);
19
+ this.#listeners.set(type, {
20
+ listener,
21
+ options: { ...options }
22
+ });
20
23
  }
21
24
  dispatchWithClass(activity) {
22
25
  let cls = activity.constructor;
@@ -26,10 +29,11 @@ var ActivityListenerSet = class {
26
29
  cls = globalThis.Object.getPrototypeOf(cls);
27
30
  }
28
31
  if (cls == null) return null;
29
- const listener = this.#listeners.get(cls);
32
+ const { listener, options } = this.#listeners.get(cls);
30
33
  return {
31
34
  class: cls,
32
- listener
35
+ listener,
36
+ options
33
37
  };
34
38
  }
35
39
  dispatch(activity) {
@@ -2,8 +2,8 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { i as getPortableDid, l as isPortableId, n as getCanonicalPortableId } from "./portable-key-id-Ca30-hOa.mjs";
5
- import { n as version, t as name } from "./deno-eNpfj4oR.mjs";
6
- import { t as ActivityListenerSet } from "./activity-listener-C-BSbKI7.mjs";
5
+ import { n as version, t as name } from "./deno-iOAA7iRN.mjs";
6
+ import { t as ActivityListenerSet } from "./activity-listener-CELFAodc.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
9
9
  import { Tombstone, getTypeId } from "@fedify/vocab";
@@ -91,7 +91,7 @@ var FederationBuilderImpl = class {
91
91
  * specified.
92
92
  */
93
93
  async build(options) {
94
- const { FederationImpl } = await import("./middleware-CCDXvXOG.mjs");
94
+ const { FederationImpl } = await import("./middleware-BKs2DLUF.mjs");
95
95
  const f = new FederationImpl(options);
96
96
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
97
97
  f.router = this.router.clone();
@@ -590,8 +590,8 @@ var FederationBuilderImpl = class {
590
590
  }
591
591
  const listeners = this.inboxListeners = new ActivityListenerSet();
592
592
  const setters = {
593
- on(type, listener) {
594
- listeners.add(type, listener);
593
+ on(type, listener, options) {
594
+ listeners.add(type, listener, options);
595
595
  return setters;
596
596
  },
597
597
  onError: (handler) => {
@@ -1,6 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { GetUserAgentOptions } from "@fedify/vocab-runtime";
3
-
4
3
  //#region src/nodeinfo/types.d.ts
5
4
  /**
6
5
  * The type of the result of parsing JSON.
@@ -1,6 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { GetUserAgentOptions } from "@fedify/vocab-runtime";
3
-
4
3
  //#region src/nodeinfo/types.d.ts
5
4
  /**
6
5
  * The type of the result of parsing JSON.
@@ -2,7 +2,8 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { getLogger } from "@logtape/logtape";
5
- import { FetchError, UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime";
5
+ import { FetchError, UrlError, getUserAgent } from "@fedify/vocab-runtime";
6
+ import { openPublicFetch } from "@fedify/vocab-runtime/internal";
6
7
  //#region src/utils/body.ts
7
8
  /** Decoded JSON body limit: 16 MiB. @internal */
8
9
  const MAX_BODY_SIZE = 16 * 1024 * 1024;
@@ -85,23 +86,34 @@ const logger = getLogger([
85
86
  ]);
86
87
  const DEFAULT_MAX_REDIRECTION = 5;
87
88
  /**
88
- * Fetches a URL while guarding against SSRF. Before every request—including
89
- * each redirect hop—the destination is validated with
90
- * {@link validatePublicUrl}, so that loopback, link-local, and private
91
- * addresses, as well as non-HTTP(S) schemes such as `data:`, are rejected.
92
- * Redirects are followed manually with a cap, so that a public URL cannot
93
- * bounce the request to an internal address.
89
+ * Fetches a URL while guarding against SSRF. Every request—including each
90
+ * redirect hop—is made in its own session opened with `openPublicFetch()`,
91
+ * which rejects loopback, link-local, and private addresses, as well as
92
+ * non-HTTP(S) schemes such as `data:`, and connects only to the validated
93
+ * addresses where the runtime supports it. Redirects are followed manually
94
+ * with a cap, so that a public URL cannot bounce the request to an internal
95
+ * address.
96
+ *
97
+ * The final response is passed to `consume`, which must consume or cancel its
98
+ * body; the session is closed after `consume` settles. The cancellation of
99
+ * redirect response bodies is started before their sessions are closed.
94
100
  * @param url The URL to fetch.
95
101
  * @param headers The request headers.
96
- * @returns The final response, or `null` if the URL is disallowed, its
97
- * hostname cannot be resolved, or there are too many redirects.
102
+ * @param consume The function to consume the final response with.
103
+ * @param deps The dependencies.
104
+ * @returns The value returned by `consume`, or `null` if the URL is
105
+ * disallowed, its hostname cannot be resolved, or there are too many
106
+ * redirects.
107
+ * @internal
98
108
  */
99
- async function fetchPublicUrl(url, headers) {
109
+ async function fetchPublicUrl(url, headers, consume, deps = {}) {
110
+ const openHop = deps.openHop ?? ((hopUrl) => openPublicFetch(hopUrl));
100
111
  let current = url instanceof URL ? url : new URL(url);
101
112
  let redirected = 0;
102
113
  while (true) {
114
+ let session;
103
115
  try {
104
- await validatePublicUrl(current.href);
116
+ session = await openHop(current.href);
105
117
  } catch (e) {
106
118
  if (e instanceof UrlError) {
107
119
  if (e.reason === "dns") logger.error("DNS lookup failed for {url}: {error}", {
@@ -116,52 +128,89 @@ async function fetchPublicUrl(url, headers) {
116
128
  }
117
129
  throw e;
118
130
  }
119
- const response = await fetch(current, {
120
- headers,
121
- redirect: "manual"
122
- });
123
- if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
124
- redirected++;
125
- if (redirected >= DEFAULT_MAX_REDIRECTION) {
126
- logger.error("Too many redirections ({redirections}) while fetching {url}.", {
127
- redirections: redirected,
128
- url: current.href
129
- });
130
- return null;
131
- }
132
- const next = new URL(response.headers.get("Location"), response.url == null || response.url === "" ? current : response.url);
133
- if (next.protocol !== current.protocol) {
134
- logger.error("Refused a redirect to a different protocol ({protocol} to {redirectedProtocol}) while fetching NodeInfo.", {
135
- protocol: current.protocol,
136
- redirectedProtocol: next.protocol
137
- });
138
- return null;
139
- }
140
- current = next;
141
- continue;
131
+ let location;
132
+ try {
133
+ const response = await session.fetch(current, {
134
+ headers,
135
+ redirect: "manual"
136
+ });
137
+ if (response.status < 300 || response.status >= 400 || !response.headers.has("Location")) return await consume(response);
138
+ location = response.headers.get("Location");
139
+ cancelBody(response, current);
140
+ } finally {
141
+ await session.close();
142
+ }
143
+ redirected++;
144
+ if (redirected >= DEFAULT_MAX_REDIRECTION) {
145
+ logger.error("Too many redirections ({redirections}) while fetching {url}.", {
146
+ redirections: redirected,
147
+ url: current.href
148
+ });
149
+ return null;
150
+ }
151
+ const next = new URL(location, current);
152
+ if (next.protocol !== current.protocol) {
153
+ logger.error("Refused a redirect to a different protocol ({protocol} to {redirectedProtocol}) while fetching NodeInfo.", {
154
+ protocol: current.protocol,
155
+ redirectedProtocol: next.protocol
156
+ });
157
+ return null;
142
158
  }
143
- return response;
159
+ current = next;
144
160
  }
145
161
  }
162
+ /**
163
+ * Starts cancelling a response body that is not read, without waiting for it
164
+ * to settle. The cancellation of a branch of a tee (e.g., a body cloned by
165
+ * a fetch mock) settles only after the other branch is cancelled too, per
166
+ * the Streams standard, so awaiting it could block forever. A failure is
167
+ * only logged.
168
+ */
169
+ function cancelBody(response, url) {
170
+ response.body?.cancel().catch((error) => {
171
+ logger.debug("Failed to cancel the response body from {url}: {error}", {
172
+ url: url.toString(),
173
+ error
174
+ });
175
+ });
176
+ }
146
177
  async function getNodeInfo(url, options = {}) {
178
+ return await getNodeInfoInternal(url, options);
179
+ }
180
+ /**
181
+ * The implementation of {@link getNodeInfo}, which is not exported from any
182
+ * entry point.
183
+ * @param url The base URL of the server, or the URL of the NodeInfo document
184
+ * if `options.direct` is turned on.
185
+ * @param options Options for fetching the NodeInfo document.
186
+ * @param deps The dependencies.
187
+ * @returns The NodeInfo document if it could be fetched successfully.
188
+ * Otherwise, `undefined` is returned.
189
+ * @internal
190
+ */
191
+ async function getNodeInfoInternal(url, options = {}, deps = {}) {
147
192
  try {
193
+ const headers = {
194
+ Accept: "application/json",
195
+ "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
196
+ };
148
197
  let nodeInfoUrl = url;
149
198
  if (!options.direct) {
150
199
  const wellKnownUrl = new URL("/.well-known/nodeinfo", url);
151
- const wellKnownResponse = await fetchPublicUrl(wellKnownUrl, {
152
- Accept: "application/json",
153
- "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
154
- });
155
- if (wellKnownResponse == null) return void 0;
156
- if (!wellKnownResponse.ok) {
157
- logger.error("Failed to fetch {url}: {status} {statusText}", {
158
- url: wellKnownUrl.href,
159
- status: wellKnownResponse.status,
160
- statusText: wellKnownResponse.statusText
161
- });
162
- return;
163
- }
164
- const wellKnownRd = JSON.parse(await readBoundedText(wellKnownResponse, MAX_BODY_SIZE, wellKnownUrl));
200
+ const wellKnown = await fetchPublicUrl(wellKnownUrl, headers, async (response) => {
201
+ if (!response.ok) {
202
+ logger.error("Failed to fetch {url}: {status} {statusText}", {
203
+ url: wellKnownUrl.href,
204
+ status: response.status,
205
+ statusText: response.statusText
206
+ });
207
+ cancelBody(response, wellKnownUrl);
208
+ return;
209
+ }
210
+ return { rd: JSON.parse(await readBoundedText(response, MAX_BODY_SIZE, wellKnownUrl)) };
211
+ }, deps);
212
+ if (wellKnown == null) return void 0;
213
+ const wellKnownRd = wellKnown.rd;
165
214
  const link = wellKnownRd?.links?.find((link) => link != null && "rel" in link && (link.rel === "http://nodeinfo.diaspora.software/ns/schema/2.0" || link.rel === "http://nodeinfo.diaspora.software/ns/schema/2.1") && "href" in link && link.href != null);
166
215
  if (link == null || link.href == null) {
167
216
  logger.error("Failed to find a NodeInfo document link from {url}: {resourceDescriptor}", {
@@ -172,20 +221,20 @@ async function getNodeInfo(url, options = {}) {
172
221
  }
173
222
  nodeInfoUrl = link.href;
174
223
  }
175
- const response = await fetchPublicUrl(nodeInfoUrl, {
176
- Accept: "application/json",
177
- "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
178
- });
179
- if (response == null) return void 0;
180
- if (!response.ok) {
181
- logger.error("Failed to fetch NodeInfo document from {url}: {status} {statusText}", {
182
- url: nodeInfoUrl.toString(),
183
- status: response.status,
184
- statusText: response.statusText
185
- });
186
- return;
187
- }
188
- const data = JSON.parse(await readBoundedText(response, MAX_BODY_SIZE, nodeInfoUrl));
224
+ const document = await fetchPublicUrl(nodeInfoUrl, headers, async (response) => {
225
+ if (!response.ok) {
226
+ logger.error("Failed to fetch NodeInfo document from {url}: {status} {statusText}", {
227
+ url: nodeInfoUrl.toString(),
228
+ status: response.status,
229
+ statusText: response.statusText
230
+ });
231
+ cancelBody(response, nodeInfoUrl);
232
+ return;
233
+ }
234
+ return { data: JSON.parse(await readBoundedText(response, MAX_BODY_SIZE, nodeInfoUrl)) };
235
+ }, deps);
236
+ if (document == null) return void 0;
237
+ const { data } = document;
189
238
  if (options.parse === "none") return data;
190
239
  return parseNodeInfo(data, { tryBestEffort: options.parse === "best-effort" }) ?? void 0;
191
240
  } catch (error) {
@@ -389,4 +438,4 @@ function parseUsage(data, options = {}) {
389
438
  };
390
439
  }
391
440
  //#endregion
392
- export { parseProtocol as a, parseUsage as c, readBoundedText as d, parseOutboundService as i, BodyTooLargeError as l, parseInboundService as n, parseServices as o, parseNodeInfo as r, parseSoftware as s, getNodeInfo as t, MAX_BODY_SIZE as u };
441
+ export { parseOutboundService as a, parseSoftware as c, MAX_BODY_SIZE as d, readBoundedText as f, parseNodeInfo as i, parseUsage as l, getNodeInfoInternal as n, parseProtocol as o, parseInboundService as r, parseServices as s, getNodeInfo as t, BodyTooLargeError as u };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { en as ActivityTransformer, n as Context } from "../context-CQ9H8vNW.cjs";
2
+ import { in as ActivityTransformer, n as Context } from "../context-DSuL3YWx.cjs";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { en as ActivityTransformer, n as Context } from "../context-BdB54V-A.js";
2
+ import { in as ActivityTransformer, n as Context } from "../context-DQJE9YfH.js";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -5,7 +5,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
7
7
  import { t as assert } from "../assert-D1Eafmd_.mjs";
8
- import { O as actorDehydrator, k as autoIdAssigner, n as FederationImpl } from "../middleware-CzoWvrdZ.mjs";
8
+ import { O as actorDehydrator, k as autoIdAssigner, n as FederationImpl } from "../middleware-CoBLrTKX.mjs";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  import { test } from "@fedify/fixture";
11
11
  //#region src/compat/transformers.test.ts
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { a as getRawCanonicalPortableId, l as isPortableId, n as getCanonicalPortableId } from "./portable-key-id-Ca30-hOa.mjs";
5
5
  import { a as verificationObservation, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
6
- import { c as getNormalizationContextLoader } from "./ld-CD2CsPxq.mjs";
6
+ import { c as getNormalizationContextLoader } from "./ld-CdvcOEXQ.mjs";
7
7
  import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
8
- import { a as preparePortableObjectProofPolicy, f as verifyPreparedPortableObjectProofPolicy, n as classifyFep2277CoreType, s as verifyMapLocalProof, u as verifyPortableObjectProofPolicy } from "./proof-Cryb1c70.mjs";
8
+ import { c as verifyMapLocalProof, f as verifyPortableObjectProofPolicy, m as verifyPreparedPortableObjectProofPolicy, n as classifyFep2277CoreType, o as preparePortableObjectProofPolicy } from "./proof-GH7Poos_.mjs";
9
9
  import { parseIri, preloadedContexts } from "@fedify/vocab-runtime";
10
10
  import jsonld from "@fedify/vocab-runtime/jsonld";
11
11
  //#region src/sig/compound-proof.ts
@@ -3,6 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as mockDocumentLoader } from "./dist-DJQM4u7i.mjs";
5
5
  import { t as isInAudience } from "./audience-CHQ-FlLD.mjs";
6
+ import { i as getEmptyAuthenticationEvidence } from "./inbox-authentication-DflPYlLL.mjs";
6
7
  import { RouterError } from "@fedify/uri-template";
7
8
  import { lookupObject, traverseCollection } from "@fedify/vocab";
8
9
  import { lookupWebFinger } from "@fedify/webfinger";
@@ -120,6 +121,7 @@ function createInboxContext(args) {
120
121
  data
121
122
  })),
122
123
  recipient: args.recipient ?? null,
124
+ authentication: args.authentication ?? getEmptyAuthenticationEvidence(),
123
125
  forwardActivity: args.forwardActivity ?? ((_forwarder, _recipients, _options) => {
124
126
  throw new Error("Not implemented");
125
127
  })