@fedify/fedify 1.9.7 → 1.9.9

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 (112) hide show
  1. package/dist/{actor-CsvteFj1.cjs → actor-DILKT_HU.cjs} +187 -187
  2. package/dist/{actor-DeUOMMMQ.mjs → actor-DVET8NhO.mjs} +1 -1
  3. package/dist/{actor-B3mkavdq.js → actor-MDInzRdc.js} +187 -187
  4. package/dist/{authdocloader-BKq994CV.mjs → authdocloader-DLvikTbR.mjs} +3 -3
  5. package/dist/{authdocloader-C3_-i4Zk.js → authdocloader-DRG9qnz7.js} +3 -3
  6. package/dist/{authdocloader-tagnJZ6u.cjs → authdocloader-hwjRHw8X.cjs} +3 -3
  7. package/dist/{builder-CnVAhip1.mjs → builder-DfInnU0K.mjs} +4 -4
  8. package/dist/{client-Bza9SeZS.mjs → client-DuRbuCIQ.mjs} +1 -1
  9. package/dist/compat/mod.cjs +1 -1
  10. package/dist/compat/mod.d.cts +1 -1
  11. package/dist/compat/mod.d.ts +1 -1
  12. package/dist/compat/transformers.test.mjs +3 -3
  13. package/dist/{context-K4cCphQj.d.ts → context-Cf8s07xm.d.ts} +4 -1
  14. package/dist/{context-CACMqDzl.d.cts → context-Crmwowsw.d.cts} +4 -1
  15. package/dist/{docloader-Co-tW1B6.cjs → docloader-BZfjD0Xt.cjs} +1 -1
  16. package/dist/{docloader-Dlo9EMTn.js → docloader-ivt5xNwJ.js} +1 -1
  17. package/dist/{esm-BLERAZrI.mjs → esm-D0urVWqo.mjs} +1 -1
  18. package/dist/federation/builder.test.mjs +3 -3
  19. package/dist/federation/collection.test.mjs +1 -1
  20. package/dist/federation/handler.test.mjs +6 -6
  21. package/dist/federation/idempotency.test.mjs +5 -5
  22. package/dist/federation/inbox.test.mjs +3 -3
  23. package/dist/federation/keycache.test.mjs +3 -3
  24. package/dist/federation/kv.test.mjs +1 -1
  25. package/dist/federation/middleware.test.mjs +93 -33
  26. package/dist/federation/mod.cjs +2 -2
  27. package/dist/federation/mod.d.cts +1 -1
  28. package/dist/federation/mod.d.ts +1 -1
  29. package/dist/federation/mod.js +1 -1
  30. package/dist/federation/mq.test.mjs +1 -1
  31. package/dist/federation/retry.test.mjs +1 -1
  32. package/dist/federation/router.test.mjs +2 -2
  33. package/dist/federation/send.test.mjs +7 -7
  34. package/dist/{http-cvQMgiFd.cjs → http-8jvVkJos.cjs} +3 -3
  35. package/dist/{http-hFXuPP4j.mjs → http-CsSHezSz.mjs} +2 -2
  36. package/dist/{http-z-J6i29D.js → http-Dbj7ZT3b.js} +3 -3
  37. package/dist/{inbox-B0NdZv6Q.mjs → inbox-D7U8Ysvc.mjs} +1 -1
  38. package/dist/{key-ByblW_7f.mjs → key-Bbuzt358.mjs} +2 -2
  39. package/dist/{key-USCeSjWo.mjs → key-Bg3Rr_bi.mjs} +1 -1
  40. package/dist/{key-BfH9JUMQ.cjs → key-Bl8yte5W.cjs} +1 -1
  41. package/dist/{key-DPg0mibt.js → key-C2e_Yz1s.js} +2 -2
  42. package/dist/{key-B2ZqbGDP.cjs → key-CUorXS6k.cjs} +2 -2
  43. package/dist/{keycache-qGjtNwWK.mjs → keycache-Dpm1JlAw.mjs} +1 -1
  44. package/dist/{keys-D48z4zQE.mjs → keys-CZlvPl27.mjs} +1 -1
  45. package/dist/{ld-Bk-CiTUe.mjs → ld-iU-MUtGB.mjs} +2 -2
  46. package/dist/{lookup-CuDOZqcB.js → lookup-BOFQeNi_.js} +1 -1
  47. package/dist/{lookup-C6EHvNN7.cjs → lookup-BnvWOvmD.cjs} +1 -1
  48. package/dist/{lookup-B-LJhUtc.mjs → lookup-DhIULso8.mjs} +1 -1
  49. package/dist/{middleware-xIvAtsQ9.mjs → middleware-BBjNkISH.mjs} +53 -28
  50. package/dist/{middleware-UNqaTRBe.cjs → middleware-BD8iV5GL.cjs} +49 -24
  51. package/dist/{middleware-Cns1QUI8.js → middleware-D0zludVl.js} +47 -22
  52. package/dist/{middleware-DYNDkDz7.mjs → middleware-DauQ1R8p.mjs} +1 -1
  53. package/dist/{middleware-SP7rhp6I.cjs → middleware-TO6qMFz0.cjs} +1 -1
  54. package/dist/mod.cjs +10 -10
  55. package/dist/mod.d.cts +1 -1
  56. package/dist/mod.d.ts +1 -1
  57. package/dist/mod.js +9 -9
  58. package/dist/nodeinfo/client.test.mjs +3 -3
  59. package/dist/nodeinfo/handler.test.mjs +2 -2
  60. package/dist/nodeinfo/mod.cjs +1 -1
  61. package/dist/nodeinfo/mod.js +1 -1
  62. package/dist/nodeinfo/semver.test.mjs +1 -1
  63. package/dist/nodeinfo/types.test.mjs +1 -1
  64. package/dist/{owner-CkmuWs8s.mjs → owner-CAvCysNj.mjs} +3 -3
  65. package/dist/{proof-DiFRNymC.cjs → proof-2V3jxAdE.cjs} +3 -3
  66. package/dist/{proof-BBEQdN7B.js → proof-C99DO0SE.js} +3 -3
  67. package/dist/{proof-DVFzuYOq.mjs → proof-DkUAJViu.mjs} +2 -2
  68. package/dist/runtime/authdocloader.test.mjs +6 -6
  69. package/dist/runtime/docloader.test.mjs +3 -3
  70. package/dist/runtime/key.test.mjs +3 -3
  71. package/dist/runtime/langstr.test.mjs +2 -2
  72. package/dist/runtime/link.test.mjs +2 -2
  73. package/dist/runtime/mod.cjs +3 -3
  74. package/dist/runtime/mod.js +3 -3
  75. package/dist/runtime/multibase/multibase.test.mjs +2 -2
  76. package/dist/runtime/url.test.mjs +2 -2
  77. package/dist/{send-BsKuGBh0.mjs → send-BxjL4pnG.mjs} +2 -2
  78. package/dist/sig/http.test.mjs +6 -6
  79. package/dist/sig/key.test.mjs +4 -4
  80. package/dist/sig/ld.test.mjs +5 -5
  81. package/dist/sig/mod.cjs +3 -3
  82. package/dist/sig/mod.js +3 -3
  83. package/dist/sig/owner.test.mjs +5 -5
  84. package/dist/sig/proof.test.mjs +4 -4
  85. package/dist/testing/docloader.test.mjs +1 -1
  86. package/dist/testing/mod.d.mts +4 -1
  87. package/dist/testing/mod.mjs +1 -1
  88. package/dist/{testing-8TvaN83G.mjs → testing-eYbMkj5P.mjs} +2 -2
  89. package/dist/{transformers-C2P5eKUT.cjs → transformers-DW7EyHh4.cjs} +1 -1
  90. package/dist/{types-D4VM3B7I.cjs → types-B0U2QC2Q.cjs} +1 -1
  91. package/dist/{types-BK9bojU0.js → types-dHLDn_7H.js} +1 -1
  92. package/dist/vocab/actor.test.mjs +4 -4
  93. package/dist/vocab/cjs.test.mjs +1 -1
  94. package/dist/vocab/lookup.test.mjs +4 -4
  95. package/dist/vocab/mod.cjs +3 -3
  96. package/dist/vocab/mod.js +3 -3
  97. package/dist/vocab/type.test.mjs +2 -2
  98. package/dist/vocab/vocab.test.mjs +3 -3
  99. package/dist/{vocab-DuJO9k13.mjs → vocab-CG-IqKPs.mjs} +186 -186
  100. package/dist/webfinger/handler.test.mjs +3 -3
  101. package/dist/webfinger/lookup.test.mjs +3 -3
  102. package/dist/webfinger/mod.cjs +1 -1
  103. package/dist/webfinger/mod.js +1 -1
  104. package/dist/x/cfworkers.cjs +1 -1
  105. package/dist/x/cfworkers.test.mjs +1 -1
  106. package/dist/x/hono.cjs +1 -1
  107. package/dist/x/hono.d.cts +1 -1
  108. package/dist/x/hono.d.ts +1 -1
  109. package/dist/x/sveltekit.cjs +1 -1
  110. package/dist/x/sveltekit.d.cts +1 -1
  111. package/dist/x/sveltekit.d.ts +1 -1
  112. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { G as FetchError, ot as name, s as CryptographicKey, st as version } from "./vocab-DuJO9k13.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-ByblW_7f.mjs";
4
+ import { G as FetchError, ot as name, s as CryptographicKey, st as version } from "./vocab-CG-IqKPs.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-Bbuzt358.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
- import { d as name, f as version, t as FetchError } from "./docloader-Dlo9EMTn.js";
4
- import { y as CryptographicKey } from "./actor-B3mkavdq.js";
5
- import { n as fetchKey, o as validateCryptoKey } from "./key-DPg0mibt.js";
3
+ import { d as name, f as version, t as FetchError } from "./docloader-ivt5xNwJ.js";
4
+ import { y as CryptographicKey } from "./actor-MDInzRdc.js";
5
+ import { n as fetchKey, o as validateCryptoKey } from "./key-C2e_Yz1s.js";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { U as getTypeId, ot as name, st as version, t as Activity } from "./vocab-DuJO9k13.mjs";
4
+ import { U as getTypeId, ot as name, st as version, t as Activity } from "./vocab-CG-IqKPs.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
7
7
  //#region src/federation/inbox.ts
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { J as getDocumentLoader, ot as name, s as CryptographicKey, st as version, v as Object$1 } from "./vocab-DuJO9k13.mjs";
5
- import { i as isActor } from "./actor-DeUOMMMQ.mjs";
4
+ import { J as getDocumentLoader, ot as name, s as CryptographicKey, st as version, v as Object$1 } from "./vocab-CG-IqKPs.mjs";
5
+ import { i as isActor } from "./actor-DVET8NhO.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  //#region src/sig/key.ts
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { a as validateCryptoKey } from "./key-ByblW_7f.mjs";
4
+ import { a as validateCryptoKey } from "./key-Bbuzt358.mjs";
5
5
  export { validateCryptoKey };
@@ -1,4 +1,4 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_key = require("./key-B2ZqbGDP.cjs");
3
+ const require_key = require("./key-CUorXS6k.cjs");
4
4
  exports.validateCryptoKey = require_key.validateCryptoKey;
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./rolldown-runtime-C7fyD9f2.js";
4
- import { d as name, f as version, i as getDocumentLoader } from "./docloader-Dlo9EMTn.js";
5
- import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-B3mkavdq.js";
4
+ import { d as name, f as version, i as getDocumentLoader } from "./docloader-ivt5xNwJ.js";
5
+ import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-MDInzRdc.js";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  //#region src/sig/key.ts
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_docloader = require("./docloader-Co-tW1B6.cjs");
4
- const require_actor = require("./actor-CsvteFj1.cjs");
3
+ const require_docloader = require("./docloader-BZfjD0Xt.cjs");
4
+ const require_actor = require("./actor-DILKT_HU.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _opentelemetry_api = require("@opentelemetry/api");
7
7
  //#region src/sig/key.ts
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { g as Multikey, s as CryptographicKey } from "./vocab-DuJO9k13.mjs";
4
+ import { g as Multikey, s as CryptographicKey } from "./vocab-CG-IqKPs.mjs";
5
5
  //#region src/federation/keycache.ts
6
6
  const NULL_KEY_CACHE_VALUE = { _fedify: "key-unavailable" };
7
7
  const NULL_KEY_CACHE_TTL = Temporal.Duration.from({ minutes: 5 });
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { I as importSpki, g as Multikey, s as CryptographicKey } from "./vocab-DuJO9k13.mjs";
4
+ import { I as importSpki, g as Multikey, s as CryptographicKey } from "./vocab-CG-IqKPs.mjs";
5
5
  //#region src/testing/keys.ts
6
6
  const rsaPublicKey1 = new CryptographicKey({
7
7
  id: new URL("https://example.com/key"),
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { J as getDocumentLoader, U as getTypeId, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1 } from "./vocab-DuJO9k13.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-ByblW_7f.mjs";
4
+ import { J as getDocumentLoader, U as getTypeId, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1 } from "./vocab-CG-IqKPs.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-Bbuzt358.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import jsonld from "jsonld";
@@ -1,6 +1,6 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
- import { d as name, f as version, l as UrlError, o as getUserAgent, u as validatePublicUrl } from "./docloader-Dlo9EMTn.js";
3
+ import { d as name, f as version, l as UrlError, o as getUserAgent, u as validatePublicUrl } from "./docloader-ivt5xNwJ.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
6
6
  //#region src/webfinger/lookup.ts
@@ -1,6 +1,6 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_docloader = require("./docloader-Co-tW1B6.cjs");
3
+ const require_docloader = require("./docloader-BZfjD0Xt.cjs");
4
4
  let _logtape_logtape = require("@logtape/logtape");
5
5
  let _opentelemetry_api = require("@opentelemetry/api");
6
6
  //#region src/webfinger/lookup.ts
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, ot as name, st as version, v as Object$1 } from "./vocab-DuJO9k13.mjs";
4
+ import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, ot as name, st as version, v as Object$1 } from "./vocab-CG-IqKPs.mjs";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  import { SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { cloneDeep, delay } from "es-toolkit";
@@ -1,23 +1,23 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, Z as kvCache, a as CollectionPage, b as OrderedCollection, g as Multikey, h as Link, i as Collection, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1, x as OrderedCollectionPage } from "./vocab-DuJO9k13.mjs";
5
- import { i as RouterError, n as traverseCollection, t as lookupObject } from "./lookup-B-LJhUtc.mjs";
6
- import { t as getNodeInfo } from "./client-Bza9SeZS.mjs";
4
+ import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, Z as kvCache, a as CollectionPage, b as OrderedCollection, g as Multikey, h as Link, i as Collection, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1, x as OrderedCollectionPage } from "./vocab-CG-IqKPs.mjs";
5
+ import { i as RouterError, n as traverseCollection, t as lookupObject } from "./lookup-DhIULso8.mjs";
6
+ import { t as getNodeInfo } from "./client-DuRbuCIQ.mjs";
7
7
  import { t as nodeInfoToJson } from "./types-CAnkAQGM.mjs";
8
- import "./actor-DeUOMMMQ.mjs";
9
- import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-ByblW_7f.mjs";
10
- import { l as verifyRequest } from "./http-hFXuPP4j.mjs";
11
- import { t as getAuthenticatedDocumentLoader } from "./authdocloader-BKq994CV.mjs";
12
- import { a as signJsonLd, i as hasSignature, o as verifyJsonLd, r as detachSignature } from "./ld-Bk-CiTUe.mjs";
13
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CkmuWs8s.mjs";
14
- import { n as signObject, r as verifyObject } from "./proof-DVFzuYOq.mjs";
15
- import { n as routeActivity } from "./inbox-B0NdZv6Q.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-CnVAhip1.mjs";
8
+ import "./actor-DVET8NhO.mjs";
9
+ import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-Bbuzt358.mjs";
10
+ import { l as verifyRequest } from "./http-CsSHezSz.mjs";
11
+ import { t as getAuthenticatedDocumentLoader } from "./authdocloader-DLvikTbR.mjs";
12
+ import { a as signJsonLd, i as hasSignature, o as verifyJsonLd, r as detachSignature } from "./ld-iU-MUtGB.mjs";
13
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CAvCysNj.mjs";
14
+ import { n as signObject, r as verifyObject } from "./proof-DkUAJViu.mjs";
15
+ import { n as routeActivity } from "./inbox-D7U8Ysvc.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-DfInnU0K.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-BD6-SZ6O.mjs";
18
- import { t as KvKeyCache } from "./keycache-qGjtNwWK.mjs";
18
+ import { t as KvKeyCache } from "./keycache-Dpm1JlAw.mjs";
19
19
  import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
20
- import { n as sendActivity, t as extractInboxes } from "./send-BsKuGBh0.mjs";
20
+ import { n as sendActivity, t as extractInboxes } from "./send-BxjL4pnG.mjs";
21
21
  import { getLogger, withContext } from "@logtape/logtape";
22
22
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
23
23
  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";
@@ -1845,14 +1845,17 @@ var FederationImpl = class extends FederationBuilderImpl {
1845
1845
  let rsaKey = null;
1846
1846
  for (const { keyId, privateKey } of keys) {
1847
1847
  validateCryptoKey(privateKey, "private");
1848
- if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
1849
- rsaKey = {
1850
- keyId,
1851
- privateKey
1852
- };
1853
- continue;
1854
- }
1855
- if (privateKey.algorithm.name === "Ed25519") {
1848
+ if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
1849
+ keyId,
1850
+ privateKey
1851
+ };
1852
+ }
1853
+ for await (const _ of activity.getProofs({ contextLoader })) {
1854
+ proofCreated = true;
1855
+ break;
1856
+ }
1857
+ if (!proofCreated) {
1858
+ for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
1856
1859
  activity = await signObject(activity, privateKey, keyId, {
1857
1860
  contextLoader,
1858
1861
  tracerProvider: this.tracerProvider
@@ -2485,6 +2488,7 @@ var ContextImpl = class ContextImpl {
2485
2488
  }
2486
2489
  const owner = this.getActorUri(identifier);
2487
2490
  const result = [];
2491
+ let i = 1;
2488
2492
  for (const keyPair of keyPairs) {
2489
2493
  const newPair = {
2490
2494
  ...keyPair,
@@ -2494,12 +2498,13 @@ var ContextImpl = class ContextImpl {
2494
2498
  publicKey: keyPair.publicKey
2495
2499
  }),
2496
2500
  multikey: new Multikey({
2497
- id: keyPair.keyId,
2501
+ id: new URL(`#multikey-${i}`, owner),
2498
2502
  controller: owner,
2499
2503
  publicKey: keyPair.publicKey
2500
2504
  })
2501
2505
  };
2502
2506
  result.push(newPair);
2507
+ i++;
2503
2508
  }
2504
2509
  return result;
2505
2510
  }
@@ -2646,6 +2651,7 @@ var ContextImpl = class ContextImpl {
2646
2651
  ]);
2647
2652
  let keys;
2648
2653
  let identifier = null;
2654
+ let actorKeyPairs = null;
2649
2655
  if ("identifier" in sender || "username" in sender || "handle" in sender) {
2650
2656
  if ("identifier" in sender) identifier = sender.identifier;
2651
2657
  else {
@@ -2663,8 +2669,13 @@ var ContextImpl = class ContextImpl {
2663
2669
  }
2664
2670
  }
2665
2671
  span.setAttribute("fedify.actor.identifier", identifier);
2666
- keys = await this.getKeyPairsFromIdentifier(identifier);
2667
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
2672
+ if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
2673
+ actorKeyPairs = await this.getActorKeyPairs(identifier);
2674
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
2675
+ keys = actorKeyPairs.map((kp) => ({
2676
+ keyId: kp.keyId,
2677
+ privateKey: kp.privateKey
2678
+ }));
2668
2679
  } else if (Array.isArray(sender)) {
2669
2680
  if (sender.length < 1) throw new Error("The sender's key pairs are empty.");
2670
2681
  keys = sender;
@@ -2695,6 +2706,16 @@ var ContextImpl = class ContextImpl {
2695
2706
  });
2696
2707
  throw new TypeError("The activity to send must have at least one actor property.");
2697
2708
  }
2709
+ if (actorKeyPairs != null) {
2710
+ const contextLoader = this.contextLoader;
2711
+ for (const kp of actorKeyPairs) {
2712
+ if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
2713
+ activity = await signObject(activity, kp.privateKey, kp.multikey.id, {
2714
+ contextLoader,
2715
+ tracerProvider: this.tracerProvider
2716
+ });
2717
+ }
2718
+ }
2698
2719
  const inboxes = extractInboxes({
2699
2720
  recipients: expandedRecipients,
2700
2721
  preferSharedInbox: options.preferSharedInbox,
@@ -2734,7 +2755,7 @@ var ContextImpl = class ContextImpl {
2734
2755
  traceContext: carrier
2735
2756
  };
2736
2757
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
2737
- this.federation.fanoutQueue.enqueue(message);
2758
+ await this.federation.fanoutQueue.enqueue(message);
2738
2759
  }
2739
2760
  async *getFollowers(identifier) {
2740
2761
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -3016,8 +3037,12 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
3016
3037
  identifier = mapped;
3017
3038
  }
3018
3039
  }
3019
- keys = await this.getKeyPairsFromIdentifier(identifier);
3020
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3040
+ const actorKeyPairs = await this.getActorKeyPairs(identifier);
3041
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3042
+ keys = actorKeyPairs.map((kp) => ({
3043
+ keyId: kp.keyId,
3044
+ privateKey: kp.privateKey
3045
+ }));
3021
3046
  } else if (Array.isArray(forwarder)) {
3022
3047
  if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
3023
3048
  keys = forwarder;
@@ -1,14 +1,14 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_docloader = require("./docloader-Co-tW1B6.cjs");
4
- const require_transformers = require("./transformers-C2P5eKUT.cjs");
5
- const require_actor = require("./actor-CsvteFj1.cjs");
6
- const require_lookup = require("./lookup-C6EHvNN7.cjs");
7
- const require_key = require("./key-B2ZqbGDP.cjs");
8
- const require_http = require("./http-cvQMgiFd.cjs");
9
- const require_proof = require("./proof-DiFRNymC.cjs");
10
- const require_types = require("./types-D4VM3B7I.cjs");
11
- const require_authdocloader = require("./authdocloader-tagnJZ6u.cjs");
3
+ const require_docloader = require("./docloader-BZfjD0Xt.cjs");
4
+ const require_transformers = require("./transformers-DW7EyHh4.cjs");
5
+ const require_actor = require("./actor-DILKT_HU.cjs");
6
+ const require_lookup = require("./lookup-BnvWOvmD.cjs");
7
+ const require_key = require("./key-CUorXS6k.cjs");
8
+ const require_http = require("./http-8jvVkJos.cjs");
9
+ const require_proof = require("./proof-2V3jxAdE.cjs");
10
+ const require_types = require("./types-B0U2QC2Q.cjs");
11
+ const require_authdocloader = require("./authdocloader-hwjRHw8X.cjs");
12
12
  const require_vocab_mod = require("./vocab/mod.cjs");
13
13
  let _logtape_logtape = require("@logtape/logtape");
14
14
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -335,7 +335,7 @@ var FederationBuilderImpl = class {
335
335
  this.collectionTypeIds = {};
336
336
  }
337
337
  async build(options) {
338
- const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-SP7rhp6I.cjs"));
338
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-TO6qMFz0.cjs"));
339
339
  const f = new FederationImpl(options);
340
340
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
341
341
  f.router = this.router.clone();
@@ -2819,14 +2819,17 @@ var FederationImpl = class extends FederationBuilderImpl {
2819
2819
  let rsaKey = null;
2820
2820
  for (const { keyId, privateKey } of keys) {
2821
2821
  require_key.validateCryptoKey(privateKey, "private");
2822
- if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
2823
- rsaKey = {
2824
- keyId,
2825
- privateKey
2826
- };
2827
- continue;
2828
- }
2829
- if (privateKey.algorithm.name === "Ed25519") {
2822
+ if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
2823
+ keyId,
2824
+ privateKey
2825
+ };
2826
+ }
2827
+ for await (const _ of activity.getProofs({ contextLoader })) {
2828
+ proofCreated = true;
2829
+ break;
2830
+ }
2831
+ if (!proofCreated) {
2832
+ for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
2830
2833
  activity = await require_proof.signObject(activity, privateKey, keyId, {
2831
2834
  contextLoader,
2832
2835
  tracerProvider: this.tracerProvider
@@ -3459,6 +3462,7 @@ var ContextImpl = class ContextImpl {
3459
3462
  }
3460
3463
  const owner = this.getActorUri(identifier);
3461
3464
  const result = [];
3465
+ let i = 1;
3462
3466
  for (const keyPair of keyPairs) {
3463
3467
  const newPair = {
3464
3468
  ...keyPair,
@@ -3468,12 +3472,13 @@ var ContextImpl = class ContextImpl {
3468
3472
  publicKey: keyPair.publicKey
3469
3473
  }),
3470
3474
  multikey: new require_actor.Multikey({
3471
- id: keyPair.keyId,
3475
+ id: new URL(`#multikey-${i}`, owner),
3472
3476
  controller: owner,
3473
3477
  publicKey: keyPair.publicKey
3474
3478
  })
3475
3479
  };
3476
3480
  result.push(newPair);
3481
+ i++;
3477
3482
  }
3478
3483
  return result;
3479
3484
  }
@@ -3620,6 +3625,7 @@ var ContextImpl = class ContextImpl {
3620
3625
  ]);
3621
3626
  let keys;
3622
3627
  let identifier = null;
3628
+ let actorKeyPairs = null;
3623
3629
  if ("identifier" in sender || "username" in sender || "handle" in sender) {
3624
3630
  if ("identifier" in sender) identifier = sender.identifier;
3625
3631
  else {
@@ -3637,8 +3643,13 @@ var ContextImpl = class ContextImpl {
3637
3643
  }
3638
3644
  }
3639
3645
  span.setAttribute("fedify.actor.identifier", identifier);
3640
- keys = await this.getKeyPairsFromIdentifier(identifier);
3641
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3646
+ if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
3647
+ actorKeyPairs = await this.getActorKeyPairs(identifier);
3648
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3649
+ keys = actorKeyPairs.map((kp) => ({
3650
+ keyId: kp.keyId,
3651
+ privateKey: kp.privateKey
3652
+ }));
3642
3653
  } else if (Array.isArray(sender)) {
3643
3654
  if (sender.length < 1) throw new Error("The sender's key pairs are empty.");
3644
3655
  keys = sender;
@@ -3669,6 +3680,16 @@ var ContextImpl = class ContextImpl {
3669
3680
  });
3670
3681
  throw new TypeError("The activity to send must have at least one actor property.");
3671
3682
  }
3683
+ if (actorKeyPairs != null) {
3684
+ const contextLoader = this.contextLoader;
3685
+ for (const kp of actorKeyPairs) {
3686
+ if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
3687
+ activity = await require_proof.signObject(activity, kp.privateKey, kp.multikey.id, {
3688
+ contextLoader,
3689
+ tracerProvider: this.tracerProvider
3690
+ });
3691
+ }
3692
+ }
3672
3693
  const inboxes = extractInboxes({
3673
3694
  recipients: expandedRecipients,
3674
3695
  preferSharedInbox: options.preferSharedInbox,
@@ -3708,7 +3729,7 @@ var ContextImpl = class ContextImpl {
3708
3729
  traceContext: carrier
3709
3730
  };
3710
3731
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
3711
- this.federation.fanoutQueue.enqueue(message);
3732
+ await this.federation.fanoutQueue.enqueue(message);
3712
3733
  }
3713
3734
  async *getFollowers(identifier) {
3714
3735
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -3990,8 +4011,12 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
3990
4011
  identifier = mapped;
3991
4012
  }
3992
4013
  }
3993
- keys = await this.getKeyPairsFromIdentifier(identifier);
3994
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4014
+ const actorKeyPairs = await this.getActorKeyPairs(identifier);
4015
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4016
+ keys = actorKeyPairs.map((kp) => ({
4017
+ keyId: kp.keyId,
4018
+ privateKey: kp.privateKey
4019
+ }));
3995
4020
  } else if (Array.isArray(forwarder)) {
3996
4021
  if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
3997
4022
  keys = forwarder;
@@ -2,14 +2,14 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./rolldown-runtime-C7fyD9f2.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BV4OeK9o.js";
5
- import { d as name, f as version, i as getDocumentLoader, s as kvCache } from "./docloader-Dlo9EMTn.js";
6
- import { G as Multikey, Tt as getTypeId, V as Link, X as OrderedCollectionPage, Y as OrderedCollection, _ as CollectionPage, g as Collection, q as Object$1, s as Activity, y as CryptographicKey } from "./actor-B3mkavdq.js";
7
- import { t as lookupWebFinger } from "./lookup-CuDOZqcB.js";
8
- import { i as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-DPg0mibt.js";
9
- import { r as verifyRequest, t as doubleKnock } from "./http-z-J6i29D.js";
10
- import { a as doesActorOwnKey, d as signJsonLd, f as verifyJsonLd, l as detachSignature, n as signObject, o as getKeyOwner, r as verifyObject, u as hasSignature } from "./proof-BBEQdN7B.js";
11
- import { n as getNodeInfo, t as nodeInfoToJson } from "./types-BK9bojU0.js";
12
- import { t as getAuthenticatedDocumentLoader } from "./authdocloader-C3_-i4Zk.js";
5
+ import { d as name, f as version, i as getDocumentLoader, s as kvCache } from "./docloader-ivt5xNwJ.js";
6
+ import { G as Multikey, Tt as getTypeId, V as Link, X as OrderedCollectionPage, Y as OrderedCollection, _ as CollectionPage, g as Collection, q as Object$1, s as Activity, y as CryptographicKey } from "./actor-MDInzRdc.js";
7
+ import { t as lookupWebFinger } from "./lookup-BOFQeNi_.js";
8
+ import { i as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-C2e_Yz1s.js";
9
+ import { r as verifyRequest, t as doubleKnock } from "./http-Dbj7ZT3b.js";
10
+ import { a as doesActorOwnKey, d as signJsonLd, f as verifyJsonLd, l as detachSignature, n as signObject, o as getKeyOwner, r as verifyObject, u as hasSignature } from "./proof-C99DO0SE.js";
11
+ import { n as getNodeInfo, t as nodeInfoToJson } from "./types-dHLDn_7H.js";
12
+ import { t as getAuthenticatedDocumentLoader } from "./authdocloader-DRG9qnz7.js";
13
13
  import { lookupObject, traverseCollection } from "./vocab/mod.js";
14
14
  import { getLogger, withContext } from "@logtape/logtape";
15
15
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -2827,14 +2827,17 @@ var FederationImpl = class extends FederationBuilderImpl {
2827
2827
  let rsaKey = null;
2828
2828
  for (const { keyId, privateKey } of keys) {
2829
2829
  validateCryptoKey(privateKey, "private");
2830
- if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
2831
- rsaKey = {
2832
- keyId,
2833
- privateKey
2834
- };
2835
- continue;
2836
- }
2837
- if (privateKey.algorithm.name === "Ed25519") {
2830
+ if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
2831
+ keyId,
2832
+ privateKey
2833
+ };
2834
+ }
2835
+ for await (const _ of activity.getProofs({ contextLoader })) {
2836
+ proofCreated = true;
2837
+ break;
2838
+ }
2839
+ if (!proofCreated) {
2840
+ for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
2838
2841
  activity = await signObject(activity, privateKey, keyId, {
2839
2842
  contextLoader,
2840
2843
  tracerProvider: this.tracerProvider
@@ -3467,6 +3470,7 @@ var ContextImpl = class ContextImpl {
3467
3470
  }
3468
3471
  const owner = this.getActorUri(identifier);
3469
3472
  const result = [];
3473
+ let i = 1;
3470
3474
  for (const keyPair of keyPairs) {
3471
3475
  const newPair = {
3472
3476
  ...keyPair,
@@ -3476,12 +3480,13 @@ var ContextImpl = class ContextImpl {
3476
3480
  publicKey: keyPair.publicKey
3477
3481
  }),
3478
3482
  multikey: new Multikey({
3479
- id: keyPair.keyId,
3483
+ id: new URL(`#multikey-${i}`, owner),
3480
3484
  controller: owner,
3481
3485
  publicKey: keyPair.publicKey
3482
3486
  })
3483
3487
  };
3484
3488
  result.push(newPair);
3489
+ i++;
3485
3490
  }
3486
3491
  return result;
3487
3492
  }
@@ -3628,6 +3633,7 @@ var ContextImpl = class ContextImpl {
3628
3633
  ]);
3629
3634
  let keys;
3630
3635
  let identifier = null;
3636
+ let actorKeyPairs = null;
3631
3637
  if ("identifier" in sender || "username" in sender || "handle" in sender) {
3632
3638
  if ("identifier" in sender) identifier = sender.identifier;
3633
3639
  else {
@@ -3645,8 +3651,13 @@ var ContextImpl = class ContextImpl {
3645
3651
  }
3646
3652
  }
3647
3653
  span.setAttribute("fedify.actor.identifier", identifier);
3648
- keys = await this.getKeyPairsFromIdentifier(identifier);
3649
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3654
+ if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
3655
+ actorKeyPairs = await this.getActorKeyPairs(identifier);
3656
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3657
+ keys = actorKeyPairs.map((kp) => ({
3658
+ keyId: kp.keyId,
3659
+ privateKey: kp.privateKey
3660
+ }));
3650
3661
  } else if (Array.isArray(sender)) {
3651
3662
  if (sender.length < 1) throw new Error("The sender's key pairs are empty.");
3652
3663
  keys = sender;
@@ -3677,6 +3688,16 @@ var ContextImpl = class ContextImpl {
3677
3688
  });
3678
3689
  throw new TypeError("The activity to send must have at least one actor property.");
3679
3690
  }
3691
+ if (actorKeyPairs != null) {
3692
+ const contextLoader = this.contextLoader;
3693
+ for (const kp of actorKeyPairs) {
3694
+ if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
3695
+ activity = await signObject(activity, kp.privateKey, kp.multikey.id, {
3696
+ contextLoader,
3697
+ tracerProvider: this.tracerProvider
3698
+ });
3699
+ }
3700
+ }
3680
3701
  const inboxes = extractInboxes({
3681
3702
  recipients: expandedRecipients,
3682
3703
  preferSharedInbox: options.preferSharedInbox,
@@ -3716,7 +3737,7 @@ var ContextImpl = class ContextImpl {
3716
3737
  traceContext: carrier
3717
3738
  };
3718
3739
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
3719
- this.federation.fanoutQueue.enqueue(message);
3740
+ await this.federation.fanoutQueue.enqueue(message);
3720
3741
  }
3721
3742
  async *getFollowers(identifier) {
3722
3743
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -3998,8 +4019,12 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
3998
4019
  identifier = mapped;
3999
4020
  }
4000
4021
  }
4001
- keys = await this.getKeyPairsFromIdentifier(identifier);
4002
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4022
+ const actorKeyPairs = await this.getActorKeyPairs(identifier);
4023
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4024
+ keys = actorKeyPairs.map((kp) => ({
4025
+ keyId: kp.keyId,
4026
+ privateKey: kp.privateKey
4027
+ }));
4003
4028
  } else if (Array.isArray(forwarder)) {
4004
4029
  if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
4005
4030
  keys = forwarder;
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-xIvAtsQ9.mjs";
4
+ import { n as FederationImpl } from "./middleware-BBjNkISH.mjs";
5
5
  export { FederationImpl };
@@ -1,4 +1,4 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_middleware = require("./middleware-UNqaTRBe.cjs");
3
+ const require_middleware = require("./middleware-BD8iV5GL.cjs");
4
4
  exports.FederationImpl = require_middleware.FederationImpl;
package/dist/mod.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_docloader = require("./docloader-Co-tW1B6.cjs");
5
- const require_transformers = require("./transformers-C2P5eKUT.cjs");
4
+ const require_docloader = require("./docloader-BZfjD0Xt.cjs");
5
+ const require_transformers = require("./transformers-DW7EyHh4.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_actor = require("./actor-CsvteFj1.cjs");
8
- const require_middleware = require("./middleware-UNqaTRBe.cjs");
9
- const require_lookup = require("./lookup-C6EHvNN7.cjs");
10
- const require_key = require("./key-B2ZqbGDP.cjs");
11
- const require_http = require("./http-cvQMgiFd.cjs");
12
- const require_proof = require("./proof-DiFRNymC.cjs");
13
- const require_types = require("./types-D4VM3B7I.cjs");
14
- const require_authdocloader = require("./authdocloader-tagnJZ6u.cjs");
7
+ const require_actor = require("./actor-DILKT_HU.cjs");
8
+ const require_middleware = require("./middleware-BD8iV5GL.cjs");
9
+ const require_lookup = require("./lookup-BnvWOvmD.cjs");
10
+ const require_key = require("./key-CUorXS6k.cjs");
11
+ const require_http = require("./http-8jvVkJos.cjs");
12
+ const require_proof = require("./proof-2V3jxAdE.cjs");
13
+ const require_types = require("./types-B0U2QC2Q.cjs");
14
+ const require_authdocloader = require("./authdocloader-hwjRHw8X.cjs");
15
15
  const require_vocab_mod = require("./vocab/mod.cjs");
16
16
  const require_federation_mod = require("./federation/mod.cjs");
17
17
  require("./nodeinfo/mod.cjs");