@fedify/fedify 2.5.0-dev.2855 → 2.5.0-dev.2860

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 (53) hide show
  1. package/dist/{client-3InDZbba.d.cts → client-DLHsPY7X.d.cts} +16 -0
  2. package/dist/{client-3InDZbba.d.ts → client-DLHsPY7X.d.ts} +16 -0
  3. package/dist/compat/mod.cjs +1 -1
  4. package/dist/compat/mod.d.cts +1 -1
  5. package/dist/compat/mod.d.ts +1 -1
  6. package/dist/compat/mod.js +1 -1
  7. package/dist/{context-ZtE85CT_.d.cts → context-BhEcRbHo.d.cts} +32 -15
  8. package/dist/{context-CgIOZfHW.d.ts → context-C96-nSuT.d.ts} +32 -15
  9. package/dist/federation/mod.cjs +1 -1
  10. package/dist/federation/mod.d.cts +3 -3
  11. package/dist/federation/mod.d.ts +3 -3
  12. package/dist/federation/mod.js +1 -1
  13. package/dist/{federation-CNVLkzEA.cjs → federation-Auvn2nQS.cjs} +525 -196
  14. package/dist/{http-CLL0a37S.js → http-BN8Zo-nG.js} +2639 -2464
  15. package/dist/{http-Dyr_FKL0.cjs → http-DcmM0AwN.cjs} +2643 -2456
  16. package/dist/{key-BZw-YiK5.d.ts → key-2YNB5dUS.d.cts} +5 -5
  17. package/dist/{key-D5fbQkKM.d.cts → key-BV9DK4qb.d.ts} +5 -5
  18. package/dist/{kv-cache-BSXFjN7O.cjs → kv-cache-DRJgdRR0.cjs} +1 -1
  19. package/dist/{kv-cache-CfDFmySj.js → kv-cache-Dz6xiM-c.js} +1 -1
  20. package/dist/{ld-DlC78ioJ.d.ts → ld-BKOmKbuX.d.cts} +28 -6
  21. package/dist/{ld-DEi9ERHf.d.cts → ld-BewN9CW6.d.ts} +28 -6
  22. package/dist/{middleware-Bxhz1UUh.js → middleware-kGZB_Ab7.js} +457 -129
  23. package/dist/{mod-rDDnkuR8.d.cts → mod-B9UuZYxK.d.cts} +3 -3
  24. package/dist/{mod-BD6xjFNY.d.ts → mod-BMHC9eZs.d.ts} +1 -1
  25. package/dist/{mod-Bl1EEZMj.d.cts → mod-CUXI3ede.d.cts} +1 -1
  26. package/dist/{mod-SgCN1wPF.d.ts → mod-DHjHSPnw.d.ts} +3 -3
  27. package/dist/{mod-BamwZjJx.d.cts → mod-iIOirIJV.d.ts} +3 -3
  28. package/dist/{mod-BJRtsw7l.d.ts → mod-oIp2uo8F.d.cts} +3 -3
  29. package/dist/mod.cjs +6 -6
  30. package/dist/mod.d.cts +9 -9
  31. package/dist/mod.d.ts +9 -9
  32. package/dist/mod.js +6 -6
  33. package/dist/nodeinfo/mod.cjs +1 -1
  34. package/dist/nodeinfo/mod.d.cts +1 -1
  35. package/dist/nodeinfo/mod.d.ts +1 -1
  36. package/dist/nodeinfo/mod.js +1 -1
  37. package/dist/{portable-collection-NzJ-twKe.js → portable-collection-BKIPytM_.js} +3 -2
  38. package/dist/{portable-collection-CIJWeEsY.cjs → portable-collection-C5sRy1VN.cjs} +3 -2
  39. package/dist/portable-verifier-CPA86vIP.js +22 -0
  40. package/dist/portable-verifier-DiLU8c9T.cjs +26 -0
  41. package/dist/sig/mod.cjs +2 -2
  42. package/dist/sig/mod.d.cts +4 -4
  43. package/dist/sig/mod.d.ts +4 -4
  44. package/dist/sig/mod.js +2 -2
  45. package/dist/{transformers-DAtXl_Kc.js → transformers-BlJ53iKs.js} +3 -2
  46. package/dist/{transformers-BalCrSsr.cjs → transformers-aIK89ibB.cjs} +3 -2
  47. package/dist/{types-DUjZb4i6.js → types-BbCbtwZp.js} +86 -11
  48. package/dist/{types-hKCCjii0.cjs → types-C8gac_AD.cjs} +85 -10
  49. package/dist/utils/mod.cjs +1 -1
  50. package/dist/utils/mod.d.cts +1 -1
  51. package/dist/utils/mod.d.ts +1 -1
  52. package/dist/utils/mod.js +1 -1
  53. package/package.json +7 -7
@@ -1,23 +1,25 @@
1
1
  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
- import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
5
- import { $ as getVerifiedKeyOwnerEvidence, A as compactJsonLd, At as getRawCanonicalPortableId, B as verifyCompactJsonLdDetailed, C as verifyPortableObjectProofWithRoot, Ct as observeAttempt, D as InvalidContextReferenceError, Dt as getCanonicalPortableId, E as normalizeOutgoingActivityJsonLd, Et as getAuthenticationOrigin, F as hasSignatureLike, Ft as isPortableUri, I as isClearlyMalformedContextReference, It as isSameObjectId, L as isInvalidUrlTypeError, M as detachSignature, Mt as isCompatibleKeyId, N as getNormalizationContextLoader, Nt as isPortableId, O as assertSafeJsonLd, Ot as getGatewayKeyBase, P as hasSignature, Pt as isPortableKeyId, Q as MAX_PORTABLE_KEY_TTL, R as markEffectiveContextLoader, Rt as name, S as verifyPortableObjectProofPolicy, Tt as verificationObservation, U as wrapContextLoaderForJsonLd, W as exportJwk, X as validateCryptoKey, Y as importJwk, _ as signObject, _t as registerQueueDepthGauge, at as isAbortError, b as verifyObjectDetailed, c as verifyRequestDetailed, ct as recordCollectionPageItems, d as InvalidPortableObjectIdError, f as classifyFep2277CoreType, ft as recordFanoutRecipients, g as preparePortableObjectProofPolicy, gt as recordWebFingerHandle, h as hasProofLike, ht as recordOutboxEnqueue, i as selectRequestSignature, it as instrumentDocumentLoader, jt as hasPortableActor, kt as getPortableDid, lt as recordCollectionRequest, m as getProofSigner, mt as recordOutboxActivity, n as listRequestSignatures, nt as getFederationMetrics, o as validateMaxSignatures, ot as recordCircuitBreakerStateChange, pt as recordInboxActivity, r as parseRfc9421SignatureInput, rt as getRemoteHost, s as verifyRequest, st as recordCollectionDispatchDuration, t as doubleKnockScoped, tt as getDurationMs, ut as recordCollectionTotalItems, v as verifyMapLocalProof, vt as preloadedOnlyDocumentLoader, w as verifyPreparedPortableObjectProofPolicy, wt as snapshotKey, x as verifyPortableObjectProof, y as verifyObject, yt as formatAcceptSignature, z as signJsonLd, zt as version } from "./http-CLL0a37S.js";
6
- import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-DUjZb4i6.js";
7
- import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-NzJ-twKe.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CfDFmySj.js";
4
+ import { t as getDefaultPortableObjectVerifier } from "./portable-verifier-CPA86vIP.js";
5
+ import { r as getDefaultActivityTransformers } from "./transformers-BlJ53iKs.js";
6
+ import { $ as getVerifiedKeyOwnerEvidence, At as getGatewayKeyBase, B as verifyCompactJsonLdDetailed, Bt as name, C as verifyPortableObjectProofWithRoot, Ct as normalizeOutgoingActivityJsonLd, D as assertSafeJsonLd, Dt as verificationObservation, E as InvalidContextReferenceError, Et as snapshotKey, F as hasVerifiableSignature, Ft as isPortableId, I as isClearlyMalformedContextReference, It as isPortableKeyId, L as isInvalidUrlTypeError, Lt as isPortableUri, M as detachSignature, Mt as getRawCanonicalPortableId, N as getNormalizationContextLoader, Nt as hasPortableActor, Ot as getAuthenticationOrigin, P as hasSignatureLike, Pt as isCompatibleKeyId, Q as MAX_PORTABLE_KEY_TTL, R as markEffectiveContextLoader, Rt as isSameObjectId, S as verifyPortableObjectProofPolicy, St as normalizeAttachmentArrays$1, Tt as observeAttempt, U as wrapContextLoaderForJsonLd, Vt as version, W as exportJwk, X as validateCryptoKey, Y as importJwk, _ as signObject, _t as registerQueueDepthGauge, at as isAbortError, b as verifyObjectDetailed, c as verifyRequestDetailed, ct as recordCollectionPageItems, d as InvalidPortableObjectIdError, f as classifyFep2277CoreType, ft as recordFanoutRecipients, g as preparePortableObjectProofPolicy, gt as recordWebFingerHandle, h as hasProofLike, ht as recordOutboxEnqueue, i as selectRequestSignature, it as instrumentDocumentLoader, j as describeSignatureShape, jt as getPortableDid, k as compactJsonLd, kt as getCanonicalPortableId, lt as recordCollectionRequest, m as getProofSigner, mt as recordOutboxActivity, n as listRequestSignatures, nt as getFederationMetrics, o as validateMaxSignatures, ot as recordCircuitBreakerStateChange, pt as recordInboxActivity, r as parseRfc9421SignatureInput, rt as getRemoteHost, s as verifyRequest, st as recordCollectionDispatchDuration, t as doubleKnockScoped, tt as getDurationMs, ut as recordCollectionTotalItems, v as verifyMapLocalProof, vt as formatAcceptSignature, w as verifyPreparedPortableObjectProofPolicy, wt as preloadedOnlyDocumentLoader, x as verifyPortableObjectProof, y as verifyObject, z as signJsonLd } from "./http-BN8Zo-nG.js";
7
+ import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-BbCbtwZp.js";
8
+ import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-BKIPytM_.js";
9
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-Dz6xiM-c.js";
9
10
  import { getLogger, withContext } from "@logtape/logtape";
10
- import { FetchError, UrlError, canonicalizePortableUri, decodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, isGatewayUrl, parseDigestMultibase, parseHashlink, parseIri, preloadedContexts, resolveDocumentLoaderTimeout, toCompatibleEf61Id } from "@fedify/vocab-runtime";
11
+ import { FetchError, UrlError, canonicalizePortableUri, decodeMultibase, encodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, isGatewayUrl, parseDigestMultibase, parseHashlink, parseIri, preloadedContexts, resolveDocumentLoaderTimeout, toCompatibleEf61Id } from "@fedify/vocab-runtime";
11
12
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
12
- import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, PUBLIC_COLLECTION, Tombstone, getTypeId, isActor, lookupObject, lookupObserver, traverseCollection } from "@fedify/vocab";
13
+ import { Activity, Collection, CollectionPage, CryptographicKey, DataIntegrityProof, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, PUBLIC_COLLECTION, Tombstone, getTypeId, isActor, lookupObject, lookupObserver, traverseCollection } from "@fedify/vocab";
13
14
  import { SpanKind, SpanStatusCode, context, isSpanContextValid, metrics, propagation, trace } from "@opentelemetry/api";
14
15
  import { getPortableGatewayCandidates, isCompatibleEf61Iri } from "@fedify/vocab-runtime/internal/portable-dereference";
15
16
  import { encodeHex } from "byte-encodings/hex";
16
17
  import jsonld from "@fedify/vocab-runtime/jsonld";
17
18
  import { uniq } from "es-toolkit";
19
+ import { asCryptoKey, openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
18
20
  import serialize from "json-canon";
19
21
  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";
20
- import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
22
+ import { normalizeDateTimeLiteral } from "@fedify/vocab-runtime/temporal";
21
23
  import { lookupWebFinger } from "@fedify/webfinger";
22
24
  import { DataPointType, MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
23
25
  import { parse, stringifyAsync } from "devalue";
@@ -2090,6 +2092,17 @@ var InboxObservation = class {
2090
2092
  }
2091
2093
  };
2092
2094
  //#endregion
2095
+ //#region src/compat/attachment-arrays.ts
2096
+ /**
2097
+ * Applies the shared attachment workaround to served documents without
2098
+ * rewriting any document that contains a semantic proof or LD signature.
2099
+ * RDF equivalence alone cannot preserve JCS signatures.
2100
+ * @internal
2101
+ */
2102
+ function normalizeAttachmentArrays(document, contextLoader) {
2103
+ return normalizeAttachmentArrays$1(document, contextLoader, { preserveSecuredDocuments: true });
2104
+ }
2105
+ //#endregion
2093
2106
  //#region src/sig/compound-proof.ts
2094
2107
  const textEncoder = new TextEncoder();
2095
2108
  /**
@@ -4960,7 +4973,8 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
4960
4973
  * @param parameters The parameters for sending the activity.
4961
4974
  * See also {@link SendActivityParameters}.
4962
4975
  * @param deps The dependencies, for tests.
4963
- * @throws {Error} If the activity fails to send.
4976
+ * @throws {FetchError} If the delivery times out before receiving a response.
4977
+ * @throws {SendActivityError} If the inbox returns an unsuccessful response.
4964
4978
  */
4965
4979
  function sendActivity(options, deps = {}) {
4966
4980
  options.attemptStarted?.(options.inbox.href);
@@ -5030,6 +5044,24 @@ async function sendActivityThroughGateways(parameters, inboxes) {
5030
5044
  }
5031
5045
  const MAX_ERROR_RESPONSE_BODY_BYTES = 1024;
5032
5046
  const ERROR_RESPONSE_BODY_TIMEOUT_MS = 1e3;
5047
+ const SEND_ACTIVITY_TIMEOUT_MS = 3e4;
5048
+ function raceWithAbort(promise, signal) {
5049
+ if (signal.aborted) return Promise.reject(signal.reason);
5050
+ return new Promise((resolve, reject) => {
5051
+ const onAbort = () => {
5052
+ signal.removeEventListener("abort", onAbort);
5053
+ reject(signal.reason);
5054
+ };
5055
+ signal.addEventListener("abort", onAbort, { once: true });
5056
+ promise.then((value) => {
5057
+ signal.removeEventListener("abort", onAbort);
5058
+ resolve(value);
5059
+ }, (error) => {
5060
+ signal.removeEventListener("abort", onAbort);
5061
+ reject(error);
5062
+ });
5063
+ });
5064
+ }
5033
5065
  function getActivityActorId(activity) {
5034
5066
  if (!isRecord(activity)) return void 0;
5035
5067
  return getIdValue(activity.actor);
@@ -5049,7 +5081,7 @@ function getIdValue(value) {
5049
5081
  function isRecord(value) {
5050
5082
  return typeof value === "object" && value != null;
5051
5083
  }
5052
- async function readLimitedResponseBody(response, maxBytes) {
5084
+ async function readLimitedResponseBody(response, maxBytes, signal) {
5053
5085
  const captured = takeCapturedDiagnostic(response);
5054
5086
  if (captured !== void 0) return captured;
5055
5087
  if (response.body == null) return "";
@@ -5061,7 +5093,8 @@ async function readLimitedResponseBody(response, maxBytes) {
5061
5093
  let timedOut = false;
5062
5094
  try {
5063
5095
  while (true) {
5064
- const result = await pump.read();
5096
+ signal.throwIfAborted();
5097
+ const result = await raceWithAbort(pump.read(), signal);
5065
5098
  if (result == null) {
5066
5099
  timedOut = true;
5067
5100
  break;
@@ -5095,11 +5128,30 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
5095
5128
  const federationMetrics = getFederationMetrics(meterProvider);
5096
5129
  const started = performance.now();
5097
5130
  let deliverySuccess = false;
5098
- const openUnvalidatedHop = deps.openHop ?? (allowPrivateAddress ? openDirectFetch : (url) => openPublicFetch(url));
5131
+ const timeoutMs = deps.timeoutMs ?? SEND_ACTIVITY_TIMEOUT_MS;
5132
+ const controller = new AbortController();
5133
+ const { signal } = controller;
5134
+ const timer = setTimeout(() => controller.abort(new DOMException("The delivery timed out.", "TimeoutError")), timeoutMs);
5135
+ function timeoutFailure(error) {
5136
+ if (!signal.aborted || error instanceof SendActivityError) return error;
5137
+ const failure = new FetchError(inbox.href, `Timed out after ${timeoutMs} ms`);
5138
+ failure.cause = signal.reason;
5139
+ return failure;
5140
+ }
5141
+ const openUnvalidatedHop = deps.openHop ?? (allowPrivateAddress ? openDirectFetch : (url) => openPublicFetch(url, { signal }));
5099
5142
  async function openHop(url) {
5100
5143
  let session;
5101
5144
  try {
5102
- session = await openUnvalidatedHop(url);
5145
+ signal.throwIfAborted();
5146
+ const opening = openUnvalidatedHop(url);
5147
+ opening.then((lateSession) => {
5148
+ if (signal.aborted) closeAfterError(lateSession, logger);
5149
+ }, () => {});
5150
+ session = await raceWithAbort(opening, signal);
5151
+ if (signal.aborted) {
5152
+ closeAfterError(session, logger);
5153
+ signal.throwIfAborted();
5154
+ }
5103
5155
  } catch (error) {
5104
5156
  if (error instanceof UrlError && error.reason === "dns") {
5105
5157
  attempt?.failure({
@@ -5161,8 +5213,15 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
5161
5213
  try {
5162
5214
  initialSession = await openHop(inbox.href);
5163
5215
  } catch (error) {
5164
- if (error instanceof FetchError) federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
5165
- throw error;
5216
+ const failure = timeoutFailure(error);
5217
+ if (failure instanceof FetchError) federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
5218
+ if (signal.aborted) logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
5219
+ activityId,
5220
+ inbox: inbox.href,
5221
+ error: failure
5222
+ });
5223
+ clearTimeout(timer);
5224
+ throw failure;
5166
5225
  }
5167
5226
  let initialPending = true;
5168
5227
  const openDeliveryHop = (url) => {
@@ -5202,7 +5261,8 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
5202
5261
  method: "POST",
5203
5262
  headers,
5204
5263
  body,
5205
- redirect: "manual"
5264
+ redirect: "manual",
5265
+ signal
5206
5266
  });
5207
5267
  } catch (error) {
5208
5268
  attempt?.failure({
@@ -5229,13 +5289,24 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
5229
5289
  }))
5230
5290
  });
5231
5291
  const consume = (response) => {
5232
- return consumeSendActivityResponse(response, inbox);
5292
+ return consumeSendActivityResponse(response, inbox, signal);
5233
5293
  };
5234
5294
  let outcome;
5295
+ const boundedSpecDeterminer = specDeterminer == null ? void 0 : {
5296
+ determineSpec(origin) {
5297
+ signal.throwIfAborted();
5298
+ return raceWithAbort(Promise.resolve(specDeterminer.determineSpec(origin)), signal);
5299
+ },
5300
+ rememberSpec(origin, spec) {
5301
+ signal.throwIfAborted();
5302
+ return raceWithAbort(Promise.resolve(specDeterminer.rememberSpec(origin, spec)), signal);
5303
+ }
5304
+ };
5235
5305
  try {
5236
- outcome = rsaKey == null ? await fetchWithValidatedRedirects(request, openDeliveryHop, consume, attempt) : await doubleKnockScoped(request, rsaKey, {
5306
+ outcome = rsaKey == null ? await fetchWithValidatedRedirects(request, openDeliveryHop, consume, attempt, signal) : await doubleKnockScoped(request, rsaKey, {
5237
5307
  tracerProvider,
5238
- specDeterminer
5308
+ specDeterminer: boundedSpecDeterminer,
5309
+ signal
5239
5310
  }, openDeliveryHop, consume, attempt == null ? void 0 : {
5240
5311
  fetch: (request, submit) => attempt.fetch(request, submit),
5241
5312
  response: (response, disposition) => attempt.response(response, disposition),
@@ -5247,7 +5318,8 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
5247
5318
  });
5248
5319
  } catch (error) {
5249
5320
  attempt?.unknown(error);
5250
- const failure = error instanceof FetchError || error instanceof UrlError ? error : createFetchError(inbox.href, error);
5321
+ const boundedError = timeoutFailure(error);
5322
+ const failure = boundedError instanceof FetchError || boundedError instanceof UrlError ? boundedError : createFetchError(inbox.href, boundedError);
5251
5323
  logger.error("Failed to send activity {activityId} to {inbox}:\n{error}", {
5252
5324
  activityId,
5253
5325
  inbox: inbox.href,
@@ -5287,6 +5359,7 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
5287
5359
  federationMetrics.recordDelivery(inbox, getDurationMs(started), deliverySuccess, activityType);
5288
5360
  }
5289
5361
  } finally {
5362
+ clearTimeout(timer);
5290
5363
  if (initialPending) await initialSession.close();
5291
5364
  }
5292
5365
  }
@@ -5318,17 +5391,18 @@ function cancelResponseBody(response, url) {
5318
5391
  * session is open: the body of a successful response is cancelled, and at
5319
5392
  * most 1 KiB of an error response body is read within its diagnostic budget.
5320
5393
  */
5321
- async function consumeSendActivityResponse(response, inbox) {
5394
+ async function consumeSendActivityResponse(response, inbox, signal) {
5322
5395
  if (response.ok) {
5323
5396
  cancelResponseBody(response, response.url || inbox.href);
5324
5397
  return { ok: true };
5325
5398
  }
5326
5399
  let error;
5327
5400
  try {
5328
- error = await readLimitedResponseBody(response, MAX_ERROR_RESPONSE_BODY_BYTES);
5401
+ error = await readLimitedResponseBody(response, MAX_ERROR_RESPONSE_BODY_BYTES, signal);
5329
5402
  } catch (_) {
5330
5403
  error = "";
5331
5404
  }
5405
+ if (signal.aborted) error = "(timed out reading response body)";
5332
5406
  return {
5333
5407
  ok: false,
5334
5408
  status: response.status,
@@ -5349,7 +5423,7 @@ async function consumeSendActivityResponse(response, inbox) {
5349
5423
  * @param attempt The in-process attempt observation, if registered.
5350
5424
  * @returns The value returned by `consume`.
5351
5425
  */
5352
- async function fetchWithValidatedRedirects(request, openHop, consume, attempt) {
5426
+ async function fetchWithValidatedRedirects(request, openHop, consume, attempt, signal) {
5353
5427
  const logger = getLogger([
5354
5428
  "fedify",
5355
5429
  "federation",
@@ -5357,10 +5431,17 @@ async function fetchWithValidatedRedirects(request, openHop, consume, attempt) {
5357
5431
  ]);
5358
5432
  let body = await request.clone().text();
5359
5433
  for (let redirects = 0;; redirects++) {
5434
+ signal?.throwIfAborted();
5360
5435
  const session = await openHop(request.url);
5361
5436
  let response;
5362
5437
  try {
5363
- response = await (attempt == null ? session.fetch(request, { redirect: "manual" }) : attempt.fetch(request, () => session.fetch(request, { redirect: "manual" })));
5438
+ response = await (attempt == null ? session.fetch(request, {
5439
+ redirect: "manual",
5440
+ signal
5441
+ }) : attempt.fetch(request, () => session.fetch(request, {
5442
+ redirect: "manual",
5443
+ signal
5444
+ })));
5364
5445
  } catch (error) {
5365
5446
  await closeAfterError(session, logger);
5366
5447
  throw error;
@@ -5414,7 +5495,8 @@ async function fetchWithValidatedRedirects(request, openHop, consume, attempt) {
5414
5495
  method,
5415
5496
  headers,
5416
5497
  body,
5417
- redirect: "manual"
5498
+ redirect: "manual",
5499
+ signal: signal ?? request.signal
5418
5500
  });
5419
5501
  }
5420
5502
  }
@@ -5952,9 +6034,6 @@ async function enqueueForwarding(parameters, outboxQueue, inboxes, observation)
5952
6034
  function isPlainObject$1(value) {
5953
6035
  return typeof value === "object" && value != null && !Array.isArray(value);
5954
6036
  }
5955
- function normalizeDateTimeLiteral(value) {
5956
- return value.substring(19).match(/[Z+-]/) ? value : value + "Z";
5957
- }
5958
6037
  function isMalformedDateTimeLiteral(value) {
5959
6038
  if (typeof value !== "string") return false;
5960
6039
  try {
@@ -5996,7 +6075,7 @@ function hasMalformedExpandedQuestionClosedLiteral(value) {
5996
6075
  if (typeof literal === "boolean") return false;
5997
6076
  if (typeof literal !== "string") return false;
5998
6077
  if (value["@type"] !== XSD_DATE_TIME_IRI) return false;
5999
- if (new Date(literal).toString() === "Invalid Date") return false;
6078
+ if (new Date(literal).toString() === "Invalid Date" && new Date(normalizeDateTimeLiteral(literal)).toString() === "Invalid Date") return false;
6000
6079
  return isMalformedDateTimeLiteral(literal);
6001
6080
  }
6002
6081
  function hasMalformedExpandedDurationLiteral(value) {
@@ -6097,7 +6176,7 @@ async function handleActor(request, { identifier, context, actorDispatcher, auth
6097
6176
  if (!await authorizePredicate(context, identifier)) return await onUnauthorized(request);
6098
6177
  }
6099
6178
  if (actor instanceof Tombstone) {
6100
- const jsonLd = await actor.toJsonLd(context);
6179
+ const jsonLd = await serializeForResponse(actor, context);
6101
6180
  return new Response(JSON.stringify(jsonLd), {
6102
6181
  status: 410,
6103
6182
  headers: {
@@ -6106,7 +6185,7 @@ async function handleActor(request, { identifier, context, actorDispatcher, auth
6106
6185
  }
6107
6186
  });
6108
6187
  }
6109
- const jsonLd = await actor.toJsonLd(context);
6188
+ const jsonLd = await serializeForResponse(actor, context);
6110
6189
  return new Response(JSON.stringify(jsonLd), { headers: {
6111
6190
  "Content-Type": "application/activity+json",
6112
6191
  Vary: "Accept"
@@ -6126,7 +6205,7 @@ async function handleObject(request, { values, context, objectDispatcher, author
6126
6205
  if (authorizePredicate != null) {
6127
6206
  if (!await authorizePredicate(context, values)) return await onUnauthorized(request);
6128
6207
  }
6129
- const jsonLd = await object.toJsonLd(context);
6208
+ const jsonLd = await serializeForResponse(object, context);
6130
6209
  if (object instanceof Tombstone) return new Response(request.method === "HEAD" ? null : JSON.stringify(jsonLd), {
6131
6210
  status: 410,
6132
6211
  headers: {
@@ -6378,13 +6457,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
6378
6457
  * @param parameters The parameters for handling the collection.
6379
6458
  * @returns A promise that resolves to an HTTP response.
6380
6459
  */
6381
- async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, portable, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
6382
- const spanName = name$1.trim().replace(/\s+/g, "_");
6460
+ async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, portable, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
6461
+ const spanName = name$2.trim().replace(/\s+/g, "_");
6383
6462
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
6384
6463
  const tracer = tracerProvider.getTracer(name, version);
6385
6464
  const cursor = new URL(request.url).searchParams.get("cursor");
6386
6465
  const metricBase = {
6387
- kind: getCollectionMetricKind(name$1),
6466
+ kind: getCollectionMetricKind(name$2),
6388
6467
  page: cursor != null,
6389
6468
  dispatcher: "built_in"
6390
6469
  };
@@ -6430,7 +6509,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
6430
6509
  span.setStatus({ code: SpanStatusCode.ERROR });
6431
6510
  return await onNotFound(request);
6432
6511
  }
6433
- const items = filterCollectionItems(page.items, name$1, filterPredicate);
6512
+ const items = filterCollectionItems(page.items, name$2, filterPredicate);
6434
6513
  itemCount = items.length;
6435
6514
  span.setAttribute("fedify.collection.items", itemCount);
6436
6515
  return items;
@@ -6472,7 +6551,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
6472
6551
  } else {
6473
6552
  const uri = new URL(portable == null ? baseUri : pageBase);
6474
6553
  uri.searchParams.set("cursor", cursor);
6475
- const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
6554
+ const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
6476
6555
  kind: SpanKind.SERVER,
6477
6556
  attributes: {
6478
6557
  "activitypub.collection.id": uri.href,
@@ -6488,7 +6567,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
6488
6567
  span.setStatus({ code: SpanStatusCode.ERROR });
6489
6568
  return await onNotFound(request);
6490
6569
  }
6491
- const items = filterCollectionItems(page.items, name$1, filterPredicate);
6570
+ const items = filterCollectionItems(page.items, name$2, filterPredicate);
6492
6571
  itemCount = items.length;
6493
6572
  span.setAttribute("fedify.collection.items", itemCount);
6494
6573
  return {
@@ -6532,7 +6611,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
6532
6611
  if (portable == null && collectionCallbacks.authorizePredicate != null) {
6533
6612
  if (!await collectionCallbacks.authorizePredicate(context, identifier)) return finish(await onUnauthorized(request), "unauthorized");
6534
6613
  }
6535
- const jsonLd = await collection.toJsonLd(context);
6614
+ const jsonLd = await serializeForResponse(collection, context, portable != null);
6536
6615
  if (portable != null) return await verifyPortableCollection(jsonLd, context, portable) ? finish(respondWithPortableCollection(request, jsonLd), "served") : finish(portableObjectInternalServerError(request), "error");
6537
6616
  return finish(new Response(JSON.stringify(jsonLd), { headers: {
6538
6617
  "Content-Type": "application/activity+json",
@@ -7131,7 +7210,11 @@ async function handleInboxInternal(request, parameters, span, snapshot) {
7131
7210
  const standardLoader = snapshot.loader("standard");
7132
7211
  const normalizationLoader = snapshot.loader("normalization");
7133
7212
  const jsonWithoutSig = detachSignature(json);
7134
- const hasLdSignature = hasSignature(json);
7213
+ const hasLdSignature = hasVerifiableSignature(json);
7214
+ if (!hasLdSignature) {
7215
+ const shape = describeSignatureShape(json);
7216
+ if (shape != null) logger.debug("Linked Data Signature has an unsupported shape: {signatureKind}; properties: {signatureProperties}.", shape);
7217
+ }
7135
7218
  const canAttemptAlternateAuthAfterLdSignatureFailure = skipSignatureVerification || hasHttpSignatureHeaders(request) || hasObjectIntegrityProof(jsonWithoutSig);
7136
7219
  let deferredLdSignatureError = void 0;
7137
7220
  const respondInvalidActivity = async (error) => {
@@ -8068,8 +8151,8 @@ var CustomCollectionHandler = class {
8068
8151
  * @param CollectionPage The CollectionPage constructor.
8069
8152
  * @param filterPredicate Optional filter predicate for items.
8070
8153
  */
8071
- constructor(name$2, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate, portable) {
8072
- this.name = name$2;
8154
+ constructor(name$1, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate, portable) {
8155
+ this.name = name$1;
8073
8156
  this.values = values;
8074
8157
  this.context = context;
8075
8158
  this.callbacks = callbacks;
@@ -8093,7 +8176,7 @@ var CustomCollectionHandler = class {
8093
8176
  * @returns A promise that resolves to the JSON-LD representation.
8094
8177
  */
8095
8178
  async toJsonLd() {
8096
- return (await this.collection).toJsonLd(this.context);
8179
+ return serializeForResponse(await this.collection, this.context, this.portable != null);
8097
8180
  }
8098
8181
  /**
8099
8182
  * Fetches the collection with optional cursor for pagination.
@@ -8489,7 +8572,7 @@ var PortableCollectionRefusedError = class extends HandlerError {
8489
8572
  * @since 0.3.0
8490
8573
  */
8491
8574
  async function respondWithObject(object, options) {
8492
- const jsonLd = await object.toJsonLd(options);
8575
+ const jsonLd = await serializeForResponse(object, options);
8493
8576
  return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": "application/activity+json" } });
8494
8577
  }
8495
8578
  /**
@@ -8617,6 +8700,13 @@ function getHttpKeyPrincipal(key) {
8617
8700
  function isPortableActorKey(key) {
8618
8701
  return key?.id != null && isPortableKeyId(key.id) && key.ownerId != null && isPortableId(key.ownerId);
8619
8702
  }
8703
+ /** Applies compatibility changes after ordinary vocabulary serialization. */
8704
+ async function serializeForResponse(object, options, compact = false) {
8705
+ return await normalizeAttachmentArrays(await object.toJsonLd(compact ? {
8706
+ format: "compact",
8707
+ contextLoader: options?.contextLoader
8708
+ } : options), options?.contextLoader);
8709
+ }
8620
8710
  /**
8621
8711
  * Checks whether an activity needs an Object Integrity Proof by its DID:
8622
8712
  * either it is performed by an [FEP-ef61] portable actor, or its own ID is
@@ -9756,6 +9846,102 @@ function buildPortableCollectionView(collectionId, requestUrl) {
9756
9846
  return view;
9757
9847
  }
9758
9848
  //#endregion
9849
+ //#region src/sig/proof-creation.ts
9850
+ /** Signs the exact serialized message supplied by an internal producer. */
9851
+ async function createProofForJsonLd(jsonLd, privateKey, keyId, created) {
9852
+ validateCryptoKey(privateKey, "private");
9853
+ if (privateKey.algorithm.name !== "Ed25519") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
9854
+ const encoder = new TextEncoder();
9855
+ const msgDigest = await crypto.subtle.digest("SHA-256", encoder.encode(serialize(jsonLd)));
9856
+ created ??= Temporal.Now.instant();
9857
+ const proofConfig = {
9858
+ "@context": jsonLd["@context"],
9859
+ type: "DataIntegrityProof",
9860
+ cryptosuite: "eddsa-jcs-2022",
9861
+ verificationMethod: keyId.href,
9862
+ proofPurpose: "assertionMethod",
9863
+ created: created.toString()
9864
+ };
9865
+ const proofDigest = await crypto.subtle.digest("SHA-256", encoder.encode(serialize(proofConfig)));
9866
+ const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
9867
+ digest.set(new Uint8Array(proofDigest), 0);
9868
+ digest.set(new Uint8Array(msgDigest), proofDigest.byteLength);
9869
+ const sig = await crypto.subtle.sign("Ed25519", asCryptoKey(privateKey), digest);
9870
+ return new DataIntegrityProof({
9871
+ cryptosuite: "eddsa-jcs-2022",
9872
+ verificationMethod: keyId,
9873
+ proofPurpose: "assertionMethod",
9874
+ created,
9875
+ proofValue: new Uint8Array(sig)
9876
+ });
9877
+ }
9878
+ //#endregion
9879
+ //#region src/compat/delivery-jsonld.ts
9880
+ /**
9881
+ * Returns changed wire JSON only; unchanged documents keep the existing
9882
+ * delivery signing path. This uses ordinary vocabulary serialization, without
9883
+ * retaining or repairing independently signed child representations.
9884
+ */
9885
+ async function prepareActivityJsonLd(activity, contextLoader) {
9886
+ if (activity.proofIds.length > 0) return void 0;
9887
+ for await (const _ of activity.getProofs({ contextLoader })) return void 0;
9888
+ const source = await activity.clone({}, { verifyPortableObject: getDefaultPortableObjectVerifier(activity) }).toJsonLd({
9889
+ format: "compact",
9890
+ contextLoader
9891
+ });
9892
+ const prepared = await normalizeOutgoingActivityJsonLd(source, contextLoader, { preserveSecuredDocuments: true });
9893
+ return prepared !== source && typeof prepared === "object" && prepared != null && !Array.isArray(prepared) ? prepared : void 0;
9894
+ }
9895
+ /** Signs a changed, proof-free delivery map without serializing it again. */
9896
+ async function signActivityJsonLd(activity, unsigned, keys, options) {
9897
+ const proofs = [];
9898
+ const serializedProofs = [];
9899
+ const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
9900
+ for (const { privateKey, keyId } of keys) {
9901
+ const proof = await tracer.startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(activity).href } }, async (span) => {
9902
+ try {
9903
+ if (activity.id != null) span.setAttribute("activitypub.object.id", activity.id.href);
9904
+ const proof = await createProofForJsonLd(unsigned, privateKey, keyId);
9905
+ if (span.isRecording()) {
9906
+ span.setAttribute("object_integrity_proofs.cryptosuite", "eddsa-jcs-2022");
9907
+ span.setAttribute("object_integrity_proofs.key_id", keyId.href);
9908
+ span.setAttribute("object_integrity_proofs.signature", encodeHex(proof.proofValue));
9909
+ }
9910
+ return proof;
9911
+ } catch (error) {
9912
+ span.setStatus({
9913
+ code: SpanStatusCode.ERROR,
9914
+ message: String(error)
9915
+ });
9916
+ throw error;
9917
+ } finally {
9918
+ span.end();
9919
+ }
9920
+ });
9921
+ proofs.push(proof);
9922
+ serializedProofs.push({
9923
+ "@context": unsigned["@context"],
9924
+ type: "DataIntegrityProof",
9925
+ cryptosuite: proof.cryptosuite,
9926
+ verificationMethod: keyId.href,
9927
+ proofPurpose: "assertionMethod",
9928
+ created: proof.created.toString(),
9929
+ proofValue: new TextDecoder().decode(encodeMultibase("base58btc", proof.proofValue))
9930
+ });
9931
+ }
9932
+ if (proofs.length === 0) return {
9933
+ activity,
9934
+ jsonLd: unsigned
9935
+ };
9936
+ return {
9937
+ activity: activity.clone({ proofs }, { verifyPortableObject: getDefaultPortableObjectVerifier(activity) }),
9938
+ jsonLd: {
9939
+ ...unsigned,
9940
+ proof: serializedProofs.length === 1 ? serializedProofs[0] : serializedProofs
9941
+ }
9942
+ };
9943
+ }
9944
+ //#endregion
9759
9945
  //#region src/federation/outgoing-proof.ts
9760
9946
  function formatKeyIds(candidates) {
9761
9947
  return candidates.map((c) => c.verificationMethod.href).join(", ");
@@ -9823,6 +10009,15 @@ async function signOutgoingActivity(activity, candidates, options) {
9823
10009
  const { contextLoader, tracerProvider } = options;
9824
10010
  assertPortableActorActivity(activity);
9825
10011
  const sign = async (selected) => {
10012
+ const prepared = !hasProof ? await prepareActivityJsonLd(activity, contextLoader) : void 0;
10013
+ if (prepared != null) return {
10014
+ ...await signActivityJsonLd(activity, prepared, selected.map(({ verificationMethod, privateKey }) => ({
10015
+ keyId: verificationMethod,
10016
+ privateKey
10017
+ })), { tracerProvider: tracerProvider ?? trace.getTracerProvider() }),
10018
+ hasProof: true,
10019
+ proofCreated: true
10020
+ };
9826
10021
  for (const { verificationMethod, privateKey } of selected) activity = await signObject(activity, privateKey, verificationMethod, {
9827
10022
  contextLoader,
9828
10023
  tracerProvider
@@ -10990,6 +11185,13 @@ var FederationImpl = class extends FederationBuilderImpl {
10990
11185
  if (resolved != null) return resolved;
10991
11186
  return this.taskQueueResolution === "strict" ? void 0 : this.outboxQueue;
10992
11187
  }
11188
+ #listenQueue(queue, ctxData, signal) {
11189
+ try {
11190
+ return queue.listen((msg) => this.processQueuedTask(ctxData, msg), { signal });
11191
+ } catch (error) {
11192
+ return Promise.reject(error);
11193
+ }
11194
+ }
10993
11195
  async _startQueueInternal(ctxData, signal, queue) {
10994
11196
  const taskQueue = this.taskQueue ?? (this.taskQueueResolution === "fallback" ? this.outboxQueue : void 0);
10995
11197
  const customQueues = this.taskDefinitions.values().map((def) => ["task", def.queue]);
@@ -11011,10 +11213,22 @@ var FederationImpl = class extends FederationBuilderImpl {
11011
11213
  if (this.startedQueues.has(target)) continue;
11012
11214
  this.startedQueues.add(target);
11013
11215
  logger.debug("Starting a {role} queue worker.", { role });
11014
- promises.push(target.listen((msg) => this.processQueuedTask(ctxData, msg), { signal }));
11216
+ promises.push(this.#listenQueue(target, ctxData, signal));
11015
11217
  }
11016
11218
  await Promise.all(promises);
11017
11219
  }
11220
+ #queueStartupFailureReported = false;
11221
+ _startQueueAutomatically(ctxData) {
11222
+ this._startQueueInternal(ctxData).catch((error) => {
11223
+ if (this.#queueStartupFailureReported) return;
11224
+ this.#queueStartupFailureReported = true;
11225
+ getLogger([
11226
+ "fedify",
11227
+ "federation",
11228
+ "queue"
11229
+ ]).warn("Failed to start queue workers automatically: {error}", { error });
11230
+ });
11231
+ }
11018
11232
  async processQueuedTask(contextData, message) {
11019
11233
  const extractedContext = propagation.extract(context.active(), message.traceContext);
11020
11234
  let provenance = emptyProvenance;
@@ -11178,10 +11392,10 @@ var FederationImpl = class extends FederationBuilderImpl {
11178
11392
  "fedify",
11179
11393
  "federation",
11180
11394
  "fanout"
11181
- ]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
11395
+ ]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", () => ({
11182
11396
  activityId: message.activityId,
11183
11397
  inboxes: globalThis.Object.keys(message.inboxes).length
11184
- });
11398
+ }));
11185
11399
  const importKeys = () => Promise.all(message.keys.map(async ({ keyId, privateKey }) => ({
11186
11400
  keyId: new URL(keyId),
11187
11401
  privateKey: await importJwk(privateKey, "private")
@@ -12098,7 +12312,7 @@ var FederationImpl = class extends FederationBuilderImpl {
12098
12312
  }
12099
12313
  try {
12100
12314
  if (activity == null) {
12101
- const hasSignatureField = hasSignature(message.activity);
12315
+ const hasSignatureField = hasSignatureLike(message.activity);
12102
12316
  const shouldParseFromNormalizedSignedPayload = message.ldSignatureVerified === true || message.normalizedActivity != null || message.ldSignatureVerified == null && hasSignatureField;
12103
12317
  const parseContext = hasSignatureField ? {
12104
12318
  ...context,
@@ -12432,10 +12646,10 @@ var FederationImpl = class extends FederationBuilderImpl {
12432
12646
  const { hasProof, proofCreated } = signed;
12433
12647
  observation?.setPhase("serialization");
12434
12648
  const serializeActivity = async () => {
12435
- let result = !proofCreated && options.activityJsonLd != null ? options.activityJsonLd : await activity.toJsonLd({
12649
+ let result = signed.jsonLd ?? (!proofCreated && options.activityJsonLd != null ? options.activityJsonLd : await activity.toJsonLd({
12436
12650
  format: "compact",
12437
12651
  contextLoader
12438
- });
12652
+ }));
12439
12653
  if (proofCreated || !hasProof || options.normalizeExistingProofs) result = await normalizeOutgoingActivityJsonLd(result, contextLoader, { preserveNestedSecuredDocuments: true });
12440
12654
  return result;
12441
12655
  };
@@ -12445,13 +12659,13 @@ var FederationImpl = class extends FederationBuilderImpl {
12445
12659
  if (worker == null) validateProofShape();
12446
12660
  else await worker.prepare("validation", validateProofShape);
12447
12661
  if (rsaKey == null && !ldSignable) logger.debug("The activity {activityId} is performed by a portable actor, so it is sent without a Linked Data signature.", { activityId });
12448
- else if (rsaKey == null) logger.warn("No supported key found to create a Linked Data signature for the activity {activityId}. The activity will be sent without a Linked Data signature. In order to create a Linked Data signature, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
12662
+ else if (rsaKey == null) logger.warn("No supported key found to create a Linked Data signature for the activity {activityId}. The activity will be sent without a Linked Data signature. In order to create a Linked Data signature, at least one RSASSA-PKCS1-v1_5 key must be provided.", () => ({
12449
12663
  activityId,
12450
12664
  keys: keys.map((pair) => ({
12451
12665
  keyId: pair.keyId.href,
12452
12666
  privateKey: pair.privateKey
12453
12667
  }))
12454
- });
12668
+ }));
12455
12669
  else {
12456
12670
  const signLinkedData = async () => {
12457
12671
  try {
@@ -12471,13 +12685,13 @@ var FederationImpl = class extends FederationBuilderImpl {
12471
12685
  };
12472
12686
  jsonLd = worker == null ? await signLinkedData() : await worker.prepare("signing", signLinkedData);
12473
12687
  }
12474
- if (!hasProof) logger.warn("No supported key found to create a proof for the activity {activityId}. The activity will be sent without a proof. In order to create a proof, at least one Ed25519 key must be provided.", {
12688
+ if (!hasProof) logger.warn("No supported key found to create a proof for the activity {activityId}. The activity will be sent without a proof. In order to create a proof, at least one Ed25519 key must be provided.", () => ({
12475
12689
  activityId,
12476
12690
  keys: keys.map((pair) => ({
12477
12691
  keyId: pair.keyId.href,
12478
12692
  privateKey: pair.privateKey
12479
12693
  }))
12480
- });
12694
+ }));
12481
12695
  observation?.setPhase("request-preparation");
12482
12696
  if (immediate || this.outboxQueue == null) {
12483
12697
  if (immediate) logger.debug("Sending activity immediately without queue since immediate option is set.", {
@@ -12489,41 +12703,45 @@ var FederationImpl = class extends FederationBuilderImpl {
12489
12703
  activity: jsonLd
12490
12704
  });
12491
12705
  const promises = [];
12492
- for (const inbox in inboxes) {
12493
- const delivery = observation?.delivery(inbox);
12494
- let sending;
12495
- try {
12496
- const createHeaders = collectionSync == null ? void 0 : async () => new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) });
12497
- const sendActivityId = activity.id?.href;
12498
- const activityType = getTypeId(activity).href;
12499
- observation?.setActivity({
12500
- ...sendActivityId == null ? {} : { id: sendActivityId },
12501
- type: activityType
12502
- });
12503
- sending = sendActivityToInbox(inbox, inboxes[inbox].gatewayInboxes, {
12504
- attemptStarted: worker == null ? void 0 : (target) => worker.directAttemptStarted(target, observation?.continuation(inbox)?.outbound),
12505
- observation: delivery,
12506
- allowPrivateAddress: this.allowPrivateAddress,
12507
- keys,
12508
- activity: jsonLd,
12509
- activityId: sendActivityId,
12510
- activityType,
12511
- sharedInbox: inboxes[inbox].sharedInbox,
12512
- headers: createHeaders == null ? void 0 : await (worker == null ? createHeaders() : worker.prepare("request-preparation", createHeaders)),
12513
- specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock, { specTtl: this.httpMessageSignaturesSpecTtl }),
12514
- meterProvider: this.meterProvider,
12515
- tracerProvider: this.tracerProvider
12516
- });
12517
- } catch (error) {
12518
- if (delivery != null) await delivery.failed(error);
12519
- throw error;
12706
+ try {
12707
+ for (const inbox in inboxes) {
12708
+ const delivery = observation?.delivery(inbox);
12709
+ let sending;
12710
+ try {
12711
+ const createHeaders = collectionSync == null ? void 0 : async () => new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) });
12712
+ const sendActivityId = activity.id?.href;
12713
+ const activityType = getTypeId(activity).href;
12714
+ observation?.setActivity({
12715
+ ...sendActivityId == null ? {} : { id: sendActivityId },
12716
+ type: activityType
12717
+ });
12718
+ sending = sendActivityToInbox(inbox, inboxes[inbox].gatewayInboxes, {
12719
+ attemptStarted: worker == null ? void 0 : (target) => worker.directAttemptStarted(target, observation?.continuation(inbox)?.outbound),
12720
+ observation: delivery,
12721
+ allowPrivateAddress: this.allowPrivateAddress,
12722
+ keys,
12723
+ activity: jsonLd,
12724
+ activityId: sendActivityId,
12725
+ activityType,
12726
+ sharedInbox: inboxes[inbox].sharedInbox,
12727
+ headers: createHeaders == null ? void 0 : await (worker == null ? createHeaders() : worker.prepare("request-preparation", createHeaders)),
12728
+ specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock, { specTtl: this.httpMessageSignaturesSpecTtl }),
12729
+ meterProvider: this.meterProvider,
12730
+ tracerProvider: this.tracerProvider
12731
+ });
12732
+ } catch (error) {
12733
+ if (delivery != null) await delivery.failed(error);
12734
+ throw error;
12735
+ }
12736
+ sending.catch(() => {});
12737
+ promises.push(sending);
12738
+ if (delivery != null) await delivery.handoff({ type: "direct" });
12520
12739
  }
12521
- if (observation != null) sending.catch(() => {});
12522
- if (delivery != null) await delivery.handoff({ type: "direct" });
12523
- promises.push(sending);
12740
+ if (observation != null) await observation.prepared("delivery");
12741
+ await Promise.all(promises);
12742
+ } finally {
12743
+ await Promise.allSettled(promises);
12524
12744
  }
12525
- if (observation != null) await observation.prepared("delivery");
12526
- await Promise.all(promises);
12527
12745
  return;
12528
12746
  }
12529
12747
  logger.debug("Enqueuing activity {activityId} to send later.", {
@@ -12540,7 +12758,7 @@ var FederationImpl = class extends FederationBuilderImpl {
12540
12758
  privateKey: privateKeyJwk
12541
12759
  });
12542
12760
  }
12543
- if (!this.manuallyStartQueue) this._startQueueInternal(ctx.data);
12761
+ if (!this.manuallyStartQueue) this._startQueueAutomatically(ctx.data);
12544
12762
  observation?.setPhase("request-preparation");
12545
12763
  const carrier = {};
12546
12764
  const injectTraceContext = () => propagation.inject(context.active(), carrier);
@@ -13284,7 +13502,7 @@ var FederationImpl = class extends FederationBuilderImpl {
13284
13502
  return await observation.run(() => Promise.reject(error), span);
13285
13503
  }
13286
13504
  async #handleInbox(request, { recipient, context, contextData, onNotFound, portableInbox, observation }) {
13287
- if (!this.manuallyStartQueue) this._startQueueInternal(contextData);
13505
+ if (!this.manuallyStartQueue) this._startQueueAutomatically(contextData);
13288
13506
  const inboxContextFactory = context.toInboxContext.bind(context);
13289
13507
  inboxContextFactory[rawInboxContextFactorySymbol] = context.toInboxContext.bind(context);
13290
13508
  return await handleInbox(request, {
@@ -13410,7 +13628,7 @@ var FederationImpl = class extends FederationBuilderImpl {
13410
13628
  kv: this.kv,
13411
13629
  kvPrefix: this.kvPrefixes.portableInboxForwarding,
13412
13630
  outboxQueue: this.outboxQueue,
13413
- startQueue: this.manuallyStartQueue ? void 0 : () => this._startQueueInternal(contextData),
13631
+ startQueue: this.manuallyStartQueue ? void 0 : () => this._startQueueAutomatically(contextData),
13414
13632
  allowPrivateAddress: this.allowPrivateAddress,
13415
13633
  getKeys: () => this.#getPortableGatewayKeyPairs(context, identifier, recipient),
13416
13634
  specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock, { specTtl: this.httpMessageSignaturesSpecTtl }),
@@ -13920,6 +14138,8 @@ var ContextImpl = class ContextImpl {
13920
14138
  for (const keyPair of keyPairs) {
13921
14139
  const newPair = {
13922
14140
  ...keyPair,
14141
+ privateKey: asCryptoKey(keyPair.privateKey),
14142
+ publicKey: asCryptoKey(keyPair.publicKey),
13923
14143
  cryptographicKey: new CryptographicKey({
13924
14144
  id: keyPair.keyId,
13925
14145
  owner,
@@ -14018,10 +14238,16 @@ var ContextImpl = class ContextImpl {
14018
14238
  return identifierPromise.then(async (identifier) => {
14019
14239
  if (identifier == null) return this.documentLoader;
14020
14240
  const pair = await this.getRsaKeyPairFromIdentifier(identifier);
14021
- return pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair);
14241
+ return pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory({
14242
+ keyId: pair.keyId,
14243
+ privateKey: asCryptoKey(pair.privateKey)
14244
+ });
14022
14245
  });
14023
14246
  }
14024
- return this.federation.authenticatedDocumentLoaderFactory(identity);
14247
+ return this.federation.authenticatedDocumentLoaderFactory({
14248
+ keyId: identity.keyId,
14249
+ privateKey: asCryptoKey(identity.privateKey)
14250
+ });
14025
14251
  }
14026
14252
  lookupObject(identifier, options = {}) {
14027
14253
  return lookupObject(identifier, {
@@ -14047,10 +14273,14 @@ var ContextImpl = class ContextImpl {
14047
14273
  return options.parse === "none" ? getNodeInfo(url, {
14048
14274
  parse: "none",
14049
14275
  direct: options.direct,
14276
+ timeout: options.timeout,
14277
+ signal: options.signal,
14050
14278
  userAgent: options?.userAgent ?? this.federation.userAgent
14051
14279
  }) : getNodeInfo(url, {
14052
14280
  parse: options.parse,
14053
14281
  direct: options.direct,
14282
+ timeout: options.timeout,
14283
+ signal: options.signal,
14054
14284
  userAgent: options?.userAgent ?? this.federation.userAgent
14055
14285
  });
14056
14286
  }
@@ -14071,7 +14301,18 @@ var ContextImpl = class ContextImpl {
14071
14301
  await this.#enqueueTasks(task, payloads, options);
14072
14302
  }
14073
14303
  sendActivity(sender, recipients, activity, options = {}) {
14074
- return observeOutboundBroadcast(this, this.federation.outboundObservers, (observation, provenance) => {
14304
+ return observeOutboundBroadcast(this, this.federation.outboundObservers, async (observation, provenance) => {
14305
+ observation?.setPhase("signing");
14306
+ let activityJsonLd = void 0;
14307
+ let hasProof = activity.proofIds.length > 0;
14308
+ if (!hasProof) for await (const _ of activity.getProofs({ contextLoader: this.contextLoader })) {
14309
+ hasProof = true;
14310
+ break;
14311
+ }
14312
+ if (hasProof) {
14313
+ activityJsonLd = await activity.toJsonLd({ contextLoader: this.contextLoader });
14314
+ if (!hasTopLevelProof(activityJsonLd)) activityJsonLd = void 0;
14315
+ }
14075
14316
  const tracer = this.tracerProvider.getTracer(name, version);
14076
14317
  const parentSpanContext = trace.getSpanContext(context.active());
14077
14318
  const activityType = getTypeId(activity).href;
@@ -14094,7 +14335,7 @@ var ContextImpl = class ContextImpl {
14094
14335
  type: activityType,
14095
14336
  ...activityId == null ? {} : { id: activityId }
14096
14337
  });
14097
- await this.sendActivityInternal(sender, recipients, activity, options, span, observation, provenance);
14338
+ await this.sendActivityInternal(sender, recipients, activity, options, span, observation, provenance, activityJsonLd);
14098
14339
  } catch (e) {
14099
14340
  span.setStatus({
14100
14341
  code: SpanStatusCode.ERROR,
@@ -14107,7 +14348,7 @@ var ContextImpl = class ContextImpl {
14107
14348
  });
14108
14349
  }, "send", options.dispatchId);
14109
14350
  }
14110
- async sendActivityInternal(sender, recipients, activity, options, span, observation, provenance = getOutboundProvenance(this)) {
14351
+ async sendActivityInternal(sender, recipients, activity, options, span, observation, provenance = getOutboundProvenance(this), activityJsonLd) {
14111
14352
  const logger = getLogger([
14112
14353
  "fedify",
14113
14354
  "federation",
@@ -14172,6 +14413,21 @@ var ContextImpl = class ContextImpl {
14172
14413
  observation?.setPhase("transformation");
14173
14414
  if (this.federation.activityTransformers.length > 0) observation?.setActivity({});
14174
14415
  for (const activityTransformer of this.federation.activityTransformers) activity = activityTransformer(activity, this);
14416
+ let contextMatches = false;
14417
+ if (activityJsonLd != null) {
14418
+ const capturedJsonLd = activityJsonLd;
14419
+ const transformedJsonLd = await activity.toJsonLd({
14420
+ format: "compact",
14421
+ contextLoader: this.contextLoader
14422
+ });
14423
+ const contentChanged = getContentFields(transformedJsonLd) !== getContentFields(capturedJsonLd);
14424
+ contextMatches = getContextFields(transformedJsonLd) === getContextFields(capturedJsonLd);
14425
+ const proofsChanged = getProofFields(transformedJsonLd) !== getProofFields(capturedJsonLd);
14426
+ if (contentChanged || !contextMatches && proofsChanged) {
14427
+ activity = activity.clone({ proofs: await getUncapturedProofs(activity, capturedJsonLd, this.contextLoader) }, { verifyPortableObject: getDefaultPortableObjectVerifier(activity) });
14428
+ activityJsonLd = void 0;
14429
+ } else if (proofsChanged) activityJsonLd = void 0;
14430
+ }
14175
14431
  let transformedActivityId;
14176
14432
  try {
14177
14433
  transformedActivityId = activity?.id?.href;
@@ -14197,7 +14453,11 @@ var ContextImpl = class ContextImpl {
14197
14453
  throw new TypeError("The activity to send must have at least one actor property.");
14198
14454
  }
14199
14455
  observation?.setPhase("signing");
14200
- const { activity: signedActivity, proofCreated } = await signOutgoingActivity(activity, actorKeyPairs == null ? keys.map(({ keyId, privateKey }) => ({
14456
+ if (actorKeyPairs != null && activityJsonLd != null && !contextMatches && actorKeyPairs.some((kp) => kp.privateKey.algorithm.name === "Ed25519" && kp.multikey.id != null && !isPortableKeyId(kp.multikey.id))) {
14457
+ activity = activity.clone({ proofs: [] }, { verifyPortableObject: getDefaultPortableObjectVerifier(activity) });
14458
+ activityJsonLd = void 0;
14459
+ }
14460
+ const signed = await signOutgoingActivity(activity, actorKeyPairs == null ? keys.map(({ keyId, privateKey }) => ({
14201
14461
  verificationMethod: keyId,
14202
14462
  privateKey
14203
14463
  })) : actorKeyPairs.flatMap((kp) => kp.multikey.id == null ? [] : [{
@@ -14208,7 +14468,8 @@ var ContextImpl = class ContextImpl {
14208
14468
  tracerProvider: this.tracerProvider,
14209
14469
  appendToExistingProofs: actorKeyPairs != null
14210
14470
  });
14211
- activity = signedActivity;
14471
+ activity = signed.activity;
14472
+ const { proofCreated } = signed;
14212
14473
  observation?.setPhase("destination-planning");
14213
14474
  const inboxes = extractInboxes({
14214
14475
  recipients: expandedRecipients,
@@ -14224,16 +14485,16 @@ var ContextImpl = class ContextImpl {
14224
14485
  if (observation != null) await observation.skipped();
14225
14486
  return false;
14226
14487
  }
14227
- logger.debug("Sending activity {activityId} to inboxes:\n{inboxes}", {
14488
+ logger.debug("Sending activity {activityId} to inboxes:\n{inboxes}", () => ({
14228
14489
  inboxes: globalThis.Object.keys(inboxes),
14229
14490
  activityId: activity.id?.href,
14230
14491
  activity
14231
- });
14492
+ }));
14232
14493
  observation?.setPhase("serialization");
14233
- const activityJsonLd = await activity.toJsonLd({
14494
+ activityJsonLd = signed.jsonLd ?? (!proofCreated && activityJsonLd != null ? activityJsonLd : await activity.toJsonLd({
14234
14495
  format: "compact",
14235
14496
  contextLoader: this.contextLoader
14236
- });
14497
+ }));
14237
14498
  try {
14238
14499
  await warnCompatibleIdsInJson(activityJsonLd, this instanceof RequestContextImpl && !this.isInActorDispatcher() ? this : void 0);
14239
14500
  } catch (error) {
@@ -14286,7 +14547,7 @@ var ContextImpl = class ContextImpl {
14286
14547
  normalizeExistingProofs: proofCreated || options.normalizeExistingProofs,
14287
14548
  traceContext: carrier
14288
14549
  };
14289
- if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
14550
+ if (!this.federation.manuallyStartQueue) this.federation._startQueueAutomatically(this.data);
14290
14551
  if (observation != null) await observation.prepared("fanout");
14291
14552
  await (observation == null ? this.federation.fanoutQueue.enqueue(message, { orderingKey: options.orderingKey }) : observation.enqueue(globalThis.Object.keys(inboxes).map((inbox) => ({
14292
14553
  inbox,
@@ -14820,42 +15081,46 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
14820
15081
  if (observation != null) await observation.skipped();
14821
15082
  return false;
14822
15083
  }
14823
- logger.debug("Forwarding activity {activityId} to inboxes:\n{inboxes}", {
15084
+ logger.debug("Forwarding activity {activityId} to inboxes:\n{inboxes}", () => ({
14824
15085
  inboxes: globalThis.Object.keys(inboxes),
14825
15086
  activityId: ctx.activityId,
14826
15087
  activity: ctx.activity
14827
- });
15088
+ }));
14828
15089
  if (options?.immediate || ctx.federation.outboxQueue == null) {
14829
15090
  if (options?.immediate) logger.debug("Forwarding activity immediately without queue since immediate option is set.");
14830
15091
  else logger.debug("Forwarding activity immediately without queue since queue is not set.");
14831
15092
  observation?.setPhase("request-preparation");
14832
15093
  const promises = [];
14833
- for (const inbox in inboxes) {
14834
- const delivery = observation?.delivery(inbox);
14835
- let sending;
14836
- try {
14837
- sending = sendActivityToInbox(inbox, inboxes[inbox].gatewayInboxes, {
14838
- observation: delivery,
14839
- allowPrivateAddress: ctx.federation.allowPrivateAddress,
14840
- keys,
14841
- activity: ctx.activity,
14842
- activityId: ctx.activityId,
14843
- activityType: ctx.activityType,
14844
- sharedInbox: inboxes[inbox].sharedInbox,
14845
- meterProvider: ctx.meterProvider,
14846
- tracerProvider: ctx.tracerProvider,
14847
- specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock, { specTtl: ctx.federation.httpMessageSignaturesSpecTtl })
14848
- });
14849
- } catch (error) {
14850
- if (delivery != null) await delivery.failed(error);
14851
- throw error;
15094
+ try {
15095
+ for (const inbox in inboxes) {
15096
+ const delivery = observation?.delivery(inbox);
15097
+ let sending;
15098
+ try {
15099
+ sending = sendActivityToInbox(inbox, inboxes[inbox].gatewayInboxes, {
15100
+ observation: delivery,
15101
+ allowPrivateAddress: ctx.federation.allowPrivateAddress,
15102
+ keys,
15103
+ activity: ctx.activity,
15104
+ activityId: ctx.activityId,
15105
+ activityType: ctx.activityType,
15106
+ sharedInbox: inboxes[inbox].sharedInbox,
15107
+ meterProvider: ctx.meterProvider,
15108
+ tracerProvider: ctx.tracerProvider,
15109
+ specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock, { specTtl: ctx.federation.httpMessageSignaturesSpecTtl })
15110
+ });
15111
+ } catch (error) {
15112
+ if (delivery != null) await delivery.failed(error);
15113
+ throw error;
15114
+ }
15115
+ sending.catch(() => {});
15116
+ promises.push(sending);
15117
+ if (delivery != null) await delivery.handoff({ type: "direct" });
14852
15118
  }
14853
- if (observation != null) sending.catch(() => {});
14854
- if (delivery != null) await delivery.handoff({ type: "direct" });
14855
- promises.push(sending);
15119
+ if (observation != null) await observation.prepared("delivery");
15120
+ await Promise.all(promises);
15121
+ } finally {
15122
+ await Promise.allSettled(promises);
14856
15123
  }
14857
- if (observation != null) await observation.prepared("delivery");
14858
- await Promise.all(promises);
14859
15124
  return true;
14860
15125
  }
14861
15126
  logger.debug("Enqueuing activity {activityId} to forward later.", {
@@ -14863,7 +15128,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
14863
15128
  activity: ctx.activity
14864
15129
  });
14865
15130
  observation?.setPhase("request-preparation");
14866
- if (!ctx.federation.manuallyStartQueue) ctx.federation._startQueueInternal(ctx.data);
15131
+ if (!ctx.federation.manuallyStartQueue) ctx.federation._startQueueAutomatically(ctx.data);
14867
15132
  observation?.setPhase("key-resolution");
14868
15133
  const keyJwkPairs = [];
14869
15134
  for (const { keyId, privateKey } of keys) {
@@ -15073,6 +15338,69 @@ var KvSpecDeterminer = class {
15073
15338
  function notFound(_request) {
15074
15339
  return new Response("Not Found", { status: 404 });
15075
15340
  }
15341
+ function hasTopLevelProof(value) {
15342
+ return typeof value === "object" && value != null && !Array.isArray(value) && globalThis.Object.prototype.hasOwnProperty.call(value, "proof");
15343
+ }
15344
+ function getContentFields(value) {
15345
+ if (typeof value !== "object" || value == null || Array.isArray(value)) return JSON.stringify(sortJsonKeys(value));
15346
+ const record = { ...value };
15347
+ delete record["@context"];
15348
+ delete record.proof;
15349
+ delete record.signature;
15350
+ return JSON.stringify(sortJsonKeys(record));
15351
+ }
15352
+ function getContextFields(value) {
15353
+ if (typeof value !== "object" || value == null || Array.isArray(value)) return JSON.stringify(sortJsonKeys(value));
15354
+ const context = value["@context"];
15355
+ return JSON.stringify(sortJsonKeys(context ?? null));
15356
+ }
15357
+ function getProofEntries(value) {
15358
+ if (typeof value !== "object" || value == null || Array.isArray(value)) return [];
15359
+ const proof = value.proof;
15360
+ if (proof == null) return [];
15361
+ return Array.isArray(proof) ? proof : [proof];
15362
+ }
15363
+ function normalizeProofEntry(proof) {
15364
+ const stripped = stripContexts(proof);
15365
+ if (typeof stripped !== "object" || stripped == null || Array.isArray(stripped)) return stripped;
15366
+ const record = { ...stripped };
15367
+ if (typeof record.created === "string") try {
15368
+ record.created = Temporal.Instant.from(record.created).toString();
15369
+ } catch {}
15370
+ return record;
15371
+ }
15372
+ function getProofEntryFields(proof) {
15373
+ return JSON.stringify(sortJsonKeys(normalizeProofEntry(proof)));
15374
+ }
15375
+ function getProofFields(value) {
15376
+ return JSON.stringify(getProofEntries(value).map(getProofEntryFields).sort());
15377
+ }
15378
+ async function getUncapturedProofs(activity, capturedJsonLd, contextLoader) {
15379
+ const capturedProofs = new Set(getProofEntries(capturedJsonLd).map(getProofEntryFields));
15380
+ const retainedProofs = [];
15381
+ for await (const proof of activity.getProofs({ contextLoader })) {
15382
+ const proofJsonLd = await proof.toJsonLd({
15383
+ format: "compact",
15384
+ contextLoader
15385
+ });
15386
+ if (!capturedProofs.has(getProofEntryFields(proofJsonLd))) retainedProofs.push(proof);
15387
+ }
15388
+ return retainedProofs;
15389
+ }
15390
+ function stripContexts(value) {
15391
+ if (Array.isArray(value)) return value.map(stripContexts);
15392
+ if (typeof value !== "object" || value == null) return value;
15393
+ const record = { ...value };
15394
+ delete record["@context"];
15395
+ delete record.signature;
15396
+ for (const key of globalThis.Object.keys(record)) record[key] = stripContexts(record[key]);
15397
+ return record;
15398
+ }
15399
+ function sortJsonKeys(value) {
15400
+ if (Array.isArray(value)) return value.map(sortJsonKeys);
15401
+ if (typeof value !== "object" || value == null) return value;
15402
+ return globalThis.Object.fromEntries(globalThis.Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, item]) => [key, sortJsonKeys(item)]));
15403
+ }
15076
15404
  function notAcceptable(_request) {
15077
15405
  return new Response("Not Acceptable", {
15078
15406
  status: 406,