@fedify/fedify 2.4.0-dev.2047 → 2.4.0-dev.2056

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 (75) hide show
  1. package/dist/{builder-Cue1kVHU.mjs → builder-D_XU_Fw2.mjs} +8 -2
  2. package/dist/compat/mod.d.cts +1 -1
  3. package/dist/compat/mod.d.ts +1 -1
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{compound-proof-YT4tajyj.mjs → compound-proof-CwTySDnn.mjs} +1 -1
  6. package/dist/{context-BJPHhBmD.d.ts → context-D_gg4M0n.d.ts} +102 -1
  7. package/dist/{context-Bh_mJfbD.d.cts → context-b36TpPoG.d.cts} +102 -1
  8. package/dist/{deno-Dcj6O4LJ.mjs → deno-BtpLWN2L.mjs} +1 -1
  9. package/dist/{docloader-BRlNjHlQ.mjs → docloader-CJADEtqb.mjs} +2 -2
  10. package/dist/federation/builder.test.mjs +1 -1
  11. package/dist/federation/compound-fanout.test.mjs +3 -3
  12. package/dist/federation/handler-compound-proof.test.mjs +3 -3
  13. package/dist/federation/handler.test.mjs +5 -5
  14. package/dist/federation/hashlink-media.test.d.mts +2 -0
  15. package/dist/federation/hashlink-media.test.mjs +422 -0
  16. package/dist/federation/idempotency.test.mjs +2 -2
  17. package/dist/federation/metrics.test.mjs +1 -1
  18. package/dist/federation/middleware.test.mjs +7 -7
  19. package/dist/federation/mod.cjs +1 -1
  20. package/dist/federation/mod.d.cts +3 -3
  21. package/dist/federation/mod.d.ts +3 -3
  22. package/dist/federation/mod.js +1 -1
  23. package/dist/federation/outgoing-proof.test.mjs +5 -5
  24. package/dist/federation/portable.test.mjs +3 -3
  25. package/dist/federation/router.test.mjs +2 -152
  26. package/dist/federation/send.test.mjs +3 -3
  27. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  28. package/dist/federation/tasks/tasks.test.mjs +2 -2
  29. package/dist/federation/temporal.test.mjs +1 -1
  30. package/dist/federation/webfinger.test.mjs +1 -1
  31. package/dist/{federation-Bdu06LEl.cjs → federation-DDwszIrk.cjs} +139 -21
  32. package/dist/{http-CK6kjLnO.mjs → http-CotELN-4.mjs} +3 -3
  33. package/dist/{http-CGjvl34X.cjs → http-DW5mt8FG.cjs} +1 -1
  34. package/dist/{http-BmdqHyms.js → http-iLCx9vk-.js} +1 -1
  35. package/dist/{key-CzCAq6D9.mjs → key-DrCNkH3Y.mjs} +2 -2
  36. package/dist/{kv-cache-CvEicbrf.cjs → kv-cache-LOyq_Ty6.cjs} +1 -1
  37. package/dist/{kv-cache-YATuzCy-.mjs → kv-cache-a1ghEA4h.mjs} +1 -1
  38. package/dist/{kv-cache-fi_-XZco.js → kv-cache-bXLDSaRu.js} +1 -1
  39. package/dist/{ld-CNWm8mJc.mjs → ld-BPG92sC0.mjs} +3 -3
  40. package/dist/{metrics-CDoBPWjf.mjs → metrics-DxVi0UJD.mjs} +1 -1
  41. package/dist/{middleware-Drzx-OID.js → middleware-1nes8_U-.js} +140 -22
  42. package/dist/{middleware-CF6uz8wa.mjs → middleware-BIPftTly.mjs} +1 -1
  43. package/dist/{middleware-CtFNjIUD.mjs → middleware-DohUu-Tz.mjs} +145 -33
  44. package/dist/{mod-DU8aVzQJ.d.cts → mod-Bfenkg_c.d.cts} +1 -1
  45. package/dist/{mod-BofpDIcU.d.ts → mod-BhMvsgdF.d.ts} +1 -1
  46. package/dist/mod.cjs +4 -4
  47. package/dist/mod.d.cts +4 -4
  48. package/dist/mod.d.ts +4 -4
  49. package/dist/mod.js +4 -4
  50. package/dist/nodeinfo/handler.test.mjs +1 -1
  51. package/dist/{owner-B3PgGiJ1.mjs → owner-BN7Mqjso.mjs} +2 -2
  52. package/dist/{owner-Hurn_ocn.cjs → owner-C2ER4VD7.cjs} +1 -1
  53. package/dist/{owner-CMnmv7S9.js → owner-SBgt2USF.js} +1 -1
  54. package/dist/{proof-fKycdssC.mjs → proof-BigVZwkl.mjs} +4 -4
  55. package/dist/router-u5O5KCQr.mjs +156 -0
  56. package/dist/{send-BqBILxYE.mjs → send-CvatEhyY.mjs} +3 -3
  57. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  58. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  59. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  60. package/dist/sig/compound-proof.test.mjs +2 -2
  61. package/dist/sig/http.test.mjs +2 -2
  62. package/dist/sig/key.test.mjs +1 -1
  63. package/dist/sig/ld.test.mjs +2 -2
  64. package/dist/sig/mod.cjs +2 -2
  65. package/dist/sig/mod.js +2 -2
  66. package/dist/sig/owner.test.mjs +1 -1
  67. package/dist/sig/proof.test.mjs +3 -3
  68. package/dist/{temporal-SUiLJ0Co.mjs → temporal-DV5jeBbR.mjs} +1 -1
  69. package/dist/testing/kv.test.mjs +1 -1
  70. package/dist/testing/mod.d.mts +101 -0
  71. package/dist/utils/docloader.test.mjs +2 -2
  72. package/dist/utils/kv-cache.test.mjs +1 -1
  73. package/dist/utils/mod.cjs +1 -1
  74. package/dist/utils/mod.js +1 -1
  75. package/package.json +6 -6
@@ -2,16 +2,16 @@ import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
5
- import { A as recordWebFingerHandle, C as recordCollectionRequest, D as recordInboxActivity, E as recordFanoutRecipients, I as name, L as version, M as formatAcceptSignature, O as recordOutboxActivity, S as recordCollectionPageItems, _ as instrumentDocumentLoader, a as verifyRequestDetailed, b as recordCircuitBreakerStateChange, d as importJwk, f as validateCryptoKey, g as getRemoteHost, h as getFederationMetrics, i as verifyRequest, j as registerQueueDepthGauge, k as recordOutboxEnqueue, m as getDurationMs, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-BmdqHyms.js";
5
+ import { A as recordWebFingerHandle, C as recordCollectionRequest, D as recordInboxActivity, E as recordFanoutRecipients, I as name, L as version, M as formatAcceptSignature, O as recordOutboxActivity, S as recordCollectionPageItems, _ as instrumentDocumentLoader, a as verifyRequestDetailed, b as recordCircuitBreakerStateChange, d as importJwk, f as validateCryptoKey, g as getRemoteHost, h as getFederationMetrics, i as verifyRequest, j as registerQueueDepthGauge, k as recordOutboxEnqueue, m as getDurationMs, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-iLCx9vk-.js";
6
6
  import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-C_cNlNVK.js";
7
- import { C as verifyCompactJsonLd, D as normalizeOutgoingActivityJsonLd, E as wrapContextLoaderForJsonLd, S as signJsonLd, _ as getNormalizationContextLoader, a as signObject, b as isClearlyMalformedContextReference, c as verifyPortableObjectProof, d as InvalidContextReferenceError, f as assertSafeJsonLd, g as detachSignature, i as hasProofLike, l as verifyPortableObjectProofPolicy, m as compactJsonLd, n as getKeyOwner, o as verifyMapLocalProof, s as verifyObject, t as doesActorOwnKey, v as hasSignature, x as isInvalidUrlTypeError, y as hasSignatureLike } from "./owner-CMnmv7S9.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-fi_-XZco.js";
7
+ import { C as verifyCompactJsonLd, D as normalizeOutgoingActivityJsonLd, E as wrapContextLoaderForJsonLd, S as signJsonLd, _ as getNormalizationContextLoader, a as signObject, b as isClearlyMalformedContextReference, c as verifyPortableObjectProof, d as InvalidContextReferenceError, f as assertSafeJsonLd, g as detachSignature, i as hasProofLike, l as verifyPortableObjectProofPolicy, m as compactJsonLd, n as getKeyOwner, o as verifyMapLocalProof, s as verifyObject, t as doesActorOwnKey, v as hasSignature, x as isInvalidUrlTypeError, y as hasSignatureLike } from "./owner-SBgt2USF.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-bXLDSaRu.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
11
11
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
12
12
  import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
13
13
  import { encodeHex } from "byte-encodings/hex";
14
- import { FetchError, UrlError, canonicalizePortableUri, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, haveSameFe34Origin, isGatewayUrl, parseIri, toCompatibleEf61Id, validatePublicUrl } from "@fedify/vocab-runtime";
14
+ import { FetchError, UrlError, canonicalizePortableUri, decodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, haveSameFe34Origin, isGatewayUrl, parseDigestMultibase, parseHashlink, parseIri, toCompatibleEf61Id, validatePublicUrl } from "@fedify/vocab-runtime";
15
15
  import jsonld from "@fedify/vocab-runtime/jsonld";
16
16
  import { uniq } from "es-toolkit";
17
17
  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";
@@ -105,6 +105,7 @@ var FederationBuilderImpl = class {
105
105
  mediaUploaderPath;
106
106
  mediaUploaderCallback;
107
107
  mediaUploaderAuthorizePredicate;
108
+ hashlinkMediaDispatcher;
108
109
  sharedInboxKeyDispatcher;
109
110
  unverifiedActivityHandler;
110
111
  outboxPermanentFailureHandler;
@@ -162,6 +163,7 @@ var FederationBuilderImpl = class {
162
163
  f.mediaUploaderPath = this.mediaUploaderPath;
163
164
  f.mediaUploaderCallback = this.mediaUploaderCallback;
164
165
  f.mediaUploaderAuthorizePredicate = this.mediaUploaderAuthorizePredicate;
166
+ f.hashlinkMediaDispatcher = this.hashlinkMediaDispatcher;
165
167
  f.sharedInboxKeyDispatcher = this.sharedInboxKeyDispatcher;
166
168
  f.unverifiedActivityHandler = this.unverifiedActivityHandler;
167
169
  f.outboxPermanentFailureHandler = this.outboxPermanentFailureHandler;
@@ -469,6 +471,10 @@ var FederationBuilderImpl = class {
469
471
  } };
470
472
  return setters;
471
473
  }
474
+ setHashlinkMediaDispatcher(dispatcher) {
475
+ if (this.hashlinkMediaDispatcher != null) throw new RouterError("Hashlink media dispatcher already set.");
476
+ this.hashlinkMediaDispatcher = dispatcher;
477
+ }
472
478
  setFollowingDispatcher(path, dispatcher) {
473
479
  if (this.router.has("following")) throw new RouterError("Following collection dispatcher already set.");
474
480
  assertPath(path);
@@ -2196,6 +2202,12 @@ function acceptsJsonLd(request) {
2196
2202
  const PORTABLE_OBJECT_CONTENT_TYPE = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"";
2197
2203
  const GATEWAY_OBJECT_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
2198
2204
  const BARE_DID_PATTERN = /^did:[a-z0-9]+:[^/?#]+$/i;
2205
+ const GATEWAY_PATH_PREFIX = "/.well-known/apgateway/";
2206
+ const HASHLINK_SCHEME_PATTERN = /^hl(?::|%3A)/i;
2207
+ /**
2208
+ * The route template of hashlink media requests, used for metrics and traces.
2209
+ */
2210
+ const HASHLINK_MEDIA_ROUTE_TEMPLATE = "/.well-known/apgateway/hl:{digestMultibase}";
2199
2211
  /**
2200
2212
  * Recognizes an FEP-ef61 gateway request for a portable object, e.g.,
2201
2213
  * `GET /.well-known/apgateway/did:key:z6Mk.../notes/123`.
@@ -2250,6 +2262,55 @@ function buildPortableUri(authority, path) {
2250
2262
  getFe34Origin(authority);
2251
2263
  return parseIri(`ap+ef61://${authority}${path}`);
2252
2264
  }
2265
+ /**
2266
+ * Recognizes an FEP-ef61 gateway request for a resource addressed by
2267
+ * a hashlink, e.g.,
2268
+ * `GET /.well-known/apgateway/hl:zQmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n`.
2269
+ *
2270
+ * The rest of the path, including any slashes, is taken as the hashlink, as
2271
+ * a digest in a multibase encoding like base64 may contain slashes. The query
2272
+ * is not part of the hashlink, so it is ignored here.
2273
+ *
2274
+ * @param url The request URL.
2275
+ * @returns The parsed request, or `null` if the URL is not a gateway request
2276
+ * for a hashlink, e.g., a request for a portable object.
2277
+ */
2278
+ function parseHashlinkGatewayRequest(url) {
2279
+ if (url.protocol !== "http:" && url.protocol !== "https:") return null;
2280
+ if (!url.pathname.startsWith(GATEWAY_PATH_PREFIX)) return null;
2281
+ const encoded = url.pathname.slice(23);
2282
+ if (!HASHLINK_SCHEME_PATTERN.test(encoded)) return null;
2283
+ let digestMultibase;
2284
+ let digest;
2285
+ let multihash;
2286
+ try {
2287
+ let hashlink;
2288
+ try {
2289
+ hashlink = decodeURIComponent(encoded);
2290
+ } catch (error) {
2291
+ throw new TypeError("Invalid percent-encoding in the hashlink.", { cause: error });
2292
+ }
2293
+ ({digestMultibase} = parseHashlink(hashlink));
2294
+ ({digest} = parseDigestMultibase(digestMultibase));
2295
+ multihash = decodeMultibase(digestMultibase);
2296
+ } catch (error) {
2297
+ if (error instanceof TypeError) return {
2298
+ type: "malformed",
2299
+ error
2300
+ };
2301
+ throw error;
2302
+ }
2303
+ return {
2304
+ type: "media",
2305
+ media: Object.freeze({
2306
+ hashlink: `hl:${digestMultibase}`,
2307
+ digestMultibase,
2308
+ algorithm: "sha2-256",
2309
+ digest,
2310
+ multihash
2311
+ })
2312
+ };
2313
+ }
2253
2314
  //#endregion
2254
2315
  //#region src/federation/temporal.ts
2255
2316
  function isPlainObject$1(value) {
@@ -6901,7 +6962,7 @@ var FederationImpl = class extends FederationBuilderImpl {
6901
6962
  tracer,
6902
6963
  metricState
6903
6964
  });
6904
- if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
6965
+ if (metricState.endpoint !== "hashlink_media" && acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
6905
6966
  } catch (error) {
6906
6967
  this.metrics.recordHttpServerRequest(request.method, metricState.endpoint ?? "error", getDurationMs(metricStart), { routeTemplate: metricState.routeTemplate });
6907
6968
  span.setStatus({
@@ -6952,24 +7013,22 @@ var FederationImpl = class extends FederationBuilderImpl {
6952
7013
  const url = new URL(request.url);
6953
7014
  const route = this.router.route(url.pathname);
6954
7015
  if (route == null) {
7016
+ const media = this.hashlinkMediaDispatcher == null ? null : parseHashlinkGatewayRequest(url);
7017
+ if (media != null) return await this.#fetchHashlinkMedia(request, media, {
7018
+ onNotFound,
7019
+ contextData,
7020
+ span,
7021
+ metricState
7022
+ });
6955
7023
  const portable = request.method === "GET" || request.method === "HEAD" ? parsePortableGatewayRequest(url) : null;
6956
- if (portable != null) {
6957
- const response = await this.#fetchPortableObject(request, portable, {
6958
- onNotFound,
6959
- onNotAcceptable,
6960
- onUnauthorized,
6961
- contextData,
6962
- span,
6963
- metricState
6964
- });
6965
- if (request.method !== "HEAD" || response.body == null) return response;
6966
- await response.body.cancel();
6967
- return new Response(null, {
6968
- status: response.status,
6969
- statusText: response.statusText,
6970
- headers: response.headers
6971
- });
6972
- }
7024
+ if (portable != null) return await discardBodyForHead(request, await this.#fetchPortableObject(request, portable, {
7025
+ onNotFound,
7026
+ onNotAcceptable,
7027
+ onUnauthorized,
7028
+ contextData,
7029
+ span,
7030
+ metricState
7031
+ }));
6973
7032
  metricState.endpoint = "not_found";
6974
7033
  return await onNotFound(request);
6975
7034
  }
@@ -7293,8 +7352,67 @@ var FederationImpl = class extends FederationBuilderImpl {
7293
7352
  onNotFound
7294
7353
  });
7295
7354
  }
7355
+ async #fetchHashlinkMedia(request, media, { onNotFound, contextData, span, metricState }) {
7356
+ metricState.endpoint = "hashlink_media";
7357
+ metricState.routeTemplate = HASHLINK_MEDIA_ROUTE_TEMPLATE;
7358
+ span.updateName(`${request.method} ${HASHLINK_MEDIA_ROUTE_TEMPLATE}`);
7359
+ if (request.method !== "GET" && request.method !== "HEAD") return new Response("Method not allowed.", {
7360
+ status: 405,
7361
+ headers: {
7362
+ Allow: "GET, HEAD",
7363
+ "Content-Type": "text/plain; charset=utf-8"
7364
+ }
7365
+ });
7366
+ if (media.type === "malformed") {
7367
+ getLogger([
7368
+ "fedify",
7369
+ "federation",
7370
+ "hashlinkMedia"
7371
+ ]).debug("Malformed FEP-ef61 hashlink media request {url}: {error}", {
7372
+ url: request.url,
7373
+ error: media.error
7374
+ });
7375
+ return new Response(request.method === "HEAD" ? null : "Malformed hashlink.", {
7376
+ status: 400,
7377
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
7378
+ });
7379
+ }
7380
+ const context = this.#createContext(request, contextData);
7381
+ const response = await this.hashlinkMediaDispatcher(context, media.media);
7382
+ if (response == null) return await onNotFound(request);
7383
+ return await discardBodyForHead(request, response, false);
7384
+ }
7296
7385
  };
7297
7386
  const PORTABLE_GATEWAY_ROUTE_PREFIX = "/.well-known/apgateway/{did}";
7387
+ /**
7388
+ * Removes the body of a response to a `HEAD` request.
7389
+ * @param request The request.
7390
+ * @param response The response to the request.
7391
+ * @param waitForCancel Whether to wait until the discarded body is cancelled.
7392
+ * @returns The response without a body if the request is a `HEAD` request,
7393
+ * or the response itself otherwise.
7394
+ */
7395
+ async function discardBodyForHead(request, response, waitForCancel = true) {
7396
+ if (request.method !== "HEAD" || response.body == null) return response;
7397
+ const cancelled = response.body.cancel();
7398
+ if (waitForCancel) await cancelled;
7399
+ else cancelled.catch((error) => {
7400
+ getLogger([
7401
+ "fedify",
7402
+ "federation",
7403
+ "http"
7404
+ ]).debug("Failed to cancel the body of a response to {method} {url}: {error}", {
7405
+ method: request.method,
7406
+ url: request.url,
7407
+ error
7408
+ });
7409
+ });
7410
+ return new Response(null, {
7411
+ status: response.status,
7412
+ statusText: response.statusText,
7413
+ headers: response.headers
7414
+ });
7415
+ }
7298
7416
  function getEndpointCategory(routeName) {
7299
7417
  if (routeName.startsWith("object:")) return "object";
7300
7418
  if (routeName.startsWith("collection:") || routeName.startsWith("orderedCollection:")) return "collection";
@@ -1,5 +1,5 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-CtFNjIUD.mjs";
4
+ import { n as FederationImpl } from "./middleware-DohUu-Tz.mjs";
5
5
  export { FederationImpl };
@@ -1,27 +1,27 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Dcj6O4LJ.mjs";
5
- import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-CDoBPWjf.mjs";
4
+ import { n as version, t as name } from "./deno-BtpLWN2L.mjs";
5
+ import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-DxVi0UJD.mjs";
6
6
  import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
7
- import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-CzCAq6D9.mjs";
8
- import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-CK6kjLnO.mjs";
9
- import { t as getAuthenticatedDocumentLoader } from "./docloader-BRlNjHlQ.mjs";
10
- import { n as kvCache } from "./kv-cache-YATuzCy-.mjs";
7
+ import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-DrCNkH3Y.mjs";
8
+ import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-CotELN-4.mjs";
9
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-CJADEtqb.mjs";
10
+ import { n as kvCache } from "./kv-cache-a1ghEA4h.mjs";
11
11
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
12
12
  import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-DpnpgjyX.mjs";
13
13
  import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
14
- import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-CNWm8mJc.mjs";
15
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-B3PgGiJ1.mjs";
16
- import { a as verifyObject, n as hasProofLike, o as verifyPortableObjectProof, r as signObject } from "./proof-fKycdssC.mjs";
17
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-BqBILxYE.mjs";
18
- import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-Cue1kVHU.mjs";
14
+ import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-BPG92sC0.mjs";
15
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-BN7Mqjso.mjs";
16
+ import { a as verifyObject, n as hasProofLike, o as verifyPortableObjectProof, r as signObject } from "./proof-BigVZwkl.mjs";
17
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-CvatEhyY.mjs";
18
+ import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-D_XU_Fw2.mjs";
19
19
  import { t as CircuitBreaker } from "./circuit-breaker-C5NqoLBJ.mjs";
20
20
  import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
21
- import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "./compound-proof-YT4tajyj.mjs";
21
+ import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "./compound-proof-CwTySDnn.mjs";
22
22
  import { t as KvKeyCache } from "./keycache-BUDHB5rY.mjs";
23
23
  import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
24
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-SUiLJ0Co.mjs";
24
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-DV5jeBbR.mjs";
25
25
  import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
26
26
  import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
27
27
  import { getLogger, withContext } from "@logtape/logtape";
@@ -30,7 +30,7 @@ import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey,
30
30
  import { lookupWebFinger } from "@fedify/webfinger";
31
31
  import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
32
32
  import { uniq } from "es-toolkit";
33
- import { FetchError, canonicalizePortableUri, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, haveSameFe34Origin, isGatewayUrl, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
33
+ import { FetchError, canonicalizePortableUri, decodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, haveSameFe34Origin, isGatewayUrl, parseDigestMultibase, parseHashlink, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
34
34
  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";
35
35
  import jsonld from "@fedify/vocab-runtime/jsonld";
36
36
  import { DataPointType, MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
@@ -520,6 +520,12 @@ async function routeActivity({ context: ctx, json, originalJson, normalizedActiv
520
520
  const PORTABLE_OBJECT_CONTENT_TYPE = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"";
521
521
  const GATEWAY_OBJECT_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
522
522
  const BARE_DID_PATTERN = /^did:[a-z0-9]+:[^/?#]+$/i;
523
+ const GATEWAY_PATH_PREFIX = "/.well-known/apgateway/";
524
+ const HASHLINK_SCHEME_PATTERN = /^hl(?::|%3A)/i;
525
+ /**
526
+ * The route template of hashlink media requests, used for metrics and traces.
527
+ */
528
+ const HASHLINK_MEDIA_ROUTE_TEMPLATE = "/.well-known/apgateway/hl:{digestMultibase}";
523
529
  /**
524
530
  * Recognizes an FEP-ef61 gateway request for a portable object, e.g.,
525
531
  * `GET /.well-known/apgateway/did:key:z6Mk.../notes/123`.
@@ -574,6 +580,55 @@ function buildPortableUri(authority, path) {
574
580
  getFe34Origin(authority);
575
581
  return parseIri(`ap+ef61://${authority}${path}`);
576
582
  }
583
+ /**
584
+ * Recognizes an FEP-ef61 gateway request for a resource addressed by
585
+ * a hashlink, e.g.,
586
+ * `GET /.well-known/apgateway/hl:zQmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n`.
587
+ *
588
+ * The rest of the path, including any slashes, is taken as the hashlink, as
589
+ * a digest in a multibase encoding like base64 may contain slashes. The query
590
+ * is not part of the hashlink, so it is ignored here.
591
+ *
592
+ * @param url The request URL.
593
+ * @returns The parsed request, or `null` if the URL is not a gateway request
594
+ * for a hashlink, e.g., a request for a portable object.
595
+ */
596
+ function parseHashlinkGatewayRequest(url) {
597
+ if (url.protocol !== "http:" && url.protocol !== "https:") return null;
598
+ if (!url.pathname.startsWith(GATEWAY_PATH_PREFIX)) return null;
599
+ const encoded = url.pathname.slice(23);
600
+ if (!HASHLINK_SCHEME_PATTERN.test(encoded)) return null;
601
+ let digestMultibase;
602
+ let digest;
603
+ let multihash;
604
+ try {
605
+ let hashlink;
606
+ try {
607
+ hashlink = decodeURIComponent(encoded);
608
+ } catch (error) {
609
+ throw new TypeError("Invalid percent-encoding in the hashlink.", { cause: error });
610
+ }
611
+ ({digestMultibase} = parseHashlink(hashlink));
612
+ ({digest} = parseDigestMultibase(digestMultibase));
613
+ multihash = decodeMultibase(digestMultibase);
614
+ } catch (error) {
615
+ if (error instanceof TypeError) return {
616
+ type: "malformed",
617
+ error
618
+ };
619
+ throw error;
620
+ }
621
+ return {
622
+ type: "media",
623
+ media: Object.freeze({
624
+ hashlink: `hl:${digestMultibase}`,
625
+ digestMultibase,
626
+ algorithm: "sha2-256",
627
+ digest,
628
+ multihash
629
+ })
630
+ };
631
+ }
577
632
  //#endregion
578
633
  //#region src/federation/handler.ts
579
634
  const rawInboxContextFactorySymbol = Symbol("fedify.rawInboxContextFactory");
@@ -4441,7 +4496,7 @@ var FederationImpl = class extends FederationBuilderImpl {
4441
4496
  tracer,
4442
4497
  metricState
4443
4498
  });
4444
- if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
4499
+ if (metricState.endpoint !== "hashlink_media" && acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
4445
4500
  } catch (error) {
4446
4501
  this.metrics.recordHttpServerRequest(request.method, metricState.endpoint ?? "error", getDurationMs(metricStart), { routeTemplate: metricState.routeTemplate });
4447
4502
  span.setStatus({
@@ -4492,24 +4547,22 @@ var FederationImpl = class extends FederationBuilderImpl {
4492
4547
  const url = new URL(request.url);
4493
4548
  const route = this.router.route(url.pathname);
4494
4549
  if (route == null) {
4550
+ const media = this.hashlinkMediaDispatcher == null ? null : parseHashlinkGatewayRequest(url);
4551
+ if (media != null) return await this.#fetchHashlinkMedia(request, media, {
4552
+ onNotFound,
4553
+ contextData,
4554
+ span,
4555
+ metricState
4556
+ });
4495
4557
  const portable = request.method === "GET" || request.method === "HEAD" ? parsePortableGatewayRequest(url) : null;
4496
- if (portable != null) {
4497
- const response = await this.#fetchPortableObject(request, portable, {
4498
- onNotFound,
4499
- onNotAcceptable,
4500
- onUnauthorized,
4501
- contextData,
4502
- span,
4503
- metricState
4504
- });
4505
- if (request.method !== "HEAD" || response.body == null) return response;
4506
- await response.body.cancel();
4507
- return new Response(null, {
4508
- status: response.status,
4509
- statusText: response.statusText,
4510
- headers: response.headers
4511
- });
4512
- }
4558
+ if (portable != null) return await discardBodyForHead(request, await this.#fetchPortableObject(request, portable, {
4559
+ onNotFound,
4560
+ onNotAcceptable,
4561
+ onUnauthorized,
4562
+ contextData,
4563
+ span,
4564
+ metricState
4565
+ }));
4513
4566
  metricState.endpoint = "not_found";
4514
4567
  return await onNotFound(request);
4515
4568
  }
@@ -4833,8 +4886,67 @@ var FederationImpl = class extends FederationBuilderImpl {
4833
4886
  onNotFound
4834
4887
  });
4835
4888
  }
4889
+ async #fetchHashlinkMedia(request, media, { onNotFound, contextData, span, metricState }) {
4890
+ metricState.endpoint = "hashlink_media";
4891
+ metricState.routeTemplate = HASHLINK_MEDIA_ROUTE_TEMPLATE;
4892
+ span.updateName(`${request.method} ${HASHLINK_MEDIA_ROUTE_TEMPLATE}`);
4893
+ if (request.method !== "GET" && request.method !== "HEAD") return new Response("Method not allowed.", {
4894
+ status: 405,
4895
+ headers: {
4896
+ Allow: "GET, HEAD",
4897
+ "Content-Type": "text/plain; charset=utf-8"
4898
+ }
4899
+ });
4900
+ if (media.type === "malformed") {
4901
+ getLogger([
4902
+ "fedify",
4903
+ "federation",
4904
+ "hashlinkMedia"
4905
+ ]).debug("Malformed FEP-ef61 hashlink media request {url}: {error}", {
4906
+ url: request.url,
4907
+ error: media.error
4908
+ });
4909
+ return new Response(request.method === "HEAD" ? null : "Malformed hashlink.", {
4910
+ status: 400,
4911
+ headers: { "Content-Type": "text/plain; charset=utf-8" }
4912
+ });
4913
+ }
4914
+ const context = this.#createContext(request, contextData);
4915
+ const response = await this.hashlinkMediaDispatcher(context, media.media);
4916
+ if (response == null) return await onNotFound(request);
4917
+ return await discardBodyForHead(request, response, false);
4918
+ }
4836
4919
  };
4837
4920
  const PORTABLE_GATEWAY_ROUTE_PREFIX = "/.well-known/apgateway/{did}";
4921
+ /**
4922
+ * Removes the body of a response to a `HEAD` request.
4923
+ * @param request The request.
4924
+ * @param response The response to the request.
4925
+ * @param waitForCancel Whether to wait until the discarded body is cancelled.
4926
+ * @returns The response without a body if the request is a `HEAD` request,
4927
+ * or the response itself otherwise.
4928
+ */
4929
+ async function discardBodyForHead(request, response, waitForCancel = true) {
4930
+ if (request.method !== "HEAD" || response.body == null) return response;
4931
+ const cancelled = response.body.cancel();
4932
+ if (waitForCancel) await cancelled;
4933
+ else cancelled.catch((error) => {
4934
+ getLogger([
4935
+ "fedify",
4936
+ "federation",
4937
+ "http"
4938
+ ]).debug("Failed to cancel the body of a response to {method} {url}: {error}", {
4939
+ method: request.method,
4940
+ url: request.url,
4941
+ error
4942
+ });
4943
+ });
4944
+ return new Response(null, {
4945
+ status: response.status,
4946
+ statusText: response.statusText,
4947
+ headers: response.headers
4948
+ });
4949
+ }
4838
4950
  function getEndpointCategory(routeName) {
4839
4951
  if (routeName.startsWith("object:")) return "object";
4840
4952
  if (routeName.startsWith("collection:") || routeName.startsWith("orderedCollection:")) return "collection";
@@ -5974,4 +6086,4 @@ function getRequestId(request) {
5974
6086
  return `req_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
5975
6087
  }
5976
6088
  //#endregion
5977
- export { handleBenchmarkTrigger as _, OutboxContextImpl as a, actorDehydrator as b, handleActor as c, handleInbox as d, handleObject as f, PORTABLE_OBJECT_CONTENT_TYPE as g, respondWithObjectIfAcceptable as h, KvSpecDeterminer as i, handleCollection as l, respondWithObject as m, FederationImpl as n, createFederation as o, handleOutbox as p, InboxContextImpl as r, handleWebFinger as s, ContextImpl as t, handleCustomCollection as u, handleNodeInfo as v, autoIdAssigner as x, handleNodeInfoJrd as y };
6089
+ export { autoIdAssigner as S, parseHashlinkGatewayRequest as _, OutboxContextImpl as a, handleNodeInfoJrd as b, handleActor as c, handleInbox as d, handleObject as f, PORTABLE_OBJECT_CONTENT_TYPE as g, respondWithObjectIfAcceptable as h, KvSpecDeterminer as i, handleCollection as l, respondWithObject as m, FederationImpl as n, createFederation as o, handleOutbox as p, InboxContextImpl as r, handleWebFinger as s, ContextImpl as t, handleCustomCollection as u, handleBenchmarkTrigger as v, actorDehydrator as x, handleNodeInfo as y };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { Bt as WebFingerLinksDispatcher, _t as ActorDispatcher, gt as ActorAliasMapper, u as RequestContext, vt as ActorHandleMapper } from "./context-Bh_mJfbD.cjs";
2
+ import { Ht as WebFingerLinksDispatcher, _t as ActorDispatcher, gt as ActorAliasMapper, u as RequestContext, vt as ActorHandleMapper } from "./context-b36TpPoG.cjs";
3
3
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
4
4
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
5
5
 
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { Bt as WebFingerLinksDispatcher, _t as ActorDispatcher, gt as ActorAliasMapper, u as RequestContext, vt as ActorHandleMapper } from "./context-BJPHhBmD.js";
2
+ import { Ht as WebFingerLinksDispatcher, _t as ActorDispatcher, gt as ActorAliasMapper, u as RequestContext, vt as ActorHandleMapper } from "./context-D_gg4M0n.js";
3
3
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
4
4
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
5
5
 
package/dist/mod.cjs CHANGED
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("./rolldown-runtime-Dmm3t92W.cjs");
4
4
  const require_transformers = require("./transformers-BalCrSsr.cjs");
5
5
  require("./compat/mod.cjs");
6
- const require_http = require("./http-CGjvl34X.cjs");
7
- const require_federation = require("./federation-Bdu06LEl.cjs");
6
+ const require_http = require("./http-DW5mt8FG.cjs");
7
+ const require_federation = require("./federation-DDwszIrk.cjs");
8
8
  const require_types = require("./types-Be2zbyeG.cjs");
9
- const require_owner = require("./owner-Hurn_ocn.cjs");
10
- const require_kv_cache = require("./kv-cache-CvEicbrf.cjs");
9
+ const require_owner = require("./owner-C2ER4VD7.cjs");
10
+ const require_kv_cache = require("./kv-cache-LOyq_Ty6.cjs");
11
11
  require("./nodeinfo/mod.cjs");
12
12
  require("./runtime/mod.cjs");
13
13
  require("./sig/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -2,17 +2,17 @@
2
2
  import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-D-XP_Ccb.cjs";
3
3
  import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-CP-7OdSq.cjs";
4
4
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-BF0L9cMt.cjs";
5
- import { $ as MessageQueue, A as ObjectCallbackSetters, At as NodeInfoDispatcher, B as TaskDefinitionOptions, Bt as WebFingerLinksDispatcher, C as FederationOptions, Ct as CollectionDispatcher, D as InboxChallengePolicy, Dt as InboxErrorHandler, E as IdempotencyStrategy, Et as CustomCollectionDispatcher, F as FederationQueueOptions, Ft as OutboxListenerErrorHandler, G as RetryContext, Gt as digest, H as TaskHandler, Ht as SenderKeyPair, I as createFederation, It as OutboxPermanentFailureHandler, J as RespondWithObjectOptions, K as RetryPolicy, Kt as ActivityTransformer, L as Message, Lt as SharedInboxKeyDispatcher, M as Rfc6570Expression, Mt as ObjectDispatcher, N as FederationKvPrefixes, Nt as OutboxErrorHandler, O as InboxListenerSetters, Ot as InboxListener, P as FederationOrigin, Pt as OutboxListener, Q as InProcessMessageQueueOptions, R as createFederationBuilder, Rt as UnverifiedActivityHandler, S as FederationFetchOptions, St as CollectionCursor, T as IdempotencyKeyCallback, Tt as CustomCollectionCursor, U as TaskRegistry, Ut as PageItems, V as TaskEnqueueOptions, Vt as SendActivityError, W as CreateExponentialBackoffPolicyOptions, Wt as buildCollectionSynchronizationHeader, X as respondWithObjectIfAcceptable, Y as respondWithObject, Z as InProcessMessageQueue, _ as CustomCollectionCallbackSetters, _t as ActorDispatcher, a as GetSignedKeyOptions, at as CircuitBreakerActivityDrop, b as FederationBenchmarkOptions, bt as AuthorizePredicate, c as ParseUriResult, ct as CircuitBreakerFailurePolicy, d as RouteActivityOptions, dt as CircuitBreakerState, et as MessageQueueDepth, f as SendActivityOptions, ft as CircuitBreakerStateChange, g as ConstructorWithTypeId, gt as ActorAliasMapper, h as CollectionCallbackSetters, ht as parseCircuitBreakerKvState, i as GetActorOptions, it as CircuitBreaker, j as OutboxListenerSetters, jt as ObjectAuthorizePredicate, k as MediaUploaderSetters, kt as MediaUploaderCallback, l as PortableRequest, lt as CircuitBreakerKvState, m as ActorCallbackSetters, mt as normalizeCircuitBreakerOptions, n as Context, nt as MessageQueueListenOptions, o as InboxContext, ot as CircuitBreakerBeforeSendDecision, p as SendActivityOptionsForCollection, pt as NormalizedCircuitBreakerOptions, q as createExponentialBackoffPolicy, r as ForwardActivityOptions, rt as ParallelMessageQueue, s as OutboxContext, st as CircuitBreakerCreateOptions, t as ActorKeyPair, tt as MessageQueueEnqueueOptions, u as RequestContext, ut as CircuitBreakerOptions, v as Federatable, vt as ActorHandleMapper, w as FederationStartQueueOptions, wt as CustomCollectionCounter, x as FederationBuilder, xt as CollectionCounter, y as Federation, yt as ActorKeyPairsDispatcher, z as TaskDefinition, zt as UnverifiedActivityReason } from "./context-Bh_mJfbD.cjs";
5
+ import { $ as MessageQueue, A as ObjectCallbackSetters, At as InboxListener, B as TaskDefinitionOptions, Bt as UnverifiedActivityHandler, C as FederationOptions, Ct as CollectionDispatcher, D as InboxChallengePolicy, Dt as HashlinkMediaDispatcher, E as IdempotencyStrategy, Et as CustomCollectionDispatcher, F as FederationQueueOptions, Ft as OutboxErrorHandler, G as RetryContext, Gt as PageItems, H as TaskHandler, Ht as WebFingerLinksDispatcher, I as createFederation, It as OutboxListener, J as RespondWithObjectOptions, Jt as ActivityTransformer, K as RetryPolicy, Kt as buildCollectionSynchronizationHeader, L as Message, Lt as OutboxListenerErrorHandler, M as Rfc6570Expression, Mt as NodeInfoDispatcher, N as FederationKvPrefixes, Nt as ObjectAuthorizePredicate, O as InboxListenerSetters, Ot as HashlinkMediaRequest, P as FederationOrigin, Pt as ObjectDispatcher, Q as InProcessMessageQueueOptions, R as createFederationBuilder, Rt as OutboxPermanentFailureHandler, S as FederationFetchOptions, St as CollectionCursor, T as IdempotencyKeyCallback, Tt as CustomCollectionCursor, U as TaskRegistry, Ut as SendActivityError, V as TaskEnqueueOptions, Vt as UnverifiedActivityReason, W as CreateExponentialBackoffPolicyOptions, Wt as SenderKeyPair, X as respondWithObjectIfAcceptable, Y as respondWithObject, Z as InProcessMessageQueue, _ as CustomCollectionCallbackSetters, _t as ActorDispatcher, a as GetSignedKeyOptions, at as CircuitBreakerActivityDrop, b as FederationBenchmarkOptions, bt as AuthorizePredicate, c as ParseUriResult, ct as CircuitBreakerFailurePolicy, d as RouteActivityOptions, dt as CircuitBreakerState, et as MessageQueueDepth, f as SendActivityOptions, ft as CircuitBreakerStateChange, g as ConstructorWithTypeId, gt as ActorAliasMapper, h as CollectionCallbackSetters, ht as parseCircuitBreakerKvState, i as GetActorOptions, it as CircuitBreaker, j as OutboxListenerSetters, jt as MediaUploaderCallback, k as MediaUploaderSetters, kt as InboxErrorHandler, l as PortableRequest, lt as CircuitBreakerKvState, m as ActorCallbackSetters, mt as normalizeCircuitBreakerOptions, n as Context, nt as MessageQueueListenOptions, o as InboxContext, ot as CircuitBreakerBeforeSendDecision, p as SendActivityOptionsForCollection, pt as NormalizedCircuitBreakerOptions, q as createExponentialBackoffPolicy, qt as digest, r as ForwardActivityOptions, rt as ParallelMessageQueue, s as OutboxContext, st as CircuitBreakerCreateOptions, t as ActorKeyPair, tt as MessageQueueEnqueueOptions, u as RequestContext, ut as CircuitBreakerOptions, v as Federatable, vt as ActorHandleMapper, w as FederationStartQueueOptions, wt as CustomCollectionCounter, x as FederationBuilder, xt as CollectionCounter, y as Federation, yt as ActorKeyPairsDispatcher, z as TaskDefinition, zt as SharedInboxKeyDispatcher } from "./context-b36TpPoG.cjs";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.cjs";
7
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
8
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-DU8aVzQJ.cjs";
8
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-Bfenkg_c.cjs";
9
9
  import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-CVQFWefn.cjs";
10
10
  import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CyiSjRkk.cjs";
11
11
  export * from "@fedify/vocab-runtime";
12
12
 
13
13
  //#region src/mod.d.ts
14
14
  declare namespace mod_d_exports {
15
- export { AcceptSignatureMember, AcceptSignatureParameters, ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, FulfillAcceptSignatureResult, GetActorOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, PortableRequest, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, Rfc9421SignRequestOptions, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, hasProofLike, hasSignatureLike, importJwk, kvCache, nodeInfoToJson, normalizeCircuitBreakerOptions, parseAcceptSignature, parseCircuitBreakerKvState, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
15
+ export { AcceptSignatureMember, AcceptSignatureParameters, ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, FulfillAcceptSignatureResult, GetActorOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HashlinkMediaDispatcher, HashlinkMediaRequest, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, PortableRequest, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, Rfc9421SignRequestOptions, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, hasProofLike, hasSignatureLike, importJwk, kvCache, nodeInfoToJson, normalizeCircuitBreakerOptions, parseAcceptSignature, parseCircuitBreakerKvState, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
16
16
  }
17
17
  //#endregion
18
- export { AcceptSignatureMember, AcceptSignatureParameters, ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, FulfillAcceptSignatureResult, GetActorOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, PortableRequest, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, Rfc9421SignRequestOptions, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, hasProofLike, hasSignatureLike, importJwk, kvCache, nodeInfoToJson, normalizeCircuitBreakerOptions, parseAcceptSignature, parseCircuitBreakerKvState, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
18
+ export { AcceptSignatureMember, AcceptSignatureParameters, ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, FulfillAcceptSignatureResult, GetActorOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HashlinkMediaDispatcher, HashlinkMediaRequest, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, PortableRequest, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, Rfc9421SignRequestOptions, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, hasProofLike, hasSignatureLike, importJwk, kvCache, nodeInfoToJson, normalizeCircuitBreakerOptions, parseAcceptSignature, parseCircuitBreakerKvState, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };