@fedify/fedify 1.10.6 → 1.10.8

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 (114) hide show
  1. package/dist/{actor-D7XOmVKd.js → actor-BtdqoffI.js} +187 -187
  2. package/dist/{actor-Bhyv1XG8.cjs → actor-CHbT9hXW.cjs} +187 -187
  3. package/dist/{actor-Cl985C7Q.mjs → actor-stZ3L5bm.mjs} +1 -1
  4. package/dist/{authdocloader-D_IgE19r.js → authdocloader-BjFtWv8Q.js} +3 -3
  5. package/dist/{authdocloader-A-uvTiEn.mjs → authdocloader-DiNlCuEL.mjs} +3 -3
  6. package/dist/{authdocloader-BLlsL860.cjs → authdocloader-qSZCRtME.cjs} +3 -3
  7. package/dist/{builder-BqZNPx3S.mjs → builder-C06p3NRV.mjs} +4 -4
  8. package/dist/{client-Ds4v9YJZ.mjs → client-aAP3RFq_.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-PfghnHYj.d.cts → context-BzSr5FCW.d.cts} +4 -1
  14. package/dist/{context-C6n2yrj0.d.ts → context-CyacVopT.d.ts} +4 -1
  15. package/dist/{docloader-DWWy7Mlm.cjs → docloader--HMTXXhM.cjs} +1 -1
  16. package/dist/{docloader-LthfAmat.js → docloader-Cms83CjK.js} +1 -1
  17. package/dist/{esm-CYg0RhgA.mjs → esm-CfjSLJ-h.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-pZJd5Nkb.mjs → http-BPQ_zPRB.mjs} +2 -2
  35. package/dist/{http-kyXntNm5.cjs → http-Bg-OkZtX.cjs} +3 -3
  36. package/dist/{http-CbNRWhO2.js → http-CDZB3DBW.js} +3 -3
  37. package/dist/{inbox-gr3hW-GD.mjs → inbox-Cnih7u27.mjs} +1 -1
  38. package/dist/{key-BR2q2bCE.js → key-ASS7oK8n.js} +2 -2
  39. package/dist/{key-CTKl4AWD.mjs → key-B0qYOng3.mjs} +1 -1
  40. package/dist/{key-DgYChyco.cjs → key-Bbf-ITpM.cjs} +2 -2
  41. package/dist/{key-Db4XYUx7.mjs → key-C16D-kud.mjs} +2 -2
  42. package/dist/{key-Bzt8qD6I.cjs → key-DGuUMBsU.cjs} +1 -1
  43. package/dist/{keycache-YHrypd98.mjs → keycache-CBPbgb7d.mjs} +1 -1
  44. package/dist/{keys-r0MYdjdV.mjs → keys-Br4iedk3.mjs} +1 -1
  45. package/dist/{ld-iTK8z54J.mjs → ld-7nQ68-rS.mjs} +2 -2
  46. package/dist/{lookup-BdSpYC1N.cjs → lookup-CA5RreoS.cjs} +1 -1
  47. package/dist/{lookup-BzhBNUNH.mjs → lookup-CCcDhxO2.mjs} +1 -1
  48. package/dist/{lookup-DZ9GTTzJ.js → lookup-CpMB-hV5.js} +1 -1
  49. package/dist/{middleware-Df-QFT32.js → middleware-BDTuu7QY.js} +47 -22
  50. package/dist/{middleware-DRNvNZa1.cjs → middleware-BPTDstS-.cjs} +1 -1
  51. package/dist/{middleware-XbutA7xe.mjs → middleware-Bi5LcEMF.mjs} +1 -1
  52. package/dist/{middleware-CZOiI7j6.cjs → middleware-C90kKt44.cjs} +49 -24
  53. package/dist/{middleware-Bk0hNv-N.mjs → middleware-Crs1EVL7.mjs} +53 -28
  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/otel/exporter.test.mjs +1 -1
  65. package/dist/otel/mod.cjs +1 -1
  66. package/dist/{owner-CoLrSrJE.mjs → owner-ncOJW9jU.mjs} +3 -3
  67. package/dist/{proof-D9Y-Sfn8.cjs → proof-BYdxNk_7.cjs} +3 -3
  68. package/dist/{proof-CzEaLrMm.mjs → proof-Bd732W1s.mjs} +2 -2
  69. package/dist/{proof-CmhkztK1.js → proof-JCn_Nftz.js} +3 -3
  70. package/dist/runtime/authdocloader.test.mjs +6 -6
  71. package/dist/runtime/docloader.test.mjs +3 -3
  72. package/dist/runtime/key.test.mjs +3 -3
  73. package/dist/runtime/langstr.test.mjs +2 -2
  74. package/dist/runtime/link.test.mjs +2 -2
  75. package/dist/runtime/mod.cjs +3 -3
  76. package/dist/runtime/mod.js +3 -3
  77. package/dist/runtime/multibase/multibase.test.mjs +2 -2
  78. package/dist/runtime/url.test.mjs +2 -2
  79. package/dist/{send-vtEBiKbR.mjs → send-BUUNtAjI.mjs} +2 -2
  80. package/dist/sig/http.test.mjs +6 -6
  81. package/dist/sig/key.test.mjs +4 -4
  82. package/dist/sig/ld.test.mjs +5 -5
  83. package/dist/sig/mod.cjs +3 -3
  84. package/dist/sig/mod.js +3 -3
  85. package/dist/sig/owner.test.mjs +5 -5
  86. package/dist/sig/proof.test.mjs +4 -4
  87. package/dist/testing/docloader.test.mjs +1 -1
  88. package/dist/testing/mod.d.mts +4 -1
  89. package/dist/testing/mod.mjs +1 -1
  90. package/dist/{testing-Csq3Xnki.mjs → testing-CvmsaHLW.mjs} +2 -2
  91. package/dist/{transformers-DQcMoinm.cjs → transformers-Cd6Tdn3M.cjs} +1 -1
  92. package/dist/{types-BNAdhXAI.cjs → types-BVCtDIwE.cjs} +1 -1
  93. package/dist/{types-9gce5lHU.js → types-Dy8sMtkH.js} +1 -1
  94. package/dist/vocab/actor.test.mjs +4 -4
  95. package/dist/vocab/cjs.test.mjs +1 -1
  96. package/dist/vocab/lookup.test.mjs +4 -4
  97. package/dist/vocab/mod.cjs +3 -3
  98. package/dist/vocab/mod.js +3 -3
  99. package/dist/vocab/type.test.mjs +2 -2
  100. package/dist/vocab/vocab.test.mjs +3 -3
  101. package/dist/{vocab-CeumAiRh.mjs → vocab-DcYXFzyR.mjs} +186 -186
  102. package/dist/webfinger/handler.test.mjs +3 -3
  103. package/dist/webfinger/lookup.test.mjs +3 -3
  104. package/dist/webfinger/mod.cjs +1 -1
  105. package/dist/webfinger/mod.js +1 -1
  106. package/dist/x/cfworkers.cjs +1 -1
  107. package/dist/x/cfworkers.test.mjs +1 -1
  108. package/dist/x/hono.cjs +1 -1
  109. package/dist/x/hono.d.cts +1 -1
  110. package/dist/x/hono.d.ts +1 -1
  111. package/dist/x/sveltekit.cjs +1 -1
  112. package/dist/x/sveltekit.d.cts +1 -1
  113. package/dist/x/sveltekit.d.ts +1 -1
  114. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_docloader = require("./docloader-DWWy7Mlm.cjs");
4
- const require_actor = require("./actor-Bhyv1XG8.cjs");
5
- const require_key = require("./key-DgYChyco.cjs");
3
+ const require_docloader = require("./docloader--HMTXXhM.cjs");
4
+ const require_actor = require("./actor-CHbT9hXW.cjs");
5
+ const require_key = require("./key-Bbf-ITpM.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
8
8
  let byte_encodings_base64 = require("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-LthfAmat.js";
4
- import { y as CryptographicKey } from "./actor-D7XOmVKd.js";
5
- import { n as fetchKey, o as validateCryptoKey } from "./key-BR2q2bCE.js";
3
+ import { d as name, f as version, t as FetchError } from "./docloader-Cms83CjK.js";
4
+ import { y as CryptographicKey } from "./actor-BtdqoffI.js";
5
+ import { n as fetchKey, o as validateCryptoKey } from "./key-ASS7oK8n.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-CeumAiRh.mjs";
4
+ import { U as getTypeId, ot as name, st as version, t as Activity } from "./vocab-DcYXFzyR.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
  import { t as __exportAll } from "./rolldown-runtime-C7fyD9f2.js";
4
- import { d as name, f as version, i as getDocumentLoader } from "./docloader-LthfAmat.js";
5
- import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-D7XOmVKd.js";
4
+ import { d as name, f as version, i as getDocumentLoader } from "./docloader-Cms83CjK.js";
5
+ import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-BtdqoffI.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,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-Db4XYUx7.mjs";
4
+ import { a as validateCryptoKey } from "./key-C16D-kud.mjs";
5
5
  export { validateCryptoKey };
@@ -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-DWWy7Mlm.cjs");
4
- const require_actor = require("./actor-Bhyv1XG8.cjs");
3
+ const require_docloader = require("./docloader--HMTXXhM.cjs");
4
+ const require_actor = require("./actor-CHbT9hXW.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,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-CeumAiRh.mjs";
5
- import { i as isActor } from "./actor-Cl985C7Q.mjs";
4
+ import { J as getDocumentLoader, ot as name, s as CryptographicKey, st as version, v as Object$1 } from "./vocab-DcYXFzyR.mjs";
5
+ import { i as isActor } from "./actor-stZ3L5bm.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,4 +1,4 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_key = require("./key-DgYChyco.cjs");
3
+ const require_key = require("./key-Bbf-ITpM.cjs");
4
4
  exports.validateCryptoKey = require_key.validateCryptoKey;
@@ -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-CeumAiRh.mjs";
4
+ import { g as Multikey, s as CryptographicKey } from "./vocab-DcYXFzyR.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-CeumAiRh.mjs";
4
+ import { I as importSpki, g as Multikey, s as CryptographicKey } from "./vocab-DcYXFzyR.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-CeumAiRh.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-Db4XYUx7.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-DcYXFzyR.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-C16D-kud.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
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_docloader = require("./docloader-DWWy7Mlm.cjs");
3
+ const require_docloader = require("./docloader--HMTXXhM.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-CeumAiRh.mjs";
4
+ import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, ot as name, st as version, v as Object$1 } from "./vocab-DcYXFzyR.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,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-LthfAmat.js";
3
+ import { d as name, f as version, l as UrlError, o as getUserAgent, u as validatePublicUrl } from "./docloader-Cms83CjK.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
6
6
  //#region src/webfinger/lookup.ts
@@ -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-LthfAmat.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-D7XOmVKd.js";
7
- import { t as lookupWebFinger } from "./lookup-DZ9GTTzJ.js";
8
- import { i as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-BR2q2bCE.js";
9
- import { r as verifyRequest, t as doubleKnock } from "./http-CbNRWhO2.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-CmhkztK1.js";
11
- import { n as getNodeInfo, t as nodeInfoToJson } from "./types-9gce5lHU.js";
12
- import { t as getAuthenticatedDocumentLoader } from "./authdocloader-D_IgE19r.js";
5
+ import { d as name, f as version, i as getDocumentLoader, s as kvCache } from "./docloader-Cms83CjK.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-BtdqoffI.js";
7
+ import { t as lookupWebFinger } from "./lookup-CpMB-hV5.js";
8
+ import { i as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-ASS7oK8n.js";
9
+ import { r as verifyRequest, t as doubleKnock } from "./http-CDZB3DBW.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-JCn_Nftz.js";
11
+ import { n as getNodeInfo, t as nodeInfoToJson } from "./types-Dy8sMtkH.js";
12
+ import { t as getAuthenticatedDocumentLoader } from "./authdocloader-BjFtWv8Q.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";
@@ -2839,14 +2839,17 @@ var FederationImpl = class extends FederationBuilderImpl {
2839
2839
  let rsaKey = null;
2840
2840
  for (const { keyId, privateKey } of keys) {
2841
2841
  validateCryptoKey(privateKey, "private");
2842
- if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
2843
- rsaKey = {
2844
- keyId,
2845
- privateKey
2846
- };
2847
- continue;
2848
- }
2849
- if (privateKey.algorithm.name === "Ed25519") {
2842
+ if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
2843
+ keyId,
2844
+ privateKey
2845
+ };
2846
+ }
2847
+ for await (const _ of activity.getProofs({ contextLoader })) {
2848
+ proofCreated = true;
2849
+ break;
2850
+ }
2851
+ if (!proofCreated) {
2852
+ for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
2850
2853
  activity = await signObject(activity, privateKey, keyId, {
2851
2854
  contextLoader,
2852
2855
  tracerProvider: this.tracerProvider
@@ -3479,6 +3482,7 @@ var ContextImpl = class ContextImpl {
3479
3482
  }
3480
3483
  const owner = this.getActorUri(identifier);
3481
3484
  const result = [];
3485
+ let i = 1;
3482
3486
  for (const keyPair of keyPairs) {
3483
3487
  const newPair = {
3484
3488
  ...keyPair,
@@ -3488,12 +3492,13 @@ var ContextImpl = class ContextImpl {
3488
3492
  publicKey: keyPair.publicKey
3489
3493
  }),
3490
3494
  multikey: new Multikey({
3491
- id: keyPair.keyId,
3495
+ id: new URL(`#multikey-${i}`, owner),
3492
3496
  controller: owner,
3493
3497
  publicKey: keyPair.publicKey
3494
3498
  })
3495
3499
  };
3496
3500
  result.push(newPair);
3501
+ i++;
3497
3502
  }
3498
3503
  return result;
3499
3504
  }
@@ -3640,6 +3645,7 @@ var ContextImpl = class ContextImpl {
3640
3645
  ]);
3641
3646
  let keys;
3642
3647
  let identifier = null;
3648
+ let actorKeyPairs = null;
3643
3649
  if ("identifier" in sender || "username" in sender || "handle" in sender) {
3644
3650
  if ("identifier" in sender) identifier = sender.identifier;
3645
3651
  else {
@@ -3657,8 +3663,13 @@ var ContextImpl = class ContextImpl {
3657
3663
  }
3658
3664
  }
3659
3665
  span.setAttribute("fedify.actor.identifier", identifier);
3660
- keys = await this.getKeyPairsFromIdentifier(identifier);
3661
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3666
+ if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
3667
+ actorKeyPairs = await this.getActorKeyPairs(identifier);
3668
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3669
+ keys = actorKeyPairs.map((kp) => ({
3670
+ keyId: kp.keyId,
3671
+ privateKey: kp.privateKey
3672
+ }));
3662
3673
  } else if (Array.isArray(sender)) {
3663
3674
  if (sender.length < 1) throw new Error("The sender's key pairs are empty.");
3664
3675
  keys = sender;
@@ -3689,6 +3700,16 @@ var ContextImpl = class ContextImpl {
3689
3700
  });
3690
3701
  throw new TypeError("The activity to send must have at least one actor property.");
3691
3702
  }
3703
+ if (actorKeyPairs != null) {
3704
+ const contextLoader = this.contextLoader;
3705
+ for (const kp of actorKeyPairs) {
3706
+ if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
3707
+ activity = await signObject(activity, kp.privateKey, kp.multikey.id, {
3708
+ contextLoader,
3709
+ tracerProvider: this.tracerProvider
3710
+ });
3711
+ }
3712
+ }
3692
3713
  const inboxes = extractInboxes({
3693
3714
  recipients: expandedRecipients,
3694
3715
  preferSharedInbox: options.preferSharedInbox,
@@ -3728,7 +3749,7 @@ var ContextImpl = class ContextImpl {
3728
3749
  traceContext: carrier
3729
3750
  };
3730
3751
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
3731
- this.federation.fanoutQueue.enqueue(message);
3752
+ await this.federation.fanoutQueue.enqueue(message);
3732
3753
  }
3733
3754
  async *getFollowers(identifier) {
3734
3755
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -4010,8 +4031,12 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4010
4031
  identifier = mapped;
4011
4032
  }
4012
4033
  }
4013
- keys = await this.getKeyPairsFromIdentifier(identifier);
4014
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4034
+ const actorKeyPairs = await this.getActorKeyPairs(identifier);
4035
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4036
+ keys = actorKeyPairs.map((kp) => ({
4037
+ keyId: kp.keyId,
4038
+ privateKey: kp.privateKey
4039
+ }));
4015
4040
  } else if (Array.isArray(forwarder)) {
4016
4041
  if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
4017
4042
  keys = forwarder;
@@ -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-CZOiI7j6.cjs");
3
+ const require_middleware = require("./middleware-C90kKt44.cjs");
4
4
  exports.FederationImpl = require_middleware.FederationImpl;
@@ -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-Bk0hNv-N.mjs";
4
+ import { n as FederationImpl } from "./middleware-Crs1EVL7.mjs";
5
5
  export { FederationImpl };
@@ -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-DWWy7Mlm.cjs");
4
- const require_transformers = require("./transformers-DQcMoinm.cjs");
5
- const require_actor = require("./actor-Bhyv1XG8.cjs");
6
- const require_lookup = require("./lookup-BdSpYC1N.cjs");
7
- const require_key = require("./key-DgYChyco.cjs");
8
- const require_http = require("./http-kyXntNm5.cjs");
9
- const require_proof = require("./proof-D9Y-Sfn8.cjs");
10
- const require_types = require("./types-BNAdhXAI.cjs");
11
- const require_authdocloader = require("./authdocloader-BLlsL860.cjs");
3
+ const require_docloader = require("./docloader--HMTXXhM.cjs");
4
+ const require_transformers = require("./transformers-Cd6Tdn3M.cjs");
5
+ const require_actor = require("./actor-CHbT9hXW.cjs");
6
+ const require_lookup = require("./lookup-CA5RreoS.cjs");
7
+ const require_key = require("./key-Bbf-ITpM.cjs");
8
+ const require_http = require("./http-Bg-OkZtX.cjs");
9
+ const require_proof = require("./proof-BYdxNk_7.cjs");
10
+ const require_types = require("./types-BVCtDIwE.cjs");
11
+ const require_authdocloader = require("./authdocloader-qSZCRtME.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-DRNvNZa1.cjs"));
338
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-BPTDstS-.cjs"));
339
339
  const f = new FederationImpl(options);
340
340
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
341
341
  f.router = this.router.clone();
@@ -2831,14 +2831,17 @@ var FederationImpl = class extends FederationBuilderImpl {
2831
2831
  let rsaKey = null;
2832
2832
  for (const { keyId, privateKey } of keys) {
2833
2833
  require_key.validateCryptoKey(privateKey, "private");
2834
- if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
2835
- rsaKey = {
2836
- keyId,
2837
- privateKey
2838
- };
2839
- continue;
2840
- }
2841
- if (privateKey.algorithm.name === "Ed25519") {
2834
+ if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
2835
+ keyId,
2836
+ privateKey
2837
+ };
2838
+ }
2839
+ for await (const _ of activity.getProofs({ contextLoader })) {
2840
+ proofCreated = true;
2841
+ break;
2842
+ }
2843
+ if (!proofCreated) {
2844
+ for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
2842
2845
  activity = await require_proof.signObject(activity, privateKey, keyId, {
2843
2846
  contextLoader,
2844
2847
  tracerProvider: this.tracerProvider
@@ -3471,6 +3474,7 @@ var ContextImpl = class ContextImpl {
3471
3474
  }
3472
3475
  const owner = this.getActorUri(identifier);
3473
3476
  const result = [];
3477
+ let i = 1;
3474
3478
  for (const keyPair of keyPairs) {
3475
3479
  const newPair = {
3476
3480
  ...keyPair,
@@ -3480,12 +3484,13 @@ var ContextImpl = class ContextImpl {
3480
3484
  publicKey: keyPair.publicKey
3481
3485
  }),
3482
3486
  multikey: new require_actor.Multikey({
3483
- id: keyPair.keyId,
3487
+ id: new URL(`#multikey-${i}`, owner),
3484
3488
  controller: owner,
3485
3489
  publicKey: keyPair.publicKey
3486
3490
  })
3487
3491
  };
3488
3492
  result.push(newPair);
3493
+ i++;
3489
3494
  }
3490
3495
  return result;
3491
3496
  }
@@ -3632,6 +3637,7 @@ var ContextImpl = class ContextImpl {
3632
3637
  ]);
3633
3638
  let keys;
3634
3639
  let identifier = null;
3640
+ let actorKeyPairs = null;
3635
3641
  if ("identifier" in sender || "username" in sender || "handle" in sender) {
3636
3642
  if ("identifier" in sender) identifier = sender.identifier;
3637
3643
  else {
@@ -3649,8 +3655,13 @@ var ContextImpl = class ContextImpl {
3649
3655
  }
3650
3656
  }
3651
3657
  span.setAttribute("fedify.actor.identifier", identifier);
3652
- keys = await this.getKeyPairsFromIdentifier(identifier);
3653
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3658
+ if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
3659
+ actorKeyPairs = await this.getActorKeyPairs(identifier);
3660
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3661
+ keys = actorKeyPairs.map((kp) => ({
3662
+ keyId: kp.keyId,
3663
+ privateKey: kp.privateKey
3664
+ }));
3654
3665
  } else if (Array.isArray(sender)) {
3655
3666
  if (sender.length < 1) throw new Error("The sender's key pairs are empty.");
3656
3667
  keys = sender;
@@ -3681,6 +3692,16 @@ var ContextImpl = class ContextImpl {
3681
3692
  });
3682
3693
  throw new TypeError("The activity to send must have at least one actor property.");
3683
3694
  }
3695
+ if (actorKeyPairs != null) {
3696
+ const contextLoader = this.contextLoader;
3697
+ for (const kp of actorKeyPairs) {
3698
+ if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
3699
+ activity = await require_proof.signObject(activity, kp.privateKey, kp.multikey.id, {
3700
+ contextLoader,
3701
+ tracerProvider: this.tracerProvider
3702
+ });
3703
+ }
3704
+ }
3684
3705
  const inboxes = extractInboxes({
3685
3706
  recipients: expandedRecipients,
3686
3707
  preferSharedInbox: options.preferSharedInbox,
@@ -3720,7 +3741,7 @@ var ContextImpl = class ContextImpl {
3720
3741
  traceContext: carrier
3721
3742
  };
3722
3743
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
3723
- this.federation.fanoutQueue.enqueue(message);
3744
+ await this.federation.fanoutQueue.enqueue(message);
3724
3745
  }
3725
3746
  async *getFollowers(identifier) {
3726
3747
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -4002,8 +4023,12 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
4002
4023
  identifier = mapped;
4003
4024
  }
4004
4025
  }
4005
- keys = await this.getKeyPairsFromIdentifier(identifier);
4006
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4026
+ const actorKeyPairs = await this.getActorKeyPairs(identifier);
4027
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
4028
+ keys = actorKeyPairs.map((kp) => ({
4029
+ keyId: kp.keyId,
4030
+ privateKey: kp.privateKey
4031
+ }));
4007
4032
  } else if (Array.isArray(forwarder)) {
4008
4033
  if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
4009
4034
  keys = forwarder;
@@ -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-CeumAiRh.mjs";
5
- import { i as RouterError, n as traverseCollection, t as lookupObject } from "./lookup-BzhBNUNH.mjs";
6
- import { t as getNodeInfo } from "./client-Ds4v9YJZ.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-DcYXFzyR.mjs";
5
+ import { i as RouterError, n as traverseCollection, t as lookupObject } from "./lookup-CCcDhxO2.mjs";
6
+ import { t as getNodeInfo } from "./client-aAP3RFq_.mjs";
7
7
  import { t as nodeInfoToJson } from "./types-CAnkAQGM.mjs";
8
- import "./actor-Cl985C7Q.mjs";
9
- import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-Db4XYUx7.mjs";
10
- import { l as verifyRequest } from "./http-pZJd5Nkb.mjs";
11
- import { t as getAuthenticatedDocumentLoader } from "./authdocloader-A-uvTiEn.mjs";
12
- import { a as signJsonLd, i as hasSignature, o as verifyJsonLd, r as detachSignature } from "./ld-iTK8z54J.mjs";
13
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CoLrSrJE.mjs";
14
- import { n as signObject, r as verifyObject } from "./proof-CzEaLrMm.mjs";
15
- import { n as routeActivity } from "./inbox-gr3hW-GD.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-BqZNPx3S.mjs";
8
+ import "./actor-stZ3L5bm.mjs";
9
+ import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-C16D-kud.mjs";
10
+ import { l as verifyRequest } from "./http-BPQ_zPRB.mjs";
11
+ import { t as getAuthenticatedDocumentLoader } from "./authdocloader-DiNlCuEL.mjs";
12
+ import { a as signJsonLd, i as hasSignature, o as verifyJsonLd, r as detachSignature } from "./ld-7nQ68-rS.mjs";
13
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-ncOJW9jU.mjs";
14
+ import { n as signObject, r as verifyObject } from "./proof-Bd732W1s.mjs";
15
+ import { n as routeActivity } from "./inbox-Cnih7u27.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-C06p3NRV.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-BD6-SZ6O.mjs";
18
- import { t as KvKeyCache } from "./keycache-YHrypd98.mjs";
18
+ import { t as KvKeyCache } from "./keycache-CBPbgb7d.mjs";
19
19
  import { t as createExponentialBackoffPolicy } from "./retry-Ddbq3AcK.mjs";
20
- import { n as sendActivity, t as extractInboxes } from "./send-vtEBiKbR.mjs";
20
+ import { n as sendActivity, t as extractInboxes } from "./send-BUUNtAjI.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";
@@ -1852,14 +1852,17 @@ var FederationImpl = class extends FederationBuilderImpl {
1852
1852
  let rsaKey = null;
1853
1853
  for (const { keyId, privateKey } of keys) {
1854
1854
  validateCryptoKey(privateKey, "private");
1855
- if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
1856
- rsaKey = {
1857
- keyId,
1858
- privateKey
1859
- };
1860
- continue;
1861
- }
1862
- if (privateKey.algorithm.name === "Ed25519") {
1855
+ if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
1856
+ keyId,
1857
+ privateKey
1858
+ };
1859
+ }
1860
+ for await (const _ of activity.getProofs({ contextLoader })) {
1861
+ proofCreated = true;
1862
+ break;
1863
+ }
1864
+ if (!proofCreated) {
1865
+ for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
1863
1866
  activity = await signObject(activity, privateKey, keyId, {
1864
1867
  contextLoader,
1865
1868
  tracerProvider: this.tracerProvider
@@ -2492,6 +2495,7 @@ var ContextImpl = class ContextImpl {
2492
2495
  }
2493
2496
  const owner = this.getActorUri(identifier);
2494
2497
  const result = [];
2498
+ let i = 1;
2495
2499
  for (const keyPair of keyPairs) {
2496
2500
  const newPair = {
2497
2501
  ...keyPair,
@@ -2501,12 +2505,13 @@ var ContextImpl = class ContextImpl {
2501
2505
  publicKey: keyPair.publicKey
2502
2506
  }),
2503
2507
  multikey: new Multikey({
2504
- id: keyPair.keyId,
2508
+ id: new URL(`#multikey-${i}`, owner),
2505
2509
  controller: owner,
2506
2510
  publicKey: keyPair.publicKey
2507
2511
  })
2508
2512
  };
2509
2513
  result.push(newPair);
2514
+ i++;
2510
2515
  }
2511
2516
  return result;
2512
2517
  }
@@ -2653,6 +2658,7 @@ var ContextImpl = class ContextImpl {
2653
2658
  ]);
2654
2659
  let keys;
2655
2660
  let identifier = null;
2661
+ let actorKeyPairs = null;
2656
2662
  if ("identifier" in sender || "username" in sender || "handle" in sender) {
2657
2663
  if ("identifier" in sender) identifier = sender.identifier;
2658
2664
  else {
@@ -2670,8 +2676,13 @@ var ContextImpl = class ContextImpl {
2670
2676
  }
2671
2677
  }
2672
2678
  span.setAttribute("fedify.actor.identifier", identifier);
2673
- keys = await this.getKeyPairsFromIdentifier(identifier);
2674
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
2679
+ if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
2680
+ actorKeyPairs = await this.getActorKeyPairs(identifier);
2681
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
2682
+ keys = actorKeyPairs.map((kp) => ({
2683
+ keyId: kp.keyId,
2684
+ privateKey: kp.privateKey
2685
+ }));
2675
2686
  } else if (Array.isArray(sender)) {
2676
2687
  if (sender.length < 1) throw new Error("The sender's key pairs are empty.");
2677
2688
  keys = sender;
@@ -2702,6 +2713,16 @@ var ContextImpl = class ContextImpl {
2702
2713
  });
2703
2714
  throw new TypeError("The activity to send must have at least one actor property.");
2704
2715
  }
2716
+ if (actorKeyPairs != null) {
2717
+ const contextLoader = this.contextLoader;
2718
+ for (const kp of actorKeyPairs) {
2719
+ if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
2720
+ activity = await signObject(activity, kp.privateKey, kp.multikey.id, {
2721
+ contextLoader,
2722
+ tracerProvider: this.tracerProvider
2723
+ });
2724
+ }
2725
+ }
2705
2726
  const inboxes = extractInboxes({
2706
2727
  recipients: expandedRecipients,
2707
2728
  preferSharedInbox: options.preferSharedInbox,
@@ -2741,7 +2762,7 @@ var ContextImpl = class ContextImpl {
2741
2762
  traceContext: carrier
2742
2763
  };
2743
2764
  if (!this.federation.manuallyStartQueue) this.federation._startQueueInternal(this.data);
2744
- this.federation.fanoutQueue.enqueue(message);
2765
+ await this.federation.fanoutQueue.enqueue(message);
2745
2766
  }
2746
2767
  async *getFollowers(identifier) {
2747
2768
  if (this.federation.followersCallbacks == null) throw new Error("No followers collection dispatcher registered.");
@@ -3023,8 +3044,12 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
3023
3044
  identifier = mapped;
3024
3045
  }
3025
3046
  }
3026
- keys = await this.getKeyPairsFromIdentifier(identifier);
3027
- if (keys.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3047
+ const actorKeyPairs = await this.getActorKeyPairs(identifier);
3048
+ if (actorKeyPairs.length < 1) throw new Error(`No key pair found for actor ${JSON.stringify(identifier)}.`);
3049
+ keys = actorKeyPairs.map((kp) => ({
3050
+ keyId: kp.keyId,
3051
+ privateKey: kp.privateKey
3052
+ }));
3028
3053
  } else if (Array.isArray(forwarder)) {
3029
3054
  if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
3030
3055
  keys = forwarder;
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-DWWy7Mlm.cjs");
5
- const require_transformers = require("./transformers-DQcMoinm.cjs");
4
+ const require_docloader = require("./docloader--HMTXXhM.cjs");
5
+ const require_transformers = require("./transformers-Cd6Tdn3M.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_actor = require("./actor-Bhyv1XG8.cjs");
8
- const require_middleware = require("./middleware-CZOiI7j6.cjs");
9
- const require_lookup = require("./lookup-BdSpYC1N.cjs");
10
- const require_key = require("./key-DgYChyco.cjs");
11
- const require_http = require("./http-kyXntNm5.cjs");
12
- const require_proof = require("./proof-D9Y-Sfn8.cjs");
13
- const require_types = require("./types-BNAdhXAI.cjs");
14
- const require_authdocloader = require("./authdocloader-BLlsL860.cjs");
7
+ const require_actor = require("./actor-CHbT9hXW.cjs");
8
+ const require_middleware = require("./middleware-C90kKt44.cjs");
9
+ const require_lookup = require("./lookup-CA5RreoS.cjs");
10
+ const require_key = require("./key-Bbf-ITpM.cjs");
11
+ const require_http = require("./http-Bg-OkZtX.cjs");
12
+ const require_proof = require("./proof-BYdxNk_7.cjs");
13
+ const require_types = require("./types-BVCtDIwE.cjs");
14
+ const require_authdocloader = require("./authdocloader-qSZCRtME.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");