@fedify/fedify 2.0.36-dev.2647 → 2.0.36-dev.2729

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 (71) hide show
  1. package/dist/{builder-Cv8baeaM.mjs → builder-DifMW7os.mjs} +3 -3
  2. package/dist/callback-CJd-aCRE.d.mts +2223 -0
  3. package/dist/compat/mod.d.cts +1 -1
  4. package/dist/compat/mod.d.ts +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/{context-C00pWP8x.d.ts → context-CgpkmUFq.d.ts} +23 -12
  7. package/dist/{context-ao-qb3eP.d.cts → context-DGC1C_UU.d.cts} +23 -12
  8. package/dist/{deno-Bk4jrob6.mjs → deno-CZYDJcbZ.mjs} +1 -1
  9. package/dist/{docloader-w8xGNWvP.mjs → docloader-DXZDJeg3.mjs} +2 -2
  10. package/dist/federation/builder.test.mjs +1 -1
  11. package/dist/federation/handler.test.mjs +6 -6
  12. package/dist/federation/idempotency.test.mjs +2 -2
  13. package/dist/federation/inbox.test.mjs +1 -1
  14. package/dist/federation/middleware.test.mjs +105 -7
  15. package/dist/federation/mod.cjs +1 -1
  16. package/dist/federation/mod.d.cts +2 -2
  17. package/dist/federation/mod.d.ts +2 -2
  18. package/dist/federation/mod.js +1 -1
  19. package/dist/federation/send.test.mjs +3 -3
  20. package/dist/federation/temporal.test.mjs +1 -1
  21. package/dist/federation/webfinger.test.mjs +1 -1
  22. package/dist/{http-C1v_vvt4.js → http-6beU7KiN.js} +6 -4
  23. package/dist/{http-Cd8UD1ym.d.ts → http-B57wVmZ3.d.cts} +3 -3
  24. package/dist/{http-CDK9iAjb.mjs → http-BEyjd3P7.mjs} +6 -4
  25. package/dist/{http-B9ZWGTaN.cjs → http-CU9dab8F.cjs} +6 -4
  26. package/dist/{http-DFqAb11b.d.cts → http-CURWmZlP.d.ts} +3 -3
  27. package/dist/{inbox-DAm48Q_C.mjs → inbox-DO4a9FKE.mjs} +1 -1
  28. package/dist/{key-C8OKWl8g.mjs → key-DjCiTRyO.mjs} +3 -2
  29. package/dist/{kv-cache-BFFwfQPZ.cjs → kv-cache-DFybNxHG.cjs} +1 -1
  30. package/dist/{kv-cache-B1Y7_B63.js → kv-cache-DPBGlPnW.js} +1 -1
  31. package/dist/{ld-gUJKeHbH.mjs → ld-B5pG0yhd.mjs} +20 -7
  32. package/dist/{middleware-3t8hmtzt.cjs → middleware-Bdvdue5B.cjs} +1 -1
  33. package/dist/{middleware-D-DIq_jJ.js → middleware-BqQbaTiu.js} +15 -7
  34. package/dist/{middleware-_yMwRAE9.cjs → middleware-ClxSuYs7.cjs} +16 -8
  35. package/dist/{middleware-DLxdIffl.mjs → middleware-DnnYzTPv.mjs} +23 -14
  36. package/dist/{middleware-LgcMsPlF.mjs → middleware-Dsw0i5sQ.mjs} +1 -1
  37. package/dist/{mod-DtRh015i.d.ts → mod-BqnolIm8.d.ts} +1 -1
  38. package/dist/{mod-6uJWdCc0.d.cts → mod-BzKteaAe.d.cts} +1 -1
  39. package/dist/{mod-DGP89q0u.d.ts → mod-CIjZ1RmH.d.ts} +3 -3
  40. package/dist/{mod-BPDfu4Ey.d.cts → mod-DaQ6pIH3.d.cts} +3 -3
  41. package/dist/{mod-CL9Ep0uo.d.ts → mod-DmmcsbU8.d.cts} +12 -7
  42. package/dist/{mod-BA6vqC2S.d.cts → mod-fnE_D0lV.d.ts} +12 -7
  43. package/dist/mod.cjs +4 -4
  44. package/dist/mod.d.cts +7 -7
  45. package/dist/mod.d.ts +7 -7
  46. package/dist/mod.js +4 -4
  47. package/dist/nodeinfo/handler.test.mjs +1 -1
  48. package/dist/{owner-BenEndHH.mjs → owner-Dmlm2oR_.mjs} +2 -2
  49. package/dist/{proof-DF1RSNYg.cjs → proof-BGPhmUJL.cjs} +20 -7
  50. package/dist/{proof-BvtZYI3N.js → proof-iPBfQoMT.js} +20 -7
  51. package/dist/{proof-Bo9pmjQJ.mjs → proof-v76wU5Lv.mjs} +4 -3
  52. package/dist/{send-PTFa5PEa.mjs → send-C830qz95.mjs} +2 -2
  53. package/dist/sig/http.test.mjs +2 -2
  54. package/dist/sig/key-types.test.d.mts +218 -0
  55. package/dist/sig/key-types.test.mjs +8 -0
  56. package/dist/sig/key.test.mjs +2 -2
  57. package/dist/sig/ld.test.mjs +156 -4
  58. package/dist/sig/mod.cjs +2 -2
  59. package/dist/sig/mod.d.cts +3 -3
  60. package/dist/sig/mod.d.ts +3 -3
  61. package/dist/sig/mod.js +2 -2
  62. package/dist/sig/owner.test.mjs +1 -1
  63. package/dist/sig/proof.test.mjs +2 -2
  64. package/dist/{temporal-CNbx4A18.mjs → temporal-Bm5DL5mq.mjs} +1 -1
  65. package/dist/testing/mod.d.mts +2 -2123
  66. package/dist/utils/docloader.test.mjs +2 -2
  67. package/dist/utils/mod.cjs +1 -1
  68. package/dist/utils/mod.d.cts +1 -1
  69. package/dist/utils/mod.d.ts +1 -1
  70. package/dist/utils/mod.js +1 -1
  71. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { bt as ActivityTransformer, n as Context } from "../context-ao-qb3eP.cjs";
2
+ import { bt as ActivityTransformer, n as Context } from "../context-DGC1C_UU.cjs";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { bt as ActivityTransformer, n as Context } from "../context-C00pWP8x.js";
2
+ import { bt as ActivityTransformer, n as Context } from "../context-CgpkmUFq.js";
3
3
  import { Activity } from "@fedify/vocab";
4
4
 
5
5
  //#region src/compat/transformers.d.ts
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-DLxdIffl.mjs";
7
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-DnnYzTPv.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  //#region src/compat/transformers.test.ts
@@ -1,11 +1,11 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-jE7oGvRh.js";
3
- import { t as HttpMessageSignaturesSpec } from "./http-Cd8UD1ym.js";
3
+ import { t as HttpMessageSignaturesSpec } from "./http-CURWmZlP.js";
4
4
  import { n as GetKeyOwnerOptions } from "./owner-CiBPcC6F.js";
5
5
  import { n as KvStore, t as KvKey } from "./kv-CxaI4eGo.js";
6
6
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
7
7
  import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
8
- import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
8
+ import { AuthenticatedDocumentLoaderFactory, CryptoKeyLike, CryptoKeyPairLike, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
9
9
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
10
10
 
11
11
  //#region src/compat/types.d.ts
@@ -46,13 +46,18 @@ declare function buildCollectionSynchronizationHeader(collectionId: string | URL
46
46
  //#region src/federation/send.d.ts
47
47
  /**
48
48
  * A key pair for an actor who sends an activity.
49
+ *
50
+ * The private key type is parameterized so that Fedify can accept keys from
51
+ * `node:crypto` at its input boundaries while `SenderKeyPair` still exposes the
52
+ * ambient `CryptoKey` type by default.
53
+ * @template TKey The type of the private key.
49
54
  * @since 0.10.0
50
55
  */
51
- interface SenderKeyPair {
56
+ interface SenderKeyPair<TKey extends CryptoKeyLike = CryptoKey> {
52
57
  /**
53
58
  * The actor's private key to sign the request.
54
59
  */
55
- readonly privateKey: CryptoKey;
60
+ readonly privateKey: TKey;
56
61
  /**
57
62
  * The public key ID that corresponds to the private key.
58
63
  */
@@ -116,13 +121,19 @@ type ActorDispatcher<TContextData> = (context: RequestContext<TContextData>, ide
116
121
  /**
117
122
  * A callback that dispatches key pairs for an actor.
118
123
  *
124
+ * The returned key pairs may come from any supported runtime, including keys
125
+ * obtained from `node:crypto`'s Web Crypto API, so the key pair type is
126
+ * parameterized. It defaults to the ambient `CryptoKeyPair` type for
127
+ * compatibility with code that calls a dispatcher directly.
128
+ *
119
129
  * @template TContextData The context data to pass to the {@link Context}.
130
+ * @template TKeyPair The type of the key pairs the dispatcher returns.
120
131
  * @param context The context.
121
132
  * @param identifier The actor's internal identifier or username.
122
133
  * @returns The key pairs.
123
134
  * @since 0.10.0
124
135
  */
125
- type ActorKeyPairsDispatcher<TContextData> = (context: Context<TContextData>, identifier: string) => CryptoKeyPair[] | Promise<CryptoKeyPair[]>;
136
+ type ActorKeyPairsDispatcher<TContextData, TKeyPair extends CryptoKeyPairLike = CryptoKeyPair> = (context: Context<TContextData>, identifier: string) => TKeyPair[] | Promise<TKeyPair[]>;
126
137
  /**
127
138
  * A callback that maps a WebFinger username to the corresponding actor's
128
139
  * internal identifier, or `null` if the username is not found.
@@ -229,11 +240,11 @@ type InboxErrorHandler<TContextData> = (context: Context<TContextData>, error: E
229
240
  * not authorized.
230
241
  * @since 0.11.0
231
242
  */
232
- type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) => SenderKeyPair | {
243
+ type SharedInboxKeyDispatcher<TContextData, TKeyPair extends CryptoKeyLike = CryptoKey> = (context: Context<TContextData>) => SenderKeyPair<TKeyPair> | {
233
244
  identifier: string;
234
245
  } | {
235
246
  username: string;
236
- } | null | Promise<SenderKeyPair | {
247
+ } | null | Promise<SenderKeyPair<TKeyPair> | {
237
248
  identifier: string;
238
249
  } | {
239
250
  username: string;
@@ -1531,7 +1542,7 @@ interface ActorCallbackSetters<TContextData> {
1531
1542
  * @returns The setters object so that settings can be chained.
1532
1543
  * @since 0.10.0
1533
1544
  */
1534
- setKeyPairsDispatcher(dispatcher: ActorKeyPairsDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
1545
+ setKeyPairsDispatcher(dispatcher: ActorKeyPairsDispatcher<TContextData, CryptoKeyPairLike>): ActorCallbackSetters<TContextData>;
1535
1546
  /**
1536
1547
  * Sets the callback function that maps a WebFinger username to
1537
1548
  * the corresponding actor's identifier. If it's omitted, the identifier
@@ -1669,7 +1680,7 @@ interface InboxListenerSetters<TContextData> {
1669
1680
  * @returns The setters object so that settings can be chained.
1670
1681
  * @since 0.11.0
1671
1682
  */
1672
- setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
1683
+ setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData, CryptoKeyLike>): InboxListenerSetters<TContextData>;
1673
1684
  /**
1674
1685
  * Configures the strategy for handling activity idempotency in inbox processing.
1675
1686
  *
@@ -2002,7 +2013,7 @@ interface Context<TContextData> {
2002
2013
  */
2003
2014
  getDocumentLoader(identity: {
2004
2015
  keyId: URL;
2005
- privateKey: CryptoKey;
2016
+ privateKey: CryptoKeyLike;
2006
2017
  }): DocumentLoader;
2007
2018
  /**
2008
2019
  * Looks up an ActivityStreams object by its URI (including `acct:` URIs)
@@ -2115,7 +2126,7 @@ interface Context<TContextData> {
2115
2126
  * @param activity The activity to send.
2116
2127
  * @param options Options for sending the activity.
2117
2128
  */
2118
- sendActivity(sender: SenderKeyPair | SenderKeyPair[] | {
2129
+ sendActivity(sender: SenderKeyPair<CryptoKeyLike> | SenderKeyPair<CryptoKeyLike>[] | {
2119
2130
  identifier: string;
2120
2131
  } | {
2121
2132
  username: string;
@@ -2335,7 +2346,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
2335
2346
  * @param options Options for forwarding the activity.
2336
2347
  * @since 1.0.0
2337
2348
  */
2338
- forwardActivity(forwarder: SenderKeyPair | SenderKeyPair[] | {
2349
+ forwardActivity(forwarder: SenderKeyPair<CryptoKeyLike> | SenderKeyPair<CryptoKeyLike>[] | {
2339
2350
  identifier: string;
2340
2351
  } | {
2341
2352
  username: string;
@@ -1,10 +1,10 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { o as JsonValue, s as NodeInfo, t as GetNodeInfoOptions } from "./client-BIBzqEIp.cjs";
3
- import { t as HttpMessageSignaturesSpec } from "./http-DFqAb11b.cjs";
3
+ import { t as HttpMessageSignaturesSpec } from "./http-B57wVmZ3.cjs";
4
4
  import { n as GetKeyOwnerOptions } from "./owner-B3hNQCG8.cjs";
5
5
  import { n as KvStore, t as KvKey } from "./kv-CZKl1IUS.cjs";
6
6
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, TraverseCollectionOptions } from "@fedify/vocab";
7
- import { AuthenticatedDocumentLoaderFactory, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
7
+ import { AuthenticatedDocumentLoaderFactory, CryptoKeyLike, CryptoKeyPairLike, DocumentLoader, DocumentLoaderFactory, GetUserAgentOptions } from "@fedify/vocab-runtime";
8
8
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
9
9
  import { Span, Tracer, TracerProvider } from "@opentelemetry/api";
10
10
 
@@ -46,13 +46,18 @@ declare function buildCollectionSynchronizationHeader(collectionId: string | URL
46
46
  //#region src/federation/send.d.ts
47
47
  /**
48
48
  * A key pair for an actor who sends an activity.
49
+ *
50
+ * The private key type is parameterized so that Fedify can accept keys from
51
+ * `node:crypto` at its input boundaries while `SenderKeyPair` still exposes the
52
+ * ambient `CryptoKey` type by default.
53
+ * @template TKey The type of the private key.
49
54
  * @since 0.10.0
50
55
  */
51
- interface SenderKeyPair {
56
+ interface SenderKeyPair<TKey extends CryptoKeyLike = CryptoKey> {
52
57
  /**
53
58
  * The actor's private key to sign the request.
54
59
  */
55
- readonly privateKey: CryptoKey;
60
+ readonly privateKey: TKey;
56
61
  /**
57
62
  * The public key ID that corresponds to the private key.
58
63
  */
@@ -116,13 +121,19 @@ type ActorDispatcher<TContextData> = (context: RequestContext<TContextData>, ide
116
121
  /**
117
122
  * A callback that dispatches key pairs for an actor.
118
123
  *
124
+ * The returned key pairs may come from any supported runtime, including keys
125
+ * obtained from `node:crypto`'s Web Crypto API, so the key pair type is
126
+ * parameterized. It defaults to the ambient `CryptoKeyPair` type for
127
+ * compatibility with code that calls a dispatcher directly.
128
+ *
119
129
  * @template TContextData The context data to pass to the {@link Context}.
130
+ * @template TKeyPair The type of the key pairs the dispatcher returns.
120
131
  * @param context The context.
121
132
  * @param identifier The actor's internal identifier or username.
122
133
  * @returns The key pairs.
123
134
  * @since 0.10.0
124
135
  */
125
- type ActorKeyPairsDispatcher<TContextData> = (context: Context<TContextData>, identifier: string) => CryptoKeyPair[] | Promise<CryptoKeyPair[]>;
136
+ type ActorKeyPairsDispatcher<TContextData, TKeyPair extends CryptoKeyPairLike = CryptoKeyPair> = (context: Context<TContextData>, identifier: string) => TKeyPair[] | Promise<TKeyPair[]>;
126
137
  /**
127
138
  * A callback that maps a WebFinger username to the corresponding actor's
128
139
  * internal identifier, or `null` if the username is not found.
@@ -229,11 +240,11 @@ type InboxErrorHandler<TContextData> = (context: Context<TContextData>, error: E
229
240
  * not authorized.
230
241
  * @since 0.11.0
231
242
  */
232
- type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) => SenderKeyPair | {
243
+ type SharedInboxKeyDispatcher<TContextData, TKeyPair extends CryptoKeyLike = CryptoKey> = (context: Context<TContextData>) => SenderKeyPair<TKeyPair> | {
233
244
  identifier: string;
234
245
  } | {
235
246
  username: string;
236
- } | null | Promise<SenderKeyPair | {
247
+ } | null | Promise<SenderKeyPair<TKeyPair> | {
237
248
  identifier: string;
238
249
  } | {
239
250
  username: string;
@@ -1531,7 +1542,7 @@ interface ActorCallbackSetters<TContextData> {
1531
1542
  * @returns The setters object so that settings can be chained.
1532
1543
  * @since 0.10.0
1533
1544
  */
1534
- setKeyPairsDispatcher(dispatcher: ActorKeyPairsDispatcher<TContextData>): ActorCallbackSetters<TContextData>;
1545
+ setKeyPairsDispatcher(dispatcher: ActorKeyPairsDispatcher<TContextData, CryptoKeyPairLike>): ActorCallbackSetters<TContextData>;
1535
1546
  /**
1536
1547
  * Sets the callback function that maps a WebFinger username to
1537
1548
  * the corresponding actor's identifier. If it's omitted, the identifier
@@ -1669,7 +1680,7 @@ interface InboxListenerSetters<TContextData> {
1669
1680
  * @returns The setters object so that settings can be chained.
1670
1681
  * @since 0.11.0
1671
1682
  */
1672
- setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData>): InboxListenerSetters<TContextData>;
1683
+ setSharedKeyDispatcher(dispatcher: SharedInboxKeyDispatcher<TContextData, CryptoKeyLike>): InboxListenerSetters<TContextData>;
1673
1684
  /**
1674
1685
  * Configures the strategy for handling activity idempotency in inbox processing.
1675
1686
  *
@@ -2002,7 +2013,7 @@ interface Context<TContextData> {
2002
2013
  */
2003
2014
  getDocumentLoader(identity: {
2004
2015
  keyId: URL;
2005
- privateKey: CryptoKey;
2016
+ privateKey: CryptoKeyLike;
2006
2017
  }): DocumentLoader;
2007
2018
  /**
2008
2019
  * Looks up an ActivityStreams object by its URI (including `acct:` URIs)
@@ -2115,7 +2126,7 @@ interface Context<TContextData> {
2115
2126
  * @param activity The activity to send.
2116
2127
  * @param options Options for sending the activity.
2117
2128
  */
2118
- sendActivity(sender: SenderKeyPair | SenderKeyPair[] | {
2129
+ sendActivity(sender: SenderKeyPair<CryptoKeyLike> | SenderKeyPair<CryptoKeyLike>[] | {
2119
2130
  identifier: string;
2120
2131
  } | {
2121
2132
  username: string;
@@ -2335,7 +2346,7 @@ interface InboxContext<TContextData> extends Context<TContextData> {
2335
2346
  * @param options Options for forwarding the activity.
2336
2347
  * @since 1.0.0
2337
2348
  */
2338
- forwardActivity(forwarder: SenderKeyPair | SenderKeyPair[] | {
2349
+ forwardActivity(forwarder: SenderKeyPair<CryptoKeyLike> | SenderKeyPair<CryptoKeyLike>[] | {
2339
2350
  identifier: string;
2340
2351
  } | {
2341
2352
  username: string;
@@ -3,6 +3,6 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  //#region deno.json
5
5
  var name = "@fedify/fedify";
6
- var version = "2.0.36-dev.2647+2864b09d";
6
+ var version = "2.0.36-dev.2729+88a727c8";
7
7
  //#endregion
8
8
  export { version as n, name as t };
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { o as validateCryptoKey } from "./key-C8OKWl8g.mjs";
5
- import { r as doubleKnockScoped } from "./http-CDK9iAjb.mjs";
4
+ import { o as validateCryptoKey } from "./key-DjCiTRyO.mjs";
5
+ import { r as doubleKnockScoped } from "./http-BEyjd3P7.mjs";
6
6
  import { curry } from "es-toolkit";
7
7
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest } from "@fedify/vocab-runtime";
8
8
  import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { i as assertExists, n as assertStrictEquals } from "../std__assert-DflMZha5.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { n as createFederationBuilder } from "../builder-Cv8baeaM.mjs";
8
+ import { n as createFederationBuilder } from "../builder-DifMW7os.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Activity, Note, Person } from "@fedify/vocab";
11
11
  //#region src/federation/builder.test.ts
@@ -6,14 +6,14 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-DflMZha5.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
9
- import { i as generateCryptoKeyPair } from "../key-C8OKWl8g.mjs";
10
- import { c as signRequest } from "../http-CDK9iAjb.mjs";
9
+ import { i as generateCryptoKeyPair } from "../key-DjCiTRyO.mjs";
10
+ import { c as signRequest } from "../http-BEyjd3P7.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
12
- import { a as compactJsonLd, f as signJsonLd } from "../ld-gUJKeHbH.mjs";
13
- import { n as signObject } from "../proof-Bo9pmjQJ.mjs";
12
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-B5pG0yhd.mjs";
13
+ import { n as signObject } from "../proof-v76wU5Lv.mjs";
14
14
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
15
- import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-DLxdIffl.mjs";
16
- import { t as InboxListenerSet } from "../inbox-DAm48Q_C.mjs";
15
+ import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-DnnYzTPv.mjs";
16
+ import { t as InboxListenerSet } from "../inbox-DO4a9FKE.mjs";
17
17
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
18
  import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
19
19
  //#region src/federation/handler.test.ts
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-DflMZha5.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
7
- import { n as signObject } from "../proof-Bo9pmjQJ.mjs";
7
+ import { n as signObject } from "../proof-v76wU5Lv.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
9
- import { a as createFederation } from "../middleware-DLxdIffl.mjs";
9
+ import { a as createFederation } from "../middleware-DnnYzTPv.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, Follow, Person } from "@fedify/vocab";
12
12
  //#region src/federation/idempotency.test.ts
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
6
- import { n as actorsHaveSameOrigin, t as InboxListenerSet } from "../inbox-DAm48Q_C.mjs";
6
+ import { n as actorsHaveSameOrigin, t as InboxListenerSet } from "../inbox-DO4a9FKE.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
9
9
  //#region src/federation/inbox.test.ts
@@ -9,15 +9,15 @@ import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.m
9
9
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
10
10
  import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
11
11
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
12
- import { c as signRequest, u as verifyRequest } from "../http-CDK9iAjb.mjs";
12
+ import { c as signRequest, u as verifyRequest } from "../http-BEyjd3P7.mjs";
13
13
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
14
- import { n as getAuthenticatedDocumentLoader } from "../docloader-w8xGNWvP.mjs";
15
- import { a as compactJsonLd, f as signJsonLd, i as attachSignature, m as verifyJsonLd, s as detachSignature } from "../ld-gUJKeHbH.mjs";
16
- import { t as doesActorOwnKey } from "../owner-BenEndHH.mjs";
17
- import { n as signObject, r as verifyObject } from "../proof-Bo9pmjQJ.mjs";
14
+ import { n as getAuthenticatedDocumentLoader } from "../docloader-DXZDJeg3.mjs";
15
+ import { a as compactJsonLd, f as signJsonLd, i as attachSignature, m as verifyJsonLd, s as detachSignature } from "../ld-B5pG0yhd.mjs";
16
+ import { t as doesActorOwnKey } from "../owner-Dmlm2oR_.mjs";
17
+ import { n as signObject, r as verifyObject } from "../proof-v76wU5Lv.mjs";
18
18
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
19
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-DLxdIffl.mjs";
20
- import { t as SendActivityError } from "../send-PTFa5PEa.mjs";
19
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-DnnYzTPv.mjs";
20
+ import { t as SendActivityError } from "../send-C830qz95.mjs";
21
21
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
22
22
  import * as vocab from "@fedify/vocab";
23
23
  import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
@@ -196,6 +196,104 @@ test("createFederation()", async (t) => {
196
196
  }), TypeError);
197
197
  });
198
198
  });
199
+ test("FederationImpl.startQueue()", async (t) => {
200
+ function createCountingQueue() {
201
+ const messages = [];
202
+ let listenCount = 0;
203
+ return {
204
+ messages,
205
+ get listenCount() {
206
+ return listenCount;
207
+ },
208
+ enqueue(message) {
209
+ messages.push(message);
210
+ return Promise.resolve();
211
+ },
212
+ listen() {
213
+ listenCount++;
214
+ return Promise.resolve();
215
+ }
216
+ };
217
+ }
218
+ await t.step("starts a fanout-only queue with an explicit selector", async () => {
219
+ const queue = createCountingQueue();
220
+ const federation = new FederationImpl({
221
+ kv: new MemoryKvStore(),
222
+ queue: { fanout: queue },
223
+ manuallyStartQueue: true
224
+ });
225
+ await federation.startQueue(void 0, { queue: "fanout" });
226
+ assertEquals(queue.listenCount, 1);
227
+ await federation.startQueue(void 0, { queue: "fanout" });
228
+ assertEquals(queue.listenCount, 1);
229
+ });
230
+ await t.step("starts a fanout-only queue without a selector", async () => {
231
+ const queue = createCountingQueue();
232
+ await new FederationImpl({
233
+ kv: new MemoryKvStore(),
234
+ queue: { fanout: queue },
235
+ manuallyStartQueue: true
236
+ }).startQueue(void 0);
237
+ assertEquals(queue.listenCount, 1);
238
+ });
239
+ await t.step("starts a fanout-only queue after a fanout enqueue", async () => {
240
+ const queue = createCountingQueue();
241
+ const ctx = new ContextImpl({
242
+ data: void 0,
243
+ federation: new FederationImpl({
244
+ kv: new MemoryKvStore(),
245
+ contextLoaderFactory: () => mockDocumentLoader,
246
+ queue: { fanout: queue }
247
+ }),
248
+ url: new URL("https://example.com/"),
249
+ documentLoader: mockDocumentLoader,
250
+ contextLoader: mockDocumentLoader
251
+ });
252
+ const activity = new vocab.Create({
253
+ id: new URL("https://example.com/activity/1"),
254
+ actor: new URL("https://example.com/person")
255
+ });
256
+ await ctx.sendActivity([{
257
+ privateKey: rsaPrivateKey2,
258
+ keyId: rsaPublicKey2.id
259
+ }], {
260
+ id: new URL("https://example.com/recipient"),
261
+ inboxId: new URL("https://example.com/inbox")
262
+ }, activity, { fanout: "force" });
263
+ assertEquals(queue.listenCount, 1);
264
+ assertEquals(queue.messages.length, 1);
265
+ assertEquals(queue.messages[0].type, "fanout");
266
+ });
267
+ await t.step("does not start a fanout-only queue automatically when manually started", async () => {
268
+ const queue = createCountingQueue();
269
+ const ctx = new ContextImpl({
270
+ data: void 0,
271
+ federation: new FederationImpl({
272
+ kv: new MemoryKvStore(),
273
+ contextLoaderFactory: () => mockDocumentLoader,
274
+ queue: { fanout: queue },
275
+ manuallyStartQueue: true
276
+ }),
277
+ url: new URL("https://example.com/"),
278
+ documentLoader: mockDocumentLoader,
279
+ contextLoader: mockDocumentLoader
280
+ });
281
+ const activity = new vocab.Create({
282
+ id: new URL("https://example.com/activity/1"),
283
+ actor: new URL("https://example.com/person")
284
+ });
285
+ await ctx.sendActivity([{
286
+ privateKey: rsaPrivateKey2,
287
+ keyId: rsaPublicKey2.id
288
+ }], {
289
+ id: new URL("https://example.com/recipient"),
290
+ inboxId: new URL("https://example.com/inbox")
291
+ }, activity, { fanout: "force" });
292
+ assertEquals(queue.listenCount, 0);
293
+ assertEquals(queue.messages.length, 1);
294
+ assertEquals(queue.messages[0].type, "fanout");
295
+ });
296
+ });
199
297
  test({
200
298
  name: "Federation.createContext()",
201
299
  permissions: {
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("../chunk-DDcVe30Y.cjs");
5
- const require_middleware = require("../middleware-_yMwRAE9.cjs");
5
+ const require_middleware = require("../middleware-ClxSuYs7.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-ao-qb3eP.cjs";
2
+ import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-DGC1C_UU.cjs";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CZKl1IUS.cjs";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-6uJWdCc0.cjs";
4
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-BzKteaAe.cjs";
5
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-C00pWP8x.js";
2
+ import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "../context-CgpkmUFq.js";
3
3
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CxaI4eGo.js";
4
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-DtRh015i.js";
4
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-BqnolIm8.js";
5
5
  export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-D-DIq_jJ.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-BqQbaTiu.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -8,10 +8,10 @@ import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
8
8
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
10
10
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
11
- import { u as verifyRequest } from "../http-CDK9iAjb.mjs";
11
+ import { u as verifyRequest } from "../http-BEyjd3P7.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
13
- import { t as doesActorOwnKey } from "../owner-BenEndHH.mjs";
14
- import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-PTFa5PEa.mjs";
13
+ import { t as doesActorOwnKey } from "../owner-Dmlm2oR_.mjs";
14
+ import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-C830qz95.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-DflMZha5.mjs";
5
5
  import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
6
6
  import { t as assert } from "../assert-BhQd8QHP.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CNbx4A18.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-Bm5DL5mq.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-DflMZha5.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-DLxdIffl.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-DnnYzTPv.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Image, Link, Person } from "@fedify/vocab";
11
11
  //#region src/federation/webfinger.test.ts
@@ -5,12 +5,13 @@ import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
5
5
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
6
6
  import { encodeHex } from "byte-encodings/hex";
7
7
  import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
8
+ import { asCryptoKey } from "@fedify/vocab-runtime/internal";
8
9
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
9
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
10
11
  import { Item, decodeDict, encodeItem } from "structured-field-values";
11
12
  //#region deno.json
12
13
  var name = "@fedify/fedify";
13
- var version = "2.0.36-dev.2647+2864b09d";
14
+ var version = "2.0.36-dev.2729+88a727c8";
14
15
  //#endregion
15
16
  //#region src/sig/key.ts
16
17
  /** Classifies decoding failures without hiding unexpected loader errors. */
@@ -105,7 +106,7 @@ function generateCryptoKeyPair(algorithm) {
105
106
  */
106
107
  async function exportJwk(key) {
107
108
  validateCryptoKey(key);
108
- const jwk = await crypto.subtle.exportKey("jwk", key);
109
+ const jwk = await crypto.subtle.exportKey("jwk", asCryptoKey(key));
109
110
  if (jwk.crv === "Ed25519") jwk.alg = "Ed25519";
110
111
  return jwk;
111
112
  }
@@ -505,12 +506,13 @@ const DOUBLE_KNOCK_TRANSPORT_RETRY_DELAY_MS = 100;
505
506
  */
506
507
  async function signRequest(request, privateKey, keyId, options = {}) {
507
508
  validateCryptoKey(privateKey, "private");
509
+ const signingKey = asCryptoKey(privateKey);
508
510
  return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
509
511
  try {
510
512
  const spec = options.spec ?? "draft-cavage-http-signatures-12";
511
513
  let signed;
512
- if (spec === "rfc9421") signed = await signRequestRfc9421(request, privateKey, keyId, span, options.currentTime, options.body);
513
- else signed = await signRequestDraft(request, privateKey, keyId, span, options.currentTime, options.body);
514
+ if (spec === "rfc9421") signed = await signRequestRfc9421(request, signingKey, keyId, span, options.currentTime, options.body);
515
+ else signed = await signRequestDraft(request, signingKey, keyId, span, options.currentTime, options.body);
514
516
  if (span.isRecording()) {
515
517
  span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
516
518
  span.setAttribute(ATTR_URL_FULL, signed.url);
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { Actor, CryptographicKey, Multikey } from "@fedify/vocab";
3
+ import { CryptoKeyLike, DocumentLoader } from "@fedify/vocab-runtime";
3
4
  import { TracerProvider } from "@opentelemetry/api";
4
- import { DocumentLoader } from "@fedify/vocab-runtime";
5
5
  //#region src/sig/key.d.ts
6
6
  /**
7
7
  * Generates a key pair which is appropriate for Fedify.
@@ -18,7 +18,7 @@ declare function generateCryptoKeyPair(algorithm?: "RSASSA-PKCS1-v1_5" | "Ed2551
18
18
  * serialization and storage.
19
19
  * @throws {TypeError} If the key is invalid or unsupported.
20
20
  */
21
- declare function exportJwk(key: CryptoKey): Promise<JsonWebKey>;
21
+ declare function exportJwk(key: CryptoKeyLike): Promise<JsonWebKey>;
22
22
  /**
23
23
  * Imports a key from JWK format.
24
24
  * @param jwk The key in JWK format.
@@ -156,7 +156,7 @@ interface SignRequestOptions {
156
156
  * @returns The signed request.
157
157
  * @throws {TypeError} If the private key is invalid or unsupported.
158
158
  */
159
- declare function signRequest(request: Request, privateKey: CryptoKey, keyId: URL, options?: SignRequestOptions): Promise<Request>;
159
+ declare function signRequest(request: Request, privateKey: CryptoKeyLike, keyId: URL, options?: SignRequestOptions): Promise<Request>;
160
160
  /**
161
161
  * Options for {@link verifyRequest}.
162
162
  */