@fedify/fedify 2.3.14 → 2.3.15

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 (87) hide show
  1. package/dist/{builder-C6yXExXl.mjs → builder-B6vSXYxn.mjs} +2 -2
  2. package/dist/{client-CAM_bQXx.d.cts → client-BIBzqEIp.d.cts} +0 -1
  3. package/dist/{client-1He2YuBF.mjs → client-DpUNYKla.mjs} +113 -64
  4. package/dist/{client-CSddvgWN.d.ts → client-jE7oGvRh.d.ts} +0 -1
  5. package/dist/compat/mod.d.cts +1 -1
  6. package/dist/compat/mod.d.ts +1 -1
  7. package/dist/compat/transformers.test.mjs +1 -1
  8. package/dist/{context-MOrCC7yl.d.cts → context-CE_Tj_Oc.d.cts} +28 -2
  9. package/dist/{context-BWbdE_MZ.d.ts → context-H_5tZXg-.d.ts} +28 -2
  10. package/dist/{deno-y3L4Oa94.mjs → deno-BCuL3mid.mjs} +1 -1
  11. package/dist/docloader-D2dr1_6B.mjs +125 -0
  12. package/dist/federation/builder.test.mjs +1 -1
  13. package/dist/federation/handler.test.mjs +5 -5
  14. package/dist/federation/idempotency.test.mjs +2 -2
  15. package/dist/federation/inbox.test.mjs +1 -1
  16. package/dist/federation/metrics.test.mjs +1 -1
  17. package/dist/federation/middleware.test.mjs +455 -29
  18. package/dist/federation/mod.cjs +1 -1
  19. package/dist/federation/mod.d.cts +2 -2
  20. package/dist/federation/mod.d.ts +2 -2
  21. package/dist/federation/mod.js +1 -1
  22. package/dist/federation/send.test.mjs +498 -88
  23. package/dist/federation/temporal.test.mjs +1 -1
  24. package/dist/federation/webfinger.test.mjs +1 -1
  25. package/dist/{http-DNM9KyIO.js → http-BkjxY3U0.js} +172 -103
  26. package/dist/{http-BCSf1KIY.mjs → http-CSDcThvz.mjs} +196 -98
  27. package/dist/{http-DQmNpfym.d.ts → http-CZPYFK3b.d.cts} +1 -2
  28. package/dist/{http-DiWQB8Mr.d.cts → http-DmP0sr2l.d.ts} +1 -2
  29. package/dist/{http-D77Wjrcg.cjs → http-gOkAiIe1.cjs} +173 -104
  30. package/dist/{inbox-NObX26c9.mjs → inbox-BHxez4d5.mjs} +2 -2
  31. package/dist/{key-APURZ0ky.mjs → key-D8IMQ72M.mjs} +2 -2
  32. package/dist/{kv-cache-Bg4utAuv.cjs → kv-cache-Alm5UmJa.cjs} +59 -17
  33. package/dist/{kv-cache-C69dzgQi.mjs → kv-cache-Blr9nDDp.mjs} +1 -1
  34. package/dist/{kv-cache-LBCwHNLu.js → kv-cache-CkXgU-ak.js} +60 -18
  35. package/dist/{ld-BoLqbDaL.mjs → ld-CVxxE1Pp.mjs} +3 -3
  36. package/dist/{metrics-DBSl8wEr.mjs → metrics-SYIZHFf_.mjs} +1 -1
  37. package/dist/{middleware-BQUQ0pPl.cjs → middleware-4yPyyoF5.cjs} +237 -99
  38. package/dist/{middleware-CZ8tI1qL.mjs → middleware-CfskJGfV.mjs} +81 -41
  39. package/dist/{middleware-DAqo2eOY.mjs → middleware-D3JWfiCu.mjs} +1 -1
  40. package/dist/{middleware-CRd1JmuL.js → middleware-DhN7c65B.js} +238 -100
  41. package/dist/{mod-LmD03uRA.d.ts → mod-CDFFESfL.d.ts} +1 -1
  42. package/dist/{mod-Bid79LFU.d.cts → mod-C_gFmeNq.d.cts} +1 -1
  43. package/dist/{mod-Co1M3Ux0.d.cts → mod-DDVkmZ_h.d.cts} +2 -8
  44. package/dist/{mod-B6PwkUMU.d.cts → mod-DDjtbkZO.d.cts} +1 -1
  45. package/dist/{mod-Br8yJNcE.d.ts → mod-DMjhnFbg.d.ts} +2 -8
  46. package/dist/{mod-TLEvgT1i.d.ts → mod-HQXFvOHs.d.ts} +1 -1
  47. package/dist/mod.cjs +5 -5
  48. package/dist/mod.d.cts +6 -6
  49. package/dist/mod.d.ts +6 -6
  50. package/dist/mod.js +5 -5
  51. package/dist/nodeinfo/client.test.mjs +337 -19
  52. package/dist/nodeinfo/handler.test.mjs +1 -1
  53. package/dist/nodeinfo/mod.cjs +1 -1
  54. package/dist/nodeinfo/mod.d.cts +1 -1
  55. package/dist/nodeinfo/mod.d.ts +1 -1
  56. package/dist/nodeinfo/mod.js +1 -1
  57. package/dist/otel/exporter.test.mjs +292 -30
  58. package/dist/otel/mod.cjs +36 -30
  59. package/dist/otel/mod.d.cts +13 -0
  60. package/dist/otel/mod.d.ts +13 -0
  61. package/dist/otel/mod.js +36 -30
  62. package/dist/{owner-DjKvngeb.mjs → owner-BluLVPf0.mjs} +2 -2
  63. package/dist/{proof-CWTnYhjS.cjs → proof-CR-HwI0l.cjs} +1 -1
  64. package/dist/{proof-D2oFOdNA.mjs → proof-Co6nQBVR.mjs} +3 -3
  65. package/dist/{proof-s9sy44kx.js → proof-Dg0d9QBo.js} +1 -1
  66. package/dist/{send-xDK5UnL-.mjs → send-D_DnqOFA.mjs} +171 -73
  67. package/dist/sig/http.test.mjs +528 -2
  68. package/dist/sig/key.test.mjs +2 -2
  69. package/dist/sig/ld.test.mjs +2 -2
  70. package/dist/sig/mod.cjs +2 -2
  71. package/dist/sig/mod.d.cts +2 -2
  72. package/dist/sig/mod.d.ts +2 -2
  73. package/dist/sig/mod.js +2 -2
  74. package/dist/sig/owner.test.mjs +1 -1
  75. package/dist/sig/proof.test.mjs +1 -1
  76. package/dist/{temporal-C6icc5n9.mjs → temporal-B8FUNkXB.mjs} +1 -1
  77. package/dist/testing/mod.d.mts +26 -0
  78. package/dist/{types-miAYfiGO.js → types-B1_pRFE_.js} +112 -63
  79. package/dist/{types-DRPjmHVV.cjs → types-DOvyymM4.cjs} +111 -62
  80. package/dist/utils/docloader.test.mjs +318 -34
  81. package/dist/utils/kv-cache.test.mjs +1 -1
  82. package/dist/utils/mod.cjs +1 -1
  83. package/dist/utils/mod.d.cts +1 -1
  84. package/dist/utils/mod.d.ts +1 -1
  85. package/dist/utils/mod.js +1 -1
  86. package/package.json +8 -8
  87. package/dist/docloader-yuyzZC9a.mjs +0 -83
@@ -2,20 +2,21 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./chunk-CRNNMoPX.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
5
- import { A as 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-DNM9KyIO.js";
6
- import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-miAYfiGO.js";
7
- import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-s9sy44kx.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-LBCwHNLu.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 doubleKnockScoped, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-BkjxY3U0.js";
6
+ import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-B1_pRFE_.js";
7
+ import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-Dg0d9QBo.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CkXgU-ak.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
11
11
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
12
12
  import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
13
13
  import { encodeHex } from "byte-encodings/hex";
14
- import { FetchError, UrlError, getDocumentLoader, validatePublicUrl } from "@fedify/vocab-runtime";
14
+ import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
15
15
  import { uniq } from "es-toolkit";
16
16
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
17
17
  import jsonld from "@fedify/vocab-runtime/jsonld";
18
18
  import { lookupWebFinger } from "@fedify/webfinger";
19
+ import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
19
20
  import { DataPointType, MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
20
21
  import { domainToASCII } from "node:url";
21
22
  //#region src/federation/activity-listener.ts
@@ -3422,9 +3423,10 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
3422
3423
  *
3423
3424
  * @param parameters The parameters for sending the activity.
3424
3425
  * See also {@link SendActivityParameters}.
3426
+ * @param deps The dependencies, for tests.
3425
3427
  * @throws {Error} If the activity fails to send.
3426
3428
  */
3427
- function sendActivity(options) {
3429
+ function sendActivity(options, deps = {}) {
3428
3430
  const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
3429
3431
  return tracerProvider.getTracer(name, version).startActiveSpan("activitypub.send_activity", {
3430
3432
  kind: SpanKind.CLIENT,
@@ -3436,7 +3438,7 @@ function sendActivity(options) {
3436
3438
  await sendActivityInternal({
3437
3439
  ...options,
3438
3440
  tracerProvider
3439
- }, span);
3441
+ }, span, deps);
3440
3442
  } catch (e) {
3441
3443
  span.setStatus({
3442
3444
  code: SpanStatusCode.ERROR,
@@ -3489,13 +3491,14 @@ async function readLimitedResponseBody(response, maxBytes) {
3489
3491
  totalBytes += value.length;
3490
3492
  }
3491
3493
  } finally {
3494
+ if (truncated) reader.cancel().catch(() => {});
3492
3495
  reader.releaseLock();
3493
3496
  }
3494
3497
  let result = chunks.join("");
3495
3498
  if (truncated) result += "… (truncated)";
3496
3499
  return result;
3497
3500
  }
3498
- async function sendActivityInternal({ activity, activityId, activityType, keys, inbox, allowPrivateAddress, headers, specDeterminer, meterProvider, tracerProvider }, span) {
3501
+ async function sendActivityInternal({ activity, activityId, activityType, keys, inbox, allowPrivateAddress, headers, specDeterminer, meterProvider, tracerProvider }, span, deps) {
3499
3502
  const logger = getLogger([
3500
3503
  "fedify",
3501
3504
  "federation",
@@ -3504,9 +3507,11 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3504
3507
  const federationMetrics = getFederationMetrics(meterProvider);
3505
3508
  const started = performance.now();
3506
3509
  let deliverySuccess = false;
3507
- async function validateUrl(url) {
3508
- if (!allowPrivateAddress) try {
3509
- await validatePublicUrl(url);
3510
+ const openUnvalidatedHop = deps.openHop ?? (allowPrivateAddress ? openDirectFetch : (url) => openPublicFetch(url));
3511
+ async function openHop(url) {
3512
+ let session;
3513
+ try {
3514
+ session = await openUnvalidatedHop(url);
3510
3515
  } catch (error) {
3511
3516
  if (error instanceof UrlError && error.reason === "dns") {
3512
3517
  logger.error("DNS resolution failed for URL: {url}", {
@@ -3523,78 +3528,86 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3523
3528
  });
3524
3529
  throw error;
3525
3530
  }
3531
+ return session;
3526
3532
  }
3533
+ let initialSession;
3527
3534
  try {
3528
- await validateUrl(inbox.href);
3535
+ initialSession = await openHop(inbox.href);
3529
3536
  } catch (error) {
3530
3537
  if (error instanceof FetchError) federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
3531
3538
  throw error;
3532
3539
  }
3533
- headers = new Headers(headers);
3534
- headers.set("Content-Type", "application/activity+json");
3535
- const request = new Request(inbox, {
3536
- method: "POST",
3537
- headers,
3538
- body: JSON.stringify(activity),
3539
- redirect: "manual"
3540
- });
3541
- let rsaKey = null;
3542
- for (const key of keys) if (key.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
3543
- rsaKey = key;
3544
- break;
3545
- }
3546
- if (rsaKey == null) logger.warn("No supported key found to sign the request to {inbox}. The request will be sent without a signature. In order to sign the request, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
3547
- inbox: inbox.href,
3548
- keys: keys.map((pair) => ({
3549
- keyId: pair.keyId.href,
3550
- privateKey: pair.privateKey
3551
- }))
3552
- });
3553
- let response;
3540
+ let initialPending = true;
3541
+ const openDeliveryHop = (url) => {
3542
+ if (initialPending) {
3543
+ initialPending = false;
3544
+ return Promise.resolve(initialSession);
3545
+ }
3546
+ return openHop(url);
3547
+ };
3554
3548
  try {
3555
- response = rsaKey == null ? await fetchWithValidatedRedirects(request, validateUrl) : await doubleKnock(request, rsaKey, {
3556
- tracerProvider,
3557
- specDeterminer,
3558
- validateRedirect: validateUrl
3549
+ headers = new Headers(headers);
3550
+ headers.set("Content-Type", "application/activity+json");
3551
+ const request = new Request(inbox, {
3552
+ method: "POST",
3553
+ headers,
3554
+ body: JSON.stringify(activity),
3555
+ redirect: "manual"
3559
3556
  });
3560
- } catch (error) {
3561
- const failure = error instanceof FetchError || error instanceof UrlError ? error : createFetchError(inbox.href, error);
3562
- logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
3563
- activityId,
3557
+ let rsaKey = null;
3558
+ for (const key of keys) if (key.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
3559
+ rsaKey = key;
3560
+ break;
3561
+ }
3562
+ if (rsaKey == null) logger.warn("No supported key found to sign the request to {inbox}. The request will be sent without a signature. In order to sign the request, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
3564
3563
  inbox: inbox.href,
3565
- error: failure
3564
+ keys: keys.map((pair) => ({
3565
+ keyId: pair.keyId.href,
3566
+ privateKey: pair.privateKey
3567
+ }))
3566
3568
  });
3567
- federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
3568
- throw failure;
3569
- }
3570
- try {
3571
- if (!response.ok) {
3572
- let error;
3573
- try {
3574
- error = await readLimitedResponseBody(response, MAX_ERROR_RESPONSE_BODY_BYTES);
3575
- } catch (_) {
3576
- error = "";
3577
- }
3578
- logger.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
3569
+ let outcome;
3570
+ try {
3571
+ outcome = rsaKey == null ? await fetchWithValidatedRedirects(request, openDeliveryHop, (response) => consumeSendActivityResponse(response, inbox)) : await doubleKnockScoped(request, rsaKey, {
3572
+ tracerProvider,
3573
+ specDeterminer
3574
+ }, openDeliveryHop, (response) => consumeSendActivityResponse(response, inbox));
3575
+ } catch (error) {
3576
+ const failure = error instanceof FetchError || error instanceof UrlError ? error : createFetchError(inbox.href, error);
3577
+ logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
3579
3578
  activityId,
3580
3579
  inbox: inbox.href,
3581
- status: response.status,
3582
- statusText: response.statusText,
3583
- error
3580
+ error: failure
3584
3581
  });
3585
- throw new SendActivityError(inbox, response.status, `Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`, error, response.headers);
3582
+ federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
3583
+ throw failure;
3584
+ }
3585
+ try {
3586
+ if (!outcome.ok) {
3587
+ const { status, statusText, error, responseHeaders } = outcome;
3588
+ logger.error("Failed to send activity {activityId} to {inbox} ({status} {statusText}):\n{error}", {
3589
+ activityId,
3590
+ inbox: inbox.href,
3591
+ status,
3592
+ statusText,
3593
+ error
3594
+ });
3595
+ throw new SendActivityError(inbox, status, `Failed to send activity ${activityId} to ${inbox.href} (${status} ${statusText}):\n${error}`, error, responseHeaders);
3596
+ }
3597
+ deliverySuccess = true;
3598
+ const eventAttributes = {
3599
+ "activitypub.inbox.url": inbox.href,
3600
+ "activitypub.activity.id": activityId ?? ""
3601
+ };
3602
+ if (activityType != null) eventAttributes["activitypub.activity.type"] = activityType;
3603
+ const actorId = getActivityActorId(activity);
3604
+ if (actorId != null) eventAttributes["activitypub.actor.id"] = actorId;
3605
+ span.addEvent("activitypub.activity.sent", eventAttributes);
3606
+ } finally {
3607
+ federationMetrics.recordDelivery(inbox, getDurationMs(started), deliverySuccess, activityType);
3586
3608
  }
3587
- deliverySuccess = true;
3588
- const eventAttributes = {
3589
- "activitypub.inbox.url": inbox.href,
3590
- "activitypub.activity.id": activityId ?? ""
3591
- };
3592
- if (activityType != null) eventAttributes["activitypub.activity.type"] = activityType;
3593
- const actorId = getActivityActorId(activity);
3594
- if (actorId != null) eventAttributes["activitypub.actor.id"] = actorId;
3595
- span.addEvent("activitypub.activity.sent", eventAttributes);
3596
3609
  } finally {
3597
- federationMetrics.recordDelivery(inbox, getDurationMs(started), deliverySuccess, activityType);
3610
+ if (initialPending) await initialSession.close();
3598
3611
  }
3599
3612
  }
3600
3613
  function createFetchError(url, cause) {
@@ -3602,10 +3615,75 @@ function createFetchError(url, cause) {
3602
3615
  error.cause = cause;
3603
3616
  return error;
3604
3617
  }
3605
- async function fetchWithValidatedRedirects(request, validateUrl) {
3618
+ /**
3619
+ * Starts cancelling the body of a response without waiting for it to settle.
3620
+ * The cancellation of a branch of a tee (e.g., a body cloned by a fetch mock)
3621
+ * settles only after the other branch is cancelled too, per the Streams
3622
+ * standard, so awaiting it could block forever. Failures are only logged.
3623
+ */
3624
+ function cancelResponseBody(response, url) {
3625
+ response.body?.cancel().catch((error) => {
3626
+ getLogger([
3627
+ "fedify",
3628
+ "federation",
3629
+ "outbox"
3630
+ ]).debug("Failed to cancel the response body from {url}: {error}", {
3631
+ url,
3632
+ error
3633
+ });
3634
+ });
3635
+ }
3636
+ /**
3637
+ * Reads what is needed from the final response of a delivery while its
3638
+ * session is open: the body of a successful response is cancelled, and at
3639
+ * most 1 KiB of an error response body is read.
3640
+ */
3641
+ async function consumeSendActivityResponse(response, inbox) {
3642
+ if (response.ok) {
3643
+ cancelResponseBody(response, response.url || inbox.href);
3644
+ return { ok: true };
3645
+ }
3646
+ let error;
3647
+ try {
3648
+ error = await readLimitedResponseBody(response, MAX_ERROR_RESPONSE_BODY_BYTES);
3649
+ } catch (_) {
3650
+ error = "";
3651
+ }
3652
+ return {
3653
+ ok: false,
3654
+ status: response.status,
3655
+ statusText: response.statusText,
3656
+ error,
3657
+ responseHeaders: new Headers(response.headers)
3658
+ };
3659
+ }
3660
+ /**
3661
+ * Sends a request without signing it, following redirects manually like the
3662
+ * Fetch standard does. Every hop is opened with `openHop()`, which validates
3663
+ * the destination, after the previous hop is closed. The final response is
3664
+ * passed to `consume()`, and its session is closed after that.
3665
+ * This is exported only for tests; it is not exported from any entry point.
3666
+ * @param request The request to send.
3667
+ * @param openHop The function to open a session for each hop.
3668
+ * @param consume The function to consume the final response.
3669
+ * @returns The value returned by `consume`.
3670
+ */
3671
+ async function fetchWithValidatedRedirects(request, openHop, consume) {
3672
+ const logger = getLogger([
3673
+ "fedify",
3674
+ "federation",
3675
+ "outbox"
3676
+ ]);
3606
3677
  let body = await request.clone().text();
3607
3678
  for (let redirects = 0;; redirects++) {
3608
- const response = await fetch(request, { redirect: "manual" });
3679
+ const session = await openHop(request.url);
3680
+ let response;
3681
+ try {
3682
+ response = await session.fetch(request, { redirect: "manual" });
3683
+ } catch (error) {
3684
+ await closeAfterError(session, logger);
3685
+ throw error;
3686
+ }
3609
3687
  const location = response.headers.get("Location");
3610
3688
  if (![
3611
3689
  301,
@@ -3613,11 +3691,21 @@ async function fetchWithValidatedRedirects(request, validateUrl) {
3613
3691
  303,
3614
3692
  307,
3615
3693
  308
3616
- ].includes(response.status) || location == null) return response;
3617
- await response.body?.cancel();
3694
+ ].includes(response.status) || location == null) try {
3695
+ return await consume(response);
3696
+ } catch (error) {
3697
+ logger.debug("Failed to consume the response from {url}; closing the session: {error}", {
3698
+ url: request.url,
3699
+ error
3700
+ });
3701
+ throw error;
3702
+ } finally {
3703
+ await session.close();
3704
+ }
3705
+ cancelResponseBody(response, request.url);
3706
+ await session.close();
3618
3707
  if (redirects >= 20) throw new TypeError("Too many redirects");
3619
3708
  const url = new URL(location, request.url);
3620
- await validateUrl(url.href);
3621
3709
  const headers = new Headers(request.headers);
3622
3710
  if (url.origin !== new URL(request.url).origin) {
3623
3711
  headers.delete("Authorization");
@@ -3645,6 +3733,16 @@ async function fetchWithValidatedRedirects(request, validateUrl) {
3645
3733
  });
3646
3734
  }
3647
3735
  }
3736
+ async function closeAfterError(session, logger) {
3737
+ try {
3738
+ await session.close();
3739
+ } catch (error) {
3740
+ logger.debug("Failed to close the session for {url}: {error}", {
3741
+ url: session.url.href,
3742
+ error
3743
+ });
3744
+ }
3745
+ }
3648
3746
  /**
3649
3747
  * An error that is thrown when an activity fails to send to a remote inbox.
3650
3748
  * It contains structured information about the failure, including the HTTP
@@ -5505,7 +5603,7 @@ var FederationImpl = class extends FederationBuilderImpl {
5505
5603
  onNotAcceptable ??= notAcceptable;
5506
5604
  onUnauthorized ??= unauthorized;
5507
5605
  const url = new URL(request.url);
5508
- const route = this.router.route(url.pathname);
5606
+ const route = this.router.route(url.pathname, { allowUnencodedColon: true });
5509
5607
  if (route == null) {
5510
5608
  metricState.endpoint = "not_found";
5511
5609
  return await onNotFound(request);
@@ -6496,44 +6594,84 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
6496
6594
  }
6497
6595
  }), values);
6498
6596
  }
6499
- #signedKey = void 0;
6597
+ #signedKey = null;
6598
+ #signedKeyOwner = null;
6599
+ #signatureChecks = /* @__PURE__ */ new WeakMap();
6600
+ #getSignatureCheck(documentLoader, contextLoader) {
6601
+ let checks = this.#signatureChecks.get(documentLoader);
6602
+ if (checks == null) {
6603
+ checks = /* @__PURE__ */ new WeakMap();
6604
+ this.#signatureChecks.set(documentLoader, checks);
6605
+ }
6606
+ let check = checks.get(contextLoader);
6607
+ if (check == null) {
6608
+ check = {};
6609
+ checks.set(contextLoader, check);
6610
+ }
6611
+ return check;
6612
+ }
6500
6613
  async getSignedKey(options = {}) {
6501
6614
  if (this.#signedKey != null) return this.#signedKey;
6502
- return this.#signedKey = await verifyRequest(this.request, {
6615
+ const documentLoader = options.documentLoader ?? this.documentLoader;
6616
+ const contextLoader = options.contextLoader ?? this.contextLoader;
6617
+ const check = this.#getSignatureCheck(documentLoader, contextLoader);
6618
+ if (check.key != null) return check.key;
6619
+ const promise = verifyRequest(this.request, {
6503
6620
  ...this,
6504
- contextLoader: options.contextLoader ?? this.contextLoader,
6505
- documentLoader: options.documentLoader ?? this.documentLoader,
6621
+ contextLoader,
6622
+ documentLoader,
6506
6623
  timeWindow: this.federation.signatureTimeWindow,
6507
6624
  meterProvider: this.meterProvider,
6508
6625
  tracerProvider: options.tracerProvider ?? this.tracerProvider
6626
+ }).then((key) => {
6627
+ if (key != null) this.#signedKey ??= key;
6628
+ return key;
6629
+ }).catch((error) => {
6630
+ if (check.key === promise) check.key = void 0;
6631
+ throw error;
6509
6632
  });
6633
+ check.key = promise;
6634
+ return await promise;
6510
6635
  }
6511
- #signedKeyOwner = void 0;
6512
6636
  async getSignedKeyOwner(options = {}) {
6513
6637
  if (this.#signedKeyOwner != null) return this.#signedKeyOwner;
6514
- const key = await this.getSignedKey(options);
6515
- if (key == null) return this.#signedKeyOwner = null;
6516
- try {
6517
- return this.#signedKeyOwner = await getKeyOwner(key, {
6518
- contextLoader: options.contextLoader ?? this.contextLoader,
6519
- documentLoader: options.documentLoader ?? this.documentLoader,
6520
- tracerProvider: options.tracerProvider ?? this.tracerProvider
6521
- });
6522
- } catch (error) {
6523
- if (error instanceof FetchError) {
6524
- getLogger([
6525
- "fedify",
6526
- "federation",
6527
- "actor"
6528
- ]).warn("Failed to fetch the key owner {keyOwner} of {keyId} while verifying the request signature; treating the request as unauthenticated: {error}", {
6529
- keyId: key.id?.href,
6530
- keyOwner: error.url.href,
6531
- error
6532
- });
6533
- return this.#signedKeyOwner = null;
6638
+ const normalizedOptions = {
6639
+ documentLoader: options.documentLoader ?? this.documentLoader,
6640
+ contextLoader: options.contextLoader ?? this.contextLoader,
6641
+ tracerProvider: options.tracerProvider ?? this.tracerProvider
6642
+ };
6643
+ const check = this.#getSignatureCheck(normalizedOptions.documentLoader, normalizedOptions.contextLoader);
6644
+ if (check.owner != null) return check.owner;
6645
+ const promise = this.getSignedKey(normalizedOptions).then(async (key) => {
6646
+ if (key == null) {
6647
+ if (check.owner === promise) check.owner = void 0;
6648
+ return null;
6534
6649
  }
6650
+ try {
6651
+ const owner = await getKeyOwner(key, normalizedOptions);
6652
+ if (owner != null) this.#signedKeyOwner ??= owner;
6653
+ return owner;
6654
+ } catch (error) {
6655
+ if (error instanceof FetchError) {
6656
+ getLogger([
6657
+ "fedify",
6658
+ "federation",
6659
+ "actor"
6660
+ ]).warn("Failed to fetch the key owner {keyOwner} of {keyId} while verifying the request signature; treating the request as unauthenticated: {error}", {
6661
+ keyId: key.id?.href,
6662
+ keyOwner: error.url.href,
6663
+ error
6664
+ });
6665
+ return null;
6666
+ }
6667
+ throw error;
6668
+ }
6669
+ }).catch((error) => {
6670
+ if (check.owner === promise) check.owner = void 0;
6535
6671
  throw error;
6536
- }
6672
+ });
6673
+ check.owner = promise;
6674
+ return await promise;
6537
6675
  }
6538
6676
  };
6539
6677
  function forwardActivity(ctx, loggerCategory, forwarder, recipients, options) {
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-BWbdE_MZ.js";
2
+ import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-H_5tZXg-.js";
3
3
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
4
4
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
5
5
 
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { S as KeyCache } from "./http-DiWQB8Mr.cjs";
2
+ import { S as KeyCache } from "./http-CZPYFK3b.cjs";
3
3
  import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
4
4
  import { DocumentLoader } from "@fedify/vocab-runtime";
5
5
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as HttpMessageSignaturesSpecDeterminer } from "./http-DiWQB8Mr.cjs";
2
+ import { n as HttpMessageSignaturesSpecDeterminer } from "./http-CZPYFK3b.cjs";
3
3
  import { n as KvStore, t as KvKey } from "./kv-CZKl1IUS.cjs";
4
4
  import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
5
5
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
@@ -42,13 +42,7 @@ interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOpt
42
42
  declare function getAuthenticatedDocumentLoader(identity: {
43
43
  keyId: URL;
44
44
  privateKey: CryptoKey;
45
- }, {
46
- allowPrivateAddress,
47
- maxRedirection,
48
- userAgent,
49
- specDeterminer,
50
- tracerProvider
51
- }?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
45
+ }, options?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
52
46
  //#endregion
53
47
  //#region src/federation/metrics.d.ts
54
48
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-MOrCC7yl.cjs";
2
+ import { G as ActorDispatcher, K as ActorHandleMapper, W as ActorAliasMapper, l as RequestContext, pt as WebFingerLinksDispatcher } from "./context-CE_Tj_Oc.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 { n as HttpMessageSignaturesSpecDeterminer } from "./http-DQmNpfym.js";
2
+ import { n as HttpMessageSignaturesSpecDeterminer } from "./http-DmP0sr2l.js";
3
3
  import { n as KvStore, t as KvKey } from "./kv-CxaI4eGo.js";
4
4
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
5
5
  import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
@@ -42,13 +42,7 @@ interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOpt
42
42
  declare function getAuthenticatedDocumentLoader(identity: {
43
43
  keyId: URL;
44
44
  privateKey: CryptoKey;
45
- }, {
46
- allowPrivateAddress,
47
- maxRedirection,
48
- userAgent,
49
- specDeterminer,
50
- tracerProvider
51
- }?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
45
+ }, options?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
52
46
  //#endregion
53
47
  //#region src/federation/metrics.d.ts
54
48
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { S as KeyCache } from "./http-DQmNpfym.js";
2
+ import { S as KeyCache } from "./http-DmP0sr2l.js";
3
3
  import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
4
4
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
5
5
  import { DocumentLoader } from "@fedify/vocab-runtime";
package/dist/mod.cjs CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-DDcVe30Y.cjs");
5
5
  const require_transformers = require("./transformers-NeAONrAq.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_http = require("./http-D77Wjrcg.cjs");
8
- const require_middleware = require("./middleware-BQUQ0pPl.cjs");
9
- const require_types = require("./types-DRPjmHVV.cjs");
10
- const require_proof = require("./proof-CWTnYhjS.cjs");
11
- const require_kv_cache = require("./kv-cache-Bg4utAuv.cjs");
7
+ const require_http = require("./http-gOkAiIe1.cjs");
8
+ const require_middleware = require("./middleware-4yPyyoF5.cjs");
9
+ const require_types = require("./types-DOvyymM4.cjs");
10
+ const require_proof = require("./proof-CR-HwI0l.cjs");
11
+ const require_kv_cache = require("./kv-cache-Alm5UmJa.cjs");
12
12
  const require_federation_mod = require("./federation/mod.cjs");
13
13
  require("./nodeinfo/mod.cjs");
14
14
  require("./runtime/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -1,14 +1,14 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CAM_bQXx.cjs";
3
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-DiWQB8Mr.cjs";
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-BIBzqEIp.cjs";
3
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-CZPYFK3b.cjs";
4
4
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-B3hNQCG8.cjs";
5
- import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-MOrCC7yl.cjs";
5
+ import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-CE_Tj_Oc.cjs";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CZKl1IUS.cjs";
7
7
  import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "./mq-D8uSFzxe.cjs";
8
8
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
9
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-B6PwkUMU.cjs";
10
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-Bid79LFU.cjs";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-Co1M3Ux0.cjs";
9
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-DDjtbkZO.cjs";
10
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-C_gFmeNq.cjs";
11
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DDVkmZ_h.cjs";
12
12
  export * from "@fedify/vocab-runtime";
13
13
 
14
14
  //#region src/mod.d.ts
package/dist/mod.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CSddvgWN.js";
3
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-DQmNpfym.js";
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-jE7oGvRh.js";
3
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-DmP0sr2l.js";
4
4
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CiBPcC6F.js";
5
- import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-BWbdE_MZ.js";
5
+ import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, jt as ActivityTransformer, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "./context-H_5tZXg-.js";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CxaI4eGo.js";
7
7
  import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "./mq-D-nlpY04.js";
8
8
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
9
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-LmD03uRA.js";
10
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-TLEvgT1i.js";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-Br8yJNcE.js";
9
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-CDFFESfL.js";
10
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-HQXFvOHs.js";
11
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DMjhnFbg.js";
12
12
  export * from "@fedify/vocab-runtime";
13
13
 
14
14
  //#region src/mod.d.ts