@openclaw/nostr 2026.7.2-beta.4 → 2026.7.2-beta.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 (470) hide show
  1. package/dist/api.js +9 -6
  2. package/dist/{channel-DqbdMXMg.js → channel-O6-jXoT5.js} +21 -32
  3. package/dist/channel-plugin-api.js +1 -1
  4. package/dist/setup-api.js +1 -1
  5. package/dist/setup-plugin-api.js +1 -1
  6. package/dist/{setup-surface-ChtM-WSY.js → setup-surface-BJCFpe02.js} +8 -24
  7. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js +24 -25
  8. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +3 -3
  9. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +14 -5
  10. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +2 -2
  11. package/node_modules/nostr-tools/lib/cjs/core.js +17 -1
  12. package/node_modules/nostr-tools/lib/cjs/core.js.map +3 -3
  13. package/node_modules/nostr-tools/lib/cjs/filter.js.map +1 -1
  14. package/node_modules/nostr-tools/lib/cjs/index.js +137 -127
  15. package/node_modules/nostr-tools/lib/cjs/index.js.map +4 -4
  16. package/node_modules/nostr-tools/lib/cjs/kinds.js +17 -1
  17. package/node_modules/nostr-tools/lib/cjs/kinds.js.map +3 -3
  18. package/node_modules/nostr-tools/lib/cjs/nip04.js.map +1 -1
  19. package/node_modules/nostr-tools/lib/cjs/nip10.js +20 -5
  20. package/node_modules/nostr-tools/lib/cjs/nip10.js.map +3 -3
  21. package/node_modules/nostr-tools/lib/cjs/nip13.js.map +1 -1
  22. package/node_modules/nostr-tools/lib/cjs/nip17.js +30 -23
  23. package/node_modules/nostr-tools/lib/cjs/nip17.js.map +4 -4
  24. package/node_modules/nostr-tools/lib/cjs/nip18.js +21 -14
  25. package/node_modules/nostr-tools/lib/cjs/nip18.js.map +4 -4
  26. package/node_modules/nostr-tools/lib/cjs/nip19.js.map +1 -1
  27. package/node_modules/nostr-tools/lib/cjs/nip21.js.map +1 -1
  28. package/node_modules/nostr-tools/lib/cjs/nip22.js +22 -7
  29. package/node_modules/nostr-tools/lib/cjs/nip22.js.map +3 -3
  30. package/node_modules/nostr-tools/lib/cjs/nip25.js +21 -14
  31. package/node_modules/nostr-tools/lib/cjs/nip25.js.map +4 -4
  32. package/node_modules/nostr-tools/lib/cjs/nip27.js.map +1 -1
  33. package/node_modules/nostr-tools/lib/cjs/nip28.js +21 -14
  34. package/node_modules/nostr-tools/lib/cjs/nip28.js.map +4 -4
  35. package/node_modules/nostr-tools/lib/cjs/nip29.js.map +1 -1
  36. package/node_modules/nostr-tools/lib/cjs/nip30.js.map +2 -2
  37. package/node_modules/nostr-tools/lib/cjs/nip42.js.map +2 -2
  38. package/node_modules/nostr-tools/lib/cjs/nip44.js.map +1 -1
  39. package/node_modules/nostr-tools/lib/cjs/nip45.js +22 -9
  40. package/node_modules/nostr-tools/lib/cjs/nip45.js.map +4 -4
  41. package/node_modules/nostr-tools/lib/cjs/nip46.js +76 -67
  42. package/node_modules/nostr-tools/lib/cjs/nip46.js.map +4 -4
  43. package/node_modules/nostr-tools/lib/cjs/nip47.js +25 -18
  44. package/node_modules/nostr-tools/lib/cjs/nip47.js.map +4 -4
  45. package/node_modules/nostr-tools/lib/cjs/nip57.js +23 -16
  46. package/node_modules/nostr-tools/lib/cjs/nip57.js.map +4 -4
  47. package/node_modules/nostr-tools/lib/cjs/nip58.js.map +2 -2
  48. package/node_modules/nostr-tools/lib/cjs/nip59.js +16 -7
  49. package/node_modules/nostr-tools/lib/cjs/nip59.js.map +3 -3
  50. package/node_modules/nostr-tools/lib/cjs/nip75.js.map +1 -1
  51. package/node_modules/nostr-tools/lib/cjs/nip94.js.map +1 -1
  52. package/node_modules/nostr-tools/lib/cjs/nip98.js +23 -16
  53. package/node_modules/nostr-tools/lib/cjs/nip98.js.map +4 -4
  54. package/node_modules/nostr-tools/lib/cjs/nip99.js.map +2 -2
  55. package/node_modules/nostr-tools/lib/cjs/nipb0.js +34 -16
  56. package/node_modules/nostr-tools/lib/cjs/nipb0.js.map +4 -4
  57. package/node_modules/nostr-tools/lib/cjs/nipb7.js +13 -7
  58. package/node_modules/nostr-tools/lib/cjs/nipb7.js.map +2 -2
  59. package/node_modules/nostr-tools/lib/cjs/pool.js +67 -58
  60. package/node_modules/nostr-tools/lib/cjs/pool.js.map +4 -4
  61. package/node_modules/nostr-tools/lib/cjs/pure.js +21 -14
  62. package/node_modules/nostr-tools/lib/cjs/pure.js.map +4 -4
  63. package/node_modules/nostr-tools/lib/cjs/references.js.map +1 -1
  64. package/node_modules/nostr-tools/lib/cjs/relay.js +56 -40
  65. package/node_modules/nostr-tools/lib/cjs/relay.js.map +4 -4
  66. package/node_modules/nostr-tools/lib/cjs/signer.js +21 -14
  67. package/node_modules/nostr-tools/lib/cjs/signer.js.map +4 -4
  68. package/node_modules/nostr-tools/lib/cjs/utils.js +10 -0
  69. package/node_modules/nostr-tools/lib/cjs/utils.js.map +2 -2
  70. package/node_modules/nostr-tools/lib/cjs/wasm.js +16 -2
  71. package/node_modules/nostr-tools/lib/cjs/wasm.js.map +4 -4
  72. package/node_modules/nostr-tools/lib/esm/abstract-pool.js +24 -25
  73. package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +3 -3
  74. package/node_modules/nostr-tools/lib/esm/abstract-relay.js +14 -5
  75. package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +2 -2
  76. package/node_modules/nostr-tools/lib/esm/core.js +15 -1
  77. package/node_modules/nostr-tools/lib/esm/core.js.map +3 -3
  78. package/node_modules/nostr-tools/lib/esm/filter.js.map +1 -1
  79. package/node_modules/nostr-tools/lib/esm/index.js +87 -77
  80. package/node_modules/nostr-tools/lib/esm/index.js.map +4 -4
  81. package/node_modules/nostr-tools/lib/esm/kinds.js +17 -1
  82. package/node_modules/nostr-tools/lib/esm/kinds.js.map +3 -3
  83. package/node_modules/nostr-tools/lib/esm/nip04.js.map +1 -1
  84. package/node_modules/nostr-tools/lib/esm/nip10.js +18 -5
  85. package/node_modules/nostr-tools/lib/esm/nip10.js.map +3 -3
  86. package/node_modules/nostr-tools/lib/esm/nip13.js.map +1 -1
  87. package/node_modules/nostr-tools/lib/esm/nip17.js +15 -8
  88. package/node_modules/nostr-tools/lib/esm/nip17.js.map +4 -4
  89. package/node_modules/nostr-tools/lib/esm/nip18.js +15 -8
  90. package/node_modules/nostr-tools/lib/esm/nip18.js.map +4 -4
  91. package/node_modules/nostr-tools/lib/esm/nip19.js.map +1 -1
  92. package/node_modules/nostr-tools/lib/esm/nip21.js.map +1 -1
  93. package/node_modules/nostr-tools/lib/esm/nip22.js +20 -7
  94. package/node_modules/nostr-tools/lib/esm/nip22.js.map +3 -3
  95. package/node_modules/nostr-tools/lib/esm/nip25.js +15 -8
  96. package/node_modules/nostr-tools/lib/esm/nip25.js.map +4 -4
  97. package/node_modules/nostr-tools/lib/esm/nip27.js.map +1 -1
  98. package/node_modules/nostr-tools/lib/esm/nip28.js +15 -8
  99. package/node_modules/nostr-tools/lib/esm/nip28.js.map +4 -4
  100. package/node_modules/nostr-tools/lib/esm/nip29.js.map +1 -1
  101. package/node_modules/nostr-tools/lib/esm/nip30.js.map +2 -2
  102. package/node_modules/nostr-tools/lib/esm/nip42.js.map +2 -2
  103. package/node_modules/nostr-tools/lib/esm/nip44.js.map +1 -1
  104. package/node_modules/nostr-tools/lib/esm/nip45.js +23 -10
  105. package/node_modules/nostr-tools/lib/esm/nip45.js.map +4 -4
  106. package/node_modules/nostr-tools/lib/esm/nip46.js +60 -51
  107. package/node_modules/nostr-tools/lib/esm/nip46.js.map +4 -4
  108. package/node_modules/nostr-tools/lib/esm/nip47.js +15 -8
  109. package/node_modules/nostr-tools/lib/esm/nip47.js.map +4 -4
  110. package/node_modules/nostr-tools/lib/esm/nip57.js +17 -10
  111. package/node_modules/nostr-tools/lib/esm/nip57.js.map +4 -4
  112. package/node_modules/nostr-tools/lib/esm/nip58.js.map +2 -2
  113. package/node_modules/nostr-tools/lib/esm/nip59.js +10 -1
  114. package/node_modules/nostr-tools/lib/esm/nip59.js.map +3 -3
  115. package/node_modules/nostr-tools/lib/esm/nip75.js.map +1 -1
  116. package/node_modules/nostr-tools/lib/esm/nip94.js.map +1 -1
  117. package/node_modules/nostr-tools/lib/esm/nip98.js +15 -8
  118. package/node_modules/nostr-tools/lib/esm/nip98.js.map +4 -4
  119. package/node_modules/nostr-tools/lib/esm/nip99.js.map +2 -2
  120. package/node_modules/nostr-tools/lib/esm/nipb0.js +35 -17
  121. package/node_modules/nostr-tools/lib/esm/nipb0.js.map +4 -4
  122. package/node_modules/nostr-tools/lib/esm/nipb7.js +13 -7
  123. package/node_modules/nostr-tools/lib/esm/nipb7.js.map +2 -2
  124. package/node_modules/nostr-tools/lib/esm/pool.js +60 -51
  125. package/node_modules/nostr-tools/lib/esm/pool.js.map +4 -4
  126. package/node_modules/nostr-tools/lib/esm/pure.js +15 -8
  127. package/node_modules/nostr-tools/lib/esm/pure.js.map +4 -4
  128. package/node_modules/nostr-tools/lib/esm/references.js.map +1 -1
  129. package/node_modules/nostr-tools/lib/esm/relay.js +50 -34
  130. package/node_modules/nostr-tools/lib/esm/relay.js.map +4 -4
  131. package/node_modules/nostr-tools/lib/esm/signer.js +15 -8
  132. package/node_modules/nostr-tools/lib/esm/signer.js.map +4 -4
  133. package/node_modules/nostr-tools/lib/esm/utils.js +10 -0
  134. package/node_modules/nostr-tools/lib/esm/utils.js.map +2 -2
  135. package/node_modules/nostr-tools/lib/esm/wasm.js +17 -3
  136. package/node_modules/nostr-tools/lib/esm/wasm.js.map +4 -4
  137. package/node_modules/nostr-tools/lib/nostr.bundle.js +86 -74
  138. package/node_modules/nostr-tools/lib/nostr.bundle.js.map +4 -4
  139. package/node_modules/nostr-tools/lib/types/abstract-pool.d.ts +6 -4
  140. package/node_modules/nostr-tools/lib/types/abstract-relay.d.ts +2 -2
  141. package/node_modules/nostr-tools/lib/types/kinds.d.ts +2 -0
  142. package/node_modules/nostr-tools/lib/types/nipb0.d.ts +0 -1
  143. package/node_modules/nostr-tools/lib/types/nipb7.d.ts +0 -1
  144. package/node_modules/nostr-tools/lib/types/utils.d.ts +4 -0
  145. package/node_modules/nostr-tools/node_modules/nostr-wasm/dist/generate.d.ts +1 -0
  146. package/node_modules/nostr-tools/package.json +1 -1
  147. package/package.json +5 -6
  148. package/node_modules/nostr-tools/lib/types/helpers.d.ts +0 -2
  149. package/npm-shrinkwrap.json +0 -137
  150. /package/node_modules/{nostr-wasm/dist/generate.d.ts → nostr-tools/lib/types/nipb0.test.d.ts} +0 -0
  151. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/LICENSE +0 -0
  152. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/README.md +0 -0
  153. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.d.ts +0 -0
  154. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.d.ts.map +0 -0
  155. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.js +0 -0
  156. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.js.map +0 -0
  157. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.d.ts +0 -0
  158. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.d.ts.map +0 -0
  159. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.js +0 -0
  160. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.js.map +0 -0
  161. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.d.ts +0 -0
  162. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.d.ts.map +0 -0
  163. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.js +0 -0
  164. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.js.map +0 -0
  165. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.d.ts +0 -0
  166. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.d.ts.map +0 -0
  167. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.js +0 -0
  168. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.js.map +0 -0
  169. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.d.ts +0 -0
  170. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.d.ts.map +0 -0
  171. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.js +0 -0
  172. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.js.map +0 -0
  173. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.d.ts +0 -0
  174. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.d.ts.map +0 -0
  175. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.js +0 -0
  176. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.js.map +0 -0
  177. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.d.ts +0 -0
  178. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.d.ts.map +0 -0
  179. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.js +0 -0
  180. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.js.map +0 -0
  181. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/package.json +0 -0
  182. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.d.ts +0 -0
  183. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.d.ts.map +0 -0
  184. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.js +0 -0
  185. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.js.map +0 -0
  186. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/_arx.ts +0 -0
  187. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/_poly1305.ts +0 -0
  188. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/_polyval.ts +0 -0
  189. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/aes.ts +0 -0
  190. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/chacha.ts +0 -0
  191. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/ff1.ts +0 -0
  192. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/index.ts +0 -0
  193. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/salsa.ts +0 -0
  194. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/utils.ts +0 -0
  195. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/webcrypto.ts +0 -0
  196. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.d.ts +0 -0
  197. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.d.ts.map +0 -0
  198. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.js +0 -0
  199. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.js.map +0 -0
  200. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.d.ts +0 -0
  201. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.d.ts.map +0 -0
  202. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.js +0 -0
  203. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.js.map +0 -0
  204. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/LICENSE +0 -0
  205. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/README.md +0 -0
  206. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.d.ts +0 -0
  207. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.d.ts.map +0 -0
  208. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.js +0 -0
  209. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.js.map +0 -0
  210. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.d.ts +0 -0
  211. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.d.ts.map +0 -0
  212. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.js +0 -0
  213. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.js.map +0 -0
  214. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.d.ts +0 -0
  215. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.d.ts.map +0 -0
  216. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.js +0 -0
  217. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.js.map +0 -0
  218. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.d.ts +0 -0
  219. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.d.ts.map +0 -0
  220. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.js +0 -0
  221. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.js.map +0 -0
  222. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.d.ts +0 -0
  223. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.d.ts.map +0 -0
  224. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.js +0 -0
  225. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.js.map +0 -0
  226. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.d.ts +0 -0
  227. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.d.ts.map +0 -0
  228. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.js +0 -0
  229. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.js.map +0 -0
  230. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.d.ts +0 -0
  231. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.d.ts.map +0 -0
  232. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.js +0 -0
  233. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.js.map +0 -0
  234. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.d.ts +0 -0
  235. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.d.ts.map +0 -0
  236. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.js +0 -0
  237. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.js.map +0 -0
  238. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.d.ts +0 -0
  239. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.d.ts.map +0 -0
  240. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.js +0 -0
  241. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.js.map +0 -0
  242. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.d.ts +0 -0
  243. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.d.ts.map +0 -0
  244. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.js +0 -0
  245. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.js.map +0 -0
  246. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.d.ts +0 -0
  247. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.d.ts.map +0 -0
  248. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.js +0 -0
  249. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.js.map +0 -0
  250. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.d.ts +0 -0
  251. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.d.ts.map +0 -0
  252. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.js +0 -0
  253. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.js.map +0 -0
  254. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.d.ts +0 -0
  255. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.d.ts.map +0 -0
  256. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.js +0 -0
  257. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.js.map +0 -0
  258. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.d.ts +0 -0
  259. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.d.ts.map +0 -0
  260. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.js +0 -0
  261. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.js.map +0 -0
  262. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.d.ts +0 -0
  263. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.d.ts.map +0 -0
  264. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.js +0 -0
  265. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.js.map +0 -0
  266. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.d.ts +0 -0
  267. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.d.ts.map +0 -0
  268. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.js +0 -0
  269. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.js.map +0 -0
  270. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.d.ts +0 -0
  271. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.d.ts.map +0 -0
  272. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.js +0 -0
  273. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.js.map +0 -0
  274. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.d.ts +0 -0
  275. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.d.ts.map +0 -0
  276. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.js +0 -0
  277. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.js.map +0 -0
  278. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/package.json +0 -0
  279. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.d.ts +0 -0
  280. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.d.ts.map +0 -0
  281. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.js +0 -0
  282. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.js.map +0 -0
  283. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/bls.ts +0 -0
  284. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/curve.ts +0 -0
  285. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/edwards.ts +0 -0
  286. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/fft.ts +0 -0
  287. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/hash-to-curve.ts +0 -0
  288. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/modular.ts +0 -0
  289. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/montgomery.ts +0 -0
  290. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/oprf.ts +0 -0
  291. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/poseidon.ts +0 -0
  292. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/tower.ts +0 -0
  293. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/weierstrass.ts +0 -0
  294. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/bls12-381.ts +0 -0
  295. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/bn254.ts +0 -0
  296. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/ed25519.ts +0 -0
  297. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/ed448.ts +0 -0
  298. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/index.ts +0 -0
  299. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/misc.ts +0 -0
  300. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/nist.ts +0 -0
  301. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/secp256k1.ts +0 -0
  302. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/utils.ts +0 -0
  303. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/webcrypto.ts +0 -0
  304. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.d.ts +0 -0
  305. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.d.ts.map +0 -0
  306. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.js +0 -0
  307. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.js.map +0 -0
  308. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.d.ts +0 -0
  309. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.d.ts.map +0 -0
  310. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.js +0 -0
  311. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.js.map +0 -0
  312. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/LICENSE +0 -0
  313. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/README.md +0 -0
  314. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.d.ts +0 -0
  315. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.d.ts.map +0 -0
  316. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.js +0 -0
  317. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.js.map +0 -0
  318. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.d.ts +0 -0
  319. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.d.ts.map +0 -0
  320. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.js +0 -0
  321. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.js.map +0 -0
  322. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.d.ts +0 -0
  323. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.d.ts.map +0 -0
  324. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.js +0 -0
  325. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.js.map +0 -0
  326. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.d.ts +0 -0
  327. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.d.ts.map +0 -0
  328. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.js +0 -0
  329. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.js.map +0 -0
  330. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.d.ts +0 -0
  331. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.d.ts.map +0 -0
  332. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.js +0 -0
  333. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.js.map +0 -0
  334. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.d.ts +0 -0
  335. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.d.ts.map +0 -0
  336. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.js +0 -0
  337. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.js.map +0 -0
  338. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.d.ts +0 -0
  339. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.d.ts.map +0 -0
  340. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.js +0 -0
  341. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.js.map +0 -0
  342. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.d.ts +0 -0
  343. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.d.ts.map +0 -0
  344. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.js +0 -0
  345. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.js.map +0 -0
  346. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.d.ts +0 -0
  347. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.d.ts.map +0 -0
  348. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.js +0 -0
  349. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.js.map +0 -0
  350. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.d.ts +0 -0
  351. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.d.ts.map +0 -0
  352. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.js +0 -0
  353. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.js.map +0 -0
  354. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.d.ts +0 -0
  355. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.d.ts.map +0 -0
  356. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.js +0 -0
  357. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.js.map +0 -0
  358. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.d.ts +0 -0
  359. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.d.ts.map +0 -0
  360. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.js +0 -0
  361. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.js.map +0 -0
  362. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/package.json +0 -0
  363. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.d.ts +0 -0
  364. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.d.ts.map +0 -0
  365. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.js +0 -0
  366. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.js.map +0 -0
  367. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.d.ts +0 -0
  368. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.d.ts.map +0 -0
  369. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.js +0 -0
  370. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.js.map +0 -0
  371. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.d.ts +0 -0
  372. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.d.ts.map +0 -0
  373. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.js +0 -0
  374. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.js.map +0 -0
  375. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.d.ts +0 -0
  376. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.d.ts.map +0 -0
  377. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.js +0 -0
  378. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.js.map +0 -0
  379. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.d.ts +0 -0
  380. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.d.ts.map +0 -0
  381. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.js +0 -0
  382. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.js.map +0 -0
  383. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/_blake.ts +0 -0
  384. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/_md.ts +0 -0
  385. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/_u64.ts +0 -0
  386. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/argon2.ts +0 -0
  387. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/blake1.ts +0 -0
  388. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/blake2.ts +0 -0
  389. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/blake3.ts +0 -0
  390. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/eskdf.ts +0 -0
  391. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/hkdf.ts +0 -0
  392. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/hmac.ts +0 -0
  393. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/index.ts +0 -0
  394. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/legacy.ts +0 -0
  395. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/pbkdf2.ts +0 -0
  396. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/scrypt.ts +0 -0
  397. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/sha2.ts +0 -0
  398. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/sha3-addons.ts +0 -0
  399. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/sha3.ts +0 -0
  400. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/utils.ts +0 -0
  401. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/webcrypto.ts +0 -0
  402. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.d.ts +0 -0
  403. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.d.ts.map +0 -0
  404. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.js +0 -0
  405. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.js.map +0 -0
  406. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.d.ts +0 -0
  407. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.d.ts.map +0 -0
  408. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.js +0 -0
  409. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.js.map +0 -0
  410. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/LICENSE +0 -0
  411. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/README.md +0 -0
  412. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.d.ts +0 -0
  413. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.d.ts.map +0 -0
  414. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.js +0 -0
  415. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.js.map +0 -0
  416. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.ts +0 -0
  417. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/package.json +0 -0
  418. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/LICENSE +0 -0
  419. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/README.md +0 -0
  420. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.d.ts +0 -0
  421. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.d.ts.map +0 -0
  422. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.js +0 -0
  423. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.js.map +0 -0
  424. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.ts +0 -0
  425. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/package.json +0 -0
  426. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/LICENSE +0 -0
  427. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/README.md +0 -0
  428. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/index.d.ts +0 -0
  429. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/index.js +0 -0
  430. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/package.json +0 -0
  431. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/src/index.ts +0 -0
  432. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/czech.d.ts +0 -0
  433. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/czech.js +0 -0
  434. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/english.d.ts +0 -0
  435. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/english.js +0 -0
  436. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/french.d.ts +0 -0
  437. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/french.js +0 -0
  438. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/italian.d.ts +0 -0
  439. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/italian.js +0 -0
  440. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/japanese.d.ts +0 -0
  441. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/japanese.js +0 -0
  442. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/korean.d.ts +0 -0
  443. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/korean.js +0 -0
  444. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/portuguese.d.ts +0 -0
  445. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/portuguese.js +0 -0
  446. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/simplified-chinese.d.ts +0 -0
  447. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/simplified-chinese.js +0 -0
  448. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/spanish.d.ts +0 -0
  449. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/spanish.js +0 -0
  450. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/traditional-chinese.d.ts +0 -0
  451. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/traditional-chinese.js +0 -0
  452. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/README.md +0 -0
  453. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/emsimp.d.ts +0 -0
  454. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/nostr.d.ts +0 -0
  455. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/secp256k1-types.d.ts +0 -0
  456. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/secp256k1.d.ts +0 -0
  457. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/types.d.ts +0 -0
  458. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/wasm-env.d.ts +0 -0
  459. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/gen/wasm.d.ts +0 -0
  460. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/gzipped.d.ts +0 -0
  461. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/gzipped.js +0 -0
  462. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/headless.d.ts +0 -0
  463. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/main.d.ts +0 -0
  464. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/main.js +0 -0
  465. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/nostr.js +0 -0
  466. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/secp256k1.js +0 -0
  467. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/types.d.ts +0 -0
  468. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/package.json +0 -0
  469. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/public/out/secp256k1.js +0 -0
  470. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/public/out/secp256k1.wasm +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../nip44.ts", "../../utils.ts"],
4
- "sourcesContent": ["import { chacha20 } from '@noble/ciphers/chacha.js'\nimport { equalBytes } from '@noble/ciphers/utils.js'\nimport { secp256k1 } from '@noble/curves/secp256k1.js'\nimport { extract as hkdf_extract, expand as hkdf_expand } from '@noble/hashes/hkdf.js'\nimport { hmac } from '@noble/hashes/hmac.js'\nimport { sha256 } from '@noble/hashes/sha2.js'\nimport { concatBytes, hexToBytes, randomBytes } from '@noble/hashes/utils.js'\nimport { base64 } from '@scure/base'\n\nimport { utf8Decoder, utf8Encoder } from './utils.ts'\n\nconst minPlaintextSize = 0x0001 // 1b msg => padded to 32b\nconst maxPlaintextSize = 0xffffffff // 4294967295 (2^32-1)\nconst extendedPrefixThreshold = 0x10000 // 65536: lengths below use 2-byte u16 prefix, at or above use 6-byte prefix\n\nexport function getConversationKey(privkeyA: Uint8Array, pubkeyB: string): Uint8Array {\n const sharedX = secp256k1.getSharedSecret(privkeyA, hexToBytes('02' + pubkeyB)).subarray(1, 33)\n return hkdf_extract(sha256, sharedX, utf8Encoder.encode('nip44-v2'))\n}\n\nfunction getMessageKeys(\n conversationKey: Uint8Array,\n nonce: Uint8Array,\n): { chacha_key: Uint8Array; chacha_nonce: Uint8Array; hmac_key: Uint8Array } {\n const keys = hkdf_expand(sha256, conversationKey, nonce, 76)\n return {\n chacha_key: keys.subarray(0, 32),\n chacha_nonce: keys.subarray(32, 44),\n hmac_key: keys.subarray(44, 76),\n }\n}\n\nfunction calcPaddedLen(len: number): number {\n if (!Number.isSafeInteger(len) || len < 1) throw new Error('expected positive integer')\n if (len <= 32) return 32\n const nextPower = 2 ** (Math.floor(Math.log2(len - 1)) + 1)\n const chunk = nextPower <= 256 ? 32 : nextPower / 8\n return chunk * (Math.floor((len - 1) / chunk) + 1)\n}\n\nfunction writeU16BE(num: number): Uint8Array {\n if (!Number.isSafeInteger(num) || num < minPlaintextSize || num > 0xffff)\n throw new Error('invalid plaintext size: must be between 1 and 65535 bytes')\n const arr = new Uint8Array(2)\n new DataView(arr.buffer).setUint16(0, num, false)\n return arr\n}\n\nfunction writeU32BE(num: number): Uint8Array {\n if (!Number.isSafeInteger(num) || num < extendedPrefixThreshold || num > maxPlaintextSize)\n throw new Error('invalid plaintext size: must be between 65536 and 4294967295 bytes')\n const arr = new Uint8Array(4)\n new DataView(arr.buffer).setUint32(0, num, false)\n return arr\n}\n\nfunction pad(plaintext: string): Uint8Array {\n const unpadded = utf8Encoder.encode(plaintext)\n const unpaddedLen = unpadded.length\n if (unpaddedLen < minPlaintextSize || unpaddedLen > maxPlaintextSize)\n throw new Error('invalid plaintext size: must be between 1 and 4294967295 bytes')\n const prefix =\n unpaddedLen >= extendedPrefixThreshold\n ? concatBytes(new Uint8Array([0, 0]), writeU32BE(unpaddedLen)) // 6 bytes\n : writeU16BE(unpaddedLen) // 2 bytes\n const suffix = new Uint8Array(calcPaddedLen(unpaddedLen) - unpaddedLen)\n return concatBytes(prefix, unpadded, suffix)\n}\n\nfunction unpad(padded: Uint8Array): string {\n const dv = new DataView(padded.buffer, padded.byteOffset, padded.byteLength)\n const firstTwo = dv.getUint16(0)\n let unpaddedLen: number\n let prefixLen: number\n if (firstTwo === 0) {\n // Extended format: 2 zero bytes + 4-byte u32 length\n unpaddedLen = dv.getUint32(2)\n if (unpaddedLen < extendedPrefixThreshold) throw new Error('invalid padding')\n prefixLen = 6\n } else {\n unpaddedLen = firstTwo\n prefixLen = 2\n }\n const unpadded = padded.subarray(prefixLen, prefixLen + unpaddedLen)\n if (\n unpaddedLen < minPlaintextSize ||\n unpaddedLen > maxPlaintextSize ||\n unpadded.length !== unpaddedLen ||\n padded.length !== prefixLen + calcPaddedLen(unpaddedLen)\n )\n throw new Error('invalid padding')\n return utf8Decoder.decode(unpadded)\n}\n\nfunction hmacAad(key: Uint8Array, message: Uint8Array, aad: Uint8Array): Uint8Array {\n if (aad.length !== 32) throw new Error('AAD associated data must be 32 bytes')\n const combined = concatBytes(aad, message)\n return hmac(sha256, key, combined)\n}\n\n// metadata: always 65b (version: 1b, nonce: 32b, mac: 32b)\n// plaintext: 1b to 0xffffffff\n// padded plaintext (small, <65536): 32b to 0x10000, with 2b prefix -> 34b to 0x10000+2\n// padded plaintext (large, >=65536): 0x10000 to 0x100000000, with 6b prefix -> 0x10006 to 0x100000000+6\n// ciphertext: same as padded plaintext (chacha20 doesn't change length)\n// raw payload (small): 99 (65+34) to 65603 (65+0x10000+2)\n// raw payload (large): 65607 (65+0x10006) to 4294967367 (65+0x100000000+6)\nfunction decodePayload(payload: string): { nonce: Uint8Array; ciphertext: Uint8Array; mac: Uint8Array } {\n if (typeof payload !== 'string') throw new Error('payload must be a valid string')\n const plen = payload.length\n if (plen < 132) throw new Error('invalid payload length: ' + plen)\n if (payload[0] === '#') throw new Error('unknown encryption version')\n let data: Uint8Array\n try {\n data = base64.decode(payload)\n } catch (error) {\n throw new Error('invalid base64: ' + (error as any).message)\n }\n const dlen = data.length\n if (dlen < 99) throw new Error('invalid data length: ' + dlen)\n const vers = data[0]\n if (vers !== 2) throw new Error('unknown encryption version ' + vers)\n return {\n nonce: data.subarray(1, 33),\n ciphertext: data.subarray(33, -32),\n mac: data.subarray(-32),\n }\n}\n\nexport function encrypt(plaintext: string, conversationKey: Uint8Array, nonce: Uint8Array = randomBytes(32)): string {\n const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce)\n const padded = pad(plaintext)\n const ciphertext = chacha20(chacha_key, chacha_nonce, padded)\n const mac = hmacAad(hmac_key, ciphertext, nonce)\n return base64.encode(concatBytes(new Uint8Array([2]), nonce, ciphertext, mac))\n}\n\n/** Callers should validate payload size before calling to prevent DoS from oversized inputs. */\nexport function decrypt(payload: string, conversationKey: Uint8Array): string {\n const { nonce, ciphertext, mac } = decodePayload(payload)\n const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce)\n const calculatedMac = hmacAad(hmac_key, ciphertext, nonce)\n if (!equalBytes(calculatedMac, mac)) throw new Error('invalid MAC')\n const padded = chacha20(chacha_key, chacha_nonce, ciphertext)\n return unpad(padded)\n}\n\nexport const v2 = {\n utils: {\n getConversationKey,\n calcPaddedLen,\n pad,\n unpad,\n },\n encrypt,\n decrypt,\n}\n", "import type { NostrEvent } from './core.ts'\n\nexport const utf8Decoder: TextDecoder = new TextDecoder('utf-8')\nexport const utf8Encoder: TextEncoder = new TextEncoder()\n\nexport { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'\n\nexport function normalizeURL(url: string): string {\n try {\n if (url.indexOf('://') === -1) url = 'wss://' + url\n let p = new URL(url)\n if (p.protocol === 'http:') p.protocol = 'ws:'\n else if (p.protocol === 'https:') p.protocol = 'wss:'\n p.pathname = p.pathname.replace(/\\/+/g, '/')\n if (p.pathname.endsWith('/')) p.pathname = p.pathname.slice(0, -1)\n if ((p.port === '80' && p.protocol === 'ws:') || (p.port === '443' && p.protocol === 'wss:')) p.port = ''\n p.searchParams.sort()\n p.hash = ''\n return p.toString()\n } catch (e) {\n throw new Error(`Invalid URL: ${url}`)\n }\n}\n\nexport function insertEventIntoDescendingList(sortedArray: NostrEvent[], event: NostrEvent): NostrEvent[] {\n const [idx, found] = binarySearch(sortedArray, b => {\n if (event.id === b.id) return 0\n if (event.created_at === b.created_at) return -1\n return b.created_at - event.created_at\n })\n if (!found) {\n sortedArray.splice(idx, 0, event)\n }\n return sortedArray\n}\n\nexport function insertEventIntoAscendingList(sortedArray: NostrEvent[], event: NostrEvent): NostrEvent[] {\n const [idx, found] = binarySearch(sortedArray, b => {\n if (event.id === b.id) return 0\n if (event.created_at === b.created_at) return -1\n return event.created_at - b.created_at\n })\n if (!found) {\n sortedArray.splice(idx, 0, event)\n }\n return sortedArray\n}\n\nexport function binarySearch<T>(arr: T[], compare: (b: T) => number): [number, boolean] {\n let start = 0\n let end = arr.length - 1\n\n while (start <= end) {\n const mid = Math.floor((start + end) / 2)\n const cmp = compare(arr[mid])\n\n if (cmp === 0) {\n return [mid, true]\n }\n\n if (cmp < 0) {\n end = mid - 1\n } else {\n start = mid + 1\n }\n }\n\n return [start, false]\n}\n\nexport function mergeReverseSortedLists(list1: NostrEvent[], list2: NostrEvent[]): NostrEvent[] {\n const result: NostrEvent[] = new Array(list1.length + list2.length)\n result.length = 0\n let i1 = 0\n let i2 = 0\n let sameTimestampIds: string[] = []\n\n while (i1 < list1.length && i2 < list2.length) {\n let next: NostrEvent\n if (list1[i1]?.created_at > list2[i2]?.created_at) {\n next = list1[i1]\n i1++\n } else {\n next = list2[i2]\n i2++\n }\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n while (i1 < list1.length) {\n const next = list1[i1]\n i1++\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n while (i2 < list2.length) {\n const next = list2[i2]\n i2++\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n return result\n}\n"],
4
+ "sourcesContent": ["import { chacha20 } from '@noble/ciphers/chacha.js'\nimport { equalBytes } from '@noble/ciphers/utils.js'\nimport { secp256k1 } from '@noble/curves/secp256k1.js'\nimport { extract as hkdf_extract, expand as hkdf_expand } from '@noble/hashes/hkdf.js'\nimport { hmac } from '@noble/hashes/hmac.js'\nimport { sha256 } from '@noble/hashes/sha2.js'\nimport { concatBytes, hexToBytes, randomBytes } from '@noble/hashes/utils.js'\nimport { base64 } from '@scure/base'\n\nimport { utf8Decoder, utf8Encoder } from './utils.ts'\n\nconst minPlaintextSize = 0x0001 // 1b msg => padded to 32b\nconst maxPlaintextSize = 0xffffffff // 4294967295 (2^32-1)\nconst extendedPrefixThreshold = 0x10000 // 65536: lengths below use 2-byte u16 prefix, at or above use 6-byte prefix\n\nexport function getConversationKey(privkeyA: Uint8Array, pubkeyB: string): Uint8Array {\n const sharedX = secp256k1.getSharedSecret(privkeyA, hexToBytes('02' + pubkeyB)).subarray(1, 33)\n return hkdf_extract(sha256, sharedX, utf8Encoder.encode('nip44-v2'))\n}\n\nfunction getMessageKeys(\n conversationKey: Uint8Array,\n nonce: Uint8Array,\n): { chacha_key: Uint8Array; chacha_nonce: Uint8Array; hmac_key: Uint8Array } {\n const keys = hkdf_expand(sha256, conversationKey, nonce, 76)\n return {\n chacha_key: keys.subarray(0, 32),\n chacha_nonce: keys.subarray(32, 44),\n hmac_key: keys.subarray(44, 76),\n }\n}\n\nfunction calcPaddedLen(len: number): number {\n if (!Number.isSafeInteger(len) || len < 1) throw new Error('expected positive integer')\n if (len <= 32) return 32\n const nextPower = 2 ** (Math.floor(Math.log2(len - 1)) + 1)\n const chunk = nextPower <= 256 ? 32 : nextPower / 8\n return chunk * (Math.floor((len - 1) / chunk) + 1)\n}\n\nfunction writeU16BE(num: number): Uint8Array {\n if (!Number.isSafeInteger(num) || num < minPlaintextSize || num > 0xffff)\n throw new Error('invalid plaintext size: must be between 1 and 65535 bytes')\n const arr = new Uint8Array(2)\n new DataView(arr.buffer).setUint16(0, num, false)\n return arr\n}\n\nfunction writeU32BE(num: number): Uint8Array {\n if (!Number.isSafeInteger(num) || num < extendedPrefixThreshold || num > maxPlaintextSize)\n throw new Error('invalid plaintext size: must be between 65536 and 4294967295 bytes')\n const arr = new Uint8Array(4)\n new DataView(arr.buffer).setUint32(0, num, false)\n return arr\n}\n\nfunction pad(plaintext: string): Uint8Array {\n const unpadded = utf8Encoder.encode(plaintext)\n const unpaddedLen = unpadded.length\n if (unpaddedLen < minPlaintextSize || unpaddedLen > maxPlaintextSize)\n throw new Error('invalid plaintext size: must be between 1 and 4294967295 bytes')\n const prefix =\n unpaddedLen >= extendedPrefixThreshold\n ? concatBytes(new Uint8Array([0, 0]), writeU32BE(unpaddedLen)) // 6 bytes\n : writeU16BE(unpaddedLen) // 2 bytes\n const suffix = new Uint8Array(calcPaddedLen(unpaddedLen) - unpaddedLen)\n return concatBytes(prefix, unpadded, suffix)\n}\n\nfunction unpad(padded: Uint8Array): string {\n const dv = new DataView(padded.buffer, padded.byteOffset, padded.byteLength)\n const firstTwo = dv.getUint16(0)\n let unpaddedLen: number\n let prefixLen: number\n if (firstTwo === 0) {\n // Extended format: 2 zero bytes + 4-byte u32 length\n unpaddedLen = dv.getUint32(2)\n if (unpaddedLen < extendedPrefixThreshold) throw new Error('invalid padding')\n prefixLen = 6\n } else {\n unpaddedLen = firstTwo\n prefixLen = 2\n }\n const unpadded = padded.subarray(prefixLen, prefixLen + unpaddedLen)\n if (\n unpaddedLen < minPlaintextSize ||\n unpaddedLen > maxPlaintextSize ||\n unpadded.length !== unpaddedLen ||\n padded.length !== prefixLen + calcPaddedLen(unpaddedLen)\n )\n throw new Error('invalid padding')\n return utf8Decoder.decode(unpadded)\n}\n\nfunction hmacAad(key: Uint8Array, message: Uint8Array, aad: Uint8Array): Uint8Array {\n if (aad.length !== 32) throw new Error('AAD associated data must be 32 bytes')\n const combined = concatBytes(aad, message)\n return hmac(sha256, key, combined)\n}\n\n// metadata: always 65b (version: 1b, nonce: 32b, mac: 32b)\n// plaintext: 1b to 0xffffffff\n// padded plaintext (small, <65536): 32b to 0x10000, with 2b prefix -> 34b to 0x10000+2\n// padded plaintext (large, >=65536): 0x10000 to 0x100000000, with 6b prefix -> 0x10006 to 0x100000000+6\n// ciphertext: same as padded plaintext (chacha20 doesn't change length)\n// raw payload (small): 99 (65+34) to 65603 (65+0x10000+2)\n// raw payload (large): 65607 (65+0x10006) to 4294967367 (65+0x100000000+6)\nfunction decodePayload(payload: string): { nonce: Uint8Array; ciphertext: Uint8Array; mac: Uint8Array } {\n if (typeof payload !== 'string') throw new Error('payload must be a valid string')\n const plen = payload.length\n if (plen < 132) throw new Error('invalid payload length: ' + plen)\n if (payload[0] === '#') throw new Error('unknown encryption version')\n let data: Uint8Array\n try {\n data = base64.decode(payload)\n } catch (error) {\n throw new Error('invalid base64: ' + (error as any).message)\n }\n const dlen = data.length\n if (dlen < 99) throw new Error('invalid data length: ' + dlen)\n const vers = data[0]\n if (vers !== 2) throw new Error('unknown encryption version ' + vers)\n return {\n nonce: data.subarray(1, 33),\n ciphertext: data.subarray(33, -32),\n mac: data.subarray(-32),\n }\n}\n\nexport function encrypt(plaintext: string, conversationKey: Uint8Array, nonce: Uint8Array = randomBytes(32)): string {\n const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce)\n const padded = pad(plaintext)\n const ciphertext = chacha20(chacha_key, chacha_nonce, padded)\n const mac = hmacAad(hmac_key, ciphertext, nonce)\n return base64.encode(concatBytes(new Uint8Array([2]), nonce, ciphertext, mac))\n}\n\n/** Callers should validate payload size before calling to prevent DoS from oversized inputs. */\nexport function decrypt(payload: string, conversationKey: Uint8Array): string {\n const { nonce, ciphertext, mac } = decodePayload(payload)\n const { chacha_key, chacha_nonce, hmac_key } = getMessageKeys(conversationKey, nonce)\n const calculatedMac = hmacAad(hmac_key, ciphertext, nonce)\n if (!equalBytes(calculatedMac, mac)) throw new Error('invalid MAC')\n const padded = chacha20(chacha_key, chacha_nonce, ciphertext)\n return unpad(padded)\n}\n\nexport const v2 = {\n utils: {\n getConversationKey,\n calcPaddedLen,\n pad,\n unpad,\n },\n encrypt,\n decrypt,\n}\n", "import type { NostrEvent } from './core.ts'\n\nexport const utf8Decoder: TextDecoder = new TextDecoder('utf-8')\nexport const utf8Encoder: TextEncoder = new TextEncoder()\n\nexport { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'\n\nexport function normalizeURL(url: string): string {\n try {\n if (url.indexOf('://') === -1) url = 'wss://' + url\n let p = new URL(url)\n if (p.protocol === 'http:') p.protocol = 'ws:'\n else if (p.protocol === 'https:') p.protocol = 'wss:'\n p.pathname = p.pathname.replace(/\\/+/g, '/')\n if (p.pathname.endsWith('/')) p.pathname = p.pathname.slice(0, -1)\n if ((p.port === '80' && p.protocol === 'ws:') || (p.port === '443' && p.protocol === 'wss:')) p.port = ''\n p.searchParams.sort()\n p.hash = ''\n return p.toString()\n } catch (e) {\n throw new Error(`Invalid URL: ${url}`)\n }\n}\n\nexport function insertEventIntoDescendingList(sortedArray: NostrEvent[], event: NostrEvent): NostrEvent[] {\n const [idx, found] = binarySearch(sortedArray, b => {\n if (event.id === b.id) return 0\n if (event.created_at === b.created_at) return -1\n return b.created_at - event.created_at\n })\n if (!found) {\n sortedArray.splice(idx, 0, event)\n }\n return sortedArray\n}\n\nexport function insertEventIntoAscendingList(sortedArray: NostrEvent[], event: NostrEvent): NostrEvent[] {\n const [idx, found] = binarySearch(sortedArray, b => {\n if (event.id === b.id) return 0\n if (event.created_at === b.created_at) return -1\n return event.created_at - b.created_at\n })\n if (!found) {\n sortedArray.splice(idx, 0, event)\n }\n return sortedArray\n}\n\nexport function binarySearch<T>(arr: T[], compare: (b: T) => number): [number, boolean] {\n let start = 0\n let end = arr.length - 1\n\n while (start <= end) {\n const mid = Math.floor((start + end) / 2)\n const cmp = compare(arr[mid])\n\n if (cmp === 0) {\n return [mid, true]\n }\n\n if (cmp < 0) {\n end = mid - 1\n } else {\n start = mid + 1\n }\n }\n\n return [start, false]\n}\n\nexport function mergeReverseSortedLists(list1: NostrEvent[], list2: NostrEvent[]): NostrEvent[] {\n const result: NostrEvent[] = new Array(list1.length + list2.length)\n result.length = 0\n let i1 = 0\n let i2 = 0\n let sameTimestampIds: string[] = []\n\n while (i1 < list1.length && i2 < list2.length) {\n let next: NostrEvent\n if (list1[i1]?.created_at > list2[i2]?.created_at) {\n next = list1[i1]\n i1++\n } else {\n next = list2[i2]\n i2++\n }\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n while (i1 < list1.length) {\n const next = list1[i1]\n i1++\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n while (i2 < list2.length) {\n const next = list2[i2]\n i2++\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n return result\n}\n\n/**\n * Checks if a string is a 64-char lowercase hex string as most Nostr ids and pubkeys.\n */\nexport function isHex32(input: string): boolean {\n for (let i = 0; i < 64; i++) {\n let cc = input.charCodeAt(i)\n if (isNaN(cc) || cc < 48 || cc > 102 || (cc > 57 && cc < 97)) {\n return false\n }\n }\n return true\n}\n"],
5
5
  "mappings": ";AAAA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,WAAW,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SAAS,IAAI,eAAe,iBAAiB,KAAK;AACpF,QAAM,gBAAgB,QAAQ,UAAU,YAAY,KAAK;AACzD,MAAI,CAAC,WAAW,eAAe,GAAG;AAAG,UAAM,IAAI,MAAM,aAAa;AAClE,QAAM,SAAS,SAAS,YAAY,cAAc,UAAU;AAC5D,SAAO,MAAM,MAAM;AACrB;AAEO,IAAM,KAAK;AAAA,EAChB,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["hexToBytes", "hexToBytes"]
7
7
  }
@@ -1,9 +1,25 @@
1
1
  // nip45.ts
2
2
  import { sha256 } from "@noble/hashes/sha2.js";
3
- import { bytesToHex } from "@noble/hashes/utils.js";
3
+ import { bytesToHex as bytesToHex2 } from "@noble/hashes/utils.js";
4
+
5
+ // utils.ts
6
+ import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
7
+ var utf8Decoder = new TextDecoder("utf-8");
8
+ var utf8Encoder = new TextEncoder();
9
+ function isHex32(input) {
10
+ for (let i = 0; i < 64; i++) {
11
+ let cc = input.charCodeAt(i);
12
+ if (isNaN(cc) || cc < 48 || cc > 102 || cc > 57 && cc < 97) {
13
+ return false;
14
+ }
15
+ }
16
+ return true;
17
+ }
18
+
19
+ // nip45.ts
4
20
  var M = 256;
5
21
  var HLL_HEX_LENGTH = M * 2;
6
- var utf8Encoder = new TextEncoder();
22
+ var utf8Encoder2 = new TextEncoder();
7
23
  function getCountManyFilter(target, directive) {
8
24
  switch (directive) {
9
25
  case "reactions":
@@ -24,7 +40,7 @@ function newHll() {
24
40
  return new Uint8Array(M);
25
41
  }
26
42
  function hllDecode(hex) {
27
- if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-fA-F]+$/.test(hex))
43
+ if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-f]+$/.test(hex))
28
44
  return void 0;
29
45
  const registers = new Uint8Array(M);
30
46
  for (let i = 0; i < M; i++) {
@@ -43,12 +59,12 @@ function hllEncode(registers) {
43
59
  }
44
60
  function computeOffset(filterFirstTagValue) {
45
61
  let hex = filterFirstTagValue;
46
- if (!isHex64(hex)) {
62
+ if (!isHex32(hex)) {
47
63
  const parts = hex.split(":");
48
- if (parts.length === 3 && isHex64(parts[1])) {
64
+ if (parts.length === 3 && isHex32(parts[1])) {
49
65
  hex = parts[1];
50
66
  } else {
51
- hex = bytesToHex(sha256(utf8Encoder.encode(filterFirstTagValue)));
67
+ hex = bytesToHex2(sha256(utf8Encoder2.encode(filterFirstTagValue)));
52
68
  }
53
69
  }
54
70
  return parseInt(hex[32], 16) + 8;
@@ -66,7 +82,7 @@ function getFilterFirstTagValue(filter) {
66
82
  function feedPubkey(hll, pubkey, offset) {
67
83
  if (offset < 0 || offset > 24)
68
84
  throw new Error(`invalid offset ${offset}`);
69
- if (!isHex64(pubkey))
85
+ if (!isHex32(pubkey))
70
86
  throw new Error("pubkey must be 32-byte hex");
71
87
  if (hll.length === 0)
72
88
  hll = newHll();
@@ -110,9 +126,6 @@ function estimateCount(hll) {
110
126
  return Math.floor(linearCounting(M, v));
111
127
  return Math.floor(estimate);
112
128
  }
113
- function isHex64(value) {
114
- return /^[0-9a-fA-F]{64}$/.test(value);
115
- }
116
129
  function countLeadingZeroBitsAfterOffset(pubkey, offset) {
117
130
  let zeroBits = 0;
118
131
  for (let i = offset + 1; i < offset + 8; i++) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../nip45.ts"],
4
- "sourcesContent": ["import { sha256 } from '@noble/hashes/sha2.js'\nimport { bytesToHex } from '@noble/hashes/utils.js'\n\nimport type { Event } from './core.ts'\nimport type { Filter } from './filter.ts'\n\nconst M = 256\nconst HLL_HEX_LENGTH = M * 2\nconst utf8Encoder = new TextEncoder()\n\nexport type CountManyDirective = 'reactions' | 'reposts' | 'quotes' | 'replies' | 'comments' | 'followers'\n\nexport function getCountManyFilter(target: string, directive: CountManyDirective): Filter {\n switch (directive) {\n case 'reactions':\n return { '#e': [target], kinds: [7] }\n case 'reposts':\n return { '#e': [target], kinds: [6] }\n case 'quotes':\n return { '#q': [target], kinds: [1, 1111] }\n case 'replies':\n return { '#e': [target], kinds: [1] }\n case 'comments':\n return { '#E': [target], kinds: [1111] }\n case 'followers':\n return { '#p': [target], kinds: [3] }\n }\n}\n\nexport function newHll(): Uint8Array {\n return new Uint8Array(M)\n}\n\nexport function hllDecode(hex: string): Uint8Array | undefined {\n if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-fA-F]+$/.test(hex)) return undefined\n\n const registers = new Uint8Array(M)\n for (let i = 0; i < M; i++) {\n registers[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16)\n }\n return registers\n}\n\nexport function hllEncode(registers: Uint8Array): string {\n if (registers.length !== M) throw new Error(`invalid number of registers ${registers.length}`)\n\n let hex = ''\n for (let i = 0; i < M; i++) {\n hex += registers[i].toString(16).padStart(2, '0')\n }\n return hex\n}\n\nexport function computeOffset(filterFirstTagValue: string): number {\n let hex = filterFirstTagValue\n\n if (!isHex64(hex)) {\n const parts = hex.split(':')\n if (parts.length === 3 && isHex64(parts[1])) {\n hex = parts[1]\n } else {\n hex = bytesToHex(sha256(utf8Encoder.encode(filterFirstTagValue)))\n }\n }\n\n return parseInt(hex[32], 16) + 8\n}\n\nexport function getFilterFirstTagValue(filter: Filter): string | undefined {\n for (const key in filter) {\n if (key[0] !== '#') continue\n\n const values = filter[key as `#${string}`]\n if (Array.isArray(values) && typeof values[0] === 'string') return values[0]\n }\n\n return undefined\n}\n\nexport function feedPubkey(hll: Uint8Array, pubkey: string, offset: number): Uint8Array {\n if (offset < 0 || offset > 24) throw new Error(`invalid offset ${offset}`)\n if (!isHex64(pubkey)) throw new Error('pubkey must be 32-byte hex')\n\n if (hll.length === 0) hll = newHll()\n if (hll.length !== M) throw new Error(`invalid number of registers ${hll.length}`)\n\n const ri = parseInt(pubkey.slice(offset * 2, offset * 2 + 2), 16)\n const value = countLeadingZeroBitsAfterOffset(pubkey, offset) + 1\n if (value > hll[ri]) hll[ri] = value\n\n return hll\n}\n\nexport function feedEvent(hll: Uint8Array, event: Event, offset: number): Uint8Array {\n return feedPubkey(hll, event.pubkey, offset)\n}\n\nexport function mergeHll(target: Uint8Array, source: Uint8Array): Uint8Array {\n if (target.length === 0) target = newHll()\n if (target.length !== M) throw new Error(`invalid number of registers ${target.length}`)\n if (source.length !== M) throw new Error(`invalid number of registers ${source.length}`)\n\n for (let i = 0; i < M; i++) {\n if (source[i] > target[i]) target[i] = source[i]\n }\n\n return target\n}\n\nexport function estimateCount(hll: Uint8Array): number {\n if (hll.length === 0) return 0\n if (hll.length !== M) throw new Error(`invalid number of registers ${hll.length}`)\n\n const v = countZeros(hll)\n if (v !== 0) {\n const lc = linearCounting(M, v)\n if (lc <= 220) return Math.floor(lc)\n }\n\n const estimate = calculateEstimate(hll)\n if (estimate <= M * 3 && v !== 0) return Math.floor(linearCounting(M, v))\n\n return Math.floor(estimate)\n}\n\nfunction isHex64(value: string): boolean {\n return /^[0-9a-fA-F]{64}$/.test(value)\n}\n\nfunction countLeadingZeroBitsAfterOffset(pubkey: string, offset: number): number {\n let zeroBits = 0\n for (let i = offset + 1; i < offset + 8; i++) {\n const byte = parseInt(pubkey.slice(i * 2, i * 2 + 2), 16)\n if (byte === 0) {\n zeroBits += 8\n continue\n }\n\n let mask = 0x80\n while ((byte & mask) === 0) {\n zeroBits++\n mask >>= 1\n }\n break\n }\n return zeroBits\n}\n\nfunction countZeros(registers: Uint8Array): number {\n let count = 0\n for (let i = 0; i < M; i++) {\n if (registers[i] === 0) count++\n }\n return count\n}\n\nfunction linearCounting(m: number, v: number): number {\n return m * Math.log(m / v)\n}\n\nfunction calculateEstimate(registers: Uint8Array): number {\n let sum = 0\n for (let i = 0; i < M; i++) {\n sum += 1 / 2 ** registers[i]\n }\n return (0.7182725932495458 * M * M) / sum\n}\n"],
5
- "mappings": ";AAAA,SAAS,cAAc;AACvB,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AO;AACT;AAEA,SAAS,eAAe,GAAW,GAAmB;AACpD,SAAO,IAAI,KAAK,IAAI,IAAI,CAAC;AAC3B;AAEA,SAAS,kBAAkB,WAA+B;AACxD,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,WAAO,IAAI,KAAK,UAAU;AAAA,EAC5B;AACA,SAAQ,qBAAqB,IAAI,IAAK;AACxC;",
6
- "names": []
3
+ "sources": ["../../nip45.ts", "../../utils.ts"],
4
+ "sourcesContent": ["import { sha256 } from '@noble/hashes/sha2.js'\nimport { bytesToHex } from '@noble/hashes/utils.js'\n\nimport type { Event } from './core.ts'\nimport type { Filter } from './filter.ts'\nimport { isHex32 } from './utils.ts'\n\nconst M = 256\nconst HLL_HEX_LENGTH = M * 2\nconst utf8Encoder = new TextEncoder()\n\nexport type CountManyDirective = 'reactions' | 'reposts' | 'quotes' | 'replies' | 'comments' | 'followers'\n\nexport function getCountManyFilter(target: string, directive: CountManyDirective): Filter {\n switch (directive) {\n case 'reactions':\n return { '#e': [target], kinds: [7] }\n case 'reposts':\n return { '#e': [target], kinds: [6] }\n case 'quotes':\n return { '#q': [target], kinds: [1, 1111] }\n case 'replies':\n return { '#e': [target], kinds: [1] }\n case 'comments':\n return { '#E': [target], kinds: [1111] }\n case 'followers':\n return { '#p': [target], kinds: [3] }\n }\n}\n\nexport function newHll(): Uint8Array {\n return new Uint8Array(M)\n}\n\nexport function hllDecode(hex: string): Uint8Array | undefined {\n if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-f]+$/.test(hex)) return undefined\n\n const registers = new Uint8Array(M)\n for (let i = 0; i < M; i++) {\n registers[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16)\n }\n return registers\n}\n\nexport function hllEncode(registers: Uint8Array): string {\n if (registers.length !== M) throw new Error(`invalid number of registers ${registers.length}`)\n\n let hex = ''\n for (let i = 0; i < M; i++) {\n hex += registers[i].toString(16).padStart(2, '0')\n }\n return hex\n}\n\nexport function computeOffset(filterFirstTagValue: string): number {\n let hex = filterFirstTagValue\n\n if (!isHex32(hex)) {\n const parts = hex.split(':')\n if (parts.length === 3 && isHex32(parts[1])) {\n hex = parts[1]\n } else {\n hex = bytesToHex(sha256(utf8Encoder.encode(filterFirstTagValue)))\n }\n }\n\n return parseInt(hex[32], 16) + 8\n}\n\nexport function getFilterFirstTagValue(filter: Filter): string | undefined {\n for (const key in filter) {\n if (key[0] !== '#') continue\n\n const values = filter[key as `#${string}`]\n if (Array.isArray(values) && typeof values[0] === 'string') return values[0]\n }\n\n return undefined\n}\n\nexport function feedPubkey(hll: Uint8Array, pubkey: string, offset: number): Uint8Array {\n if (offset < 0 || offset > 24) throw new Error(`invalid offset ${offset}`)\n if (!isHex32(pubkey)) throw new Error('pubkey must be 32-byte hex')\n\n if (hll.length === 0) hll = newHll()\n if (hll.length !== M) throw new Error(`invalid number of registers ${hll.length}`)\n\n const ri = parseInt(pubkey.slice(offset * 2, offset * 2 + 2), 16)\n const value = countLeadingZeroBitsAfterOffset(pubkey, offset) + 1\n if (value > hll[ri]) hll[ri] = value\n\n return hll\n}\n\nexport function feedEvent(hll: Uint8Array, event: Event, offset: number): Uint8Array {\n return feedPubkey(hll, event.pubkey, offset)\n}\n\nexport function mergeHll(target: Uint8Array, source: Uint8Array): Uint8Array {\n if (target.length === 0) target = newHll()\n if (target.length !== M) throw new Error(`invalid number of registers ${target.length}`)\n if (source.length !== M) throw new Error(`invalid number of registers ${source.length}`)\n\n for (let i = 0; i < M; i++) {\n if (source[i] > target[i]) target[i] = source[i]\n }\n\n return target\n}\n\nexport function estimateCount(hll: Uint8Array): number {\n if (hll.length === 0) return 0\n if (hll.length !== M) throw new Error(`invalid number of registers ${hll.length}`)\n\n const v = countZeros(hll)\n if (v !== 0) {\n const lc = linearCounting(M, v)\n if (lc <= 220) return Math.floor(lc)\n }\n\n const estimate = calculateEstimate(hll)\n if (estimate <= M * 3 && v !== 0) return Math.floor(linearCounting(M, v))\n\n return Math.floor(estimate)\n}\n\nfunction countLeadingZeroBitsAfterOffset(pubkey: string, offset: number): number {\n let zeroBits = 0\n for (let i = offset + 1; i < offset + 8; i++) {\n const byte = parseInt(pubkey.slice(i * 2, i * 2 + 2), 16)\n if (byte === 0) {\n zeroBits += 8\n continue\n }\n\n let mask = 0x80\n while ((byte & mask) === 0) {\n zeroBits++\n mask >>= 1\n }\n break\n }\n return zeroBits\n}\n\nfunction countZeros(registers: Uint8Array): number {\n let count = 0\n for (let i = 0; i < M; i++) {\n if (registers[i] === 0) count++\n }\n return count\n}\n\nfunction linearCounting(m: number, v: number): number {\n return m * Math.log(m / v)\n}\n\nfunction calculateEstimate(registers: Uint8Array): number {\n let sum = 0\n for (let i = 0; i < M; i++) {\n sum += 1 / 2 ** registers[i]\n }\n return (0.7182725932495458 * M * M) / sum\n}\n", "import type { NostrEvent } from './core.ts'\n\nexport const utf8Decoder: TextDecoder = new TextDecoder('utf-8')\nexport const utf8Encoder: TextEncoder = new TextEncoder()\n\nexport { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'\n\nexport function normalizeURL(url: string): string {\n try {\n if (url.indexOf('://') === -1) url = 'wss://' + url\n let p = new URL(url)\n if (p.protocol === 'http:') p.protocol = 'ws:'\n else if (p.protocol === 'https:') p.protocol = 'wss:'\n p.pathname = p.pathname.replace(/\\/+/g, '/')\n if (p.pathname.endsWith('/')) p.pathname = p.pathname.slice(0, -1)\n if ((p.port === '80' && p.protocol === 'ws:') || (p.port === '443' && p.protocol === 'wss:')) p.port = ''\n p.searchParams.sort()\n p.hash = ''\n return p.toString()\n } catch (e) {\n throw new Error(`Invalid URL: ${url}`)\n }\n}\n\nexport function insertEventIntoDescendingList(sortedArray: NostrEvent[], event: NostrEvent): NostrEvent[] {\n const [idx, found] = binarySearch(sortedArray, b => {\n if (event.id === b.id) return 0\n if (event.created_at === b.created_at) return -1\n return b.created_at - event.created_at\n })\n if (!found) {\n sortedArray.splice(idx, 0, event)\n }\n return sortedArray\n}\n\nexport function insertEventIntoAscendingList(sortedArray: NostrEvent[], event: NostrEvent): NostrEvent[] {\n const [idx, found] = binarySearch(sortedArray, b => {\n if (event.id === b.id) return 0\n if (event.created_at === b.created_at) return -1\n return event.created_at - b.created_at\n })\n if (!found) {\n sortedArray.splice(idx, 0, event)\n }\n return sortedArray\n}\n\nexport function binarySearch<T>(arr: T[], compare: (b: T) => number): [number, boolean] {\n let start = 0\n let end = arr.length - 1\n\n while (start <= end) {\n const mid = Math.floor((start + end) / 2)\n const cmp = compare(arr[mid])\n\n if (cmp === 0) {\n return [mid, true]\n }\n\n if (cmp < 0) {\n end = mid - 1\n } else {\n start = mid + 1\n }\n }\n\n return [start, false]\n}\n\nexport function mergeReverseSortedLists(list1: NostrEvent[], list2: NostrEvent[]): NostrEvent[] {\n const result: NostrEvent[] = new Array(list1.length + list2.length)\n result.length = 0\n let i1 = 0\n let i2 = 0\n let sameTimestampIds: string[] = []\n\n while (i1 < list1.length && i2 < list2.length) {\n let next: NostrEvent\n if (list1[i1]?.created_at > list2[i2]?.created_at) {\n next = list1[i1]\n i1++\n } else {\n next = list2[i2]\n i2++\n }\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n while (i1 < list1.length) {\n const next = list1[i1]\n i1++\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n while (i2 < list2.length) {\n const next = list2[i2]\n i2++\n\n if (result.length > 0 && result[result.length - 1].created_at === next.created_at) {\n if (sameTimestampIds.includes(next.id)) continue\n } else {\n sameTimestampIds.length = 0\n }\n result.push(next)\n sameTimestampIds.push(next.id)\n }\n\n return result\n}\n\n/**\n * Checks if a string is a 64-char lowercase hex string as most Nostr ids and pubkeys.\n */\nexport function isHex32(input: string): boolean {\n for (let i = 0; i < 64; i++) {\n let cc = input.charCodeAt(i)\n if (isNaN(cc) || cc < 48 || cc > 102 || (cc > 57 && cc < 97)) {\n return false\n }\n }\n return true\n}\n"],
5
+ "mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,cAAAA,mBAAkB;;;ACI3B,SAAS,YAAY,kBAAkB;AAHhC,IAAM,cAA2B,IAAI,YAAY,OAAO;AACxD,IAAM,cAA2B,IAAI,YAAY;AA8HjD,SAAS,QAAQ,OAAwB;AAC9C,WAAS,IAAI,GAAG,IAAI,IAAI,KAAK;AAC3B,QAAI,KAAK,MAAM,WAAW,CAAC;AAC3B,QAAI,MAAM,EAAE,KAAK,KAAK,MAAM,KAAK,OAAQ,KAAK,MAAM,KAAK,IAAK;AAC5D,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;;;ADlIA,IAAM,IAAI;AACV,IAAM,iBAAiB,IAAI;AAC3B,IAAMC,eAAc,IAAI,YAAY;AAI7B,SAAS,mBAAmB,QAAgB,WAAuC;AACxF,UAAQ,WAAW;AAAA,IACjB,KAAK;AACH,aAAO,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE;AAAA,IACtC,KAAK;AACH,aAAO,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE;AAAA,IACtC,KAAK;AACH,aAAO,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,IAAI,EAAE;AAAA,IAC5C,KAAK;AACH,aAAO,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE;AAAA,IACtC,KAAK;AACH,aAAO,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE;AAAA,IACzC,KAAK;AACH,aAAO,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE;AAAA,EACxC;AACF;AAEO,SAAS,SAAqB;AACnC,SAAO,IAAI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AgB,QAAwB;AAC/E,MAAI,WAAW;AACf,WAAS,IAAI,SAAS,GAAG,IAAI,SAAS,GAAG,KAAK;AAC5C,UAAM,OAAO,SAAS,OAAO,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE;AACxD,QAAI,SAAS,GAAG;AACd,kBAAY;AACZ;AAAA,IACF;AAEA,QAAI,OAAO;AACX,YAAQ,OAAO,UAAU,GAAG;AAC1B;AACA,eAAS;AAAA,IACX;AACA;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,WAAW,WAA+B;AACjD,MAAI,QAAQ;AACZ,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,QAAI,UAAU,OAAO;AAAG;AAAA,EAC1B;AACA,SAAO;AACT;AAEA,SAAS,eAAe,GAAW,GAAmB;AACpD,SAAO,IAAI,KAAK,IAAI,IAAI,CAAC;AAC3B;AAEA,SAAS,kBAAkB,WAA+B;AACxD,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,WAAO,IAAI,KAAK,UAAU;AAAA,EAC5B;AACA,SAAQ,qBAAqB,IAAI,IAAK;AACxC;",
6
+ "names": ["bytesToHex", "utf8Encoder", "bytesToHex"]
7
7
  }
@@ -2,6 +2,41 @@
2
2
  import { schnorr } from "@noble/curves/secp256k1.js";
3
3
  import { bytesToHex as bytesToHex2, hexToBytes as hexToBytes2 } from "@noble/hashes/utils.js";
4
4
 
5
+ // utils.ts
6
+ import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
7
+ var utf8Decoder = new TextDecoder("utf-8");
8
+ var utf8Encoder = new TextEncoder();
9
+ function normalizeURL(url) {
10
+ try {
11
+ if (url.indexOf("://") === -1)
12
+ url = "wss://" + url;
13
+ let p = new URL(url);
14
+ if (p.protocol === "http:")
15
+ p.protocol = "ws:";
16
+ else if (p.protocol === "https:")
17
+ p.protocol = "wss:";
18
+ p.pathname = p.pathname.replace(/\/+/g, "/");
19
+ if (p.pathname.endsWith("/"))
20
+ p.pathname = p.pathname.slice(0, -1);
21
+ if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
22
+ p.port = "";
23
+ p.searchParams.sort();
24
+ p.hash = "";
25
+ return p.toString();
26
+ } catch (e) {
27
+ throw new Error(`Invalid URL: ${url}`);
28
+ }
29
+ }
30
+ function isHex32(input) {
31
+ for (let i2 = 0; i2 < 64; i2++) {
32
+ let cc = input.charCodeAt(i2);
33
+ if (isNaN(cc) || cc < 48 || cc > 102 || cc > 57 && cc < 97) {
34
+ return false;
35
+ }
36
+ }
37
+ return true;
38
+ }
39
+
5
40
  // core.ts
6
41
  var verifiedSymbol = Symbol("verified");
7
42
  var isRecord = (obj) => obj instanceof Object;
@@ -16,7 +51,7 @@ function validateEvent(event) {
16
51
  return false;
17
52
  if (typeof event.pubkey !== "string")
18
53
  return false;
19
- if (!event.pubkey.match(/^[a-f0-9]{64}$/))
54
+ if (!isHex32(event.pubkey))
20
55
  return false;
21
56
  if (!Array.isArray(event.tags))
22
57
  return false;
@@ -34,34 +69,6 @@ function validateEvent(event) {
34
69
 
35
70
  // pure.ts
36
71
  import { sha256 } from "@noble/hashes/sha2.js";
37
-
38
- // utils.ts
39
- import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
40
- var utf8Decoder = new TextDecoder("utf-8");
41
- var utf8Encoder = new TextEncoder();
42
- function normalizeURL(url) {
43
- try {
44
- if (url.indexOf("://") === -1)
45
- url = "wss://" + url;
46
- let p = new URL(url);
47
- if (p.protocol === "http:")
48
- p.protocol = "ws:";
49
- else if (p.protocol === "https:")
50
- p.protocol = "wss:";
51
- p.pathname = p.pathname.replace(/\/+/g, "/");
52
- if (p.pathname.endsWith("/"))
53
- p.pathname = p.pathname.slice(0, -1);
54
- if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
55
- p.port = "";
56
- p.searchParams.sort();
57
- p.hash = "";
58
- return p.toString();
59
- } catch (e) {
60
- throw new Error(`Invalid URL: ${url}`);
61
- }
62
- }
63
-
64
- // pure.ts
65
72
  var JS = class {
66
73
  generateSecretKey() {
67
74
  return schnorr.utils.randomSecretKey();
@@ -413,6 +420,11 @@ var AbstractRelay = class {
413
420
  }, backoff);
414
421
  }
415
422
  handleHardClose(reason) {
423
+ if (this.ws) {
424
+ this.ws.onopen = null;
425
+ this.ws.onerror = null;
426
+ this.ws.onclose = null;
427
+ }
416
428
  if (this.pingIntervalHandle) {
417
429
  clearInterval(this.pingIntervalHandle);
418
430
  this.pingIntervalHandle = void 0;
@@ -443,7 +455,6 @@ var AbstractRelay = class {
443
455
  if (this.reconnectAttempts === 0) {
444
456
  this.skipReconnection = true;
445
457
  }
446
- this.onclose?.();
447
458
  this.handleHardClose("relay connection timed out");
448
459
  }, opts.timeout);
449
460
  }
@@ -489,7 +500,6 @@ var AbstractRelay = class {
489
500
  if (this.reconnectAttempts === 0) {
490
501
  this.skipReconnection = true;
491
502
  }
492
- this.onclose?.();
493
503
  this.handleHardClose("relay connection failed");
494
504
  };
495
505
  this.ws.onclose = (ev) => {
@@ -658,11 +668,17 @@ var AbstractRelay = class {
658
668
  }
659
669
  this.closeAllSubscriptions("relay connection closed by us");
660
670
  this._connected = false;
671
+ this.connectionPromise = void 0;
661
672
  this.idleSince = void 0;
662
673
  this.clearIdleTimeout();
663
674
  this.onclose?.();
664
- if (this.ws?.readyState === this._WebSocket.OPEN) {
665
- this.ws?.close();
675
+ if (this.ws) {
676
+ this.ws.onopen = null;
677
+ this.ws.onerror = null;
678
+ this.ws.onclose = null;
679
+ if (this.ws.readyState !== this._WebSocket.CLOSING && this.ws.readyState !== this._WebSocket.CLOSED) {
680
+ this.ws.close();
681
+ }
666
682
  }
667
683
  }
668
684
  _onmessage(ev) {
@@ -689,7 +705,7 @@ var AbstractRelay = class {
689
705
  case "EVENT": {
690
706
  const so = this.openSubs.get(data[1]);
691
707
  const event = data[2];
692
- if (this.verifyEvent(event) && matchFilters(so.filters, event)) {
708
+ if (matchFilters(so.filters, event) && this.verifyEvent(event, this.url)) {
693
709
  so.onevent(event);
694
710
  } else {
695
711
  so.oninvalidevent?.(event);
@@ -845,12 +861,6 @@ var Subscription = class {
845
861
  }
846
862
  };
847
863
 
848
- // helpers.ts
849
- var alwaysTrue = (t) => {
850
- t[verifiedSymbol] = true;
851
- return true;
852
- };
853
-
854
864
  // nip45.ts
855
865
  import { sha256 as sha2563 } from "@noble/hashes/sha2.js";
856
866
  import { bytesToHex as bytesToHex3 } from "@noble/hashes/utils.js";
@@ -877,7 +887,7 @@ function newHll() {
877
887
  return new Uint8Array(M);
878
888
  }
879
889
  function hllDecode(hex) {
880
- if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-fA-F]+$/.test(hex))
890
+ if (hex.length !== HLL_HEX_LENGTH || !/^[0-9a-f]+$/.test(hex))
881
891
  return void 0;
882
892
  const registers = new Uint8Array(M);
883
893
  for (let i2 = 0; i2 < M; i2++) {
@@ -918,7 +928,6 @@ var AbstractSimplePool = class {
918
928
  enableReconnect;
919
929
  idleTimeout = 2e4;
920
930
  automaticallyAuth;
921
- trustedRelayURLs = /* @__PURE__ */ new Set();
922
931
  onRelayConnectionFailure;
923
932
  onRelayConnectionSuccess;
924
933
  allowConnectingToRelay;
@@ -942,7 +951,7 @@ var AbstractSimplePool = class {
942
951
  let relay = this.relays.get(url);
943
952
  if (!relay) {
944
953
  relay = new AbstractRelay(url, {
945
- verifyEvent: this.trustedRelayURLs.has(url) ? alwaysTrue : this.verifyEvent,
954
+ verifyEvent: this.verifyEvent,
946
955
  websocketImplementation: this._WebSocket,
947
956
  enablePing: this.enablePing,
948
957
  enableReconnect: this.enableReconnect,
@@ -1026,11 +1035,11 @@ var AbstractSimplePool = class {
1026
1035
  }
1027
1036
  };
1028
1037
  const closesReceived = [];
1029
- let handleClose = (i2, reason) => {
1038
+ let handleClose = (i2, url, reason) => {
1030
1039
  if (closesReceived[i2])
1031
1040
  return;
1032
1041
  handleEose(i2);
1033
- closesReceived[i2] = reason;
1042
+ closesReceived[i2] = { url, reason };
1034
1043
  if (closesReceived.filter((a) => a).length === groupedRequests.length) {
1035
1044
  params.onclose?.(closesReceived);
1036
1045
  handleClose = () => {
@@ -1048,7 +1057,7 @@ var AbstractSimplePool = class {
1048
1057
  const allOpened = Promise.all(
1049
1058
  groupedRequests.map(async ({ url, filters }, i2) => {
1050
1059
  if (this.allowConnectingToRelay?.(url, ["read", filters]) === false) {
1051
- handleClose(i2, "connection skipped by allowConnectingToRelay");
1060
+ handleClose(i2, url, "connection skipped by allowConnectingToRelay");
1052
1061
  return;
1053
1062
  }
1054
1063
  let relay;
@@ -1059,7 +1068,7 @@ var AbstractSimplePool = class {
1059
1068
  });
1060
1069
  } catch (err) {
1061
1070
  this.onRelayConnectionFailure?.(url);
1062
- handleClose(i2, err?.message || String(err));
1071
+ handleClose(i2, url, err?.message || String(err));
1063
1072
  return;
1064
1073
  }
1065
1074
  this.onRelayConnectionSuccess?.(url);
@@ -1073,17 +1082,17 @@ var AbstractSimplePool = class {
1073
1082
  ...params,
1074
1083
  oneose: () => handleEose(i2),
1075
1084
  onclose: (reason2) => {
1076
- handleClose(i2, reason2);
1085
+ handleClose(i2, url, reason2);
1077
1086
  },
1078
1087
  alreadyHaveEvent: localAlreadyHaveEventHandler,
1079
1088
  eoseTimeout: params.maxWait,
1080
1089
  abort: params.abort
1081
1090
  });
1082
1091
  }).catch((err) => {
1083
- handleClose(i2, `auth was required and attempted, but failed with: ${err}`);
1092
+ handleClose(i2, url, `auth was required and attempted, but failed with: ${err}`);
1084
1093
  });
1085
1094
  } else {
1086
- handleClose(i2, reason);
1095
+ handleClose(i2, url, reason);
1087
1096
  }
1088
1097
  },
1089
1098
  alreadyHaveEvent: localAlreadyHaveEventHandler,
@@ -1111,7 +1120,7 @@ var AbstractSimplePool = class {
1111
1120
  if (subcloser)
1112
1121
  subcloser.close(reason);
1113
1122
  else
1114
- params.onclose?.(relays.map((_) => reason));
1123
+ params.onclose?.(relays.map((url) => ({ url, reason })));
1115
1124
  }
1116
1125
  });
1117
1126
  return subcloser;