@openclaw/nostr 2026.7.2-beta.5 → 2026.8.1-beta.2

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 (473) hide show
  1. package/dist/api.js +10 -7
  2. package/dist/{channel-DNeI-LB-.js → channel-BifOvAwp.js} +58 -41
  3. package/dist/channel-plugin-api.js +1 -1
  4. package/dist/{config-schema-CelPzg1N.js → config-schema-CkYd8ACn.js} +1 -0
  5. package/dist/doctor-contract-api.js +5 -7
  6. package/dist/{setup-adapter-BjKmSwdW.js → setup-adapter-DLthHa2q.js} +40 -12
  7. package/dist/setup-api.js +1 -1
  8. package/dist/setup-plugin-api.js +11 -39
  9. package/dist/{setup-surface-BJCFpe02.js → setup-surface-DAhyNOcb.js} +5 -18
  10. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js +24 -25
  11. package/node_modules/nostr-tools/lib/cjs/abstract-pool.js.map +3 -3
  12. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js +14 -5
  13. package/node_modules/nostr-tools/lib/cjs/abstract-relay.js.map +2 -2
  14. package/node_modules/nostr-tools/lib/cjs/core.js +17 -1
  15. package/node_modules/nostr-tools/lib/cjs/core.js.map +3 -3
  16. package/node_modules/nostr-tools/lib/cjs/filter.js.map +1 -1
  17. package/node_modules/nostr-tools/lib/cjs/index.js +137 -127
  18. package/node_modules/nostr-tools/lib/cjs/index.js.map +4 -4
  19. package/node_modules/nostr-tools/lib/cjs/kinds.js +17 -1
  20. package/node_modules/nostr-tools/lib/cjs/kinds.js.map +3 -3
  21. package/node_modules/nostr-tools/lib/cjs/nip04.js.map +1 -1
  22. package/node_modules/nostr-tools/lib/cjs/nip10.js +20 -5
  23. package/node_modules/nostr-tools/lib/cjs/nip10.js.map +3 -3
  24. package/node_modules/nostr-tools/lib/cjs/nip13.js.map +1 -1
  25. package/node_modules/nostr-tools/lib/cjs/nip17.js +30 -23
  26. package/node_modules/nostr-tools/lib/cjs/nip17.js.map +4 -4
  27. package/node_modules/nostr-tools/lib/cjs/nip18.js +21 -14
  28. package/node_modules/nostr-tools/lib/cjs/nip18.js.map +4 -4
  29. package/node_modules/nostr-tools/lib/cjs/nip19.js.map +1 -1
  30. package/node_modules/nostr-tools/lib/cjs/nip21.js.map +1 -1
  31. package/node_modules/nostr-tools/lib/cjs/nip22.js +22 -7
  32. package/node_modules/nostr-tools/lib/cjs/nip22.js.map +3 -3
  33. package/node_modules/nostr-tools/lib/cjs/nip25.js +21 -14
  34. package/node_modules/nostr-tools/lib/cjs/nip25.js.map +4 -4
  35. package/node_modules/nostr-tools/lib/cjs/nip27.js.map +1 -1
  36. package/node_modules/nostr-tools/lib/cjs/nip28.js +21 -14
  37. package/node_modules/nostr-tools/lib/cjs/nip28.js.map +4 -4
  38. package/node_modules/nostr-tools/lib/cjs/nip29.js.map +1 -1
  39. package/node_modules/nostr-tools/lib/cjs/nip30.js.map +2 -2
  40. package/node_modules/nostr-tools/lib/cjs/nip42.js.map +2 -2
  41. package/node_modules/nostr-tools/lib/cjs/nip44.js.map +1 -1
  42. package/node_modules/nostr-tools/lib/cjs/nip45.js +22 -9
  43. package/node_modules/nostr-tools/lib/cjs/nip45.js.map +4 -4
  44. package/node_modules/nostr-tools/lib/cjs/nip46.js +76 -67
  45. package/node_modules/nostr-tools/lib/cjs/nip46.js.map +4 -4
  46. package/node_modules/nostr-tools/lib/cjs/nip47.js +25 -18
  47. package/node_modules/nostr-tools/lib/cjs/nip47.js.map +4 -4
  48. package/node_modules/nostr-tools/lib/cjs/nip57.js +23 -16
  49. package/node_modules/nostr-tools/lib/cjs/nip57.js.map +4 -4
  50. package/node_modules/nostr-tools/lib/cjs/nip58.js.map +2 -2
  51. package/node_modules/nostr-tools/lib/cjs/nip59.js +16 -7
  52. package/node_modules/nostr-tools/lib/cjs/nip59.js.map +3 -3
  53. package/node_modules/nostr-tools/lib/cjs/nip75.js.map +1 -1
  54. package/node_modules/nostr-tools/lib/cjs/nip94.js.map +1 -1
  55. package/node_modules/nostr-tools/lib/cjs/nip98.js +23 -16
  56. package/node_modules/nostr-tools/lib/cjs/nip98.js.map +4 -4
  57. package/node_modules/nostr-tools/lib/cjs/nip99.js.map +2 -2
  58. package/node_modules/nostr-tools/lib/cjs/nipb0.js +34 -16
  59. package/node_modules/nostr-tools/lib/cjs/nipb0.js.map +4 -4
  60. package/node_modules/nostr-tools/lib/cjs/nipb7.js +13 -7
  61. package/node_modules/nostr-tools/lib/cjs/nipb7.js.map +2 -2
  62. package/node_modules/nostr-tools/lib/cjs/pool.js +67 -58
  63. package/node_modules/nostr-tools/lib/cjs/pool.js.map +4 -4
  64. package/node_modules/nostr-tools/lib/cjs/pure.js +21 -14
  65. package/node_modules/nostr-tools/lib/cjs/pure.js.map +4 -4
  66. package/node_modules/nostr-tools/lib/cjs/references.js.map +1 -1
  67. package/node_modules/nostr-tools/lib/cjs/relay.js +56 -40
  68. package/node_modules/nostr-tools/lib/cjs/relay.js.map +4 -4
  69. package/node_modules/nostr-tools/lib/cjs/signer.js +21 -14
  70. package/node_modules/nostr-tools/lib/cjs/signer.js.map +4 -4
  71. package/node_modules/nostr-tools/lib/cjs/utils.js +10 -0
  72. package/node_modules/nostr-tools/lib/cjs/utils.js.map +2 -2
  73. package/node_modules/nostr-tools/lib/cjs/wasm.js +16 -2
  74. package/node_modules/nostr-tools/lib/cjs/wasm.js.map +4 -4
  75. package/node_modules/nostr-tools/lib/esm/abstract-pool.js +24 -25
  76. package/node_modules/nostr-tools/lib/esm/abstract-pool.js.map +3 -3
  77. package/node_modules/nostr-tools/lib/esm/abstract-relay.js +14 -5
  78. package/node_modules/nostr-tools/lib/esm/abstract-relay.js.map +2 -2
  79. package/node_modules/nostr-tools/lib/esm/core.js +15 -1
  80. package/node_modules/nostr-tools/lib/esm/core.js.map +3 -3
  81. package/node_modules/nostr-tools/lib/esm/filter.js.map +1 -1
  82. package/node_modules/nostr-tools/lib/esm/index.js +87 -77
  83. package/node_modules/nostr-tools/lib/esm/index.js.map +4 -4
  84. package/node_modules/nostr-tools/lib/esm/kinds.js +17 -1
  85. package/node_modules/nostr-tools/lib/esm/kinds.js.map +3 -3
  86. package/node_modules/nostr-tools/lib/esm/nip04.js.map +1 -1
  87. package/node_modules/nostr-tools/lib/esm/nip10.js +18 -5
  88. package/node_modules/nostr-tools/lib/esm/nip10.js.map +3 -3
  89. package/node_modules/nostr-tools/lib/esm/nip13.js.map +1 -1
  90. package/node_modules/nostr-tools/lib/esm/nip17.js +15 -8
  91. package/node_modules/nostr-tools/lib/esm/nip17.js.map +4 -4
  92. package/node_modules/nostr-tools/lib/esm/nip18.js +15 -8
  93. package/node_modules/nostr-tools/lib/esm/nip18.js.map +4 -4
  94. package/node_modules/nostr-tools/lib/esm/nip19.js.map +1 -1
  95. package/node_modules/nostr-tools/lib/esm/nip21.js.map +1 -1
  96. package/node_modules/nostr-tools/lib/esm/nip22.js +20 -7
  97. package/node_modules/nostr-tools/lib/esm/nip22.js.map +3 -3
  98. package/node_modules/nostr-tools/lib/esm/nip25.js +15 -8
  99. package/node_modules/nostr-tools/lib/esm/nip25.js.map +4 -4
  100. package/node_modules/nostr-tools/lib/esm/nip27.js.map +1 -1
  101. package/node_modules/nostr-tools/lib/esm/nip28.js +15 -8
  102. package/node_modules/nostr-tools/lib/esm/nip28.js.map +4 -4
  103. package/node_modules/nostr-tools/lib/esm/nip29.js.map +1 -1
  104. package/node_modules/nostr-tools/lib/esm/nip30.js.map +2 -2
  105. package/node_modules/nostr-tools/lib/esm/nip42.js.map +2 -2
  106. package/node_modules/nostr-tools/lib/esm/nip44.js.map +1 -1
  107. package/node_modules/nostr-tools/lib/esm/nip45.js +23 -10
  108. package/node_modules/nostr-tools/lib/esm/nip45.js.map +4 -4
  109. package/node_modules/nostr-tools/lib/esm/nip46.js +60 -51
  110. package/node_modules/nostr-tools/lib/esm/nip46.js.map +4 -4
  111. package/node_modules/nostr-tools/lib/esm/nip47.js +15 -8
  112. package/node_modules/nostr-tools/lib/esm/nip47.js.map +4 -4
  113. package/node_modules/nostr-tools/lib/esm/nip57.js +17 -10
  114. package/node_modules/nostr-tools/lib/esm/nip57.js.map +4 -4
  115. package/node_modules/nostr-tools/lib/esm/nip58.js.map +2 -2
  116. package/node_modules/nostr-tools/lib/esm/nip59.js +10 -1
  117. package/node_modules/nostr-tools/lib/esm/nip59.js.map +3 -3
  118. package/node_modules/nostr-tools/lib/esm/nip75.js.map +1 -1
  119. package/node_modules/nostr-tools/lib/esm/nip94.js.map +1 -1
  120. package/node_modules/nostr-tools/lib/esm/nip98.js +15 -8
  121. package/node_modules/nostr-tools/lib/esm/nip98.js.map +4 -4
  122. package/node_modules/nostr-tools/lib/esm/nip99.js.map +2 -2
  123. package/node_modules/nostr-tools/lib/esm/nipb0.js +35 -17
  124. package/node_modules/nostr-tools/lib/esm/nipb0.js.map +4 -4
  125. package/node_modules/nostr-tools/lib/esm/nipb7.js +13 -7
  126. package/node_modules/nostr-tools/lib/esm/nipb7.js.map +2 -2
  127. package/node_modules/nostr-tools/lib/esm/pool.js +60 -51
  128. package/node_modules/nostr-tools/lib/esm/pool.js.map +4 -4
  129. package/node_modules/nostr-tools/lib/esm/pure.js +15 -8
  130. package/node_modules/nostr-tools/lib/esm/pure.js.map +4 -4
  131. package/node_modules/nostr-tools/lib/esm/references.js.map +1 -1
  132. package/node_modules/nostr-tools/lib/esm/relay.js +50 -34
  133. package/node_modules/nostr-tools/lib/esm/relay.js.map +4 -4
  134. package/node_modules/nostr-tools/lib/esm/signer.js +15 -8
  135. package/node_modules/nostr-tools/lib/esm/signer.js.map +4 -4
  136. package/node_modules/nostr-tools/lib/esm/utils.js +10 -0
  137. package/node_modules/nostr-tools/lib/esm/utils.js.map +2 -2
  138. package/node_modules/nostr-tools/lib/esm/wasm.js +17 -3
  139. package/node_modules/nostr-tools/lib/esm/wasm.js.map +4 -4
  140. package/node_modules/nostr-tools/lib/nostr.bundle.js +86 -74
  141. package/node_modules/nostr-tools/lib/nostr.bundle.js.map +4 -4
  142. package/node_modules/nostr-tools/lib/types/abstract-pool.d.ts +6 -4
  143. package/node_modules/nostr-tools/lib/types/abstract-relay.d.ts +2 -2
  144. package/node_modules/nostr-tools/lib/types/kinds.d.ts +2 -0
  145. package/node_modules/nostr-tools/lib/types/nipb0.d.ts +0 -1
  146. package/node_modules/nostr-tools/lib/types/nipb7.d.ts +0 -1
  147. package/node_modules/nostr-tools/lib/types/utils.d.ts +4 -0
  148. package/node_modules/nostr-tools/node_modules/nostr-wasm/dist/generate.d.ts +1 -0
  149. package/node_modules/nostr-tools/package.json +1 -1
  150. package/openclaw.plugin.json +29 -0
  151. package/package.json +9 -6
  152. package/node_modules/nostr-tools/lib/types/helpers.d.ts +0 -2
  153. /package/node_modules/{nostr-wasm/dist/generate.d.ts → nostr-tools/lib/types/nipb0.test.d.ts} +0 -0
  154. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/LICENSE +0 -0
  155. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/README.md +0 -0
  156. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.d.ts +0 -0
  157. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.d.ts.map +0 -0
  158. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.js +0 -0
  159. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_arx.js.map +0 -0
  160. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.d.ts +0 -0
  161. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.d.ts.map +0 -0
  162. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.js +0 -0
  163. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_poly1305.js.map +0 -0
  164. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.d.ts +0 -0
  165. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.d.ts.map +0 -0
  166. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.js +0 -0
  167. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/_polyval.js.map +0 -0
  168. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.d.ts +0 -0
  169. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.d.ts.map +0 -0
  170. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.js +0 -0
  171. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/aes.js.map +0 -0
  172. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.d.ts +0 -0
  173. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.d.ts.map +0 -0
  174. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.js +0 -0
  175. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/chacha.js.map +0 -0
  176. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.d.ts +0 -0
  177. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.d.ts.map +0 -0
  178. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.js +0 -0
  179. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/ff1.js.map +0 -0
  180. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.d.ts +0 -0
  181. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.d.ts.map +0 -0
  182. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.js +0 -0
  183. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/index.js.map +0 -0
  184. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/package.json +0 -0
  185. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.d.ts +0 -0
  186. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.d.ts.map +0 -0
  187. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.js +0 -0
  188. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/salsa.js.map +0 -0
  189. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/_arx.ts +0 -0
  190. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/_poly1305.ts +0 -0
  191. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/_polyval.ts +0 -0
  192. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/aes.ts +0 -0
  193. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/chacha.ts +0 -0
  194. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/ff1.ts +0 -0
  195. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/index.ts +0 -0
  196. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/salsa.ts +0 -0
  197. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/utils.ts +0 -0
  198. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/src/webcrypto.ts +0 -0
  199. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.d.ts +0 -0
  200. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.d.ts.map +0 -0
  201. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.js +0 -0
  202. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/utils.js.map +0 -0
  203. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.d.ts +0 -0
  204. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.d.ts.map +0 -0
  205. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.js +0 -0
  206. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/ciphers/webcrypto.js.map +0 -0
  207. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/LICENSE +0 -0
  208. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/README.md +0 -0
  209. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.d.ts +0 -0
  210. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.d.ts.map +0 -0
  211. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.js +0 -0
  212. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/bls.js.map +0 -0
  213. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.d.ts +0 -0
  214. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.d.ts.map +0 -0
  215. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.js +0 -0
  216. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/curve.js.map +0 -0
  217. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.d.ts +0 -0
  218. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.d.ts.map +0 -0
  219. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.js +0 -0
  220. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/edwards.js.map +0 -0
  221. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.d.ts +0 -0
  222. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.d.ts.map +0 -0
  223. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.js +0 -0
  224. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/fft.js.map +0 -0
  225. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.d.ts +0 -0
  226. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.d.ts.map +0 -0
  227. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.js +0 -0
  228. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/hash-to-curve.js.map +0 -0
  229. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.d.ts +0 -0
  230. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.d.ts.map +0 -0
  231. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.js +0 -0
  232. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/modular.js.map +0 -0
  233. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.d.ts +0 -0
  234. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.d.ts.map +0 -0
  235. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.js +0 -0
  236. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/montgomery.js.map +0 -0
  237. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.d.ts +0 -0
  238. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.d.ts.map +0 -0
  239. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.js +0 -0
  240. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/oprf.js.map +0 -0
  241. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.d.ts +0 -0
  242. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.d.ts.map +0 -0
  243. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.js +0 -0
  244. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/poseidon.js.map +0 -0
  245. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.d.ts +0 -0
  246. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.d.ts.map +0 -0
  247. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.js +0 -0
  248. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/tower.js.map +0 -0
  249. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.d.ts +0 -0
  250. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.d.ts.map +0 -0
  251. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.js +0 -0
  252. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/abstract/weierstrass.js.map +0 -0
  253. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.d.ts +0 -0
  254. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.d.ts.map +0 -0
  255. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.js +0 -0
  256. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bls12-381.js.map +0 -0
  257. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.d.ts +0 -0
  258. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.d.ts.map +0 -0
  259. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.js +0 -0
  260. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/bn254.js.map +0 -0
  261. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.d.ts +0 -0
  262. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.d.ts.map +0 -0
  263. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.js +0 -0
  264. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed25519.js.map +0 -0
  265. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.d.ts +0 -0
  266. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.d.ts.map +0 -0
  267. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.js +0 -0
  268. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/ed448.js.map +0 -0
  269. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.d.ts +0 -0
  270. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.d.ts.map +0 -0
  271. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.js +0 -0
  272. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/index.js.map +0 -0
  273. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.d.ts +0 -0
  274. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.d.ts.map +0 -0
  275. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.js +0 -0
  276. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/misc.js.map +0 -0
  277. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.d.ts +0 -0
  278. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.d.ts.map +0 -0
  279. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.js +0 -0
  280. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/nist.js.map +0 -0
  281. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/package.json +0 -0
  282. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.d.ts +0 -0
  283. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.d.ts.map +0 -0
  284. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.js +0 -0
  285. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/secp256k1.js.map +0 -0
  286. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/bls.ts +0 -0
  287. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/curve.ts +0 -0
  288. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/edwards.ts +0 -0
  289. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/fft.ts +0 -0
  290. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/hash-to-curve.ts +0 -0
  291. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/modular.ts +0 -0
  292. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/montgomery.ts +0 -0
  293. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/oprf.ts +0 -0
  294. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/poseidon.ts +0 -0
  295. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/tower.ts +0 -0
  296. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/abstract/weierstrass.ts +0 -0
  297. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/bls12-381.ts +0 -0
  298. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/bn254.ts +0 -0
  299. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/ed25519.ts +0 -0
  300. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/ed448.ts +0 -0
  301. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/index.ts +0 -0
  302. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/misc.ts +0 -0
  303. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/nist.ts +0 -0
  304. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/secp256k1.ts +0 -0
  305. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/utils.ts +0 -0
  306. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/src/webcrypto.ts +0 -0
  307. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.d.ts +0 -0
  308. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.d.ts.map +0 -0
  309. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.js +0 -0
  310. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/utils.js.map +0 -0
  311. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.d.ts +0 -0
  312. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.d.ts.map +0 -0
  313. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.js +0 -0
  314. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/curves/webcrypto.js.map +0 -0
  315. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/LICENSE +0 -0
  316. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/README.md +0 -0
  317. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.d.ts +0 -0
  318. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.d.ts.map +0 -0
  319. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.js +0 -0
  320. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_blake.js.map +0 -0
  321. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.d.ts +0 -0
  322. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.d.ts.map +0 -0
  323. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.js +0 -0
  324. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_md.js.map +0 -0
  325. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.d.ts +0 -0
  326. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.d.ts.map +0 -0
  327. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.js +0 -0
  328. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/_u64.js.map +0 -0
  329. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.d.ts +0 -0
  330. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.d.ts.map +0 -0
  331. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.js +0 -0
  332. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/argon2.js.map +0 -0
  333. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.d.ts +0 -0
  334. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.d.ts.map +0 -0
  335. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.js +0 -0
  336. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake1.js.map +0 -0
  337. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.d.ts +0 -0
  338. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.d.ts.map +0 -0
  339. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.js +0 -0
  340. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake2.js.map +0 -0
  341. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.d.ts +0 -0
  342. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.d.ts.map +0 -0
  343. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.js +0 -0
  344. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/blake3.js.map +0 -0
  345. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.d.ts +0 -0
  346. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.d.ts.map +0 -0
  347. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.js +0 -0
  348. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/eskdf.js.map +0 -0
  349. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.d.ts +0 -0
  350. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.d.ts.map +0 -0
  351. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.js +0 -0
  352. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hkdf.js.map +0 -0
  353. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.d.ts +0 -0
  354. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.d.ts.map +0 -0
  355. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.js +0 -0
  356. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/hmac.js.map +0 -0
  357. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.d.ts +0 -0
  358. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.d.ts.map +0 -0
  359. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.js +0 -0
  360. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/index.js.map +0 -0
  361. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.d.ts +0 -0
  362. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.d.ts.map +0 -0
  363. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.js +0 -0
  364. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/legacy.js.map +0 -0
  365. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/package.json +0 -0
  366. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.d.ts +0 -0
  367. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.d.ts.map +0 -0
  368. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.js +0 -0
  369. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/pbkdf2.js.map +0 -0
  370. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.d.ts +0 -0
  371. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.d.ts.map +0 -0
  372. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.js +0 -0
  373. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/scrypt.js.map +0 -0
  374. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.d.ts +0 -0
  375. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.d.ts.map +0 -0
  376. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.js +0 -0
  377. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha2.js.map +0 -0
  378. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.d.ts +0 -0
  379. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.d.ts.map +0 -0
  380. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.js +0 -0
  381. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3-addons.js.map +0 -0
  382. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.d.ts +0 -0
  383. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.d.ts.map +0 -0
  384. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.js +0 -0
  385. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/sha3.js.map +0 -0
  386. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/_blake.ts +0 -0
  387. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/_md.ts +0 -0
  388. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/_u64.ts +0 -0
  389. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/argon2.ts +0 -0
  390. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/blake1.ts +0 -0
  391. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/blake2.ts +0 -0
  392. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/blake3.ts +0 -0
  393. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/eskdf.ts +0 -0
  394. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/hkdf.ts +0 -0
  395. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/hmac.ts +0 -0
  396. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/index.ts +0 -0
  397. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/legacy.ts +0 -0
  398. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/pbkdf2.ts +0 -0
  399. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/scrypt.ts +0 -0
  400. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/sha2.ts +0 -0
  401. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/sha3-addons.ts +0 -0
  402. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/sha3.ts +0 -0
  403. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/utils.ts +0 -0
  404. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/src/webcrypto.ts +0 -0
  405. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.d.ts +0 -0
  406. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.d.ts.map +0 -0
  407. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.js +0 -0
  408. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/utils.js.map +0 -0
  409. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.d.ts +0 -0
  410. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.d.ts.map +0 -0
  411. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.js +0 -0
  412. /package/node_modules/{@noble → nostr-tools/node_modules/@noble}/hashes/webcrypto.js.map +0 -0
  413. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/LICENSE +0 -0
  414. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/README.md +0 -0
  415. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.d.ts +0 -0
  416. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.d.ts.map +0 -0
  417. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.js +0 -0
  418. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.js.map +0 -0
  419. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/index.ts +0 -0
  420. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/base/package.json +0 -0
  421. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/LICENSE +0 -0
  422. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/README.md +0 -0
  423. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.d.ts +0 -0
  424. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.d.ts.map +0 -0
  425. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.js +0 -0
  426. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.js.map +0 -0
  427. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/index.ts +0 -0
  428. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip32/package.json +0 -0
  429. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/LICENSE +0 -0
  430. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/README.md +0 -0
  431. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/index.d.ts +0 -0
  432. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/index.js +0 -0
  433. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/package.json +0 -0
  434. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/src/index.ts +0 -0
  435. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/czech.d.ts +0 -0
  436. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/czech.js +0 -0
  437. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/english.d.ts +0 -0
  438. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/english.js +0 -0
  439. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/french.d.ts +0 -0
  440. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/french.js +0 -0
  441. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/italian.d.ts +0 -0
  442. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/italian.js +0 -0
  443. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/japanese.d.ts +0 -0
  444. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/japanese.js +0 -0
  445. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/korean.d.ts +0 -0
  446. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/korean.js +0 -0
  447. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/portuguese.d.ts +0 -0
  448. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/portuguese.js +0 -0
  449. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/simplified-chinese.d.ts +0 -0
  450. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/simplified-chinese.js +0 -0
  451. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/spanish.d.ts +0 -0
  452. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/spanish.js +0 -0
  453. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/traditional-chinese.d.ts +0 -0
  454. /package/node_modules/{@scure → nostr-tools/node_modules/@scure}/bip39/wordlists/traditional-chinese.js +0 -0
  455. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/README.md +0 -0
  456. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/emsimp.d.ts +0 -0
  457. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/nostr.d.ts +0 -0
  458. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/secp256k1-types.d.ts +0 -0
  459. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/secp256k1.d.ts +0 -0
  460. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/types.d.ts +0 -0
  461. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/api/wasm-env.d.ts +0 -0
  462. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/gen/wasm.d.ts +0 -0
  463. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/gzipped.d.ts +0 -0
  464. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/gzipped.js +0 -0
  465. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/headless.d.ts +0 -0
  466. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/main.d.ts +0 -0
  467. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/main.js +0 -0
  468. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/nostr.js +0 -0
  469. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/secp256k1.js +0 -0
  470. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/dist/types.d.ts +0 -0
  471. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/package.json +0 -0
  472. /package/node_modules/{nostr-wasm → nostr-tools/node_modules/nostr-wasm}/public/out/secp256k1.js +0 -0
  473. /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
- "sources": ["../../pure.ts", "../../core.ts", "../../utils.ts"],
4
- "sourcesContent": ["import { schnorr } from '@noble/curves/secp256k1.js'\nimport { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'\nimport { Nostr, Event, EventTemplate, UnsignedEvent, VerifiedEvent, verifiedSymbol, validateEvent } from './core.ts'\nimport { sha256 } from '@noble/hashes/sha2.js'\n\nimport { utf8Encoder } from './utils.ts'\n\nclass JS implements Nostr {\n generateSecretKey(): Uint8Array {\n return schnorr.utils.randomSecretKey()\n }\n getPublicKey(secretKey: Uint8Array): string {\n return bytesToHex(schnorr.getPublicKey(secretKey))\n }\n finalizeEvent(t: EventTemplate, secretKey: Uint8Array): VerifiedEvent {\n const event = t as VerifiedEvent\n event.pubkey = bytesToHex(schnorr.getPublicKey(secretKey))\n event.id = getEventHash(event)\n event.sig = bytesToHex(schnorr.sign(hexToBytes(getEventHash(event)), secretKey))\n event[verifiedSymbol] = true\n return event\n }\n verifyEvent(event: Event): event is VerifiedEvent {\n if (typeof event[verifiedSymbol] === 'boolean') return event[verifiedSymbol]\n\n try {\n const hash = getEventHash(event)\n if (hash !== event.id) {\n event[verifiedSymbol] = false\n return false\n }\n\n const valid = schnorr.verify(hexToBytes(event.sig), hexToBytes(hash), hexToBytes(event.pubkey))\n event[verifiedSymbol] = valid\n return valid\n } catch (err) {\n event[verifiedSymbol] = false\n return false\n }\n }\n}\n\nexport function serializeEvent(evt: UnsignedEvent): string {\n if (!validateEvent(evt)) throw new Error(\"can't serialize event with wrong or missing properties\")\n return JSON.stringify([0, evt.pubkey, evt.created_at, evt.kind, evt.tags, evt.content])\n}\n\nexport function getEventHash(event: UnsignedEvent): string {\n let eventHash = sha256(utf8Encoder.encode(serializeEvent(event)))\n return bytesToHex(eventHash)\n}\n\nconst i: JS = new JS()\n\nexport const generateSecretKey = i.generateSecretKey\nexport const getPublicKey = i.getPublicKey\nexport const finalizeEvent = i.finalizeEvent\nexport const verifyEvent = i.verifyEvent\nexport * from './core.ts'\n", "export interface Nostr {\n generateSecretKey(): Uint8Array\n getPublicKey(secretKey: Uint8Array): string\n finalizeEvent(event: EventTemplate, secretKey: Uint8Array): VerifiedEvent\n verifyEvent(event: Event): event is VerifiedEvent\n}\n\n/** Designates a verified event signature. */\nexport const verifiedSymbol = Symbol('verified')\n\nexport type NostrEvent = {\n kind: number\n tags: string[][]\n content: string\n created_at: number\n pubkey: string\n id: string\n sig: string\n [verifiedSymbol]?: boolean\n}\n\nexport type Event = NostrEvent\nexport type EventTemplate = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at'>\nexport type UnsignedEvent = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at' | 'pubkey'>\n\n/** An event whose signature has been verified. */\nexport interface VerifiedEvent extends Event {\n [verifiedSymbol]: true\n}\n\nconst isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object\n\nexport function validateEvent<T>(event: T): event is T & UnsignedEvent {\n if (!isRecord(event)) return false\n if (typeof event.kind !== 'number') return false\n if (typeof event.content !== 'string') return false\n if (typeof event.created_at !== 'number') return false\n if (typeof event.pubkey !== 'string') return false\n if (!event.pubkey.match(/^[a-f0-9]{64}$/)) return false\n\n if (!Array.isArray(event.tags)) return false\n for (let i = 0; i < event.tags.length; i++) {\n let tag = event.tags[i]\n if (!Array.isArray(tag)) return false\n for (let j = 0; j < tag.length; j++) {\n if (typeof tag[j] !== 'string') return false\n }\n }\n\n return true\n}\n\n/**\n * Sort events in reverse-chronological order by the `created_at` timestamp,\n * and then by the event `id` (lexicographically) in case of ties.\n * This mutates the array.\n */\nexport function sortEvents(events: Event[]): Event[] {\n return events.sort((a: NostrEvent, b: NostrEvent): number => {\n if (a.created_at !== b.created_at) {\n return b.created_at - a.created_at\n }\n return a.id.localeCompare(b.id)\n })\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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E;AACxB,IAAM,cAAc,EAAE;",
6
- "names": ["import_utils", "i"]
3
+ "sources": ["../../pure.ts", "../../utils.ts", "../../core.ts"],
4
+ "sourcesContent": ["import { schnorr } from '@noble/curves/secp256k1.js'\nimport { bytesToHex, hexToBytes } from '@noble/hashes/utils.js'\nimport { Nostr, Event, EventTemplate, UnsignedEvent, VerifiedEvent, verifiedSymbol, validateEvent } from './core.ts'\nimport { sha256 } from '@noble/hashes/sha2.js'\n\nimport { utf8Encoder } from './utils.ts'\n\nclass JS implements Nostr {\n generateSecretKey(): Uint8Array {\n return schnorr.utils.randomSecretKey()\n }\n getPublicKey(secretKey: Uint8Array): string {\n return bytesToHex(schnorr.getPublicKey(secretKey))\n }\n finalizeEvent(t: EventTemplate, secretKey: Uint8Array): VerifiedEvent {\n const event = t as VerifiedEvent\n event.pubkey = bytesToHex(schnorr.getPublicKey(secretKey))\n event.id = getEventHash(event)\n event.sig = bytesToHex(schnorr.sign(hexToBytes(getEventHash(event)), secretKey))\n event[verifiedSymbol] = true\n return event\n }\n verifyEvent(event: Event): event is VerifiedEvent {\n if (typeof event[verifiedSymbol] === 'boolean') return event[verifiedSymbol]\n\n try {\n const hash = getEventHash(event)\n if (hash !== event.id) {\n event[verifiedSymbol] = false\n return false\n }\n\n const valid = schnorr.verify(hexToBytes(event.sig), hexToBytes(hash), hexToBytes(event.pubkey))\n event[verifiedSymbol] = valid\n return valid\n } catch (err) {\n event[verifiedSymbol] = false\n return false\n }\n }\n}\n\nexport function serializeEvent(evt: UnsignedEvent): string {\n if (!validateEvent(evt)) throw new Error(\"can't serialize event with wrong or missing properties\")\n return JSON.stringify([0, evt.pubkey, evt.created_at, evt.kind, evt.tags, evt.content])\n}\n\nexport function getEventHash(event: UnsignedEvent): string {\n let eventHash = sha256(utf8Encoder.encode(serializeEvent(event)))\n return bytesToHex(eventHash)\n}\n\nconst i: JS = new JS()\n\nexport const generateSecretKey = i.generateSecretKey\nexport const getPublicKey = i.getPublicKey\nexport const finalizeEvent = i.finalizeEvent\nexport const verifyEvent = i.verifyEvent\nexport * from './core.ts'\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", "import { isHex32 } from './utils.ts'\n\nexport interface Nostr {\n generateSecretKey(): Uint8Array\n getPublicKey(secretKey: Uint8Array): string\n finalizeEvent(event: EventTemplate, secretKey: Uint8Array): VerifiedEvent\n verifyEvent(event: Event): event is VerifiedEvent\n}\n\n/** Designates a verified event signature. */\nexport const verifiedSymbol = Symbol('verified')\n\nexport type NostrEvent = {\n kind: number\n tags: string[][]\n content: string\n created_at: number\n pubkey: string\n id: string\n sig: string\n [verifiedSymbol]?: boolean\n}\n\nexport type Event = NostrEvent\nexport type EventTemplate = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at'>\nexport type UnsignedEvent = Pick<Event, 'kind' | 'tags' | 'content' | 'created_at' | 'pubkey'>\n\n/** An event whose signature has been verified. */\nexport interface VerifiedEvent extends Event {\n [verifiedSymbol]: true\n}\n\nconst isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object\n\nexport function validateEvent<T>(event: T): event is T & UnsignedEvent {\n if (!isRecord(event)) return false\n if (typeof event.kind !== 'number') return false\n if (typeof event.content !== 'string') return false\n if (typeof event.created_at !== 'number') return false\n if (typeof event.pubkey !== 'string') return false\n if (!isHex32(event.pubkey)) return false\n\n if (!Array.isArray(event.tags)) return false\n for (let i = 0; i < event.tags.length; i++) {\n let tag = event.tags[i]\n if (!Array.isArray(tag)) return false\n for (let j = 0; j < tag.length; j++) {\n if (typeof tag[j] !== 'string') return false\n }\n }\n\n return true\n}\n\n/**\n * Sort events in reverse-chronological order by the `created_at` timestamp,\n * and then by the event `id` (lexicographically) in case of ties.\n * This mutates the array.\n */\nexport function sortEvents(events: Event[]): Event[] {\n return events.sort((a: NostrEvent, b: NostrEvent): number => {\n if (a.created_at !== b.created_at) {\n return b.created_at - a.created_at\n }\n return a.id.localeCompare(b.id)\n })\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,IAAAA,gBAAuC;;;ACIvC,mBAAuC;AAHhC,IAAM,cAA2B,IAAI,YAAY,OAAO;AACxD,IAAM,cAA2B,IAAI,YAAY;AA8HjD,SAAS,QAAQ,OAAwB;AAC9C,WAASC,KAAI,GAAGA,KAAI,IAAIA,MAAK;AAC3B,QAAI,KAAK,MAAM,WAAWA,EAAC;AAC3B,QAAI,MAAM,EAAE,KAAK,KAAK,MAAM,KAAK,OAAQ,KAAK,MAAM,KAAK,IAAK;AAC5D,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Aa,SAAS,CAAC;AACzD,UAAM,KAAK,aAAa,KAAK;AAC7B,UAAM,UAAM,0BAAW,yBAAQ,SAAK,0BAAW,aAAa,KAAK,CAAC,GAAG,SAAS,CAAC;AAC/E,UAAM,kBAAkB;AACxB,WAAO;AAAA,EACT;AAAA,EACA,YAAY,OAAsC;AAChD,QAAI,OAAO,MAAM,oBAAoB;AAAW,aAAO,MAAM;AAE7D,QAAI;AACF,YAAM,OAAO,aAAa,KAAK;AAC/B,UAAI,SAAS,MAAM,IAAI;AACrB,cAAM,kBAAkB;AACxB,eAAO;AAAA,MACT;AAEA,YAAM,QAAQ,yBAAQ,WAAO,0BAAW,MAAM,GAAG,OAAG,0BAAW,IAAI,OAAG,0BAAW,MAAM,MAAM,CAAC;AAC9F,YAAM,kBAAkB;AACxB,aAAO;AAAA,IACT,SAAS,KAAP;AACA,YAAM,kBAAkB;AACxB,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEO,SAAS,eAAe,KAA4B;AACzD,MAAI,CAAC,cAAc,GAAG;AAAG,UAAM,IAAI,MAAM,wDAAwD;AACjG,SAAO,KAAK,UAAU,CAAC,GAAG,IAAI,QAAQ,IAAI,YAAY,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,CAAC;AACxF;AAEO,SAAS,aAAa,OAA8B;AACzD,MAAI,gBAAY,oBAAO,YAAY,OAAO,eAAe,KAAK,CAAC,CAAC;AAChE,aAAO,0BAAW,SAAS;AAC7B;AAEA,IAAM,IAAQ,IAAI,GAAG;AAEd,IAAM,oBAAoB,EAAE;AAC5B,IAAM,eAAe,EAAE;AACvB,IAAM,gBAAgB,EAAE;AACxB,IAAM,cAAc,EAAE;",
6
+ "names": ["import_utils", "i", "i"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../references.ts", "../../nip19.ts", "../../utils.ts"],
4
- "sourcesContent": ["import { decode, type AddressPointer, type ProfilePointer, type EventPointer } from './nip19.ts'\n\nimport type { Event } from './core.ts'\n\ntype Reference = {\n text: string\n profile?: ProfilePointer\n event?: EventPointer\n address?: AddressPointer\n}\n\nconst mentionRegex = /\\bnostr:((note|npub|naddr|nevent|nprofile)1\\w+)\\b|#\\[(\\d+)\\]/g\n\nexport function parseReferences(evt: Event): Reference[] {\n let references: Reference[] = []\n for (let ref of evt.content.matchAll(mentionRegex)) {\n if (ref[2]) {\n // it's a NIP-27 mention\n try {\n let { type, data } = decode(ref[1])\n switch (type) {\n case 'npub': {\n references.push({\n text: ref[0],\n profile: { pubkey: data as string, relays: [] },\n })\n break\n }\n case 'nprofile': {\n references.push({\n text: ref[0],\n profile: data as ProfilePointer,\n })\n break\n }\n case 'note': {\n references.push({\n text: ref[0],\n event: { id: data as string, relays: [] },\n })\n break\n }\n case 'nevent': {\n references.push({\n text: ref[0],\n event: data as EventPointer,\n })\n break\n }\n case 'naddr': {\n references.push({\n text: ref[0],\n address: data as AddressPointer,\n })\n break\n }\n }\n } catch (err) {\n /***/\n }\n } else if (ref[3]) {\n // it's a NIP-10 mention\n let idx = parseInt(ref[3], 10)\n let tag = evt.tags[idx]\n if (!tag) continue\n\n switch (tag[0]) {\n case 'p': {\n references.push({\n text: ref[0],\n profile: { pubkey: tag[1], relays: tag[2] ? [tag[2]] : [] },\n })\n break\n }\n case 'e': {\n references.push({\n text: ref[0],\n event: { id: tag[1], relays: tag[2] ? [tag[2]] : [] },\n })\n break\n }\n case 'a': {\n try {\n let [kind, pubkey, identifier] = tag[1].split(':')\n references.push({\n text: ref[0],\n address: {\n identifier,\n pubkey,\n kind: parseInt(kind, 10),\n relays: tag[2] ? [tag[2]] : [],\n },\n })\n } catch (err) {\n /***/\n }\n break\n }\n }\n }\n }\n\n return references\n}\n", "import { bytesToHex, concatBytes, hexToBytes } from '@noble/hashes/utils.js'\nimport { bech32 } from '@scure/base'\n\nimport { utf8Decoder, utf8Encoder } from './utils.ts'\n\nexport type NProfile = `nprofile1${string}`\nexport type NEvent = `nevent1${string}`\nexport type NAddr = `naddr1${string}`\nexport type NSec = `nsec1${string}`\nexport type NPub = `npub1${string}`\nexport type Note = `note1${string}`\nexport type Ncryptsec = `ncryptsec1${string}`\n\nexport const NostrTypeGuard = {\n isNProfile: (value?: string | null): value is NProfile => /^nprofile1[a-z\\d]+$/.test(value || ''),\n isNEvent: (value?: string | null): value is NEvent => /^nevent1[a-z\\d]+$/.test(value || ''),\n isNAddr: (value?: string | null): value is NAddr => /^naddr1[a-z\\d]+$/.test(value || ''),\n isNSec: (value?: string | null): value is NSec => /^nsec1[a-z\\d]{58}$/.test(value || ''),\n isNPub: (value?: string | null): value is NPub => /^npub1[a-z\\d]{58}$/.test(value || ''),\n isNote: (value?: string | null): value is Note => /^note1[a-z\\d]+$/.test(value || ''),\n isNcryptsec: (value?: string | null): value is Ncryptsec => /^ncryptsec1[a-z\\d]+$/.test(value || ''),\n}\n\nexport const Bech32MaxSize = 5000\n\n/**\n * Bech32 regex.\n * @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32\n */\nexport const BECH32_REGEX = /[\\x21-\\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/\n\nfunction integerToUint8Array(number: number) {\n // Create a Uint8Array with enough space to hold a 32-bit integer (4 bytes).\n const uint8Array = new Uint8Array(4)\n\n // Use bitwise operations to extract the bytes.\n uint8Array[0] = (number >> 24) & 0xff // Most significant byte (MSB)\n uint8Array[1] = (number >> 16) & 0xff\n uint8Array[2] = (number >> 8) & 0xff\n uint8Array[3] = number & 0xff // Least significant byte (LSB)\n\n return uint8Array\n}\n\nexport type ProfilePointer = {\n pubkey: string // hex\n relays?: string[]\n}\n\nexport type EventPointer = {\n id: string // hex\n relays?: string[]\n author?: string\n kind?: number\n}\n\nexport type AddressPointer = {\n identifier: string\n pubkey: string\n kind: number\n relays?: string[]\n}\n\nexport function decodeNostrURI(nip19code: string): ReturnType<typeof decode> | { type: 'invalid'; data: null } {\n try {\n if (nip19code.startsWith('nostr:')) nip19code = nip19code.substring(6)\n return decode(nip19code)\n } catch (_err) {\n return { type: 'invalid', data: null }\n }\n}\n\nexport type DecodedNevent = {\n type: 'nevent'\n data: EventPointer\n}\n\nexport type DecodedNprofile = {\n type: 'nprofile'\n data: ProfilePointer\n}\n\nexport type DecodedNaddr = {\n type: 'naddr'\n data: AddressPointer\n}\n\nexport type DecodedNsec = {\n type: 'nsec'\n data: Uint8Array\n}\n\nexport type DecodedNpub = {\n type: 'npub'\n data: string\n}\n\nexport type DecodedNote = {\n type: 'note'\n data: string\n}\n\nexport type DecodedResult = DecodedNevent | DecodedNprofile | DecodedNaddr | DecodedNpub | DecodedNsec | DecodedNote\n\nexport function decode(nip19: NEvent): DecodedNevent\nexport function decode(nip19: NProfile): DecodedNprofile\nexport function decode(nip19: NAddr): DecodedNaddr\nexport function decode(nip19: NSec): DecodedNsec\nexport function decode(nip19: NPub): DecodedNpub\nexport function decode(nip19: Note): DecodedNote\nexport function decode(code: string): DecodedResult\nexport function decode(code: string): DecodedResult {\n let { prefix, words } = bech32.decode(code as `${string}1${string}`, Bech32MaxSize)\n let data = new Uint8Array(bech32.fromWords(words))\n\n switch (prefix) {\n case 'nprofile': {\n let tlv = parseTLV(data)\n if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for nprofile')\n if (tlv[0][0].length !== 32) throw new Error('TLV 0 should be 32 bytes')\n\n return {\n type: 'nprofile',\n data: {\n pubkey: bytesToHex(tlv[0][0]),\n relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],\n },\n }\n }\n case 'nevent': {\n let tlv = parseTLV(data)\n if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for nevent')\n if (tlv[0][0].length !== 32) throw new Error('TLV 0 should be 32 bytes')\n if (tlv[2] && tlv[2][0].length !== 32) throw new Error('TLV 2 should be 32 bytes')\n if (tlv[3] && tlv[3][0].length !== 4) throw new Error('TLV 3 should be 4 bytes')\n\n return {\n type: 'nevent',\n data: {\n id: bytesToHex(tlv[0][0]),\n relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],\n author: tlv[2]?.[0] ? bytesToHex(tlv[2][0]) : undefined,\n kind: tlv[3]?.[0] ? parseInt(bytesToHex(tlv[3][0]), 16) : undefined,\n },\n }\n }\n\n case 'naddr': {\n let tlv = parseTLV(data)\n if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for naddr')\n if (!tlv[2]?.[0]) throw new Error('missing TLV 2 for naddr')\n if (tlv[2][0].length !== 32) throw new Error('TLV 2 should be 32 bytes')\n if (!tlv[3]?.[0]) throw new Error('missing TLV 3 for naddr')\n if (tlv[3][0].length !== 4) throw new Error('TLV 3 should be 4 bytes')\n\n return {\n type: 'naddr',\n data: {\n identifier: utf8Decoder.decode(tlv[0][0]),\n pubkey: bytesToHex(tlv[2][0]),\n kind: parseInt(bytesToHex(tlv[3][0]), 16),\n relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],\n },\n }\n }\n\n case 'nsec':\n return { type: prefix, data }\n\n case 'npub':\n case 'note':\n return { type: prefix, data: bytesToHex(data) }\n\n default:\n throw new Error(`unknown prefix ${prefix}`)\n }\n}\n\ntype TLV = { [t: number]: Uint8Array[] }\n\nfunction parseTLV(data: Uint8Array): TLV {\n let result: TLV = {}\n let rest = data\n while (rest.length > 0) {\n if (rest.length < 2) throw new Error('not enough data to read TLV')\n let t = rest[0]\n let l = rest[1]\n let v = rest.slice(2, 2 + l)\n rest = rest.slice(2 + l)\n if (v.length < l) throw new Error(`not enough data to read on TLV ${t}`)\n result[t] = result[t] || []\n result[t].push(v)\n }\n return result\n}\n\nexport function nsecEncode(key: Uint8Array): NSec {\n return encodeBytes('nsec', key)\n}\n\nexport function npubEncode(hex: string): NPub {\n return encodeBytes('npub', hexToBytes(hex))\n}\n\nexport function noteEncode(hex: string): Note {\n return encodeBytes('note', hexToBytes(hex))\n}\n\nfunction encodeBech32<Prefix extends string>(prefix: Prefix, data: Uint8Array): `${Prefix}1${string}` {\n let words = bech32.toWords(data)\n return bech32.encode(prefix, words, Bech32MaxSize) as `${Prefix}1${string}`\n}\n\nexport function encodeBytes<Prefix extends string>(prefix: Prefix, bytes: Uint8Array): `${Prefix}1${string}` {\n return encodeBech32(prefix, bytes)\n}\n\nexport function nprofileEncode(profile: ProfilePointer): NProfile {\n let data = encodeTLV({\n 0: [hexToBytes(profile.pubkey)],\n 1: (profile.relays || []).map(url => utf8Encoder.encode(url)),\n })\n return encodeBech32('nprofile', data)\n}\n\nexport function neventEncode(event: EventPointer): NEvent {\n let kindArray\n if (event.kind !== undefined) {\n kindArray = integerToUint8Array(event.kind)\n }\n\n let data = encodeTLV({\n 0: [hexToBytes(event.id)],\n 1: (event.relays || []).map(url => utf8Encoder.encode(url)),\n 2: event.author ? [hexToBytes(event.author)] : [],\n 3: kindArray ? [new Uint8Array(kindArray)] : [],\n })\n\n return encodeBech32('nevent', data)\n}\n\nexport function naddrEncode(addr: AddressPointer): NAddr {\n let kind = new ArrayBuffer(4)\n new DataView(kind).setUint32(0, addr.kind, false)\n\n let data = encodeTLV({\n 0: [utf8Encoder.encode(addr.identifier)],\n 1: (addr.relays || []).map(url => utf8Encoder.encode(url)),\n 2: [hexToBytes(addr.pubkey)],\n 3: [new Uint8Array(kind)],\n })\n return encodeBech32('naddr', data)\n}\n\nfunction encodeTLV(tlv: TLV): Uint8Array {\n let entries: Uint8Array[] = []\n\n Object.entries(tlv)\n .reverse()\n .forEach(([t, vs]) => {\n vs.forEach(v => {\n let entry = new Uint8Array(v.length + 2)\n entry.set([parseInt(t)], 0)\n entry.set([v.length], 1)\n entry.set(v, 2)\n entries.push(entry)\n })\n })\n\n return concatBytes(...entries)\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 { decode, type AddressPointer, type ProfilePointer, type EventPointer } from './nip19.ts'\n\nimport type { Event } from './core.ts'\n\ntype Reference = {\n text: string\n profile?: ProfilePointer\n event?: EventPointer\n address?: AddressPointer\n}\n\nconst mentionRegex = /\\bnostr:((note|npub|naddr|nevent|nprofile)1\\w+)\\b|#\\[(\\d+)\\]/g\n\nexport function parseReferences(evt: Event): Reference[] {\n let references: Reference[] = []\n for (let ref of evt.content.matchAll(mentionRegex)) {\n if (ref[2]) {\n // it's a NIP-27 mention\n try {\n let { type, data } = decode(ref[1])\n switch (type) {\n case 'npub': {\n references.push({\n text: ref[0],\n profile: { pubkey: data as string, relays: [] },\n })\n break\n }\n case 'nprofile': {\n references.push({\n text: ref[0],\n profile: data as ProfilePointer,\n })\n break\n }\n case 'note': {\n references.push({\n text: ref[0],\n event: { id: data as string, relays: [] },\n })\n break\n }\n case 'nevent': {\n references.push({\n text: ref[0],\n event: data as EventPointer,\n })\n break\n }\n case 'naddr': {\n references.push({\n text: ref[0],\n address: data as AddressPointer,\n })\n break\n }\n }\n } catch (err) {\n /***/\n }\n } else if (ref[3]) {\n // it's a NIP-10 mention\n let idx = parseInt(ref[3], 10)\n let tag = evt.tags[idx]\n if (!tag) continue\n\n switch (tag[0]) {\n case 'p': {\n references.push({\n text: ref[0],\n profile: { pubkey: tag[1], relays: tag[2] ? [tag[2]] : [] },\n })\n break\n }\n case 'e': {\n references.push({\n text: ref[0],\n event: { id: tag[1], relays: tag[2] ? [tag[2]] : [] },\n })\n break\n }\n case 'a': {\n try {\n let [kind, pubkey, identifier] = tag[1].split(':')\n references.push({\n text: ref[0],\n address: {\n identifier,\n pubkey,\n kind: parseInt(kind, 10),\n relays: tag[2] ? [tag[2]] : [],\n },\n })\n } catch (err) {\n /***/\n }\n break\n }\n }\n }\n }\n\n return references\n}\n", "import { bytesToHex, concatBytes, hexToBytes } from '@noble/hashes/utils.js'\nimport { bech32 } from '@scure/base'\n\nimport { utf8Decoder, utf8Encoder } from './utils.ts'\n\nexport type NProfile = `nprofile1${string}`\nexport type NEvent = `nevent1${string}`\nexport type NAddr = `naddr1${string}`\nexport type NSec = `nsec1${string}`\nexport type NPub = `npub1${string}`\nexport type Note = `note1${string}`\nexport type Ncryptsec = `ncryptsec1${string}`\n\nexport const NostrTypeGuard = {\n isNProfile: (value?: string | null): value is NProfile => /^nprofile1[a-z\\d]+$/.test(value || ''),\n isNEvent: (value?: string | null): value is NEvent => /^nevent1[a-z\\d]+$/.test(value || ''),\n isNAddr: (value?: string | null): value is NAddr => /^naddr1[a-z\\d]+$/.test(value || ''),\n isNSec: (value?: string | null): value is NSec => /^nsec1[a-z\\d]{58}$/.test(value || ''),\n isNPub: (value?: string | null): value is NPub => /^npub1[a-z\\d]{58}$/.test(value || ''),\n isNote: (value?: string | null): value is Note => /^note1[a-z\\d]+$/.test(value || ''),\n isNcryptsec: (value?: string | null): value is Ncryptsec => /^ncryptsec1[a-z\\d]+$/.test(value || ''),\n}\n\nexport const Bech32MaxSize = 5000\n\n/**\n * Bech32 regex.\n * @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32\n */\nexport const BECH32_REGEX = /[\\x21-\\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/\n\nfunction integerToUint8Array(number: number) {\n // Create a Uint8Array with enough space to hold a 32-bit integer (4 bytes).\n const uint8Array = new Uint8Array(4)\n\n // Use bitwise operations to extract the bytes.\n uint8Array[0] = (number >> 24) & 0xff // Most significant byte (MSB)\n uint8Array[1] = (number >> 16) & 0xff\n uint8Array[2] = (number >> 8) & 0xff\n uint8Array[3] = number & 0xff // Least significant byte (LSB)\n\n return uint8Array\n}\n\nexport type ProfilePointer = {\n pubkey: string // hex\n relays?: string[]\n}\n\nexport type EventPointer = {\n id: string // hex\n relays?: string[]\n author?: string\n kind?: number\n}\n\nexport type AddressPointer = {\n identifier: string\n pubkey: string\n kind: number\n relays?: string[]\n}\n\nexport function decodeNostrURI(nip19code: string): ReturnType<typeof decode> | { type: 'invalid'; data: null } {\n try {\n if (nip19code.startsWith('nostr:')) nip19code = nip19code.substring(6)\n return decode(nip19code)\n } catch (_err) {\n return { type: 'invalid', data: null }\n }\n}\n\nexport type DecodedNevent = {\n type: 'nevent'\n data: EventPointer\n}\n\nexport type DecodedNprofile = {\n type: 'nprofile'\n data: ProfilePointer\n}\n\nexport type DecodedNaddr = {\n type: 'naddr'\n data: AddressPointer\n}\n\nexport type DecodedNsec = {\n type: 'nsec'\n data: Uint8Array\n}\n\nexport type DecodedNpub = {\n type: 'npub'\n data: string\n}\n\nexport type DecodedNote = {\n type: 'note'\n data: string\n}\n\nexport type DecodedResult = DecodedNevent | DecodedNprofile | DecodedNaddr | DecodedNpub | DecodedNsec | DecodedNote\n\nexport function decode(nip19: NEvent): DecodedNevent\nexport function decode(nip19: NProfile): DecodedNprofile\nexport function decode(nip19: NAddr): DecodedNaddr\nexport function decode(nip19: NSec): DecodedNsec\nexport function decode(nip19: NPub): DecodedNpub\nexport function decode(nip19: Note): DecodedNote\nexport function decode(code: string): DecodedResult\nexport function decode(code: string): DecodedResult {\n let { prefix, words } = bech32.decode(code as `${string}1${string}`, Bech32MaxSize)\n let data = new Uint8Array(bech32.fromWords(words))\n\n switch (prefix) {\n case 'nprofile': {\n let tlv = parseTLV(data)\n if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for nprofile')\n if (tlv[0][0].length !== 32) throw new Error('TLV 0 should be 32 bytes')\n\n return {\n type: 'nprofile',\n data: {\n pubkey: bytesToHex(tlv[0][0]),\n relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],\n },\n }\n }\n case 'nevent': {\n let tlv = parseTLV(data)\n if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for nevent')\n if (tlv[0][0].length !== 32) throw new Error('TLV 0 should be 32 bytes')\n if (tlv[2] && tlv[2][0].length !== 32) throw new Error('TLV 2 should be 32 bytes')\n if (tlv[3] && tlv[3][0].length !== 4) throw new Error('TLV 3 should be 4 bytes')\n\n return {\n type: 'nevent',\n data: {\n id: bytesToHex(tlv[0][0]),\n relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],\n author: tlv[2]?.[0] ? bytesToHex(tlv[2][0]) : undefined,\n kind: tlv[3]?.[0] ? parseInt(bytesToHex(tlv[3][0]), 16) : undefined,\n },\n }\n }\n\n case 'naddr': {\n let tlv = parseTLV(data)\n if (!tlv[0]?.[0]) throw new Error('missing TLV 0 for naddr')\n if (!tlv[2]?.[0]) throw new Error('missing TLV 2 for naddr')\n if (tlv[2][0].length !== 32) throw new Error('TLV 2 should be 32 bytes')\n if (!tlv[3]?.[0]) throw new Error('missing TLV 3 for naddr')\n if (tlv[3][0].length !== 4) throw new Error('TLV 3 should be 4 bytes')\n\n return {\n type: 'naddr',\n data: {\n identifier: utf8Decoder.decode(tlv[0][0]),\n pubkey: bytesToHex(tlv[2][0]),\n kind: parseInt(bytesToHex(tlv[3][0]), 16),\n relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],\n },\n }\n }\n\n case 'nsec':\n return { type: prefix, data }\n\n case 'npub':\n case 'note':\n return { type: prefix, data: bytesToHex(data) }\n\n default:\n throw new Error(`unknown prefix ${prefix}`)\n }\n}\n\ntype TLV = { [t: number]: Uint8Array[] }\n\nfunction parseTLV(data: Uint8Array): TLV {\n let result: TLV = {}\n let rest = data\n while (rest.length > 0) {\n if (rest.length < 2) throw new Error('not enough data to read TLV')\n let t = rest[0]\n let l = rest[1]\n let v = rest.slice(2, 2 + l)\n rest = rest.slice(2 + l)\n if (v.length < l) throw new Error(`not enough data to read on TLV ${t}`)\n result[t] = result[t] || []\n result[t].push(v)\n }\n return result\n}\n\nexport function nsecEncode(key: Uint8Array): NSec {\n return encodeBytes('nsec', key)\n}\n\nexport function npubEncode(hex: string): NPub {\n return encodeBytes('npub', hexToBytes(hex))\n}\n\nexport function noteEncode(hex: string): Note {\n return encodeBytes('note', hexToBytes(hex))\n}\n\nfunction encodeBech32<Prefix extends string>(prefix: Prefix, data: Uint8Array): `${Prefix}1${string}` {\n let words = bech32.toWords(data)\n return bech32.encode(prefix, words, Bech32MaxSize) as `${Prefix}1${string}`\n}\n\nexport function encodeBytes<Prefix extends string>(prefix: Prefix, bytes: Uint8Array): `${Prefix}1${string}` {\n return encodeBech32(prefix, bytes)\n}\n\nexport function nprofileEncode(profile: ProfilePointer): NProfile {\n let data = encodeTLV({\n 0: [hexToBytes(profile.pubkey)],\n 1: (profile.relays || []).map(url => utf8Encoder.encode(url)),\n })\n return encodeBech32('nprofile', data)\n}\n\nexport function neventEncode(event: EventPointer): NEvent {\n let kindArray\n if (event.kind !== undefined) {\n kindArray = integerToUint8Array(event.kind)\n }\n\n let data = encodeTLV({\n 0: [hexToBytes(event.id)],\n 1: (event.relays || []).map(url => utf8Encoder.encode(url)),\n 2: event.author ? [hexToBytes(event.author)] : [],\n 3: kindArray ? [new Uint8Array(kindArray)] : [],\n })\n\n return encodeBech32('nevent', data)\n}\n\nexport function naddrEncode(addr: AddressPointer): NAddr {\n let kind = new ArrayBuffer(4)\n new DataView(kind).setUint32(0, addr.kind, false)\n\n let data = encodeTLV({\n 0: [utf8Encoder.encode(addr.identifier)],\n 1: (addr.relays || []).map(url => utf8Encoder.encode(url)),\n 2: [hexToBytes(addr.pubkey)],\n 3: [new Uint8Array(kind)],\n })\n return encodeBech32('naddr', data)\n}\n\nfunction encodeTLV(tlv: TLV): Uint8Array {\n let entries: Uint8Array[] = []\n\n Object.entries(tlv)\n .reverse()\n .forEach(([t, vs]) => {\n vs.forEach(v => {\n let entry = new Uint8Array(v.length + 2)\n entry.set([parseInt(t)], 0)\n entry.set([v.length], 1)\n entry.set(v, 2)\n entries.push(entry)\n })\n })\n\n return concatBytes(...entries)\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": ";;;;;;;;;;;;;;;;;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AAAA,YACX,CAAC;AACD;AAAA,UACF;AAAA,QACF;AAAA,MACF,SAAS,KAAP;AAAA,MAEF;AAAA,IACF,WAAW,IAAI,IAAI;AAEjB,UAAI,MAAM,SAAS,IAAI,IAAI,EAAE;AAC7B,UAAI,MAAM,IAAI,KAAK;AACnB,UAAI,CAAC;AAAK;AAEV,cAAQ,IAAI,IAAI;AAAA,QACd,KAAK,KAAK;AACR,qBAAW,KAAK;AAAA,YACd,MAAM,IAAI;AAAA,YACV,SAAS,EAAE,QAAQ,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;AAAA,UAC5D,CAAC;AACD;AAAA,QACF;AAAA,QACA,KAAK,KAAK;AACR,qBAAW,KAAK;AAAA,YACd,MAAM,IAAI;AAAA,YACV,OAAO,EAAE,IAAI,IAAI,IAAI,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE;AAAA,UACtD,CAAC;AACD;AAAA,QACF;AAAA,QACA,KAAK,KAAK;AACR,cAAI;AACF,gBAAI,CAAC,MAAM,QAAQ,UAAU,IAAI,IAAI,GAAG,MAAM,GAAG;AACjD,uBAAW,KAAK;AAAA,cACd,MAAM,IAAI;AAAA,cACV,SAAS;AAAA,gBACP;AAAA,gBACA;AAAA,gBACA,MAAM,SAAS,MAAM,EAAE;AAAA,gBACvB,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;AAAA,cAC/B;AAAA,YACF,CAAC;AAAA,UACH,SAAS,KAAP;AAAA,UAEF;AACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": ["import_utils"]
7
7
  }
@@ -30,7 +30,42 @@ module.exports = __toCommonJS(relay_exports);
30
30
 
31
31
  // pure.ts
32
32
  var import_secp256k1 = require("@noble/curves/secp256k1.js");
33
- var import_utils2 = require("@noble/hashes/utils.js");
33
+ var import_utils3 = require("@noble/hashes/utils.js");
34
+
35
+ // utils.ts
36
+ var import_utils = require("@noble/hashes/utils.js");
37
+ var utf8Decoder = new TextDecoder("utf-8");
38
+ var utf8Encoder = new TextEncoder();
39
+ function normalizeURL(url) {
40
+ try {
41
+ if (url.indexOf("://") === -1)
42
+ url = "wss://" + url;
43
+ let p = new URL(url);
44
+ if (p.protocol === "http:")
45
+ p.protocol = "ws:";
46
+ else if (p.protocol === "https:")
47
+ p.protocol = "wss:";
48
+ p.pathname = p.pathname.replace(/\/+/g, "/");
49
+ if (p.pathname.endsWith("/"))
50
+ p.pathname = p.pathname.slice(0, -1);
51
+ if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
52
+ p.port = "";
53
+ p.searchParams.sort();
54
+ p.hash = "";
55
+ return p.toString();
56
+ } catch (e) {
57
+ throw new Error(`Invalid URL: ${url}`);
58
+ }
59
+ }
60
+ function isHex32(input) {
61
+ for (let i2 = 0; i2 < 64; i2++) {
62
+ let cc = input.charCodeAt(i2);
63
+ if (isNaN(cc) || cc < 48 || cc > 102 || cc > 57 && cc < 97) {
64
+ return false;
65
+ }
66
+ }
67
+ return true;
68
+ }
34
69
 
35
70
  // core.ts
36
71
  var verifiedSymbol = Symbol("verified");
@@ -46,7 +81,7 @@ function validateEvent(event) {
46
81
  return false;
47
82
  if (typeof event.pubkey !== "string")
48
83
  return false;
49
- if (!event.pubkey.match(/^[a-f0-9]{64}$/))
84
+ if (!isHex32(event.pubkey))
50
85
  return false;
51
86
  if (!Array.isArray(event.tags))
52
87
  return false;
@@ -64,46 +99,18 @@ function validateEvent(event) {
64
99
 
65
100
  // pure.ts
66
101
  var import_sha2 = require("@noble/hashes/sha2.js");
67
-
68
- // utils.ts
69
- var import_utils = require("@noble/hashes/utils.js");
70
- var utf8Decoder = new TextDecoder("utf-8");
71
- var utf8Encoder = new TextEncoder();
72
- function normalizeURL(url) {
73
- try {
74
- if (url.indexOf("://") === -1)
75
- url = "wss://" + url;
76
- let p = new URL(url);
77
- if (p.protocol === "http:")
78
- p.protocol = "ws:";
79
- else if (p.protocol === "https:")
80
- p.protocol = "wss:";
81
- p.pathname = p.pathname.replace(/\/+/g, "/");
82
- if (p.pathname.endsWith("/"))
83
- p.pathname = p.pathname.slice(0, -1);
84
- if (p.port === "80" && p.protocol === "ws:" || p.port === "443" && p.protocol === "wss:")
85
- p.port = "";
86
- p.searchParams.sort();
87
- p.hash = "";
88
- return p.toString();
89
- } catch (e) {
90
- throw new Error(`Invalid URL: ${url}`);
91
- }
92
- }
93
-
94
- // pure.ts
95
102
  var JS = class {
96
103
  generateSecretKey() {
97
104
  return import_secp256k1.schnorr.utils.randomSecretKey();
98
105
  }
99
106
  getPublicKey(secretKey) {
100
- return (0, import_utils2.bytesToHex)(import_secp256k1.schnorr.getPublicKey(secretKey));
107
+ return (0, import_utils3.bytesToHex)(import_secp256k1.schnorr.getPublicKey(secretKey));
101
108
  }
102
109
  finalizeEvent(t, secretKey) {
103
110
  const event = t;
104
- event.pubkey = (0, import_utils2.bytesToHex)(import_secp256k1.schnorr.getPublicKey(secretKey));
111
+ event.pubkey = (0, import_utils3.bytesToHex)(import_secp256k1.schnorr.getPublicKey(secretKey));
105
112
  event.id = getEventHash(event);
106
- event.sig = (0, import_utils2.bytesToHex)(import_secp256k1.schnorr.sign((0, import_utils2.hexToBytes)(getEventHash(event)), secretKey));
113
+ event.sig = (0, import_utils3.bytesToHex)(import_secp256k1.schnorr.sign((0, import_utils3.hexToBytes)(getEventHash(event)), secretKey));
107
114
  event[verifiedSymbol] = true;
108
115
  return event;
109
116
  }
@@ -116,7 +123,7 @@ var JS = class {
116
123
  event[verifiedSymbol] = false;
117
124
  return false;
118
125
  }
119
- const valid = import_secp256k1.schnorr.verify((0, import_utils2.hexToBytes)(event.sig), (0, import_utils2.hexToBytes)(hash), (0, import_utils2.hexToBytes)(event.pubkey));
126
+ const valid = import_secp256k1.schnorr.verify((0, import_utils3.hexToBytes)(event.sig), (0, import_utils3.hexToBytes)(hash), (0, import_utils3.hexToBytes)(event.pubkey));
120
127
  event[verifiedSymbol] = valid;
121
128
  return valid;
122
129
  } catch (err) {
@@ -132,7 +139,7 @@ function serializeEvent(evt) {
132
139
  }
133
140
  function getEventHash(event) {
134
141
  let eventHash = (0, import_sha2.sha256)(utf8Encoder.encode(serializeEvent(event)));
135
- return (0, import_utils2.bytesToHex)(eventHash);
142
+ return (0, import_utils3.bytesToHex)(eventHash);
136
143
  }
137
144
  var i = new JS();
138
145
  var generateSecretKey = i.generateSecretKey;
@@ -308,6 +315,11 @@ var AbstractRelay = class {
308
315
  }, backoff);
309
316
  }
310
317
  handleHardClose(reason) {
318
+ if (this.ws) {
319
+ this.ws.onopen = null;
320
+ this.ws.onerror = null;
321
+ this.ws.onclose = null;
322
+ }
311
323
  if (this.pingIntervalHandle) {
312
324
  clearInterval(this.pingIntervalHandle);
313
325
  this.pingIntervalHandle = void 0;
@@ -338,7 +350,6 @@ var AbstractRelay = class {
338
350
  if (this.reconnectAttempts === 0) {
339
351
  this.skipReconnection = true;
340
352
  }
341
- this.onclose?.();
342
353
  this.handleHardClose("relay connection timed out");
343
354
  }, opts.timeout);
344
355
  }
@@ -384,7 +395,6 @@ var AbstractRelay = class {
384
395
  if (this.reconnectAttempts === 0) {
385
396
  this.skipReconnection = true;
386
397
  }
387
- this.onclose?.();
388
398
  this.handleHardClose("relay connection failed");
389
399
  };
390
400
  this.ws.onclose = (ev) => {
@@ -553,11 +563,17 @@ var AbstractRelay = class {
553
563
  }
554
564
  this.closeAllSubscriptions("relay connection closed by us");
555
565
  this._connected = false;
566
+ this.connectionPromise = void 0;
556
567
  this.idleSince = void 0;
557
568
  this.clearIdleTimeout();
558
569
  this.onclose?.();
559
- if (this.ws?.readyState === this._WebSocket.OPEN) {
560
- this.ws?.close();
570
+ if (this.ws) {
571
+ this.ws.onopen = null;
572
+ this.ws.onerror = null;
573
+ this.ws.onclose = null;
574
+ if (this.ws.readyState !== this._WebSocket.CLOSING && this.ws.readyState !== this._WebSocket.CLOSED) {
575
+ this.ws.close();
576
+ }
561
577
  }
562
578
  }
563
579
  _onmessage(ev) {
@@ -584,7 +600,7 @@ var AbstractRelay = class {
584
600
  case "EVENT": {
585
601
  const so = this.openSubs.get(data[1]);
586
602
  const event = data[2];
587
- if (this.verifyEvent(event) && matchFilters(so.filters, event)) {
603
+ if (matchFilters(so.filters, event) && this.verifyEvent(event, this.url)) {
588
604
  so.onevent(event);
589
605
  } else {
590
606
  so.oninvalidevent?.(event);