@fedify/fedify 1.9.6 → 1.9.7

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 (274) hide show
  1. package/dist/{actor-CEGEmRll.js → actor-B3mkavdq.js} +1205 -2768
  2. package/dist/{actor-Ydzhc8dj.d.cts → actor-Be-68iJP.d.cts} +3 -3
  3. package/dist/{actor-C1Euqngb.d.ts → actor-C5AY0Tno.d.ts} +3 -3
  4. package/dist/{actor-DlS-Q8hE.cjs → actor-CsvteFj1.cjs} +3112 -4674
  5. package/dist/{actor-DbpZ6pzg.js → actor-DeUOMMMQ.mjs} +8 -15
  6. package/dist/{assert-MZs1qjMx.js → assert-DikXweDx.mjs} +5 -9
  7. package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
  8. package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
  9. package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-C50x8tnw.mjs} +5 -9
  10. package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
  11. package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-CJC9ThS-.mjs} +6 -11
  12. package/dist/{assert_throws-BOO88avQ.js → assert_throws-BIL7gChy.mjs} +6 -10
  13. package/dist/{authdocloader-DUQcOTRS.js → authdocloader-BKq994CV.mjs} +9 -14
  14. package/dist/{authdocloader-BLqMyboS.js → authdocloader-C3_-i4Zk.js} +8 -15
  15. package/dist/{authdocloader-CT_V4Z7G.cjs → authdocloader-tagnJZ6u.cjs} +14 -22
  16. package/dist/{builder-BO61xeXE.js → builder-CnVAhip1.mjs} +31 -40
  17. package/dist/{client-UG5wpNhG.js → client-Bza9SeZS.mjs} +11 -15
  18. package/dist/{client-DF8anIB5.d.ts → client-D8OSiPBT.d.ts} +2 -2
  19. package/dist/{client-DjT_tegg.d.cts → client-T0VFOdMw.d.cts} +2 -2
  20. package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
  21. package/dist/compat/mod.cjs +5 -8
  22. package/dist/compat/mod.d.cts +78 -12
  23. package/dist/compat/mod.d.ts +78 -12
  24. package/dist/compat/mod.js +4 -8
  25. package/dist/compat/transformers.test.mjs +62 -0
  26. package/dist/{context-CwUAkopp.d.cts → context-CACMqDzl.d.cts} +33 -26
  27. package/dist/{context-CXUibY4L.d.ts → context-K4cCphQj.d.ts} +33 -26
  28. package/dist/{denokv-Bv33Xxea.js → denokv-CoSB_Eps.mjs} +22 -11
  29. package/dist/{docloader-BIFI3OS7.cjs → docloader-Co-tW1B6.cjs} +112 -212
  30. package/dist/{docloader-CxWcuWqQ.d.ts → docloader-DSaLRXEA.d.ts} +2 -7
  31. package/dist/{docloader-fJgJeqiX.js → docloader-Dlo9EMTn.js} +17 -151
  32. package/dist/{docloader-D-MrRyHl.d.cts → docloader-DpGRDZrn.d.cts} +2 -7
  33. package/dist/{esm-C1EfGjSS.js → esm-BLERAZrI.mjs} +49 -85
  34. package/dist/federation/{builder.test.js → builder.test.mjs} +22 -41
  35. package/dist/federation/collection.test.d.mts +2 -0
  36. package/dist/federation/collection.test.mjs +21 -0
  37. package/dist/federation/handler.test.d.mts +2 -0
  38. package/dist/federation/{handler.test.js → handler.test.mjs} +22 -49
  39. package/dist/federation/idempotency.test.d.mts +2 -0
  40. package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +29 -59
  41. package/dist/federation/inbox.test.d.mts +2 -0
  42. package/dist/federation/{inbox.test.js → inbox.test.mjs} +10 -15
  43. package/dist/federation/keycache.test.d.mts +2 -0
  44. package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -18
  45. package/dist/federation/kv.test.d.mts +2 -0
  46. package/dist/federation/{kv.test.js → kv.test.mjs} +9 -20
  47. package/dist/federation/middleware.test.d.mts +2 -0
  48. package/dist/federation/{middleware.test.js → middleware.test.mjs} +128 -197
  49. package/dist/federation/mod.cjs +223 -21
  50. package/dist/federation/mod.d.cts +4 -13
  51. package/dist/federation/mod.d.ts +4 -13
  52. package/dist/federation/mod.js +218 -18
  53. package/dist/federation/mq.test.d.mts +2 -0
  54. package/dist/federation/{mq.test.js → mq.test.mjs} +23 -38
  55. package/dist/federation/retry.test.d.mts +2 -0
  56. package/dist/federation/{retry.test.js → retry.test.mjs} +9 -14
  57. package/dist/federation/router.test.d.mts +2 -0
  58. package/dist/federation/{router.test.js → router.test.mjs} +12 -19
  59. package/dist/federation/send.test.d.mts +2 -0
  60. package/dist/federation/{send.test.js → send.test.mjs} +17 -26
  61. package/dist/{http-wsGR6KkT.d.ts → http-BZpls--H.d.ts} +5 -9
  62. package/dist/{http-B1_DzfAU.d.cts → http-C7WoprmE.d.cts} +5 -9
  63. package/dist/{http-BgopPF-8.cjs → http-cvQMgiFd.cjs} +51 -68
  64. package/dist/{http-CR-Eg1Uq.js → http-hFXuPP4j.mjs} +16 -32
  65. package/dist/{http-05HxN-lp.js → http-z-J6i29D.js} +17 -33
  66. package/dist/{inbox-DcJN1cxM.js → inbox-B0NdZv6Q.mjs} +17 -25
  67. package/dist/{key-DjS1X9TG.cjs → key-B2ZqbGDP.cjs} +42 -50
  68. package/dist/key-BfH9JUMQ.cjs +4 -0
  69. package/dist/{key-ibMO03_0.js → key-ByblW_7f.mjs} +12 -18
  70. package/dist/{key-CPJcJjp-.js → key-DPg0mibt.js} +19 -19
  71. package/dist/key-USCeSjWo.mjs +5 -0
  72. package/dist/{keycache-CMUfqYqr.js → keycache-qGjtNwWK.mjs} +6 -10
  73. package/dist/{keys-IZ5050fT.js → keys-D48z4zQE.mjs} +6 -10
  74. package/dist/{kv-C7sopW2E.d.ts → kv-Bq9QLKm5.d.ts} +1 -1
  75. package/dist/{kv-CRZrzyXm.js → kv-DM1zFCtL.mjs} +6 -10
  76. package/dist/{kv-63Cil1MD.d.cts → kv-GIrOktyG.d.cts} +1 -1
  77. package/dist/{ld-DHNA2RSQ.js → ld-Bk-CiTUe.mjs} +17 -31
  78. package/dist/{lookup-BMAWLsP2.js → lookup-B-LJhUtc.mjs} +8 -17
  79. package/dist/{lookup-C4_dVYz7.cjs → lookup-C6EHvNN7.cjs} +16 -23
  80. package/dist/{lookup-CKZfuyxA.js → lookup-CuDOZqcB.js} +5 -11
  81. package/dist/{middleware-ODfDRN3q.js → middleware-Cns1QUI8.js} +348 -392
  82. package/dist/middleware-DYNDkDz7.mjs +5 -0
  83. package/dist/middleware-SP7rhp6I.cjs +4 -0
  84. package/dist/{middleware-CGbvIGvy.cjs → middleware-UNqaTRBe.cjs} +493 -546
  85. package/dist/{middleware-DrhEvfTo.js → middleware-xIvAtsQ9.mjs} +275 -320
  86. package/dist/{mod-CDObsV1d.d.ts → mod-BSwc3_rD.d.ts} +3 -3
  87. package/dist/{mod-DBzN0aCM.d.ts → mod-BTNpXcPj.d.ts} +2 -2
  88. package/dist/{mod-fjqfsrty.d.cts → mod-Chb_NKPp.d.cts} +4 -4
  89. package/dist/{mod-DgcYoyZK.d.ts → mod-DHoc3toL.d.ts} +4 -4
  90. package/dist/{mod-jQ4OODsl.d.cts → mod-DIMx6YjJ.d.cts} +2 -2
  91. package/dist/{mod-BUbqxBev.d.cts → mod-HElaq2UB.d.cts} +3 -3
  92. package/dist/mod.cjs +31 -33
  93. package/dist/mod.d.cts +15 -17
  94. package/dist/mod.d.ts +15 -17
  95. package/dist/mod.js +20 -23
  96. package/dist/{mq-B7R1Q-M5.d.cts → mq-CrItclRD.d.cts} +1 -1
  97. package/dist/{mq-CRGm1e_F.d.ts → mq-D_ZZRdby.d.ts} +1 -1
  98. package/dist/nodeinfo/client.test.d.mts +2 -0
  99. package/dist/nodeinfo/{client.test.js → client.test.mjs} +23 -45
  100. package/dist/nodeinfo/handler.test.d.mts +2 -0
  101. package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +14 -43
  102. package/dist/nodeinfo/mod.cjs +5 -9
  103. package/dist/nodeinfo/mod.d.cts +2 -5
  104. package/dist/nodeinfo/mod.d.ts +2 -5
  105. package/dist/nodeinfo/mod.js +4 -9
  106. package/dist/nodeinfo/semver.test.d.mts +2 -0
  107. package/dist/nodeinfo/{semver.test.js → semver.test.mjs} +28 -51
  108. package/dist/nodeinfo/types.test.d.mts +2 -0
  109. package/dist/nodeinfo/{types.test.js → types.test.mjs} +10 -21
  110. package/dist/{owner-DDHsHYQO.js → owner-CkmuWs8s.mjs} +10 -13
  111. package/dist/{owner-BbeUDvOu.d.ts → owner-DPAPnB0R.d.ts} +4 -4
  112. package/dist/{owner-6KSEp9eV.d.cts → owner-_rFs0ik_.d.cts} +4 -4
  113. package/dist/{proof-V1uQaB2y.js → proof-BBEQdN7B.js} +33 -57
  114. package/dist/{proof-exgGRW88.js → proof-DVFzuYOq.mjs} +20 -32
  115. package/dist/{proof-CX7ujFFX.cjs → proof-DiFRNymC.cjs} +112 -135
  116. package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
  117. package/dist/rolldown-runtime-C7fyD9f2.js +15 -0
  118. package/dist/runtime/authdocloader.test.d.mts +2 -0
  119. package/dist/runtime/{authdocloader.test.js → authdocloader.test.mjs} +16 -28
  120. package/dist/runtime/docloader.test.d.mts +2 -0
  121. package/dist/runtime/{docloader.test.js → docloader.test.mjs} +52 -72
  122. package/dist/runtime/key.test.d.mts +2 -0
  123. package/dist/runtime/{key.test.js → key.test.mjs} +27 -57
  124. package/dist/runtime/langstr.test.d.mts +2 -0
  125. package/dist/runtime/{langstr.test.js → langstr.test.mjs} +9 -19
  126. package/dist/runtime/link.test.d.mts +2 -0
  127. package/dist/runtime/{link.test.js → link.test.mjs} +7 -11
  128. package/dist/runtime/mod.cjs +7 -13
  129. package/dist/runtime/mod.d.cts +103 -6
  130. package/dist/runtime/mod.d.ts +103 -6
  131. package/dist/runtime/mod.js +6 -13
  132. package/dist/runtime/multibase/multibase.test.d.mts +2 -0
  133. package/dist/runtime/multibase/{multibase.test.js → multibase.test.mjs} +16 -33
  134. package/dist/runtime/url.test.d.mts +2 -0
  135. package/dist/runtime/{url.test.js → url.test.mjs} +10 -15
  136. package/dist/{semver-dArNLkR9.js → semver-CgD82xxg.mjs} +13 -28
  137. package/dist/{send-BfMYakUE.js → send-BsKuGBh0.mjs} +7 -12
  138. package/dist/sig/http.test.d.mts +2 -0
  139. package/dist/sig/{http.test.js → http.test.mjs} +119 -203
  140. package/dist/sig/key.test.d.mts +2 -0
  141. package/dist/sig/{key.test.js → key.test.mjs} +13 -22
  142. package/dist/sig/ld.test.d.mts +2 -0
  143. package/dist/sig/{ld.test.js → ld.test.mjs} +24 -39
  144. package/dist/sig/mod.cjs +7 -13
  145. package/dist/sig/mod.d.cts +3 -7
  146. package/dist/sig/mod.d.ts +3 -7
  147. package/dist/sig/mod.js +6 -13
  148. package/dist/sig/owner.test.d.mts +2 -0
  149. package/dist/sig/owner.test.mjs +39 -0
  150. package/dist/sig/proof.test.d.mts +2 -0
  151. package/dist/sig/{proof.test.js → proof.test.mjs} +18 -31
  152. package/dist/{std__assert-X-_kMxKM.js → std__assert-2v7gYiZp.mjs} +13 -24
  153. package/dist/testing/docloader.test.d.mts +2 -0
  154. package/dist/testing/docloader.test.mjs +12 -0
  155. package/dist/testing/{mod.d.ts → mod.d.mts} +371 -541
  156. package/dist/testing/mod.mjs +5 -0
  157. package/dist/{testing-RPOc_gVG.js → testing-8TvaN83G.mjs} +27 -35
  158. package/dist/{transformers-BFT6d7J5.js → transformers-BV4OeK9o.js} +3 -7
  159. package/dist/{transformers-CoBS-oFG.cjs → transformers-C2P5eKUT.cjs} +20 -25
  160. package/dist/{types-Cptev2nt.js → types-BK9bojU0.js} +18 -36
  161. package/dist/{types-BIgY6c-l.js → types-CAnkAQGM.mjs} +5 -9
  162. package/dist/{types-CGnM1vft.cjs → types-D4VM3B7I.cjs} +45 -64
  163. package/dist/vocab/actor.test.d.mts +2 -0
  164. package/dist/vocab/{actor.test.js → actor.test.mjs} +308 -550
  165. package/dist/vocab/cjs.test.d.mts +2 -0
  166. package/dist/vocab/cjs.test.mjs +14 -0
  167. package/dist/vocab/lookup.test.d.mts +2 -0
  168. package/dist/vocab/{lookup.test.js → lookup.test.mjs} +29 -45
  169. package/dist/vocab/mod.cjs +251 -16
  170. package/dist/vocab/mod.d.cts +3 -5
  171. package/dist/vocab/mod.d.ts +3 -5
  172. package/dist/vocab/mod.js +244 -10
  173. package/dist/vocab/type.test.d.mts +2 -0
  174. package/dist/vocab/type.test.mjs +16 -0
  175. package/dist/vocab/vocab.test.d.mts +2 -0
  176. package/dist/vocab/{vocab.test.js → vocab.test.mjs} +178 -311
  177. package/dist/{vocab-CDHNj5zp.d.ts → vocab-BLvSEtuz.d.cts} +2 -4
  178. package/dist/{type-COPv6pMi.js → vocab-DuJO9k13.mjs} +1177 -2871
  179. package/dist/{vocab-Cfs0937i.d.cts → vocab-lhCS9lzq.d.ts} +4 -2
  180. package/dist/webfinger/handler.test.d.mts +2 -0
  181. package/dist/webfinger/{handler.test.js → handler.test.mjs} +23 -56
  182. package/dist/webfinger/lookup.test.d.mts +2 -0
  183. package/dist/webfinger/{lookup.test.js → lookup.test.mjs} +13 -27
  184. package/dist/webfinger/mod.cjs +5 -9
  185. package/dist/webfinger/mod.d.cts +1 -3
  186. package/dist/webfinger/mod.d.ts +1 -3
  187. package/dist/webfinger/mod.js +4 -9
  188. package/dist/x/cfworkers.cjs +25 -14
  189. package/dist/x/cfworkers.d.cts +33 -6
  190. package/dist/x/cfworkers.d.ts +33 -6
  191. package/dist/x/cfworkers.js +22 -12
  192. package/dist/x/cfworkers.test.d.mts +2 -0
  193. package/dist/x/{cfworkers.test.js → cfworkers.test.mjs} +28 -26
  194. package/dist/x/hono.cjs +25 -14
  195. package/dist/x/hono.d.cts +1 -11
  196. package/dist/x/hono.d.ts +1 -11
  197. package/dist/x/hono.js +22 -12
  198. package/dist/x/sveltekit.cjs +23 -12
  199. package/dist/x/sveltekit.d.cts +1 -11
  200. package/dist/x/sveltekit.d.ts +1 -11
  201. package/dist/x/sveltekit.js +20 -10
  202. package/package.json +2 -2
  203. package/dist/chunk-DqRYRqnO.cjs +0 -34
  204. package/dist/compat/transformers.test.d.ts +0 -3
  205. package/dist/compat/transformers.test.js +0 -86
  206. package/dist/compat-DmDDELst.cjs +0 -4
  207. package/dist/compat-nxUqe4Z-.js +0 -4
  208. package/dist/federation/builder.test.d.ts +0 -3
  209. package/dist/federation/collection.test.d.ts +0 -3
  210. package/dist/federation/collection.test.js +0 -35
  211. package/dist/federation/handler.test.d.ts +0 -3
  212. package/dist/federation/idempotency.test.d.ts +0 -3
  213. package/dist/federation/inbox.test.d.ts +0 -3
  214. package/dist/federation/keycache.test.d.ts +0 -3
  215. package/dist/federation/kv.test.d.ts +0 -3
  216. package/dist/federation/middleware.test.d.ts +0 -3
  217. package/dist/federation/mq.test.d.ts +0 -3
  218. package/dist/federation/retry.test.d.ts +0 -3
  219. package/dist/federation/router.test.d.ts +0 -3
  220. package/dist/federation/send.test.d.ts +0 -3
  221. package/dist/federation-D1U8YY9t.js +0 -226
  222. package/dist/federation-H2_En3j5.cjs +0 -244
  223. package/dist/key-BCUd8FWp.js +0 -10
  224. package/dist/key-BUardnTH.cjs +0 -10
  225. package/dist/key-Dr6H_e3K.js +0 -10
  226. package/dist/middleware-BJ83veqi.js +0 -26
  227. package/dist/middleware-CJ4W2ir5.cjs +0 -17
  228. package/dist/middleware-Ve2mHJgo.js +0 -17
  229. package/dist/mod-BcObK1Lz.d.ts +0 -82
  230. package/dist/mod-C2tOeRkN.d.cts +0 -1
  231. package/dist/mod-CIbqfZW0.d.ts +0 -104
  232. package/dist/mod-Dt-G9ZOS.d.cts +0 -102
  233. package/dist/mod-FZd39qVq.d.cts +0 -1
  234. package/dist/mod-mXx9V0q5.d.cts +0 -80
  235. package/dist/nodeinfo/client.test.d.ts +0 -3
  236. package/dist/nodeinfo/handler.test.d.ts +0 -3
  237. package/dist/nodeinfo/semver.test.d.ts +0 -3
  238. package/dist/nodeinfo/types.test.d.ts +0 -3
  239. package/dist/nodeinfo-Co9lJrWl.cjs +0 -4
  240. package/dist/nodeinfo-DfycQ8Wf.js +0 -4
  241. package/dist/runtime/authdocloader.test.d.ts +0 -3
  242. package/dist/runtime/docloader.test.d.ts +0 -3
  243. package/dist/runtime/key.test.d.ts +0 -3
  244. package/dist/runtime/langstr.test.d.ts +0 -3
  245. package/dist/runtime/link.test.d.ts +0 -3
  246. package/dist/runtime/multibase/multibase.test.d.ts +0 -3
  247. package/dist/runtime/url.test.d.ts +0 -3
  248. package/dist/runtime-C58AJWSv.cjs +0 -4
  249. package/dist/runtime-DPYEDf-o.js +0 -4
  250. package/dist/sig/http.test.d.ts +0 -3
  251. package/dist/sig/key.test.d.ts +0 -3
  252. package/dist/sig/ld.test.d.ts +0 -3
  253. package/dist/sig/owner.test.d.ts +0 -3
  254. package/dist/sig/owner.test.js +0 -52
  255. package/dist/sig/proof.test.d.ts +0 -3
  256. package/dist/sig-ByHXzqUi.cjs +0 -4
  257. package/dist/sig-Cj3tk-ig.js +0 -4
  258. package/dist/testing/docloader.test.d.ts +0 -3
  259. package/dist/testing/docloader.test.js +0 -24
  260. package/dist/testing/mod.js +0 -10
  261. package/dist/vocab/actor.test.d.ts +0 -3
  262. package/dist/vocab/lookup.test.d.ts +0 -3
  263. package/dist/vocab/type.test.d.ts +0 -3
  264. package/dist/vocab/type.test.js +0 -25
  265. package/dist/vocab/vocab.test.d.ts +0 -3
  266. package/dist/vocab-BFy1CS5L.cjs +0 -289
  267. package/dist/vocab-BPFiQ650.js +0 -253
  268. package/dist/webfinger/handler.test.d.ts +0 -3
  269. package/dist/webfinger/lookup.test.d.ts +0 -3
  270. package/dist/webfinger-BjOEdFPs.cjs +0 -4
  271. package/dist/webfinger-De_bU0iE.js +0 -4
  272. package/dist/x/cfworkers.test.d.ts +0 -3
  273. /package/dist/{mod-1pDWKvUL.d.ts → compat/transformers.test.d.mts} +0 -0
  274. /package/dist/{mod-g0xFzAP9.d.ts → federation/builder.test.d.mts} +0 -0
@@ -1,17 +1,14 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { FetchError, deno_default } from "./docloader-fJgJeqiX.js";
6
- import { CryptographicKey } from "./actor-CEGEmRll.js";
7
- import { fetchKey, validateCryptoKey } from "./key-ibMO03_0.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { G as FetchError, ot as name, s as CryptographicKey, st as version } from "./vocab-DuJO9k13.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-ByblW_7f.mjs";
8
6
  import { getLogger } from "@logtape/logtape";
9
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
8
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
9
  import { encodeHex } from "byte-encodings/hex";
12
10
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
13
11
  import { Item, decodeDict, encodeItem } from "structured-field-values";
14
-
15
12
  //#region src/sig/http.ts
16
13
  const DEFAULT_MAX_REDIRECTION = 20;
17
14
  /**
@@ -25,9 +22,7 @@ const DEFAULT_MAX_REDIRECTION = 20;
25
22
  */
26
23
  async function signRequest(request, privateKey, keyId, options = {}) {
27
24
  validateCryptoKey(privateKey, "private");
28
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
29
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
30
- return await tracer.startActiveSpan("http_signatures.sign", async (span) => {
25
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
31
26
  try {
32
27
  const spec = options.spec ?? "draft-cavage-http-signatures-12";
33
28
  let signed;
@@ -122,9 +117,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
122
117
  * @returns The formatted signature string.
123
118
  */
124
119
  function formatRfc9421Signature(signature, components, parameters) {
125
- const signatureInputValue = `sig1=("${components.join("\" \"")}");${parameters}`;
126
- const signatureValue = `sig1=:${encodeBase64(signature)}:`;
127
- return [signatureInputValue, signatureValue];
120
+ return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
128
121
  }
129
122
  /**
130
123
  * Parse RFC 9421 Signature-Input header.
@@ -254,9 +247,7 @@ const supportedHashAlgorithms = {
254
247
  * could not be verified.
255
248
  */
256
249
  async function verifyRequest(request, options = {}) {
257
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
258
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
259
- return await tracer.startActiveSpan("http_signatures.verify", async (span) => {
250
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
260
251
  if (span.isRecording()) {
261
252
  span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
262
253
  span.setAttribute(ATTR_URL_FULL, request.url);
@@ -446,8 +437,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
446
437
  const message = headerNames.map((name) => `${name}: ` + (name === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name === "(created)" ? sigValues.created ?? "" : name === "(expires)" ? sigValues.expires ?? "" : name === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name))).join("\n");
447
438
  const sig = decodeBase64(signature);
448
439
  span?.setAttribute("http_signatures.signature", encodeHex(sig));
449
- const verified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message));
450
- if (!verified) {
440
+ if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
451
441
  if (cached) {
452
442
  logger.debug("Failed to verify with the cached key {keyId}; signature {signature} is invalid. Retrying with the freshly fetched key...", {
453
443
  keyId,
@@ -461,7 +451,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
461
451
  currentTime,
462
452
  keyCache: {
463
453
  get: () => Promise.resolve(void 0),
464
- set: async (keyId$1, key$1) => await keyCache?.set(keyId$1, key$1)
454
+ set: async (keyId, key) => await keyCache?.set(keyId, key)
465
455
  }
466
456
  });
467
457
  }
@@ -611,9 +601,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
611
601
  logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
612
602
  continue;
613
603
  }
614
- const body = await request.arrayBuffer();
615
- const digestValid = await verifyRfc9421ContentDigest(contentDigestHeader, body);
616
- if (!digestValid) {
604
+ if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
617
605
  logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
618
606
  continue;
619
607
  }
@@ -659,8 +647,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
659
647
  const signatureBaseBytes = new TextEncoder().encode(signatureBase);
660
648
  span?.setAttribute("http_signatures.signature", encodeHex(sigBytes));
661
649
  try {
662
- const verified = await crypto.subtle.verify(algorithm, key.publicKey, sigBytes.slice(), signatureBaseBytes);
663
- if (verified) {
650
+ if (await crypto.subtle.verify(algorithm, key.publicKey, sigBytes.slice(), signatureBaseBytes)) {
664
651
  validKey = key;
665
652
  break;
666
653
  } else if (cached) {
@@ -672,7 +659,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
672
659
  currentTime,
673
660
  keyCache: {
674
661
  get: () => Promise.resolve(void 0),
675
- set: async (keyId, key$1) => await keyCache?.set(keyId, key$1)
662
+ set: async (keyId, key) => await keyCache?.set(keyId, key)
676
663
  },
677
664
  spec: "rfc9421"
678
665
  });
@@ -745,8 +732,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
745
732
  });
746
733
  if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
747
734
  if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
748
- const location = response.headers.get("Location");
749
- const redirectRequest = createRedirectRequest(request, location, body);
735
+ const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
750
736
  if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
751
737
  return doubleKnockInternal(redirectRequest, identity, {
752
738
  ...options,
@@ -776,8 +762,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
776
762
  });
777
763
  if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
778
764
  if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
779
- const location = response.headers.get("Location");
780
- const redirectRequest = createRedirectRequest(request, location, body);
765
+ const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
781
766
  if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
782
767
  return doubleKnockInternal(redirectRequest, identity, {
783
768
  ...options,
@@ -814,6 +799,5 @@ function timingSafeEqual(a, b) {
814
799
  result |= lenA ^ lenB;
815
800
  return result === 0;
816
801
  }
817
-
818
802
  //#endregion
819
- export { doubleKnock, signRequest, verifyRequest };
803
+ export { parseRfc9421Signature as a, timingSafeEqual as c, formatRfc9421SignatureParameters as i, verifyRequest as l, doubleKnock as n, parseRfc9421SignatureInput as o, formatRfc9421Signature as r, signRequest as s, createRfc9421SignatureBase as t };
@@ -1,17 +1,14 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { CryptographicKey, FetchError, deno_default } from "./type-COPv6pMi.js";
7
- import { fetchKey, validateCryptoKey } from "./key-CPJcJjp-.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ import { d as name, f as version, t as FetchError } from "./docloader-Dlo9EMTn.js";
4
+ import { y as CryptographicKey } from "./actor-B3mkavdq.js";
5
+ import { n as fetchKey, o as validateCryptoKey } from "./key-DPg0mibt.js";
8
6
  import { getLogger } from "@logtape/logtape";
9
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
- import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
11
8
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
12
9
  import { encodeHex } from "byte-encodings/hex";
10
+ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
13
11
  import { Item, decodeDict, encodeItem } from "structured-field-values";
14
-
15
12
  //#region src/sig/http.ts
16
13
  const DEFAULT_MAX_REDIRECTION = 20;
17
14
  /**
@@ -25,9 +22,7 @@ const DEFAULT_MAX_REDIRECTION = 20;
25
22
  */
26
23
  async function signRequest(request, privateKey, keyId, options = {}) {
27
24
  validateCryptoKey(privateKey, "private");
28
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
29
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
30
- return await tracer.startActiveSpan("http_signatures.sign", async (span) => {
25
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
31
26
  try {
32
27
  const spec = options.spec ?? "draft-cavage-http-signatures-12";
33
28
  let signed;
@@ -122,9 +117,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
122
117
  * @returns The formatted signature string.
123
118
  */
124
119
  function formatRfc9421Signature(signature, components, parameters) {
125
- const signatureInputValue = `sig1=("${components.join("\" \"")}");${parameters}`;
126
- const signatureValue = `sig1=:${encodeBase64(signature)}:`;
127
- return [signatureInputValue, signatureValue];
120
+ return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
128
121
  }
129
122
  /**
130
123
  * Parse RFC 9421 Signature-Input header.
@@ -254,9 +247,7 @@ const supportedHashAlgorithms = {
254
247
  * could not be verified.
255
248
  */
256
249
  async function verifyRequest(request, options = {}) {
257
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
258
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
259
- return await tracer.startActiveSpan("http_signatures.verify", async (span) => {
250
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
260
251
  if (span.isRecording()) {
261
252
  span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
262
253
  span.setAttribute(ATTR_URL_FULL, request.url);
@@ -446,8 +437,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
446
437
  const message = headerNames.map((name) => `${name}: ` + (name === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name === "(created)" ? sigValues.created ?? "" : name === "(expires)" ? sigValues.expires ?? "" : name === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name))).join("\n");
447
438
  const sig = decodeBase64(signature);
448
439
  span?.setAttribute("http_signatures.signature", encodeHex(sig));
449
- const verified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message));
450
- if (!verified) {
440
+ if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
451
441
  if (cached) {
452
442
  logger.debug("Failed to verify with the cached key {keyId}; signature {signature} is invalid. Retrying with the freshly fetched key...", {
453
443
  keyId,
@@ -461,7 +451,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
461
451
  currentTime,
462
452
  keyCache: {
463
453
  get: () => Promise.resolve(void 0),
464
- set: async (keyId$1, key$1) => await keyCache?.set(keyId$1, key$1)
454
+ set: async (keyId, key) => await keyCache?.set(keyId, key)
465
455
  }
466
456
  });
467
457
  }
@@ -611,9 +601,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
611
601
  logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
612
602
  continue;
613
603
  }
614
- const body = await request.arrayBuffer();
615
- const digestValid = await verifyRfc9421ContentDigest(contentDigestHeader, body);
616
- if (!digestValid) {
604
+ if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
617
605
  logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
618
606
  continue;
619
607
  }
@@ -659,8 +647,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
659
647
  const signatureBaseBytes = new TextEncoder().encode(signatureBase);
660
648
  span?.setAttribute("http_signatures.signature", encodeHex(sigBytes));
661
649
  try {
662
- const verified = await crypto.subtle.verify(algorithm, key.publicKey, sigBytes.slice(), signatureBaseBytes);
663
- if (verified) {
650
+ if (await crypto.subtle.verify(algorithm, key.publicKey, sigBytes.slice(), signatureBaseBytes)) {
664
651
  validKey = key;
665
652
  break;
666
653
  } else if (cached) {
@@ -672,7 +659,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
672
659
  currentTime,
673
660
  keyCache: {
674
661
  get: () => Promise.resolve(void 0),
675
- set: async (keyId, key$1) => await keyCache?.set(keyId, key$1)
662
+ set: async (keyId, key) => await keyCache?.set(keyId, key)
676
663
  },
677
664
  spec: "rfc9421"
678
665
  });
@@ -745,8 +732,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
745
732
  });
746
733
  if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
747
734
  if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
748
- const location = response.headers.get("Location");
749
- const redirectRequest = createRedirectRequest(request, location, body);
735
+ const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
750
736
  if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
751
737
  return doubleKnockInternal(redirectRequest, identity, {
752
738
  ...options,
@@ -776,8 +762,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
776
762
  });
777
763
  if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
778
764
  if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
779
- const location = response.headers.get("Location");
780
- const redirectRequest = createRedirectRequest(request, location, body);
765
+ const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
781
766
  if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
782
767
  return doubleKnockInternal(redirectRequest, identity, {
783
768
  ...options,
@@ -814,6 +799,5 @@ function timingSafeEqual(a, b) {
814
799
  result |= lenA ^ lenB;
815
800
  return result === 0;
816
801
  }
817
-
818
802
  //#endregion
819
- export { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest };
803
+ export { signRequest as n, verifyRequest as r, doubleKnock as t };
@@ -1,12 +1,9 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { Activity, deno_default, getTypeId } from "./type-COPv6pMi.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { U as getTypeId, ot as name, st as version, t as Activity } from "./vocab-DuJO9k13.mjs";
7
5
  import { getLogger } from "@logtape/logtape";
8
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
9
-
10
7
  //#region src/federation/inbox.ts
11
8
  var InboxListenerSet = class InboxListenerSet {
12
9
  #listeners;
@@ -57,10 +54,8 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
57
54
  warnedAboutDefaultIdempotency = true;
58
55
  }
59
56
  let keyString;
60
- if (typeof strategy === "function") {
61
- const result = await strategy(inboxContext, activity);
62
- keyString = result;
63
- } else switch (strategy) {
57
+ if (typeof strategy === "function") keyString = await strategy(inboxContext, activity);
58
+ else switch (strategy) {
64
59
  case "global":
65
60
  keyString = activity.id.href;
66
61
  break;
@@ -75,8 +70,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
75
70
  if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
76
71
  }
77
72
  if (cacheKey != null) {
78
- const cached = await kv.get(cacheKey);
79
- if (cached === true) {
73
+ if (await kv.get(cacheKey) === true) {
80
74
  logger.debug("Activity {activityId} has already been processed.", {
81
75
  activityId: activity.id?.href,
82
76
  activity: json,
@@ -133,31 +127,30 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
133
127
  return "enqueued";
134
128
  }
135
129
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
136
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
137
- return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
130
+ return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span) => {
138
131
  const dispatched = inboxListeners?.dispatchWithClass(activity);
139
132
  if (dispatched == null) {
140
133
  logger.error("Unsupported activity type:\n{activity}", {
141
134
  activity: json,
142
135
  recipient
143
136
  });
144
- span$1.setStatus({
137
+ span.setStatus({
145
138
  code: SpanStatusCode.UNSET,
146
139
  message: `Unsupported activity type: ${getTypeId(activity).href}`
147
140
  });
148
- span$1.end();
141
+ span.end();
149
142
  return "unsupportedActivity";
150
143
  }
151
144
  const { class: cls, listener } = dispatched;
152
- span$1.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
145
+ span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
153
146
  try {
154
147
  await listener(inboxContextFactory(recipient, json, activity?.id?.href, getTypeId(activity).href), activity);
155
148
  } catch (error) {
156
149
  try {
157
150
  await inboxErrorHandler?.(ctx, error);
158
- } catch (error$1) {
151
+ } catch (error) {
159
152
  logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
160
- error: error$1,
153
+ error,
161
154
  activityId: activity.id?.href,
162
155
  activity: json,
163
156
  recipient
@@ -169,11 +162,11 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
169
162
  activity: json,
170
163
  recipient
171
164
  });
172
- span$1.setStatus({
165
+ span.setStatus({
173
166
  code: SpanStatusCode.ERROR,
174
167
  message: String(error)
175
168
  });
176
- span$1.end();
169
+ span.end();
177
170
  return "error";
178
171
  }
179
172
  if (cacheKey != null) await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
@@ -182,10 +175,9 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
182
175
  activity: json,
183
176
  recipient
184
177
  });
185
- span$1.end();
178
+ span.end();
186
179
  return "success";
187
180
  });
188
181
  }
189
-
190
182
  //#endregion
191
- export { InboxListenerSet, routeActivity };
183
+ export { routeActivity as n, InboxListenerSet as t };
@@ -1,13 +1,9 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
5
- const require_chunk = require('./chunk-DqRYRqnO.cjs');
6
- const require_docloader = require('./docloader-BIFI3OS7.cjs');
7
- const require_actor = require('./actor-DlS-Q8hE.cjs');
8
- const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
9
- const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
10
-
1
+ const { Temporal } = require("@js-temporal/polyfill");
2
+ const { URLPattern } = require("urlpattern-polyfill");
3
+ const require_docloader = require("./docloader-Co-tW1B6.cjs");
4
+ const require_actor = require("./actor-CsvteFj1.cjs");
5
+ let _logtape_logtape = require("@logtape/logtape");
6
+ let _opentelemetry_api = require("@opentelemetry/api");
11
7
  //#region src/sig/key.ts
12
8
  /**
13
9
  * Checks if the given key is valid and supported. No-op if the key is valid,
@@ -22,8 +18,7 @@ function validateCryptoKey(key, type) {
22
18
  if (!key.extractable) throw new TypeError("The key is not extractable.");
23
19
  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!");
24
20
  if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
25
- const algorithm = key.algorithm;
26
- 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.");
21
+ 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.");
27
22
  }
28
23
  }
29
24
  /**
@@ -34,7 +29,7 @@ function validateCryptoKey(key, type) {
34
29
  * @throws {TypeError} If the algorithm is unsupported.
35
30
  */
36
31
  function generateCryptoKeyPair(algorithm) {
37
- if (algorithm == null) (0, __logtape_logtape.getLogger)([
32
+ if (algorithm == null) (0, _logtape_logtape.getLogger)([
38
33
  "fedify",
39
34
  "sig",
40
35
  "key"
@@ -102,11 +97,10 @@ async function importJwk(jwk, type) {
102
97
  * @since 1.3.0
103
98
  */
104
99
  function fetchKey(keyId, cls, options = {}) {
105
- const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
106
- const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
100
+ const tracer = (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_docloader.name, require_docloader.version);
107
101
  keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
108
102
  return tracer.startActiveSpan("activitypub.fetch_key", {
109
- kind: __opentelemetry_api.SpanKind.CLIENT,
103
+ kind: _opentelemetry_api.SpanKind.CLIENT,
110
104
  attributes: {
111
105
  "http.method": "GET",
112
106
  "url.full": keyId.href,
@@ -123,7 +117,7 @@ function fetchKey(keyId, cls, options = {}) {
123
117
  return result;
124
118
  } catch (e) {
125
119
  span.setStatus({
126
- code: __opentelemetry_api.SpanStatusCode.ERROR,
120
+ code: _opentelemetry_api.SpanStatusCode.ERROR,
127
121
  message: String(e)
128
122
  });
129
123
  throw e;
@@ -133,7 +127,7 @@ function fetchKey(keyId, cls, options = {}) {
133
127
  });
134
128
  }
135
129
  async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, keyCache, tracerProvider } = {}) {
136
- const logger = (0, __logtape_logtape.getLogger)([
130
+ const logger = (0, _logtape_logtape.getLogger)([
137
131
  "fedify",
138
132
  "sig",
139
133
  "key"
@@ -159,8 +153,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
159
153
  logger.debug("Fetching key {keyId} to verify signature...", { keyId });
160
154
  let document;
161
155
  try {
162
- const remoteDocument = await (documentLoader ?? require_docloader.getDocumentLoader())(keyId);
163
- document = remoteDocument.document;
156
+ document = (await (documentLoader ?? require_docloader.getDocumentLoader())(keyId)).document;
164
157
  } catch (_) {
165
158
  logger.debug("Failed to fetch key {keyId}.", { keyId });
166
159
  await keyCache?.set(cacheKey, null);
@@ -184,8 +177,8 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
184
177
  contextLoader,
185
178
  tracerProvider
186
179
  });
187
- } catch (e$1) {
188
- if (e$1 instanceof TypeError) {
180
+ } catch (e) {
181
+ if (e instanceof TypeError) {
189
182
  logger.debug("Failed to verify; key {keyId} returned an invalid object.", { keyId });
190
183
  await keyCache?.set(cacheKey, null);
191
184
  return {
@@ -193,7 +186,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
193
186
  cached: false
194
187
  };
195
188
  }
196
- throw e$1;
189
+ throw e;
197
190
  }
198
191
  }
199
192
  let key = null;
@@ -256,35 +249,34 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
256
249
  cached: false
257
250
  };
258
251
  }
259
-
260
252
  //#endregion
261
- Object.defineProperty(exports, 'exportJwk', {
262
- enumerable: true,
263
- get: function () {
264
- return exportJwk;
265
- }
253
+ Object.defineProperty(exports, "exportJwk", {
254
+ enumerable: true,
255
+ get: function() {
256
+ return exportJwk;
257
+ }
258
+ });
259
+ Object.defineProperty(exports, "fetchKey", {
260
+ enumerable: true,
261
+ get: function() {
262
+ return fetchKey;
263
+ }
266
264
  });
267
- Object.defineProperty(exports, 'fetchKey', {
268
- enumerable: true,
269
- get: function () {
270
- return fetchKey;
271
- }
265
+ Object.defineProperty(exports, "generateCryptoKeyPair", {
266
+ enumerable: true,
267
+ get: function() {
268
+ return generateCryptoKeyPair;
269
+ }
272
270
  });
273
- Object.defineProperty(exports, 'generateCryptoKeyPair', {
274
- enumerable: true,
275
- get: function () {
276
- return generateCryptoKeyPair;
277
- }
271
+ Object.defineProperty(exports, "importJwk", {
272
+ enumerable: true,
273
+ get: function() {
274
+ return importJwk;
275
+ }
278
276
  });
279
- Object.defineProperty(exports, 'importJwk', {
280
- enumerable: true,
281
- get: function () {
282
- return importJwk;
283
- }
277
+ Object.defineProperty(exports, "validateCryptoKey", {
278
+ enumerable: true,
279
+ get: function() {
280
+ return validateCryptoKey;
281
+ }
284
282
  });
285
- Object.defineProperty(exports, 'validateCryptoKey', {
286
- enumerable: true,
287
- get: function () {
288
- return validateCryptoKey;
289
- }
290
- });
@@ -0,0 +1,4 @@
1
+ const { Temporal } = require("@js-temporal/polyfill");
2
+ const { URLPattern } = require("urlpattern-polyfill");
3
+ const require_key = require("./key-B2ZqbGDP.cjs");
4
+ exports.validateCryptoKey = require_key.validateCryptoKey;
@@ -1,12 +1,10 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { deno_default, getDocumentLoader } from "./docloader-fJgJeqiX.js";
6
- import { CryptographicKey, Object as Object$1, isActor } from "./actor-CEGEmRll.js";
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { J as getDocumentLoader, ot as name, s as CryptographicKey, st as version, v as Object$1 } from "./vocab-DuJO9k13.mjs";
5
+ import { i as isActor } from "./actor-DeUOMMMQ.mjs";
7
6
  import { getLogger } from "@logtape/logtape";
8
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
-
10
8
  //#region src/sig/key.ts
11
9
  /**
12
10
  * Checks if the given key is valid and supported. No-op if the key is valid,
@@ -21,8 +19,7 @@ function validateCryptoKey(key, type) {
21
19
  if (!key.extractable) throw new TypeError("The key is not extractable.");
22
20
  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!");
23
21
  if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
24
- const algorithm = key.algorithm;
25
- 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.");
22
+ 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.");
26
23
  }
27
24
  }
28
25
  /**
@@ -101,8 +98,7 @@ async function importJwk(jwk, type) {
101
98
  * @since 1.3.0
102
99
  */
103
100
  function fetchKey(keyId, cls, options = {}) {
104
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
105
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
101
+ const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
106
102
  keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
107
103
  return tracer.startActiveSpan("activitypub.fetch_key", {
108
104
  kind: SpanKind.CLIENT,
@@ -158,8 +154,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
158
154
  logger.debug("Fetching key {keyId} to verify signature...", { keyId });
159
155
  let document;
160
156
  try {
161
- const remoteDocument = await (documentLoader ?? getDocumentLoader())(keyId);
162
- document = remoteDocument.document;
157
+ document = (await (documentLoader ?? getDocumentLoader())(keyId)).document;
163
158
  } catch (_) {
164
159
  logger.debug("Failed to fetch key {keyId}.", { keyId });
165
160
  await keyCache?.set(cacheKey, null);
@@ -183,8 +178,8 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
183
178
  contextLoader,
184
179
  tracerProvider
185
180
  });
186
- } catch (e$1) {
187
- if (e$1 instanceof TypeError) {
181
+ } catch (e) {
182
+ if (e instanceof TypeError) {
188
183
  logger.debug("Failed to verify; key {keyId} returned an invalid object.", { keyId });
189
184
  await keyCache?.set(cacheKey, null);
190
185
  return {
@@ -192,7 +187,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
192
187
  cached: false
193
188
  };
194
189
  }
195
- throw e$1;
190
+ throw e;
196
191
  }
197
192
  }
198
193
  let key = null;
@@ -255,6 +250,5 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
255
250
  cached: false
256
251
  };
257
252
  }
258
-
259
253
  //#endregion
260
- export { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey };
254
+ export { validateCryptoKey as a, importJwk as i, fetchKey as n, generateCryptoKeyPair as r, exportJwk as t };