@fedify/fedify 2.2.0-dev.613 → 2.2.0-dev.622

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 (207) hide show
  1. package/dist/{accept-D7sAxyNa.js → accept-Dd__NiUL.mjs} +10 -8
  2. package/dist/{assert-MZs1qjMx.js → assert-ddO5KLpe.mjs} +5 -9
  3. package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
  4. package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
  5. package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
  6. package/dist/{assert_rejects-0h7I2Esa.js → assert_rejects-B-qJtC9Z.mjs} +6 -11
  7. package/dist/{assert_throws-rjdMBf31.js → assert_throws-4NwKEy2q.mjs} +5 -10
  8. package/dist/{builder-OscY92PK.js → builder-DcSpny3g.mjs} +32 -41
  9. package/dist/{chunk-CGaQZ11T.cjs → chunk-DDcVe30Y.cjs} +23 -24
  10. package/dist/{chunk-DJNbSFdH.js → chunk-nlSIicah.js} +8 -8
  11. package/dist/{client-BxMZiQaD.d.ts → client-AtlibPOU.d.ts} +1 -1
  12. package/dist/{client-CoCIaTNO.js → client-DEpOVgY1.mjs} +9 -13
  13. package/dist/{client-C97KOq3x.d.cts → client-z-8dc-e1.d.cts} +1 -1
  14. package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
  15. package/dist/compat/mod.cjs +5 -8
  16. package/dist/compat/mod.d.cts +78 -6
  17. package/dist/compat/mod.d.ts +78 -6
  18. package/dist/compat/mod.js +4 -8
  19. package/dist/compat/transformers.test.mjs +62 -0
  20. package/dist/{context-DyJjQQ_H.d.ts → context-BOiMZBu5.d.ts} +9 -18
  21. package/dist/{context-BcqA-0BL.d.cts → context-BhZVy7RB.d.cts} +9 -18
  22. package/dist/{context-Aqenou7c.js → context-Juj6bdHC.mjs} +7 -11
  23. package/dist/deno-D682wzlW.mjs +8 -0
  24. package/dist/{docloader-JiZmL7BP.js → docloader-CCWf4tNV.mjs} +8 -14
  25. package/dist/{esm-nLm00z9V.js → esm-DVILvP5e.mjs} +50 -89
  26. package/dist/federation/builder.test.d.mts +2 -0
  27. package/dist/federation/{builder.test.js → builder.test.mjs} +21 -44
  28. package/dist/federation/collection.test.d.mts +2 -0
  29. package/dist/federation/collection.test.mjs +21 -0
  30. package/dist/federation/handler.test.d.mts +2 -0
  31. package/dist/federation/{handler.test.js → handler.test.mjs} +69 -131
  32. package/dist/federation/idempotency.test.d.mts +2 -0
  33. package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +31 -63
  34. package/dist/federation/inbox.test.d.mts +2 -0
  35. package/dist/federation/{inbox.test.js → inbox.test.mjs} +8 -12
  36. package/dist/federation/keycache.test.d.mts +2 -0
  37. package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -19
  38. package/dist/federation/kv.test.d.mts +2 -0
  39. package/dist/federation/{kv.test.js → kv.test.mjs} +11 -22
  40. package/dist/federation/middleware.test.d.mts +2 -0
  41. package/dist/federation/{middleware.test.js → middleware.test.mjs} +173 -262
  42. package/dist/federation/mod.cjs +327 -16
  43. package/dist/federation/mod.d.cts +3 -6
  44. package/dist/federation/mod.d.ts +3 -6
  45. package/dist/federation/mod.js +322 -13
  46. package/dist/federation/mq.test.d.mts +2 -0
  47. package/dist/federation/{mq.test.js → mq.test.mjs} +21 -35
  48. package/dist/federation/negotiation.test.d.mts +2 -0
  49. package/dist/federation/{negotiation.test.js → negotiation.test.mjs} +9 -16
  50. package/dist/federation/retry.test.d.mts +2 -0
  51. package/dist/federation/{retry.test.js → retry.test.mjs} +8 -11
  52. package/dist/federation/router.test.d.mts +2 -0
  53. package/dist/federation/{router.test.js → router.test.mjs} +11 -16
  54. package/dist/federation/send.test.d.mts +2 -0
  55. package/dist/federation/{send.test.js → send.test.mjs} +22 -30
  56. package/dist/federation/webfinger.test.d.mts +2 -0
  57. package/dist/federation/{webfinger.test.js → webfinger.test.mjs} +22 -56
  58. package/dist/{http-BnsR906R.cjs → http-BQccxQlj.cjs} +177 -302
  59. package/dist/{http-CKaqhjvP.js → http-CNsnyqrO.mjs} +23 -43
  60. package/dist/{http-BudnHZE2.d.cts → http-CrGuipxe.d.cts} +1 -6
  61. package/dist/{http-IFqEftoZ.js → http-DhwEMhtv.js} +53 -184
  62. package/dist/{http-Dax_FIBo.d.ts → http-aQzN9Ayi.d.ts} +1 -6
  63. package/dist/{inbox-Bd91CVJP.js → inbox-DegXbbbS.mjs} +18 -26
  64. package/dist/{key-DFLFXKER.js → key-vL60OvqM.mjs} +29 -37
  65. package/dist/{keycache-CpGWAUbj.js → keycache-CCSwkQcY.mjs} +5 -10
  66. package/dist/{keys-BFve7QQv.js → keys-BAK-tUlf.mjs} +5 -9
  67. package/dist/{kv-BL4nlICN.d.cts → kv-CbLNp3zQ.d.cts} +1 -1
  68. package/dist/{kv-DXEUEP6z.d.ts → kv-GFYnFoOl.d.ts} +1 -1
  69. package/dist/{kv-cache-Bw2F2ABq.js → kv-cache-B01V7s3h.mjs} +4 -8
  70. package/dist/{kv-cache-Drlz6O_Y.js → kv-cache-CTj3iCix.js} +6 -13
  71. package/dist/{kv-cache-BLXcQvyb.cjs → kv-cache-DxdXJNbj.cjs} +27 -34
  72. package/dist/{kv-QzKcOQgP.js → kv-tL2TOE9X.mjs} +6 -10
  73. package/dist/{ld-CGGXZJK0.js → ld-C3CO00YY.mjs} +17 -31
  74. package/dist/{middleware-DcpBikad.js → middleware-BmsVSOeS.js} +335 -382
  75. package/dist/middleware-C7shNcsp.cjs +4 -0
  76. package/dist/{middleware-B51dB75z.cjs → middleware-Cx0Ny6_7.cjs} +532 -587
  77. package/dist/middleware-DqVGYk56.mjs +5 -0
  78. package/dist/{middleware-B53r4pdM.js → middleware-Du-vh7I_.mjs} +282 -317
  79. package/dist/{mod-em2Il1eD.d.cts → mod-Bp_CzKd4.d.cts} +2 -2
  80. package/dist/{mod-DCbh1JQ5.d.ts → mod-CLgIXe9w.d.ts} +3 -3
  81. package/dist/{mod-jfnweK2w.d.cts → mod-CMEbIaNh.d.cts} +3 -3
  82. package/dist/{mod-D6MdymW7.d.ts → mod-DKOAow7a.d.ts} +2 -2
  83. package/dist/{mod-Coe7KEgX.d.cts → mod-DoJBjjnO.d.cts} +2 -2
  84. package/dist/{mod-D6dOd--H.d.ts → mod-DvxszxXC.d.ts} +2 -2
  85. package/dist/mod.cjs +29 -74
  86. package/dist/mod.d.cts +11 -14
  87. package/dist/mod.d.ts +11 -15
  88. package/dist/mod.js +17 -71
  89. package/dist/{negotiation-BlAuS_nr.js → negotiation-DnsfFF8I.mjs} +7 -11
  90. package/dist/nodeinfo/client.test.d.mts +2 -0
  91. package/dist/nodeinfo/{client.test.js → client.test.mjs} +22 -40
  92. package/dist/nodeinfo/handler.test.d.mts +2 -0
  93. package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +13 -43
  94. package/dist/nodeinfo/mod.cjs +5 -8
  95. package/dist/nodeinfo/mod.d.cts +2 -3
  96. package/dist/nodeinfo/mod.d.ts +2 -3
  97. package/dist/nodeinfo/mod.js +4 -8
  98. package/dist/nodeinfo/types.test.d.mts +2 -0
  99. package/dist/nodeinfo/{types.test.js → types.test.mjs} +9 -16
  100. package/dist/otel/exporter.test.d.mts +2 -0
  101. package/dist/otel/{exporter.test.js → exporter.test.mjs} +124 -178
  102. package/dist/otel/mod.cjs +15 -20
  103. package/dist/otel/mod.d.cts +2 -2
  104. package/dist/otel/mod.d.ts +2 -2
  105. package/dist/otel/mod.js +8 -14
  106. package/dist/{owner-gd0Q9FuU.d.ts → owner-74ARJ5TL.d.ts} +1 -1
  107. package/dist/{owner-1AbPBOOZ.d.cts → owner-CptqhsOy.d.cts} +1 -1
  108. package/dist/{owner-Cye0yQB_.js → owner-DF320w6K.mjs} +11 -16
  109. package/dist/{proof-DdGGXVWM.js → proof-BCWk5oas.js} +32 -58
  110. package/dist/{proof-DV5lC_Bw.js → proof-IyDwwmzL.mjs} +21 -33
  111. package/dist/{proof-CN5iR1tW.cjs → proof-WhNxSv_N.cjs} +133 -157
  112. package/dist/{retry-mqLf4b-R.js → retry-B_E3V_Dx.mjs} +4 -7
  113. package/dist/{router-D9eI0s4b.js → router-CrMLXoOr.mjs} +4 -8
  114. package/dist/runtime/mod.cjs +11 -13
  115. package/dist/runtime/mod.d.cts +6 -2
  116. package/dist/runtime/mod.d.ts +0 -1
  117. package/dist/runtime/mod.js +4 -7
  118. package/dist/{send-C2a_3YAF.js → send-CJQubr5t.mjs} +8 -13
  119. package/dist/sig/accept.test.d.mts +2 -0
  120. package/dist/sig/{accept.test.js → accept.test.mjs} +35 -70
  121. package/dist/sig/http.test.d.mts +2 -0
  122. package/dist/sig/{http.test.js → http.test.mjs} +166 -280
  123. package/dist/sig/key.test.d.mts +2 -0
  124. package/dist/sig/{key.test.js → key.test.mjs} +11 -18
  125. package/dist/sig/ld.test.d.mts +2 -0
  126. package/dist/sig/{ld.test.js → ld.test.mjs} +22 -35
  127. package/dist/sig/mod.cjs +6 -9
  128. package/dist/sig/mod.d.cts +3 -3
  129. package/dist/sig/mod.d.ts +3 -3
  130. package/dist/sig/mod.js +5 -9
  131. package/dist/sig/owner.test.d.mts +2 -0
  132. package/dist/sig/{owner.test.js → owner.test.mjs} +19 -34
  133. package/dist/sig/proof.test.d.mts +2 -0
  134. package/dist/sig/{proof.test.js → proof.test.mjs} +16 -27
  135. package/dist/{std__assert-X-_kMxKM.js → std__assert-Duiq_YC9.mjs} +12 -24
  136. package/dist/testing/{mod.d.ts → mod.d.mts} +26 -90
  137. package/dist/testing/mod.mjs +6 -0
  138. package/dist/{transformers-3g8GZwkZ.cjs → transformers-NeAONrAq.cjs} +20 -25
  139. package/dist/{transformers-C3FLHUd6.js → transformers-ve6e2xcg.js} +3 -7
  140. package/dist/{types-CPz01LGH.js → types-DCP0WLdt.mjs} +4 -7
  141. package/dist/{types-Cd_hszr_.cjs → types-KC4QAoxe.cjs} +29 -34
  142. package/dist/{types-C93Ob9cU.js → types-hvL8ElAs.js} +8 -13
  143. package/dist/utils/docloader.test.d.mts +2 -0
  144. package/dist/utils/{docloader.test.js → docloader.test.mjs} +14 -25
  145. package/dist/utils/kv-cache.test.d.mts +2 -0
  146. package/dist/utils/{kv-cache.test.js → kv-cache.test.mjs} +25 -40
  147. package/dist/utils/mod.cjs +5 -9
  148. package/dist/utils/mod.d.cts +1 -3
  149. package/dist/utils/mod.d.ts +1 -3
  150. package/dist/utils/mod.js +4 -9
  151. package/dist/vocab/cjs.test.d.mts +2 -0
  152. package/dist/vocab/cjs.test.mjs +14 -0
  153. package/dist/vocab/mod.cjs +10 -12
  154. package/dist/vocab/mod.js +3 -5
  155. package/package.json +8 -8
  156. package/dist/compat/transformers.test.d.ts +0 -3
  157. package/dist/compat/transformers.test.js +0 -88
  158. package/dist/compat-Bb4NuTUO.js +0 -4
  159. package/dist/compat-DmDDELst.cjs +0 -4
  160. package/dist/deno-CnMqla6T.js +0 -121
  161. package/dist/federation/builder.test.d.ts +0 -3
  162. package/dist/federation/collection.test.d.ts +0 -3
  163. package/dist/federation/collection.test.js +0 -32
  164. package/dist/federation/handler.test.d.ts +0 -3
  165. package/dist/federation/idempotency.test.d.ts +0 -3
  166. package/dist/federation/inbox.test.d.ts +0 -3
  167. package/dist/federation/keycache.test.d.ts +0 -3
  168. package/dist/federation/kv.test.d.ts +0 -3
  169. package/dist/federation/middleware.test.d.ts +0 -3
  170. package/dist/federation/mq.test.d.ts +0 -3
  171. package/dist/federation/negotiation.test.d.ts +0 -3
  172. package/dist/federation/retry.test.d.ts +0 -3
  173. package/dist/federation/router.test.d.ts +0 -3
  174. package/dist/federation/send.test.d.ts +0 -3
  175. package/dist/federation/webfinger.test.d.ts +0 -3
  176. package/dist/federation-Bp3HI26G.cjs +0 -350
  177. package/dist/federation-DaMfqRm4.js +0 -332
  178. package/dist/middleware-B0kNQMO0.js +0 -27
  179. package/dist/middleware-BYQL9cdV.js +0 -12
  180. package/dist/middleware-DfNqksSs.cjs +0 -12
  181. package/dist/mod-B7QkWzrL.d.cts +0 -80
  182. package/dist/mod-Bh8mqlYw.d.cts +0 -9
  183. package/dist/mod-D6HodEq7.d.ts +0 -7
  184. package/dist/mod-SMHOMNpZ.d.ts +0 -82
  185. package/dist/mod-gq_Xfdz8.d.cts +0 -1
  186. package/dist/nodeinfo/client.test.d.ts +0 -3
  187. package/dist/nodeinfo/handler.test.d.ts +0 -3
  188. package/dist/nodeinfo/types.test.d.ts +0 -3
  189. package/dist/nodeinfo-DoESQxq5.js +0 -4
  190. package/dist/nodeinfo-DuMYTpbZ.cjs +0 -4
  191. package/dist/otel/exporter.test.d.ts +0 -3
  192. package/dist/runtime-c2Njxsry.cjs +0 -17
  193. package/dist/runtime-poamPCMb.js +0 -13
  194. package/dist/sig/accept.test.d.ts +0 -3
  195. package/dist/sig/http.test.d.ts +0 -3
  196. package/dist/sig/key.test.d.ts +0 -3
  197. package/dist/sig/ld.test.d.ts +0 -3
  198. package/dist/sig/owner.test.d.ts +0 -3
  199. package/dist/sig/proof.test.d.ts +0 -3
  200. package/dist/sig-BNhspNOf.js +0 -4
  201. package/dist/sig-vX39WyWI.cjs +0 -4
  202. package/dist/testing/mod.js +0 -10
  203. package/dist/utils/docloader.test.d.ts +0 -3
  204. package/dist/utils/kv-cache.test.d.ts +0 -3
  205. package/dist/utils-BQ9KqEK9.cjs +0 -4
  206. package/dist/utils-Dn5OPdSW.js +0 -4
  207. /package/dist/{mod-AGjRfPjT.d.ts → compat/transformers.test.d.mts} +0 -0
@@ -5,7 +5,6 @@ import { TracerProvider } from "@opentelemetry/api";
5
5
  import { DocumentLoader } from "@fedify/vocab-runtime";
6
6
 
7
7
  //#region src/sig/key.d.ts
8
-
9
8
  /**
10
9
  * Generates a key pair which is appropriate for Fedify.
11
10
  * @param algorithm The algorithm to use. Currently only RSASSA-PKCS1-v1_5 and
@@ -538,9 +537,5 @@ interface HttpMessageSignaturesSpecDeterminer {
538
537
  */
539
538
  rememberSpec(origin: string, spec: HttpMessageSignaturesSpec): void | Promise<void>;
540
539
  }
541
- /**
542
- * The options for double-knock requests.
543
- * @since 1.6.0
544
- */
545
540
  //#endregion
546
- export { AcceptSignatureMember, AcceptSignatureParameters, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignRequestOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, importJwk, parseAcceptSignature, signRequest, validateAcceptSignature, verifyRequest, verifyRequestDetailed };
541
+ export { exportJwk as C, importJwk as D, generateCryptoKeyPair as E, KeyCache as S, fetchKeyDetailed as T, validateAcceptSignature as _, VerifyRequestDetailedResult as a, FetchKeyOptions as b, signRequest as c, AcceptSignatureMember as d, AcceptSignatureParameters as f, parseAcceptSignature as g, fulfillAcceptSignature as h, SignRequestOptions as i, verifyRequest as l, formatAcceptSignature as m, HttpMessageSignaturesSpecDeterminer as n, VerifyRequestFailureReason as o, FulfillAcceptSignatureResult as p, Rfc9421SignRequestOptions as r, VerifyRequestOptions as s, HttpMessageSignaturesSpec as t, verifyRequestDetailed as u, FetchKeyDetailedResult as v, fetchKey as w, FetchKeyResult as x, FetchKeyErrorResult as y };
@@ -1,13 +1,10 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { deno_default } from "./deno-CnMqla6T.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { n as version, t as name } from "./deno-D682wzlW.mjs";
7
5
  import { Activity, getTypeId } from "@fedify/vocab";
8
- import { getLogger } from "@logtape/logtape";
9
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
10
-
7
+ import { getLogger } from "@logtape/logtape";
11
8
  //#region src/federation/inbox.ts
12
9
  var InboxListenerSet = class InboxListenerSet {
13
10
  #listeners;
@@ -53,10 +50,8 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
53
50
  const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
54
51
  const strategy = idempotencyStrategy ?? "per-inbox";
55
52
  let keyString;
56
- if (typeof strategy === "function") {
57
- const result = await strategy(inboxContext, activity);
58
- keyString = result;
59
- } else switch (strategy) {
53
+ if (typeof strategy === "function") keyString = await strategy(inboxContext, activity);
54
+ else switch (strategy) {
60
55
  case "global":
61
56
  keyString = activity.id.href;
62
57
  break;
@@ -71,8 +66,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
71
66
  if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
72
67
  }
73
68
  if (cacheKey != null) {
74
- const cached = await kv.get(cacheKey);
75
- if (cached === true) {
69
+ if (await kv.get(cacheKey) === true) {
76
70
  logger.debug("Activity {activityId} has already been processed.", {
77
71
  activityId: activity.id?.href,
78
72
  activity: json,
@@ -129,31 +123,30 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
129
123
  return "enqueued";
130
124
  }
131
125
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
132
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
133
- return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
126
+ return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span) => {
134
127
  const dispatched = inboxListeners?.dispatchWithClass(activity);
135
128
  if (dispatched == null) {
136
129
  logger.error("Unsupported activity type:\n{activity}", {
137
130
  activity: json,
138
131
  recipient
139
132
  });
140
- span$1.setStatus({
133
+ span.setStatus({
141
134
  code: SpanStatusCode.UNSET,
142
135
  message: `Unsupported activity type: ${getTypeId(activity).href}`
143
136
  });
144
- span$1.end();
137
+ span.end();
145
138
  return "unsupportedActivity";
146
139
  }
147
140
  const { class: cls, listener } = dispatched;
148
- span$1.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
141
+ span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
149
142
  try {
150
143
  await listener(inboxContextFactory(recipient, json, activity?.id?.href, getTypeId(activity).href), activity);
151
144
  } catch (error) {
152
145
  try {
153
146
  await inboxErrorHandler?.(ctx, error);
154
- } catch (error$1) {
147
+ } catch (error) {
155
148
  logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
156
- error: error$1,
149
+ error,
157
150
  activityId: activity.id?.href,
158
151
  activity: json,
159
152
  recipient
@@ -165,11 +158,11 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
165
158
  activity: json,
166
159
  recipient
167
160
  });
168
- span$1.setStatus({
161
+ span.setStatus({
169
162
  code: SpanStatusCode.ERROR,
170
163
  message: String(error)
171
164
  });
172
- span$1.end();
165
+ span.end();
173
166
  return "error";
174
167
  }
175
168
  if (cacheKey != null) await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
@@ -178,10 +171,9 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
178
171
  activity: json,
179
172
  recipient
180
173
  });
181
- span$1.end();
174
+ span.end();
182
175
  return "success";
183
176
  });
184
177
  }
185
-
186
178
  //#endregion
187
- export { InboxListenerSet, routeActivity };
179
+ export { routeActivity as n, InboxListenerSet as t };
@@ -1,14 +1,11 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { deno_default } from "./deno-CnMqla6T.js";
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { n as version, t as name } from "./deno-D682wzlW.mjs";
7
5
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
6
+ import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
7
  import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
9
8
  import { getLogger } from "@logtape/logtape";
10
- import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
11
-
12
9
  //#region src/sig/key.ts
13
10
  /**
14
11
  * Checks if the given key is valid and supported. No-op if the key is valid,
@@ -23,8 +20,7 @@ function validateCryptoKey(key, type) {
23
20
  if (!key.extractable) throw new TypeError("The key is not extractable.");
24
21
  if (key.algorithm.name !== "RSASSA-PKCS1-v1_5" && key.algorithm.name !== "Ed25519") throw new TypeError("Currently only RSASSA-PKCS1-v1_5 and Ed25519 keys are supported. More algorithms will be added in the future!");
25
22
  if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
26
- const algorithm = key.algorithm;
27
- if (algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
23
+ if (key.algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
28
24
  }
29
25
  }
30
26
  /**
@@ -91,8 +87,7 @@ async function importJwk(jwk, type) {
91
87
  }
92
88
  async function withFetchKeySpan(keyId, tracerProvider, fetcher) {
93
89
  tracerProvider ??= trace.getTracerProvider();
94
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
95
- return await tracer.startActiveSpan("activitypub.fetch_key", {
90
+ return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.fetch_key", {
96
91
  kind: SpanKind.CLIENT,
97
92
  attributes: {
98
93
  "http.method": "GET",
@@ -153,41 +148,41 @@ function fetchKey(keyId, cls, options = {}) {
153
148
  async function fetchKeyDetailed(keyId, cls, options = {}) {
154
149
  const cacheKey = typeof keyId === "string" ? new URL(keyId) : keyId;
155
150
  return await withFetchKeySpan(cacheKey, options.tracerProvider, async () => {
156
- return await fetchKeyWithResult(cacheKey, cls, options, async (cacheKey$1, keyId$1, keyCache, logger) => {
157
- const fetchError = await keyCache?.getFetchError?.(cacheKey$1);
151
+ return await fetchKeyWithResult(cacheKey, cls, options, async (cacheKey, keyId, keyCache, logger) => {
152
+ const fetchError = await keyCache?.getFetchError?.(cacheKey);
158
153
  if (fetchError != null) {
159
- logger.debug("Entry {keyId} found in cache with preserved fetch failure details.", { keyId: keyId$1 });
154
+ logger.debug("Entry {keyId} found in cache with preserved fetch failure details.", { keyId });
160
155
  return {
161
156
  key: null,
162
157
  cached: true,
163
158
  fetchError
164
159
  };
165
160
  }
166
- logger.debug("Entry {keyId} found in cache, but no fetch failure details are available.", { keyId: keyId$1 });
161
+ logger.debug("Entry {keyId} found in cache, but no fetch failure details are available.", { keyId });
167
162
  return {
168
163
  key: null,
169
164
  cached: true
170
165
  };
171
- }, async (error, cacheKey$1, keyId$1, keyCache, logger) => {
166
+ }, async (error, cacheKey, keyId, keyCache, logger) => {
172
167
  logger.debug("Failed to fetch key {keyId}.", {
173
- keyId: keyId$1,
168
+ keyId,
174
169
  error
175
170
  });
176
- await keyCache?.set(cacheKey$1, null);
171
+ await keyCache?.set(cacheKey, null);
177
172
  if (error instanceof FetchError && error.response != null) {
178
- const fetchError$1 = {
173
+ const fetchError = {
179
174
  status: error.response.status,
180
175
  response: error.response.clone()
181
176
  };
182
- await keyCache?.setFetchError?.(cacheKey$1, fetchError$1);
177
+ await keyCache?.setFetchError?.(cacheKey, fetchError);
183
178
  return {
184
179
  key: null,
185
180
  cached: false,
186
- fetchError: fetchError$1
181
+ fetchError
187
182
  };
188
183
  }
189
184
  const fetchError = { error: error instanceof Error ? error : new Error(String(error)) };
190
- await keyCache?.setFetchError?.(cacheKey$1, fetchError);
185
+ await keyCache?.setFetchError?.(cacheKey, fetchError);
191
186
  return {
192
187
  key: null,
193
188
  cached: false,
@@ -233,8 +228,8 @@ async function resolveFetchedKey(document, cacheKey, keyId, cls, { documentLoade
233
228
  contextLoader,
234
229
  tracerProvider
235
230
  });
236
- } catch (e$1) {
237
- if (e$1 instanceof TypeError) {
231
+ } catch (e) {
232
+ if (e instanceof TypeError) {
238
233
  logger.debug("Failed to verify; key {keyId} returned an invalid object.", { keyId });
239
234
  await keyCache?.set(cacheKey, null);
240
235
  await clearFetchErrorMetadata(cacheKey, keyCache);
@@ -243,7 +238,7 @@ async function resolveFetchedKey(document, cacheKey, keyId, cls, { documentLoade
243
238
  cached: false
244
239
  };
245
240
  }
246
- throw e$1;
241
+ throw e;
247
242
  }
248
243
  }
249
244
  let key = null;
@@ -324,37 +319,34 @@ async function fetchKeyWithResult(cacheKey, cls, options, onCachedUnavailable, o
324
319
  logger.debug("Fetching key {keyId} to verify signature...", { keyId });
325
320
  let document;
326
321
  try {
327
- const remoteDocument = await (options.documentLoader ?? getDocumentLoader())(keyId);
328
- document = remoteDocument.document;
322
+ document = (await (options.documentLoader ?? getDocumentLoader())(keyId)).document;
329
323
  } catch (error) {
330
324
  return await onFetchError(error, cacheKey, keyId, keyCache, logger);
331
325
  }
332
326
  return await resolveFetchedKey(document, cacheKey, keyId, cls, options, logger);
333
327
  }
334
328
  async function fetchKeyInternal(keyId, cls, options = {}) {
335
- const cacheKey = typeof keyId === "string" ? new URL(keyId) : keyId;
336
- return await fetchKeyWithResult(cacheKey, cls, options, (_cacheKey, _keyId, _keyCache, _logger) => {
329
+ return await fetchKeyWithResult(typeof keyId === "string" ? new URL(keyId) : keyId, cls, options, (_cacheKey, _keyId, _keyCache, _logger) => {
337
330
  return {
338
331
  key: null,
339
332
  cached: true
340
333
  };
341
- }, async (error, cacheKey$1, keyId$1, keyCache, logger) => {
334
+ }, async (error, cacheKey, keyId, keyCache, logger) => {
342
335
  logger.debug("Failed to fetch key {keyId}.", {
343
- keyId: keyId$1,
336
+ keyId,
344
337
  error
345
338
  });
346
- await keyCache?.set(cacheKey$1, null);
347
- if (error instanceof FetchError && error.response != null) await keyCache?.setFetchError?.(cacheKey$1, {
339
+ await keyCache?.set(cacheKey, null);
340
+ if (error instanceof FetchError && error.response != null) await keyCache?.setFetchError?.(cacheKey, {
348
341
  status: error.response.status,
349
342
  response: error.response.clone()
350
343
  });
351
- else await keyCache?.setFetchError?.(cacheKey$1, { error: error instanceof Error ? error : new Error(String(error)) });
344
+ else await keyCache?.setFetchError?.(cacheKey, { error: error instanceof Error ? error : new Error(String(error)) });
352
345
  return {
353
346
  key: null,
354
347
  cached: false
355
348
  };
356
349
  });
357
350
  }
358
-
359
351
  //#endregion
360
- export { exportJwk, fetchKey, fetchKeyDetailed, generateCryptoKeyPair, importJwk, validateCryptoKey };
352
+ export { importJwk as a, generateCryptoKeyPair as i, fetchKey as n, validateCryptoKey as o, fetchKeyDetailed as r, exportJwk as t };
@@ -1,10 +1,7 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
6
4
  import { CryptographicKey, Multikey } from "@fedify/vocab";
7
-
8
5
  //#region src/federation/keycache.ts
9
6
  var KvKeyCache = class {
10
7
  kv;
@@ -45,7 +42,7 @@ var KvKeyCache = class {
45
42
  return await Multikey.fromJsonLd(serialized, this.options);
46
43
  } catch {
47
44
  await this.kv.delete([...this.prefix, keyId.href]);
48
- return void 0;
45
+ return;
49
46
  }
50
47
  }
51
48
  }
@@ -75,7 +72,6 @@ var KvKeyCache = class {
75
72
  error.name = cached.errorName;
76
73
  return { error };
77
74
  }
78
- return void 0;
79
75
  }
80
76
  async setFetchError(keyId, error) {
81
77
  if (error == null) {
@@ -97,6 +93,5 @@ var KvKeyCache = class {
97
93
  }, { ttl: this.unavailableKeyTtl });
98
94
  }
99
95
  };
100
-
101
96
  //#endregion
102
- export { KvKeyCache };
97
+ export { KvKeyCache as t };
@@ -1,11 +1,8 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
6
4
  import { CryptographicKey, Multikey } from "@fedify/vocab";
7
5
  import { importSpki } from "@fedify/vocab-runtime";
8
-
9
6
  //#region src/testing/keys.ts
10
7
  const rsaPublicKey1 = new CryptographicKey({
11
8
  id: new URL("https://example.com/key"),
@@ -85,7 +82,7 @@ const rsaPublicKey3 = new CryptographicKey({
85
82
  "hash": "SHA-256"
86
83
  }, true, ["verify"])
87
84
  });
88
- const rsaMultikey4 = new Multikey({
85
+ new Multikey({
89
86
  id: new URL("https://example.com/person2#key3"),
90
87
  controller: new URL("https://example.com/person2"),
91
88
  publicKey: rsaPublicKey3.publicKey
@@ -119,6 +116,5 @@ const ed25519Multikey = new Multikey({
119
116
  controller: new URL("https://example.com/person2"),
120
117
  publicKey: ed25519PublicKey.publicKey
121
118
  });
122
-
123
119
  //#endregion
124
- export { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3, rsaPublicKey5 };
120
+ export { rsaPrivateKey3 as a, rsaPublicKey3 as c, rsaPrivateKey2 as i, rsaPublicKey5 as l, ed25519PrivateKey as n, rsaPublicKey1 as o, ed25519PublicKey as r, rsaPublicKey2 as s, ed25519Multikey as t };
@@ -107,4 +107,4 @@ declare class MemoryKvStore implements KvStore {
107
107
  list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
108
108
  }
109
109
  //#endregion
110
- export { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore };
110
+ export { MemoryKvStore as a, KvStoreSetOptions as i, KvStore as n, KvStoreListEntry as r, KvKey as t };
@@ -110,4 +110,4 @@ declare class MemoryKvStore implements KvStore {
110
110
  list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
111
111
  }
112
112
  //#endregion
113
- export { KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore };
113
+ export { MemoryKvStore as a, KvStoreSetOptions as i, KvStore as n, KvStoreListEntry as r, KvKey as t };
@@ -1,11 +1,8 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
6
4
  import { preloadedContexts } from "@fedify/vocab-runtime";
7
5
  import { getLogger } from "@logtape/logtape";
8
-
9
6
  //#region src/utils/kv-cache.ts
10
7
  const logger = getLogger([
11
8
  "fedify",
@@ -102,6 +99,5 @@ function matchRule(url, rules) {
102
99
  }
103
100
  return null;
104
101
  }
105
-
106
102
  //#endregion
107
- export { MockKvStore, kvCache };
103
+ export { kvCache as n, MockKvStore as t };
@@ -1,12 +1,9 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { doubleKnock, validateCryptoKey } from "./http-IFqEftoZ.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ import { d as validateCryptoKey, t as doubleKnock } from "./http-DhwEMhtv.js";
6
4
  import { getLogger } from "@logtape/logtape";
7
5
  import { curry } from "es-toolkit";
8
6
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
9
-
10
7
  //#region src/utils/docloader.ts
11
8
  const logger$1 = getLogger([
12
9
  "fedify",
@@ -36,19 +33,16 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, maxRedi
36
33
  });
37
34
  throw error;
38
35
  }
39
- const originalRequest = createActivityPubRequest(url, { userAgent });
40
- const response = await doubleKnock(originalRequest, identity, {
36
+ return getRemoteDocument(url, await doubleKnock(createActivityPubRequest(url, { userAgent }), identity, {
41
37
  maxRedirection,
42
38
  specDeterminer,
43
39
  log: curry(logRequest)(logger$1),
44
40
  tracerProvider,
45
41
  signal: options?.signal
46
- });
47
- return getRemoteDocument(url, response, load);
42
+ }), load);
48
43
  }
49
44
  return load;
50
45
  }
51
-
52
46
  //#endregion
53
47
  //#region src/utils/kv-cache.ts
54
48
  const logger = getLogger([
@@ -116,6 +110,5 @@ function matchRule(url, rules) {
116
110
  }
117
111
  return null;
118
112
  }
119
-
120
113
  //#endregion
121
- export { getAuthenticatedDocumentLoader, kvCache };
114
+ export { getAuthenticatedDocumentLoader as n, kvCache as t };
@@ -1,15 +1,12 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
5
- const require_chunk = require('./chunk-CGaQZ11T.cjs');
6
- const require_http = require('./http-BnsR906R.cjs');
7
- const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
8
- const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
9
- const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
10
-
1
+ const { Temporal } = require("@js-temporal/polyfill");
2
+ const { URLPattern } = require("urlpattern-polyfill");
3
+ require("./chunk-DDcVe30Y.cjs");
4
+ const require_http = require("./http-BQccxQlj.cjs");
5
+ let _logtape_logtape = require("@logtape/logtape");
6
+ let es_toolkit = require("es-toolkit");
7
+ let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
11
8
  //#region src/utils/docloader.ts
12
- const logger$1 = (0, __logtape_logtape.getLogger)([
9
+ const logger$1 = (0, _logtape_logtape.getLogger)([
13
10
  "fedify",
14
11
  "utils",
15
12
  "docloader"
@@ -29,30 +26,27 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, maxRedi
29
26
  require_http.validateCryptoKey(identity.privateKey);
30
27
  async function load(url, options) {
31
28
  if (!allowPrivateAddress) try {
32
- await (0, __fedify_vocab_runtime.validatePublicUrl)(url);
29
+ await (0, _fedify_vocab_runtime.validatePublicUrl)(url);
33
30
  } catch (error) {
34
- if (error instanceof __fedify_vocab_runtime.UrlError) logger$1.error("Disallowed private URL: {url}", {
31
+ if (error instanceof _fedify_vocab_runtime.UrlError) logger$1.error("Disallowed private URL: {url}", {
35
32
  url,
36
33
  error
37
34
  });
38
35
  throw error;
39
36
  }
40
- const originalRequest = (0, __fedify_vocab_runtime.createActivityPubRequest)(url, { userAgent });
41
- const response = await require_http.doubleKnock(originalRequest, identity, {
37
+ return (0, _fedify_vocab_runtime.getRemoteDocument)(url, await require_http.doubleKnock((0, _fedify_vocab_runtime.createActivityPubRequest)(url, { userAgent }), identity, {
42
38
  maxRedirection,
43
39
  specDeterminer,
44
- log: (0, es_toolkit.curry)(__fedify_vocab_runtime.logRequest)(logger$1),
40
+ log: (0, es_toolkit.curry)(_fedify_vocab_runtime.logRequest)(logger$1),
45
41
  tracerProvider,
46
42
  signal: options?.signal
47
- });
48
- return (0, __fedify_vocab_runtime.getRemoteDocument)(url, response, load);
43
+ }), load);
49
44
  }
50
45
  return load;
51
46
  }
52
-
53
47
  //#endregion
54
48
  //#region src/utils/kv-cache.ts
55
- const logger = (0, __logtape_logtape.getLogger)([
49
+ const logger = (0, _logtape_logtape.getLogger)([
56
50
  "fedify",
57
51
  "utils",
58
52
  "kv-cache"
@@ -67,11 +61,11 @@ function kvCache({ loader, kv, prefix, rules }) {
67
61
  rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
68
62
  for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
69
63
  return async (url, options) => {
70
- if (url in __fedify_vocab_runtime.preloadedContexts) {
64
+ if (url in _fedify_vocab_runtime.preloadedContexts) {
71
65
  logger.debug("Using preloaded context: {url}.", { url });
72
66
  return {
73
67
  contextUrl: null,
74
- document: __fedify_vocab_runtime.preloadedContexts[url],
68
+ document: _fedify_vocab_runtime.preloadedContexts[url],
75
69
  documentUrl: url
76
70
  };
77
71
  }
@@ -117,17 +111,16 @@ function matchRule(url, rules) {
117
111
  }
118
112
  return null;
119
113
  }
120
-
121
114
  //#endregion
122
- Object.defineProperty(exports, 'getAuthenticatedDocumentLoader', {
123
- enumerable: true,
124
- get: function () {
125
- return getAuthenticatedDocumentLoader;
126
- }
115
+ Object.defineProperty(exports, "getAuthenticatedDocumentLoader", {
116
+ enumerable: true,
117
+ get: function() {
118
+ return getAuthenticatedDocumentLoader;
119
+ }
120
+ });
121
+ Object.defineProperty(exports, "kvCache", {
122
+ enumerable: true,
123
+ get: function() {
124
+ return kvCache;
125
+ }
127
126
  });
128
- Object.defineProperty(exports, 'kvCache', {
129
- enumerable: true,
130
- get: function () {
131
- return kvCache;
132
- }
133
- });
@@ -1,10 +1,7 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
6
4
  import { isEqual } from "es-toolkit";
7
-
8
5
  //#region src/federation/kv.ts
9
6
  /**
10
7
  * A key–value store that stores values in memory.
@@ -57,8 +54,8 @@ var MemoryKvStore = class {
57
54
  let currentValue;
58
55
  if (entry == null) currentValue = void 0;
59
56
  else {
60
- const [value, expiration$1] = entry;
61
- if (expiration$1 != null && Temporal.Now.instant().until(expiration$1).sign < 0) {
57
+ const [value, expiration] = entry;
58
+ if (expiration != null && Temporal.Now.instant().until(expiration).sign < 0) {
62
59
  delete this.#values[encodedKey];
63
60
  currentValue = void 0;
64
61
  } else currentValue = value;
@@ -91,6 +88,5 @@ var MemoryKvStore = class {
91
88
  }
92
89
  }
93
90
  };
94
-
95
91
  //#endregion
96
- export { MemoryKvStore };
92
+ export { MemoryKvStore as t };