@fedify/fedify 2.4.0-dev.2010 → 2.4.0-dev.2027

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 (96) hide show
  1. package/dist/{assert-CebeUf0C.mjs → assert-D1Eafmd_.mjs} +1 -1
  2. package/dist/{assert_equals-CBlRfA-_.mjs → assert_equals-Z6IcEbWU.mjs} +2 -28
  3. package/dist/{assert_exists-DtzkXC47.mjs → assert_exists-cffSpJ7X.mjs} +1 -1
  4. package/dist/{assert_false-3pLLLsO4.mjs → assert_false-CPdRnc3E.mjs} +1 -1
  5. package/dist/{assert_greater_or_equal-BApOTh1h.mjs → assert_greater_or_equal-BlafOF4-.mjs} +2 -1
  6. package/dist/{assert_instance_of-g3WcyYNR.mjs → assert_instance_of-mrXWWNY-.mjs} +1 -1
  7. package/dist/{assert_not_equals-BN7yDMWe.mjs → assert_not_equals-CpPK2t89.mjs} +2 -1
  8. package/dist/{assert_rejects-wFbSPn1O.mjs → assert_rejects-CTptdYck.mjs} +2 -2
  9. package/dist/{assert_strict_equals-Bpjl4Psw.mjs → assert_strict_equals-CYvBmkpC.mjs} +2 -1
  10. package/dist/{assert_throws-BJ5wuvR2.mjs → assert_throws-BYITOvPO.mjs} +2 -1
  11. package/dist/assertion_error-B-cx0fFA.mjs +31 -0
  12. package/dist/{builder-asm96yV1.mjs → builder-BM255b90.mjs} +2 -2
  13. package/dist/compat/outgoing-jsonld.test.mjs +71 -3
  14. package/dist/compat/public-audience.test.mjs +3 -3
  15. package/dist/compat/secured-document.test.d.mts +2 -0
  16. package/dist/compat/secured-document.test.mjs +58 -0
  17. package/dist/compat/transformers.test.mjs +4 -4
  18. package/dist/{compound-proof-7UIAueLV.mjs → compound-proof-CPvNisT2.mjs} +1 -1
  19. package/dist/{deno-Ckq9TwCv.mjs → deno-BcZNXlJn.mjs} +1 -1
  20. package/dist/{docloader-DUKEPG-O.mjs → docloader-iHi0-9mK.mjs} +2 -2
  21. package/dist/federation/builder.test.mjs +5 -5
  22. package/dist/federation/circuit-breaker.test.mjs +3 -3
  23. package/dist/federation/collection.test.mjs +2 -2
  24. package/dist/federation/compound-fanout.test.d.mts +2 -0
  25. package/dist/federation/compound-fanout.test.mjs +228 -0
  26. package/dist/federation/handler-compound-proof.test.mjs +5 -5
  27. package/dist/federation/handler.test.mjs +11 -11
  28. package/dist/federation/idempotency.test.mjs +4 -4
  29. package/dist/federation/inbox.test.mjs +2 -2
  30. package/dist/federation/keycache.test.mjs +3 -3
  31. package/dist/federation/kv.test.mjs +2 -2
  32. package/dist/federation/metrics.test.mjs +4 -4
  33. package/dist/federation/middleware.test.mjs +17 -17
  34. package/dist/federation/mod.cjs +1 -1
  35. package/dist/federation/mod.js +1 -1
  36. package/dist/federation/mq.test.mjs +7 -6
  37. package/dist/federation/negotiation.test.mjs +3 -3
  38. package/dist/federation/retry.test.mjs +3 -2
  39. package/dist/federation/router.test.mjs +5 -5
  40. package/dist/federation/send.test.mjs +11 -11
  41. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  42. package/dist/federation/tasks/tasks.test.mjs +2 -2
  43. package/dist/federation/temporal.test.mjs +4 -4
  44. package/dist/federation/webfinger.test.mjs +4 -4
  45. package/dist/{federation-CgbvMauV.cjs → federation-C0ijTwhx.cjs} +21 -5
  46. package/dist/{http-DQBfmkrS.cjs → http-CWXKwHPv.cjs} +1 -1
  47. package/dist/{http-DQA2JOEJ.js → http-KZWtR1H8.js} +1 -1
  48. package/dist/{http-DZaAutqg.mjs → http-fIK5D83n.mjs} +3 -3
  49. package/dist/{key-zxzx01Ec.mjs → key-Xb1hVVZO.mjs} +2 -2
  50. package/dist/{kv-cache-CbrUX90H.mjs → kv-cache-CU1rmQFB.mjs} +1 -1
  51. package/dist/{kv-cache-sy8OMNT8.cjs → kv-cache-Dos4tOWb.cjs} +1 -1
  52. package/dist/{kv-cache-BBoePTOJ.js → kv-cache-HOO6BsuW.js} +1 -1
  53. package/dist/{ld-CD_TN0e8.mjs → ld-DFHvxLtx.mjs} +3 -3
  54. package/dist/{metrics-B47Cm5gK.mjs → metrics-D7RydU_p.mjs} +1 -1
  55. package/dist/{middleware-pHwDTAnq.mjs → middleware-BsYD_ufs.mjs} +32 -16
  56. package/dist/{middleware-U_Gannqi.mjs → middleware-DgU5bJnn.mjs} +1 -1
  57. package/dist/{middleware-U0OIuqwD.js → middleware-iffqYoTV.js} +21 -5
  58. package/dist/{mod-UDwMjuHM.d.ts → mod-CNRAxXEb.d.ts} +1 -5
  59. package/dist/{mod-CbKDOnCt.d.cts → mod-CVQFWefn.d.cts} +1 -5
  60. package/dist/mod.cjs +4 -4
  61. package/dist/mod.d.cts +1 -1
  62. package/dist/mod.d.ts +1 -1
  63. package/dist/mod.js +4 -4
  64. package/dist/nodeinfo/client.test.mjs +2 -2
  65. package/dist/nodeinfo/handler.test.mjs +3 -3
  66. package/dist/nodeinfo/types.test.mjs +3 -3
  67. package/dist/otel/exporter.test.mjs +2 -2
  68. package/dist/{outgoing-jsonld-B5Ne7JoL.mjs → outgoing-jsonld-4IJqPYos.mjs} +11 -9
  69. package/dist/{owner-BNKC3s6G.js → owner-B7lgRMdU.js} +127 -35
  70. package/dist/{owner-u3IJRhVx.mjs → owner-D53bUI-n.mjs} +2 -2
  71. package/dist/{owner--mNatWct.cjs → owner-DffLVeYC.cjs} +126 -34
  72. package/dist/{proof-D3te0SP-.mjs → proof-4ADU3qy0.mjs} +80 -23
  73. package/dist/{public-audience-Cc2YJ3ip.mjs → public-audience--klBIOk1.mjs} +13 -9
  74. package/dist/secured-document-CxzZZ9nL.mjs +35 -0
  75. package/dist/{send-CDr0Zivk.mjs → send-n-W6bG7y.mjs} +3 -3
  76. package/dist/sig/compound-proof-discovery.test.mjs +3 -3
  77. package/dist/sig/compound-proof-verification.test.mjs +5 -5
  78. package/dist/sig/compound-proof.test.mjs +145 -58
  79. package/dist/sig/http.test.mjs +11 -10
  80. package/dist/sig/key.test.mjs +6 -6
  81. package/dist/sig/ld.test.mjs +9 -9
  82. package/dist/sig/mod.cjs +2 -2
  83. package/dist/sig/mod.d.cts +1 -1
  84. package/dist/sig/mod.d.ts +1 -1
  85. package/dist/sig/mod.js +2 -2
  86. package/dist/sig/owner.test.mjs +5 -5
  87. package/dist/sig/proof.test.mjs +9 -9
  88. package/dist/std__assert-DvMDRPes.mjs +8 -0
  89. package/dist/{temporal-DKhVF_Uk.mjs → temporal-BFUyXrYg.mjs} +1 -1
  90. package/dist/testing/kv.test.mjs +2 -2
  91. package/dist/utils/docloader.test.mjs +5 -5
  92. package/dist/utils/kv-cache.test.mjs +1 -1
  93. package/dist/utils/mod.cjs +1 -1
  94. package/dist/utils/mod.js +1 -1
  95. package/package.json +6 -6
  96. package/dist/std__assert-CxFT0MNt.mjs +0 -8
@@ -9,7 +9,7 @@ let byte_encodings_base64 = require("byte-encodings/base64");
9
9
  let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
10
10
  //#region deno.json
11
11
  var name = "@fedify/fedify";
12
- var version = "2.4.0-dev.2010+498229f4";
12
+ var version = "2.4.0-dev.2027+fcf88bfc";
13
13
  //#endregion
14
14
  //#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/chunks/root.js
15
15
  const NativeTemporal = globalThis.Temporal;
@@ -10,7 +10,7 @@ import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
10
10
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.4.0-dev.2010+498229f4";
13
+ var version = "2.4.0-dev.2027+fcf88bfc";
14
14
  //#endregion
15
15
  //#region src/sig/accept.ts
16
16
  /**
@@ -1,10 +1,10 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Ckq9TwCv.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-B47Cm5gK.mjs";
4
+ import { n as version, t as name } from "./deno-BcZNXlJn.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-D7RydU_p.mjs";
6
6
  import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CPVqki78.mjs";
7
- import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-zxzx01Ec.mjs";
7
+ import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-Xb1hVVZO.mjs";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { CryptographicKey } from "@fedify/vocab";
10
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Ckq9TwCv.mjs";
5
- import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-B47Cm5gK.mjs";
4
+ import { n as version, t as name } from "./deno-BcZNXlJn.mjs";
5
+ import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-D7RydU_p.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { CryptographicKey, Multikey, Object as Object$1, isActor } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { p as recordDocumentCache } from "./metrics-B47Cm5gK.mjs";
4
+ import { p as recordDocumentCache } from "./metrics-D7RydU_p.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
7
  //#region src/utils/kv-cache.ts
@@ -1,5 +1,5 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
- const require_http = require("./http-DQBfmkrS.cjs");
2
+ const require_http = require("./http-CWXKwHPv.cjs");
3
3
  let _logtape_logtape = require("@logtape/logtape");
4
4
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
5
5
  let es_toolkit = require("es-toolkit");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { T as recordDocumentCache, f as validateCryptoKey, t as doubleKnock } from "./http-DQA2JOEJ.js";
3
+ import { T as recordDocumentCache, f as validateCryptoKey, t as doubleKnock } from "./http-KZWtR1H8.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
6
6
  import { curry } from "es-toolkit";
@@ -1,9 +1,9 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Ckq9TwCv.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-B47Cm5gK.mjs";
6
- import { r as fetchKey, s as validateCryptoKey } from "./key-zxzx01Ec.mjs";
4
+ import { n as version, t as name } from "./deno-BcZNXlJn.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-D7RydU_p.mjs";
6
+ import { r as fetchKey, s as validateCryptoKey } from "./key-Xb1hVVZO.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Ckq9TwCv.mjs";
4
+ import { n as version, t as name } from "./deno-BcZNXlJn.mjs";
5
5
  import { metrics } from "@opentelemetry/api";
6
6
  import { FetchError } from "@fedify/vocab-runtime";
7
7
  //#region src/federation/metrics.ts
@@ -1,27 +1,27 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Ckq9TwCv.mjs";
5
- import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-B47Cm5gK.mjs";
4
+ import { n as version, t as name } from "./deno-BcZNXlJn.mjs";
5
+ import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-D7RydU_p.mjs";
6
6
  import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
7
- import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-zxzx01Ec.mjs";
8
- import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-DZaAutqg.mjs";
9
- import { t as getAuthenticatedDocumentLoader } from "./docloader-DUKEPG-O.mjs";
10
- import { n as kvCache } from "./kv-cache-CbrUX90H.mjs";
11
- import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-B5Ne7JoL.mjs";
7
+ import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-Xb1hVVZO.mjs";
8
+ import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-fIK5D83n.mjs";
9
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-iHi0-9mK.mjs";
10
+ import { n as kvCache } from "./kv-cache-CU1rmQFB.mjs";
11
+ import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
12
12
  import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-DpnpgjyX.mjs";
13
13
  import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
14
- import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-CD_TN0e8.mjs";
15
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-u3IJRhVx.mjs";
16
- import { a as verifyObject, n as hasProofLike, r as signObject } from "./proof-D3te0SP-.mjs";
17
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-CDr0Zivk.mjs";
18
- import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-asm96yV1.mjs";
14
+ import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-DFHvxLtx.mjs";
15
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-D53bUI-n.mjs";
16
+ import { a as verifyObject, n as hasProofLike, r as signObject } from "./proof-4ADU3qy0.mjs";
17
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-n-W6bG7y.mjs";
18
+ import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-BM255b90.mjs";
19
19
  import { t as CircuitBreaker } from "./circuit-breaker-C5NqoLBJ.mjs";
20
20
  import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
21
- import { n as inspectCompoundPortableObjectApplicability, r as verifyCompoundPortableObjectProofs } from "./compound-proof-7UIAueLV.mjs";
21
+ import { n as inspectCompoundPortableObjectApplicability, r as verifyCompoundPortableObjectProofs } from "./compound-proof-CPvNisT2.mjs";
22
22
  import { t as KvKeyCache } from "./keycache-BUDHB5rY.mjs";
23
23
  import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
24
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-DKhVF_Uk.mjs";
24
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-BFUyXrYg.mjs";
25
25
  import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
26
26
  import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
27
27
  import { getLogger, withContext } from "@logtape/logtape";
@@ -3272,6 +3272,7 @@ var FederationImpl = class extends FederationBuilderImpl {
3272
3272
  collectionSync: message.collectionSync,
3273
3273
  orderingKey: message.orderingKey,
3274
3274
  normalizeExistingProofs: message.normalizeExistingProofs,
3275
+ activityJsonLd: message.activity,
3275
3276
  context
3276
3277
  });
3277
3278
  }
@@ -3977,11 +3978,11 @@ var FederationImpl = class extends FederationBuilderImpl {
3977
3978
  proofCreated = true;
3978
3979
  }
3979
3980
  }
3980
- let jsonLd = await activity.toJsonLd({
3981
+ let jsonLd = !proofCreated && options.activityJsonLd != null ? options.activityJsonLd : await activity.toJsonLd({
3981
3982
  format: "compact",
3982
3983
  contextLoader
3983
3984
  });
3984
- if (proofCreated || !hasProof || options.normalizeExistingProofs) jsonLd = await normalizeOutgoingActivityJsonLd(jsonLd, contextLoader);
3985
+ if (proofCreated || !hasProof || options.normalizeExistingProofs) jsonLd = await normalizeOutgoingActivityJsonLd(jsonLd, contextLoader, { preserveNestedSecuredDocuments: true });
3985
3986
  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.", {
3986
3987
  activityId,
3987
3988
  keys: keys.map((pair) => ({
@@ -4964,6 +4965,21 @@ var ContextImpl = class ContextImpl {
4964
4965
  });
4965
4966
  proofCreated = true;
4966
4967
  }
4968
+ } else {
4969
+ const contextLoader = this.contextLoader;
4970
+ let hasProof = false;
4971
+ for await (const _ of activity.getProofs({ contextLoader })) {
4972
+ hasProof = true;
4973
+ break;
4974
+ }
4975
+ if (!hasProof) for (const { keyId, privateKey } of keys) {
4976
+ if (privateKey.algorithm.name !== "Ed25519") continue;
4977
+ activity = await signObject(activity, privateKey, keyId, {
4978
+ contextLoader,
4979
+ tracerProvider: this.tracerProvider
4980
+ });
4981
+ proofCreated = true;
4982
+ }
4967
4983
  }
4968
4984
  const inboxes = extractInboxes({
4969
4985
  recipients: expandedRecipients,
@@ -1,5 +1,5 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-pHwDTAnq.mjs";
4
+ import { n as FederationImpl } from "./middleware-BsYD_ufs.mjs";
5
5
  export { FederationImpl };
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
5
- import { A as recordWebFingerHandle, C as recordCollectionRequest, D as recordInboxActivity, E as recordFanoutRecipients, I as name, L as version, M as formatAcceptSignature, O as recordOutboxActivity, S as recordCollectionPageItems, _ as instrumentDocumentLoader, a as verifyRequestDetailed, b as recordCircuitBreakerStateChange, d as importJwk, f as validateCryptoKey, g as getRemoteHost, h as getFederationMetrics, i as verifyRequest, j as registerQueueDepthGauge, k as recordOutboxEnqueue, m as getDurationMs, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-DQA2JOEJ.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-KZWtR1H8.js";
6
6
  import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-C_cNlNVK.js";
7
- import { C as verifyCompactJsonLd, D as normalizeOutgoingActivityJsonLd, E as wrapContextLoaderForJsonLd, S as signJsonLd, _ as getNormalizationContextLoader, a as signObject, b as isClearlyMalformedContextReference, d as InvalidContextReferenceError, f as assertSafeJsonLd, g as detachSignature, i as hasProofLike, l as verifyPortableObjectProofPolicy, m as compactJsonLd, n as getKeyOwner, o as verifyMapLocalProof, s as verifyObject, t as doesActorOwnKey, v as hasSignature, x as isInvalidUrlTypeError, y as hasSignatureLike } from "./owner-BNKC3s6G.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-BBoePTOJ.js";
7
+ import { C as verifyCompactJsonLd, D as normalizeOutgoingActivityJsonLd, E as wrapContextLoaderForJsonLd, S as signJsonLd, _ as getNormalizationContextLoader, a as signObject, b as isClearlyMalformedContextReference, d as InvalidContextReferenceError, f as assertSafeJsonLd, g as detachSignature, i as hasProofLike, l as verifyPortableObjectProofPolicy, m as compactJsonLd, n as getKeyOwner, o as verifyMapLocalProof, s as verifyObject, t as doesActorOwnKey, v as hasSignature, x as isInvalidUrlTypeError, y as hasSignatureLike } from "./owner-B7lgRMdU.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-HOO6BsuW.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";
@@ -5660,6 +5660,7 @@ var FederationImpl = class extends FederationBuilderImpl {
5660
5660
  collectionSync: message.collectionSync,
5661
5661
  orderingKey: message.orderingKey,
5662
5662
  normalizeExistingProofs: message.normalizeExistingProofs,
5663
+ activityJsonLd: message.activity,
5663
5664
  context
5664
5665
  });
5665
5666
  }
@@ -6365,11 +6366,11 @@ var FederationImpl = class extends FederationBuilderImpl {
6365
6366
  proofCreated = true;
6366
6367
  }
6367
6368
  }
6368
- let jsonLd = await activity.toJsonLd({
6369
+ let jsonLd = !proofCreated && options.activityJsonLd != null ? options.activityJsonLd : await activity.toJsonLd({
6369
6370
  format: "compact",
6370
6371
  contextLoader
6371
6372
  });
6372
- if (proofCreated || !hasProof || options.normalizeExistingProofs) jsonLd = await normalizeOutgoingActivityJsonLd(jsonLd, contextLoader);
6373
+ if (proofCreated || !hasProof || options.normalizeExistingProofs) jsonLd = await normalizeOutgoingActivityJsonLd(jsonLd, contextLoader, { preserveNestedSecuredDocuments: true });
6373
6374
  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.", {
6374
6375
  activityId,
6375
6376
  keys: keys.map((pair) => ({
@@ -7352,6 +7353,21 @@ var ContextImpl = class ContextImpl {
7352
7353
  });
7353
7354
  proofCreated = true;
7354
7355
  }
7356
+ } else {
7357
+ const contextLoader = this.contextLoader;
7358
+ let hasProof = false;
7359
+ for await (const _ of activity.getProofs({ contextLoader })) {
7360
+ hasProof = true;
7361
+ break;
7362
+ }
7363
+ if (!hasProof) for (const { keyId, privateKey } of keys) {
7364
+ if (privateKey.algorithm.name !== "Ed25519") continue;
7365
+ activity = await signObject(activity, privateKey, keyId, {
7366
+ contextLoader,
7367
+ tracerProvider: this.tracerProvider
7368
+ });
7369
+ proofCreated = true;
7370
+ }
7355
7371
  }
7356
7372
  const inboxes = extractInboxes({
7357
7373
  recipients: expandedRecipients,
@@ -207,11 +207,7 @@ interface CreateProofOptions {
207
207
  * @throws {TypeError} If the private key is invalid or unsupported.
208
208
  * @since 0.10.0
209
209
  */
210
- declare function createProof(object: Object$1, privateKey: CryptoKey, keyId: URL, {
211
- contextLoader,
212
- context,
213
- created
214
- }?: CreateProofOptions): Promise<DataIntegrityProof>;
210
+ declare function createProof(object: Object$1, privateKey: CryptoKey, keyId: URL, options?: CreateProofOptions): Promise<DataIntegrityProof>;
215
211
  /**
216
212
  * Options for {@link signObject}.
217
213
  * @since 0.10.0
@@ -207,11 +207,7 @@ interface CreateProofOptions {
207
207
  * @throws {TypeError} If the private key is invalid or unsupported.
208
208
  * @since 0.10.0
209
209
  */
210
- declare function createProof(object: Object$1, privateKey: CryptoKey, keyId: URL, {
211
- contextLoader,
212
- context,
213
- created
214
- }?: CreateProofOptions): Promise<DataIntegrityProof>;
210
+ declare function createProof(object: Object$1, privateKey: CryptoKey, keyId: URL, options?: CreateProofOptions): Promise<DataIntegrityProof>;
215
211
  /**
216
212
  * Options for {@link signObject}.
217
213
  * @since 0.10.0
package/dist/mod.cjs CHANGED
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("./rolldown-runtime-Dmm3t92W.cjs");
4
4
  const require_transformers = require("./transformers-BalCrSsr.cjs");
5
5
  require("./compat/mod.cjs");
6
- const require_http = require("./http-DQBfmkrS.cjs");
7
- const require_federation = require("./federation-CgbvMauV.cjs");
6
+ const require_http = require("./http-CWXKwHPv.cjs");
7
+ const require_federation = require("./federation-C0ijTwhx.cjs");
8
8
  const require_types = require("./types-Be2zbyeG.cjs");
9
- const require_owner = require("./owner--mNatWct.cjs");
10
- const require_kv_cache = require("./kv-cache-sy8OMNT8.cjs");
9
+ const require_owner = require("./owner-DffLVeYC.cjs");
10
+ const require_kv_cache = require("./kv-cache-Dos4tOWb.cjs");
11
11
  require("./nodeinfo/mod.cjs");
12
12
  require("./runtime/mod.cjs");
13
13
  require("./sig/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -6,7 +6,7 @@ import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthori
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.cjs";
7
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
8
8
  import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-x9W0d0Pk.cjs";
9
- import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-CbKDOnCt.cjs";
9
+ import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-CVQFWefn.cjs";
10
10
  import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CyiSjRkk.cjs";
11
11
  export * from "@fedify/vocab-runtime";
12
12
 
package/dist/mod.d.ts CHANGED
@@ -6,7 +6,7 @@ import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthori
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.js";
7
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
8
8
  import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-D882_Xsg.js";
9
- import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-UDwMjuHM.js";
9
+ import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-CNRAxXEb.js";
10
10
  import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-C0BYc0OU.js";
11
11
  export * from "@fedify/vocab-runtime";
12
12
 
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./rolldown-runtime-BC-Eo5Mj.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-DAtXl_Kc.js";
5
5
  import "./compat/mod.js";
6
- import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-DQA2JOEJ.js";
7
- import { a as respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-U0OIuqwD.js";
6
+ import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-KZWtR1H8.js";
7
+ import { a as respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-iffqYoTV.js";
8
8
  import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-C_cNlNVK.js";
9
- import { S as signJsonLd, T as verifySignature, a as signObject, c as verifyPortableObjectProof, g as detachSignature, h as createSignature, i as hasProofLike, n as getKeyOwner, p as attachSignature, r as createProof, s as verifyObject, t as doesActorOwnKey, u as verifyProof, w as verifyJsonLd, y as hasSignatureLike } from "./owner-BNKC3s6G.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-BBoePTOJ.js";
9
+ import { S as signJsonLd, T as verifySignature, a as signObject, c as verifyPortableObjectProof, g as detachSignature, h as createSignature, i as hasProofLike, n as getKeyOwner, p as attachSignature, r as createProof, s as verifyObject, t as doesActorOwnKey, u as verifyProof, w as verifyJsonLd, y as hasSignatureLike } from "./owner-B7lgRMdU.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-HOO6BsuW.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";
@@ -2,8 +2,8 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
- import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
6
- import "../std__assert-CxFT0MNt.mjs";
5
+ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
+ import "../std__assert-DvMDRPes.mjs";
7
7
  import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-DpnpgjyX.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/nodeinfo/client.test.ts
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { r as createRequestContext } from "../context-CbS35fLr.mjs";
5
5
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
6
- import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
7
- import "../std__assert-CxFT0MNt.mjs";
8
- import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-pHwDTAnq.mjs";
6
+ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
7
+ import "../std__assert-DvMDRPes.mjs";
8
+ import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-BsYD_ufs.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,9 +1,9 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
5
- import { t as assertThrows } from "../assert_throws-BJ5wuvR2.mjs";
6
- import "../std__assert-CxFT0MNt.mjs";
4
+ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
5
+ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
6
+ import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as nodeInfoToJson } from "../types-DE_LV1JB.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/nodeinfo/types.test.ts
@@ -2,8 +2,8 @@ import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
- import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
6
- import "../std__assert-CxFT0MNt.mjs";
5
+ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
+ import "../std__assert-DvMDRPes.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { ExportResultCode } from "@opentelemetry/core";
9
9
  import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
@@ -1,7 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-Cc2YJ3ip.mjs";
4
+ import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience--klBIOk1.mjs";
5
+ import { t as isSelfContainedSecuredDocument } from "./secured-document-CxzZZ9nL.mjs";
5
6
  import { getLogger } from "@logtape/logtape";
6
7
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
8
  import jsonld from "@fedify/vocab-runtime/jsonld";
@@ -64,13 +65,14 @@ function getKnownSafeContextUrls() {
64
65
  /**
65
66
  * Wraps scalar ActivityStreams attachment properties in arrays.
66
67
  */
67
- function wrapScalarAttachments(jsonLd, depth = 0) {
68
+ function wrapScalarAttachments(jsonLd, preserveSecured, depth = 0) {
68
69
  if (depth >= MAX_TRAVERSAL_DEPTH) return jsonLd;
70
+ if (preserveSecured && depth > 0 && isSelfContainedSecuredDocument(jsonLd)) return jsonLd;
69
71
  if (Array.isArray(jsonLd)) {
70
72
  let normalized = null;
71
73
  for (let i = 0; i < jsonLd.length; i++) {
72
74
  const item = jsonLd[i];
73
- const next = wrapScalarAttachments(item, depth + 1);
75
+ const next = wrapScalarAttachments(item, preserveSecured, depth + 1);
74
76
  if (normalized == null && next !== item) normalized = jsonLd.slice(0, i);
75
77
  if (normalized != null) normalized[i] = next;
76
78
  }
@@ -83,7 +85,7 @@ function wrapScalarAttachments(jsonLd, depth = 0) {
83
85
  for (let i = 0; i < keys.length; i++) {
84
86
  const key = keys[i];
85
87
  const value = record[key];
86
- const next = key === "@context" || key === "@value" && isJsonLdValueObject(jsonLd) ? value : wrapScalarAttachments(value, depth + 1);
88
+ const next = key === "@context" || key === "@value" && isJsonLdValueObject(jsonLd) ? value : wrapScalarAttachments(value, preserveSecured, depth + 1);
87
89
  const output = ATTACHMENT_FIELDS.has(key) && next != null && !Array.isArray(next) && !isJsonLdListObject(next) ? [next] : next;
88
90
  if (normalized == null && output !== value) {
89
91
  const cloned = Object.create(null);
@@ -166,8 +168,8 @@ function getLogSafeJsonLdMetadata(jsonLd) {
166
168
  * the semantic-preservation check to succeed; otherwise canonicalization
167
169
  * failures leave the original document unchanged.
168
170
  */
169
- async function normalizeAttachmentArrays(jsonLd, contextLoader) {
170
- const normalized = wrapScalarAttachments(jsonLd);
171
+ async function normalizeAttachmentArrays(jsonLd, contextLoader, options = {}) {
172
+ const normalized = wrapScalarAttachments(jsonLd, options.preserveNestedSecuredDocuments ?? false);
171
173
  if (normalized === jsonLd) return jsonLd;
172
174
  if (exceedsTraversalDepth(jsonLd)) {
173
175
  logger.debug("Skipping attachment array normalization because the JSON-LD document exceeds the safe traversal depth; leaving it unchanged.");
@@ -195,9 +197,9 @@ async function normalizeAttachmentArrays(jsonLd, contextLoader) {
195
197
  * to locally generated outgoing activities before they are signed, enqueued,
196
198
  * or sent.
197
199
  */
198
- async function normalizeOutgoingActivityJsonLd(jsonLd, contextLoader) {
199
- jsonLd = await normalizePublicAudience(jsonLd, contextLoader);
200
- return await normalizeAttachmentArrays(jsonLd, contextLoader);
200
+ async function normalizeOutgoingActivityJsonLd(jsonLd, contextLoader, options = {}) {
201
+ jsonLd = await normalizePublicAudience(jsonLd, contextLoader, options);
202
+ return await normalizeAttachmentArrays(jsonLd, contextLoader, options);
201
203
  }
202
204
  //#endregion
203
205
  export { normalizeAttachmentArrays as n, normalizeOutgoingActivityJsonLd as r, isPreloadedContextAttachmentSafe as t };