@btc-vision/bitcoin 6.5.6 → 7.0.0-alpha.1

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 (456) hide show
  1. package/HOW_TO_WRITE_GOOD_CODE.md +2436 -0
  2. package/benchmark/psbt-2000-inputs.bench.ts +178 -0
  3. package/benchmark/signing.bench.ts +147 -0
  4. package/browser/address.d.ts +57 -10
  5. package/browser/address.d.ts.map +1 -0
  6. package/browser/bech32utils.d.ts +9 -1
  7. package/browser/bech32utils.d.ts.map +1 -0
  8. package/browser/bip66.d.ts +11 -6
  9. package/browser/bip66.d.ts.map +1 -0
  10. package/browser/block.d.ts +117 -11
  11. package/browser/block.d.ts.map +1 -0
  12. package/browser/branded.d.ts +20 -0
  13. package/browser/branded.d.ts.map +1 -0
  14. package/browser/crypto/crypto.d.ts +1 -0
  15. package/browser/crypto/crypto.d.ts.map +1 -0
  16. package/browser/crypto.d.ts +46 -7
  17. package/browser/crypto.d.ts.map +1 -0
  18. package/browser/ecc/context.d.ts +129 -0
  19. package/browser/ecc/context.d.ts.map +1 -0
  20. package/browser/ecc/index.d.ts +11 -0
  21. package/browser/ecc/index.d.ts.map +1 -0
  22. package/browser/ecc/types.d.ts +128 -0
  23. package/browser/ecc/types.d.ts.map +1 -0
  24. package/browser/ecpair.d.ts +99 -0
  25. package/browser/errors.d.ts +124 -0
  26. package/browser/errors.d.ts.map +1 -0
  27. package/browser/index.d.ts +32 -5
  28. package/browser/index.d.ts.map +1 -0
  29. package/browser/index.js +12477 -101
  30. package/browser/io/BinaryReader.d.ts +276 -0
  31. package/browser/io/BinaryReader.d.ts.map +1 -0
  32. package/browser/io/BinaryWriter.d.ts +391 -0
  33. package/browser/io/BinaryWriter.d.ts.map +1 -0
  34. package/browser/io/MemoryPool.d.ts +220 -0
  35. package/browser/io/MemoryPool.d.ts.map +1 -0
  36. package/browser/io/base64.d.ts +13 -0
  37. package/browser/io/base64.d.ts.map +1 -0
  38. package/browser/io/hex.d.ts +67 -0
  39. package/browser/io/hex.d.ts.map +1 -0
  40. package/browser/io/index.d.ts +17 -0
  41. package/browser/io/index.d.ts.map +1 -0
  42. package/browser/io/utils.d.ts +199 -0
  43. package/browser/io/utils.d.ts.map +1 -0
  44. package/browser/merkle.d.ts +10 -1
  45. package/browser/merkle.d.ts.map +1 -0
  46. package/browser/networks.d.ts +70 -9
  47. package/browser/networks.d.ts.map +1 -0
  48. package/browser/opcodes.d.ts +1 -0
  49. package/browser/opcodes.d.ts.map +1 -0
  50. package/browser/payments/bip341.d.ts +35 -9
  51. package/browser/payments/bip341.d.ts.map +1 -0
  52. package/browser/payments/embed.d.ts +112 -1
  53. package/browser/payments/embed.d.ts.map +1 -0
  54. package/browser/payments/index.d.ts +17 -10
  55. package/browser/payments/index.d.ts.map +1 -0
  56. package/browser/payments/p2ms.d.ts +150 -0
  57. package/browser/payments/p2ms.d.ts.map +1 -0
  58. package/browser/payments/p2op.d.ts +150 -24
  59. package/browser/payments/p2op.d.ts.map +1 -0
  60. package/browser/payments/p2pk.d.ts +154 -1
  61. package/browser/payments/p2pk.d.ts.map +1 -0
  62. package/browser/payments/p2pkh.d.ts +176 -1
  63. package/browser/payments/p2pkh.d.ts.map +1 -0
  64. package/browser/payments/p2sh.d.ts +150 -1
  65. package/browser/payments/p2sh.d.ts.map +1 -0
  66. package/browser/payments/p2tr.d.ts +185 -1
  67. package/browser/payments/p2tr.d.ts.map +1 -0
  68. package/browser/payments/p2wpkh.d.ts +161 -1
  69. package/browser/payments/p2wpkh.d.ts.map +1 -0
  70. package/browser/payments/p2wsh.d.ts +146 -1
  71. package/browser/payments/p2wsh.d.ts.map +1 -0
  72. package/browser/payments/types.d.ts +94 -64
  73. package/browser/payments/types.d.ts.map +1 -0
  74. package/browser/psbt/bip371.d.ts +34 -8
  75. package/browser/psbt/bip371.d.ts.map +1 -0
  76. package/browser/psbt/psbtutils.d.ts +56 -16
  77. package/browser/psbt/psbtutils.d.ts.map +1 -0
  78. package/browser/psbt/types.d.ts +245 -0
  79. package/browser/psbt/types.d.ts.map +1 -0
  80. package/browser/psbt/utils.d.ts +64 -0
  81. package/browser/psbt/utils.d.ts.map +1 -0
  82. package/browser/psbt/validation.d.ts +84 -0
  83. package/browser/psbt/validation.d.ts.map +1 -0
  84. package/browser/psbt.d.ts +82 -118
  85. package/browser/psbt.d.ts.map +1 -0
  86. package/browser/pubkey.d.ts +27 -6
  87. package/browser/pubkey.d.ts.map +1 -0
  88. package/browser/push_data.d.ts +24 -2
  89. package/browser/push_data.d.ts.map +1 -0
  90. package/browser/script.d.ts +33 -8
  91. package/browser/script.d.ts.map +1 -0
  92. package/browser/script_number.d.ts +17 -0
  93. package/browser/script_number.d.ts.map +1 -0
  94. package/browser/script_signature.d.ts +23 -5
  95. package/browser/script_signature.d.ts.map +1 -0
  96. package/browser/transaction.d.ts +160 -18
  97. package/browser/transaction.d.ts.map +1 -0
  98. package/browser/types.d.ts +36 -38
  99. package/browser/types.d.ts.map +1 -0
  100. package/browser/workers/WorkerSigningPool.d.ts +143 -0
  101. package/browser/workers/WorkerSigningPool.d.ts.map +1 -0
  102. package/browser/workers/WorkerSigningPool.node.d.ts +116 -0
  103. package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -0
  104. package/browser/workers/ecc-bundle.d.ts +25 -0
  105. package/browser/workers/ecc-bundle.d.ts.map +1 -0
  106. package/browser/workers/index.d.ts +91 -0
  107. package/browser/workers/index.d.ts.map +1 -0
  108. package/browser/workers/psbt-parallel.d.ts +88 -0
  109. package/browser/workers/psbt-parallel.d.ts.map +1 -0
  110. package/browser/workers/signing-worker.d.ts +37 -0
  111. package/browser/workers/signing-worker.d.ts.map +1 -0
  112. package/browser/workers/types.d.ts +365 -0
  113. package/browser/workers/types.d.ts.map +1 -0
  114. package/build/address.d.ts +58 -11
  115. package/build/address.d.ts.map +1 -0
  116. package/build/address.js +82 -25
  117. package/build/address.js.map +1 -0
  118. package/build/bech32utils.d.ts +9 -1
  119. package/build/bech32utils.d.ts.map +1 -0
  120. package/build/bech32utils.js +10 -2
  121. package/build/bech32utils.js.map +1 -0
  122. package/build/bip66.d.ts +11 -6
  123. package/build/bip66.d.ts.map +1 -0
  124. package/build/bip66.js +32 -3
  125. package/build/bip66.js.map +1 -0
  126. package/build/block.d.ts +117 -11
  127. package/build/block.d.ts.map +1 -0
  128. package/build/block.js +202 -72
  129. package/build/block.js.map +1 -0
  130. package/build/branded.d.ts +20 -0
  131. package/build/branded.d.ts.map +1 -0
  132. package/build/branded.js +7 -0
  133. package/build/branded.js.map +1 -0
  134. package/build/crypto/crypto.d.ts +1 -0
  135. package/build/crypto/crypto.d.ts.map +1 -0
  136. package/build/crypto/crypto.js +1 -0
  137. package/build/crypto/crypto.js.map +1 -0
  138. package/build/crypto.d.ts +46 -7
  139. package/build/crypto.d.ts.map +1 -0
  140. package/build/crypto.js +65 -20
  141. package/build/crypto.js.map +1 -0
  142. package/build/ecc/context.d.ts +135 -0
  143. package/build/ecc/context.d.ts.map +1 -0
  144. package/build/ecc/context.js +232 -0
  145. package/build/ecc/context.js.map +1 -0
  146. package/build/ecc/index.d.ts +11 -0
  147. package/build/ecc/index.d.ts.map +1 -0
  148. package/build/ecc/index.js +11 -0
  149. package/build/ecc/index.js.map +1 -0
  150. package/build/ecc/types.d.ts +134 -0
  151. package/build/ecc/types.d.ts.map +1 -0
  152. package/build/ecc/types.js +8 -0
  153. package/build/ecc/types.js.map +1 -0
  154. package/build/errors.d.ts +124 -0
  155. package/build/errors.d.ts.map +1 -0
  156. package/build/errors.js +155 -0
  157. package/build/errors.js.map +1 -0
  158. package/build/index.d.ts +32 -5
  159. package/build/index.d.ts.map +1 -0
  160. package/build/index.js +26 -3
  161. package/build/index.js.map +1 -0
  162. package/build/io/BinaryReader.d.ts +276 -0
  163. package/build/io/BinaryReader.d.ts.map +1 -0
  164. package/build/io/BinaryReader.js +425 -0
  165. package/build/io/BinaryReader.js.map +1 -0
  166. package/build/io/BinaryWriter.d.ts +391 -0
  167. package/build/io/BinaryWriter.d.ts.map +1 -0
  168. package/build/io/BinaryWriter.js +611 -0
  169. package/build/io/BinaryWriter.js.map +1 -0
  170. package/build/io/MemoryPool.d.ts +220 -0
  171. package/build/io/MemoryPool.d.ts.map +1 -0
  172. package/build/io/MemoryPool.js +309 -0
  173. package/build/io/MemoryPool.js.map +1 -0
  174. package/build/io/base64.d.ts +13 -0
  175. package/build/io/base64.d.ts.map +1 -0
  176. package/build/io/base64.js +20 -0
  177. package/build/io/base64.js.map +1 -0
  178. package/build/io/hex.d.ts +67 -0
  179. package/build/io/hex.d.ts.map +1 -0
  180. package/build/io/hex.js +138 -0
  181. package/build/io/hex.js.map +1 -0
  182. package/build/io/index.d.ts +17 -0
  183. package/build/io/index.d.ts.map +1 -0
  184. package/build/io/index.js +23 -0
  185. package/build/io/index.js.map +1 -0
  186. package/build/io/utils.d.ts +199 -0
  187. package/build/io/utils.d.ts.map +1 -0
  188. package/build/io/utils.js +271 -0
  189. package/build/io/utils.js.map +1 -0
  190. package/build/merkle.d.ts +10 -1
  191. package/build/merkle.d.ts.map +1 -0
  192. package/build/merkle.js +12 -1
  193. package/build/merkle.js.map +1 -0
  194. package/build/networks.d.ts +70 -9
  195. package/build/networks.d.ts.map +1 -0
  196. package/build/networks.js +90 -4
  197. package/build/networks.js.map +1 -0
  198. package/build/opcodes.d.ts +1 -0
  199. package/build/opcodes.d.ts.map +1 -0
  200. package/build/opcodes.js +1 -0
  201. package/build/opcodes.js.map +1 -0
  202. package/build/payments/bip341.d.ts +35 -9
  203. package/build/payments/bip341.d.ts.map +1 -0
  204. package/build/payments/bip341.js +34 -15
  205. package/build/payments/bip341.js.map +1 -0
  206. package/build/payments/embed.d.ts +120 -1
  207. package/build/payments/embed.d.ts.map +1 -0
  208. package/build/payments/embed.js +215 -34
  209. package/build/payments/embed.js.map +1 -0
  210. package/build/payments/index.d.ts +17 -10
  211. package/build/payments/index.d.ts.map +1 -0
  212. package/build/payments/index.js +20 -10
  213. package/build/payments/index.js.map +1 -0
  214. package/build/payments/p2ms.d.ts +159 -1
  215. package/build/payments/p2ms.d.ts.map +1 -0
  216. package/build/payments/p2ms.js +427 -108
  217. package/build/payments/p2ms.js.map +1 -0
  218. package/build/payments/p2op.d.ts +158 -24
  219. package/build/payments/p2op.d.ts.map +1 -0
  220. package/build/payments/p2op.js +379 -93
  221. package/build/payments/p2op.js.map +1 -0
  222. package/build/payments/p2pk.d.ts +162 -1
  223. package/build/payments/p2pk.d.ts.map +1 -0
  224. package/build/payments/p2pk.js +327 -58
  225. package/build/payments/p2pk.js.map +1 -0
  226. package/build/payments/p2pkh.d.ts +185 -1
  227. package/build/payments/p2pkh.d.ts.map +1 -0
  228. package/build/payments/p2pkh.js +467 -114
  229. package/build/payments/p2pkh.js.map +1 -0
  230. package/build/payments/p2sh.d.ts +159 -1
  231. package/build/payments/p2sh.d.ts.map +1 -0
  232. package/build/payments/p2sh.js +500 -150
  233. package/build/payments/p2sh.js.map +1 -0
  234. package/build/payments/p2tr.d.ts +193 -1
  235. package/build/payments/p2tr.d.ts.map +1 -0
  236. package/build/payments/p2tr.js +592 -174
  237. package/build/payments/p2tr.js.map +1 -0
  238. package/build/payments/p2wpkh.d.ts +170 -1
  239. package/build/payments/p2wpkh.d.ts.map +1 -0
  240. package/build/payments/p2wpkh.js +428 -103
  241. package/build/payments/p2wpkh.js.map +1 -0
  242. package/build/payments/p2wsh.d.ts +155 -1
  243. package/build/payments/p2wsh.d.ts.map +1 -0
  244. package/build/payments/p2wsh.js +465 -143
  245. package/build/payments/p2wsh.js.map +1 -0
  246. package/build/payments/types.d.ts +98 -64
  247. package/build/payments/types.d.ts.map +1 -0
  248. package/build/payments/types.js +17 -13
  249. package/build/payments/types.js.map +1 -0
  250. package/build/psbt/bip371.d.ts +35 -9
  251. package/build/psbt/bip371.d.ts.map +1 -0
  252. package/build/psbt/bip371.js +117 -28
  253. package/build/psbt/bip371.js.map +1 -0
  254. package/build/psbt/psbtutils.d.ts +56 -16
  255. package/build/psbt/psbtutils.d.ts.map +1 -0
  256. package/build/psbt/psbtutils.js +71 -16
  257. package/build/psbt/psbtutils.js.map +1 -0
  258. package/build/psbt/types.d.ts +249 -0
  259. package/build/psbt/types.d.ts.map +1 -0
  260. package/build/psbt/types.js +6 -0
  261. package/build/psbt/types.js.map +1 -0
  262. package/build/psbt/utils.d.ts +68 -0
  263. package/build/psbt/utils.d.ts.map +1 -0
  264. package/build/psbt/utils.js +171 -0
  265. package/build/psbt/utils.js.map +1 -0
  266. package/build/psbt/validation.d.ts +88 -0
  267. package/build/psbt/validation.d.ts.map +1 -0
  268. package/build/psbt/validation.js +149 -0
  269. package/build/psbt/validation.js.map +1 -0
  270. package/build/psbt.d.ts +84 -120
  271. package/build/psbt.d.ts.map +1 -0
  272. package/build/psbt.js +406 -413
  273. package/build/psbt.js.map +1 -0
  274. package/build/pubkey.d.ts +27 -6
  275. package/build/pubkey.d.ts.map +1 -0
  276. package/build/pubkey.js +36 -12
  277. package/build/pubkey.js.map +1 -0
  278. package/build/push_data.d.ts +24 -2
  279. package/build/push_data.d.ts.map +1 -0
  280. package/build/push_data.js +44 -12
  281. package/build/push_data.js.map +1 -0
  282. package/build/script.d.ts +33 -8
  283. package/build/script.d.ts.map +1 -0
  284. package/build/script.js +101 -37
  285. package/build/script.js.map +1 -0
  286. package/build/script_number.d.ts +17 -0
  287. package/build/script_number.d.ts.map +1 -0
  288. package/build/script_number.js +19 -0
  289. package/build/script_number.js.map +1 -0
  290. package/build/script_signature.d.ts +23 -5
  291. package/build/script_signature.d.ts.map +1 -0
  292. package/build/script_signature.js +48 -15
  293. package/build/script_signature.js.map +1 -0
  294. package/build/transaction.d.ts +160 -18
  295. package/build/transaction.d.ts.map +1 -0
  296. package/build/transaction.js +443 -176
  297. package/build/transaction.js.map +1 -0
  298. package/build/tsconfig.build.tsbuildinfo +1 -0
  299. package/build/types.d.ts +36 -38
  300. package/build/types.d.ts.map +1 -0
  301. package/build/types.js +169 -57
  302. package/build/types.js.map +1 -0
  303. package/build/workers/WorkerSigningPool.d.ts +174 -0
  304. package/build/workers/WorkerSigningPool.d.ts.map +1 -0
  305. package/build/workers/WorkerSigningPool.js +553 -0
  306. package/build/workers/WorkerSigningPool.js.map +1 -0
  307. package/build/workers/WorkerSigningPool.node.d.ts +124 -0
  308. package/build/workers/WorkerSigningPool.node.d.ts.map +1 -0
  309. package/build/workers/WorkerSigningPool.node.js +753 -0
  310. package/build/workers/WorkerSigningPool.node.js.map +1 -0
  311. package/build/workers/ecc-bundle.d.ts +25 -0
  312. package/build/workers/ecc-bundle.d.ts.map +1 -0
  313. package/build/workers/ecc-bundle.js +25 -0
  314. package/build/workers/ecc-bundle.js.map +1 -0
  315. package/build/workers/index.d.ts +91 -0
  316. package/build/workers/index.d.ts.map +1 -0
  317. package/build/workers/index.js +114 -0
  318. package/build/workers/index.js.map +1 -0
  319. package/build/workers/psbt-parallel.d.ts +117 -0
  320. package/build/workers/psbt-parallel.d.ts.map +1 -0
  321. package/build/workers/psbt-parallel.js +233 -0
  322. package/build/workers/psbt-parallel.js.map +1 -0
  323. package/build/workers/signing-worker.d.ts +37 -0
  324. package/build/workers/signing-worker.d.ts.map +1 -0
  325. package/build/workers/signing-worker.js +350 -0
  326. package/build/workers/signing-worker.js.map +1 -0
  327. package/build/workers/types.d.ts +365 -0
  328. package/build/workers/types.d.ts.map +1 -0
  329. package/build/workers/types.js +60 -0
  330. package/build/workers/types.js.map +1 -0
  331. package/package.json +68 -9
  332. package/scripts/bundle-ecc.ts +111 -0
  333. package/src/address.ts +91 -45
  334. package/src/bech32utils.ts +3 -3
  335. package/src/bip66.ts +34 -24
  336. package/src/block.ts +205 -86
  337. package/src/branded.ts +18 -0
  338. package/src/crypto.ts +64 -26
  339. package/src/ecc/context.ts +280 -0
  340. package/src/ecc/index.ts +14 -0
  341. package/src/ecc/types.ts +147 -0
  342. package/src/ecpair.d.ts +99 -0
  343. package/src/errors.ts +163 -0
  344. package/src/index.ts +112 -9
  345. package/src/io/BinaryReader.ts +461 -0
  346. package/src/io/BinaryWriter.ts +696 -0
  347. package/src/io/MemoryPool.ts +343 -0
  348. package/src/io/base64.ts +20 -0
  349. package/src/io/hex.ts +155 -0
  350. package/src/io/index.ts +41 -0
  351. package/src/io/utils.ts +283 -0
  352. package/src/merkle.ts +14 -9
  353. package/src/networks.ts +9 -9
  354. package/src/payments/bip341.ts +32 -33
  355. package/src/payments/embed.ts +244 -41
  356. package/src/payments/index.ts +12 -10
  357. package/src/payments/p2ms.ts +497 -118
  358. package/src/payments/p2op.ts +432 -134
  359. package/src/payments/p2pk.ts +370 -72
  360. package/src/payments/p2pkh.ts +524 -130
  361. package/src/payments/p2sh.ts +572 -169
  362. package/src/payments/p2tr.ts +686 -194
  363. package/src/payments/p2wpkh.ts +482 -105
  364. package/src/payments/p2wsh.ts +524 -162
  365. package/src/payments/types.ts +80 -66
  366. package/src/psbt/bip371.ts +72 -51
  367. package/src/psbt/psbtutils.ts +39 -40
  368. package/src/psbt/types.ts +324 -0
  369. package/src/psbt/utils.ts +188 -0
  370. package/src/psbt/validation.ts +185 -0
  371. package/src/psbt.ts +608 -827
  372. package/src/pubkey.ts +22 -23
  373. package/src/push_data.ts +18 -16
  374. package/src/script.ts +81 -66
  375. package/src/script_number.ts +6 -6
  376. package/src/script_signature.ts +33 -36
  377. package/src/transaction.ts +462 -239
  378. package/src/types.ts +229 -100
  379. package/src/workers/WorkerSigningPool.node.ts +887 -0
  380. package/src/workers/WorkerSigningPool.ts +666 -0
  381. package/src/workers/ecc-bundle.ts +26 -0
  382. package/src/workers/index.ts +165 -0
  383. package/src/workers/psbt-parallel.ts +327 -0
  384. package/src/workers/signing-worker.ts +353 -0
  385. package/src/workers/types.ts +417 -0
  386. package/test/address.spec.ts +9 -6
  387. package/test/bitcoin.core.spec.ts +16 -17
  388. package/test/block.spec.ts +8 -7
  389. package/test/bufferutils.spec.ts +228 -214
  390. package/test/crypto.spec.ts +19 -11
  391. package/test/fixtures/p2pk.json +0 -8
  392. package/test/fixtures/p2pkh.json +1 -1
  393. package/test/fixtures/p2sh.json +1 -1
  394. package/test/fixtures/script.json +1 -1
  395. package/test/fixtures/transaction.json +2 -2
  396. package/test/integration/_regtest.ts +25 -0
  397. package/test/integration/addresses.spec.ts +4 -3
  398. package/test/integration/bip32.spec.ts +2 -1
  399. package/test/integration/blocks.spec.ts +1 -1
  400. package/test/integration/cltv.spec.ts +18 -16
  401. package/test/integration/csv.spec.ts +37 -64
  402. package/test/integration/payments.spec.ts +5 -3
  403. package/test/integration/taproot.spec.ts +76 -83
  404. package/test/integration/transactions.spec.ts +38 -35
  405. package/test/payments.spec.ts +35 -13
  406. package/test/payments.utils.ts +17 -16
  407. package/test/psbt.spec.ts +111 -100
  408. package/test/script.spec.ts +11 -10
  409. package/test/script_signature.spec.ts +9 -11
  410. package/test/taproot-cache.spec.ts +694 -0
  411. package/test/transaction.spec.ts +32 -40
  412. package/test/types.spec.ts +74 -29
  413. package/test/workers-pool.spec.ts +963 -0
  414. package/test/workers-signing.spec.ts +635 -0
  415. package/test/workers.spec.ts +1390 -0
  416. package/tsconfig.base.json +34 -18
  417. package/tsconfig.browser.json +15 -0
  418. package/tsconfig.build.json +5 -0
  419. package/tsconfig.json +5 -14
  420. package/typedoc.json +29 -0
  421. package/vite.config.browser.ts +3 -42
  422. package/vitest.config.integration.ts +2 -0
  423. package/browser/bufferutils.d.ts +0 -34
  424. package/browser/chunks/crypto-BhCpKpek.js +0 -2033
  425. package/browser/chunks/payments-B1wlSccx.js +0 -1089
  426. package/browser/chunks/psbt-BCNk7JUx.js +0 -4055
  427. package/browser/chunks/script-DyPItFEl.js +0 -318
  428. package/browser/chunks/transaction-C_UbhMGn.js +0 -432
  429. package/browser/chunks/utils-DNZi-T5W.js +0 -761
  430. package/browser/ecc_lib.d.ts +0 -3
  431. package/browser/hooks/AdvancedSignatureManager.d.ts +0 -16
  432. package/browser/hooks/HookedSigner.d.ts +0 -4
  433. package/browser/hooks/SignatureManager.d.ts +0 -13
  434. package/browser/payments/lazy.d.ts +0 -2
  435. package/browser/typeforce.d.ts +0 -38
  436. package/build/bufferutils.d.ts +0 -34
  437. package/build/bufferutils.js +0 -141
  438. package/build/ecc_lib.d.ts +0 -3
  439. package/build/ecc_lib.js +0 -61
  440. package/build/hooks/AdvancedSignatureManager.d.ts +0 -16
  441. package/build/hooks/AdvancedSignatureManager.js +0 -52
  442. package/build/hooks/HookedSigner.d.ts +0 -4
  443. package/build/hooks/HookedSigner.js +0 -64
  444. package/build/hooks/SignatureManager.d.ts +0 -13
  445. package/build/hooks/SignatureManager.js +0 -45
  446. package/build/payments/lazy.d.ts +0 -2
  447. package/build/payments/lazy.js +0 -28
  448. package/build/tsconfig.tsbuildinfo +0 -1
  449. package/src/bufferutils.ts +0 -188
  450. package/src/ecc_lib.ts +0 -94
  451. package/src/hooks/AdvancedSignatureManager.ts +0 -104
  452. package/src/hooks/HookedSigner.ts +0 -108
  453. package/src/hooks/SignatureManager.ts +0 -84
  454. package/src/payments/lazy.ts +0 -28
  455. package/src/typeforce.d.ts +0 -38
  456. package/tsconfig.webpack.json +0 -18
package/build/crypto.js CHANGED
@@ -1,20 +1,55 @@
1
+ /**
2
+ * Cryptographic hashing functions for Bitcoin.
3
+ * Includes ripemd160, sha1, sha256, hash160, hash256, and taggedHash.
4
+ *
5
+ * @packageDocumentation
6
+ */
1
7
  import { ripemd160 as _ripemd160, sha1 as _sha1 } from '@noble/hashes/legacy.js';
2
8
  import { sha256 as _sha256 } from '@noble/hashes/sha2.js';
3
- export function ripemd160(buffer) {
4
- return Buffer.from(_ripemd160(Uint8Array.from(buffer)));
9
+ import { concat } from './io/index.js';
10
+ /**
11
+ * Computes RIPEMD-160 hash of the input.
12
+ * @param data - Input data
13
+ * @returns 20-byte hash (Bytes20)
14
+ */
15
+ export function ripemd160(data) {
16
+ return _ripemd160(data);
5
17
  }
6
- export function sha1(buffer) {
7
- return Buffer.from(_sha1(Uint8Array.from(buffer)));
18
+ /**
19
+ * Computes SHA-1 hash of the input.
20
+ * @param data - Input data
21
+ * @returns 20-byte hash (Bytes20)
22
+ */
23
+ export function sha1(data) {
24
+ return _sha1(data);
8
25
  }
9
- export function sha256(buffer) {
10
- return Buffer.from(_sha256(Uint8Array.from(buffer)));
26
+ /**
27
+ * Computes SHA-256 hash of the input.
28
+ * @param data - Input data
29
+ * @returns 32-byte hash (Bytes32)
30
+ */
31
+ export function sha256(data) {
32
+ return _sha256(data);
11
33
  }
12
- export function hash160(buffer) {
13
- return Buffer.from(_ripemd160(_sha256(Uint8Array.from(buffer))));
34
+ /**
35
+ * Computes HASH160 (RIPEMD160(SHA256(data))) of the input.
36
+ * @param data - Input data
37
+ * @returns 20-byte hash (Bytes20)
38
+ */
39
+ export function hash160(data) {
40
+ return _ripemd160(_sha256(data));
14
41
  }
15
- export function hash256(buffer) {
16
- return Buffer.from(_sha256(_sha256(Uint8Array.from(buffer))));
42
+ /**
43
+ * Computes double SHA-256 hash of the input.
44
+ * @param data - Input data
45
+ * @returns 32-byte hash (Bytes32)
46
+ */
47
+ export function hash256(data) {
48
+ return _sha256(_sha256(data));
17
49
  }
50
+ /**
51
+ * BIP340/Taproot tag names for tagged hashing.
52
+ */
18
53
  export const TAGS = [
19
54
  'BIP0340/challenge',
20
55
  'BIP0340/aux',
@@ -26,61 +61,71 @@ export const TAGS = [
26
61
  'KeyAgg list',
27
62
  'KeyAgg coefficient',
28
63
  ];
64
+ /**
65
+ * Precomputed tagged hash prefixes: SHA256(tag) || SHA256(tag)
66
+ */
29
67
  export const TAGGED_HASH_PREFIXES = {
30
- 'BIP0340/challenge': Buffer.from([
68
+ 'BIP0340/challenge': new Uint8Array([
31
69
  123, 181, 45, 122, 159, 239, 88, 50, 62, 177, 191, 122, 64, 125, 179, 130, 210, 243, 242,
32
70
  216, 27, 177, 34, 79, 73, 254, 81, 143, 109, 72, 211, 124, 123, 181, 45, 122, 159, 239, 88,
33
71
  50, 62, 177, 191, 122, 64, 125, 179, 130, 210, 243, 242, 216, 27, 177, 34, 79, 73, 254, 81,
34
72
  143, 109, 72, 211, 124,
35
73
  ]),
36
- 'BIP0340/aux': Buffer.from([
74
+ 'BIP0340/aux': new Uint8Array([
37
75
  241, 239, 78, 94, 192, 99, 202, 218, 109, 148, 202, 250, 157, 152, 126, 160, 105, 38, 88,
38
76
  57, 236, 193, 31, 151, 45, 119, 165, 46, 216, 193, 204, 144, 241, 239, 78, 94, 192, 99, 202,
39
77
  218, 109, 148, 202, 250, 157, 152, 126, 160, 105, 38, 88, 57, 236, 193, 31, 151, 45, 119,
40
78
  165, 46, 216, 193, 204, 144,
41
79
  ]),
42
- 'BIP0340/nonce': Buffer.from([
80
+ 'BIP0340/nonce': new Uint8Array([
43
81
  7, 73, 119, 52, 167, 155, 203, 53, 91, 155, 140, 125, 3, 79, 18, 28, 244, 52, 215, 62, 247,
44
82
  45, 218, 25, 135, 0, 97, 251, 82, 191, 235, 47, 7, 73, 119, 52, 167, 155, 203, 53, 91, 155,
45
83
  140, 125, 3, 79, 18, 28, 244, 52, 215, 62, 247, 45, 218, 25, 135, 0, 97, 251, 82, 191, 235,
46
84
  47,
47
85
  ]),
48
- TapLeaf: Buffer.from([
86
+ TapLeaf: new Uint8Array([
49
87
  174, 234, 143, 220, 66, 8, 152, 49, 5, 115, 75, 88, 8, 29, 30, 38, 56, 211, 95, 28, 181, 64,
50
88
  8, 212, 211, 87, 202, 3, 190, 120, 233, 238, 174, 234, 143, 220, 66, 8, 152, 49, 5, 115, 75,
51
89
  88, 8, 29, 30, 38, 56, 211, 95, 28, 181, 64, 8, 212, 211, 87, 202, 3, 190, 120, 233, 238,
52
90
  ]),
53
- TapBranch: Buffer.from([
91
+ TapBranch: new Uint8Array([
54
92
  25, 65, 161, 242, 229, 110, 185, 95, 162, 169, 241, 148, 190, 92, 1, 247, 33, 111, 51, 237,
55
93
  130, 176, 145, 70, 52, 144, 208, 91, 245, 22, 160, 21, 25, 65, 161, 242, 229, 110, 185, 95,
56
94
  162, 169, 241, 148, 190, 92, 1, 247, 33, 111, 51, 237, 130, 176, 145, 70, 52, 144, 208, 91,
57
95
  245, 22, 160, 21,
58
96
  ]),
59
- TapSighash: Buffer.from([
97
+ TapSighash: new Uint8Array([
60
98
  244, 10, 72, 223, 75, 42, 112, 200, 180, 146, 75, 242, 101, 70, 97, 237, 61, 149, 253, 102,
61
99
  163, 19, 235, 135, 35, 117, 151, 198, 40, 228, 160, 49, 244, 10, 72, 223, 75, 42, 112, 200,
62
100
  180, 146, 75, 242, 101, 70, 97, 237, 61, 149, 253, 102, 163, 19, 235, 135, 35, 117, 151,
63
101
  198, 40, 228, 160, 49,
64
102
  ]),
65
- TapTweak: Buffer.from([
103
+ TapTweak: new Uint8Array([
66
104
  232, 15, 225, 99, 156, 156, 160, 80, 227, 175, 27, 57, 193, 67, 198, 62, 66, 156, 188, 235,
67
105
  21, 217, 64, 251, 181, 197, 161, 244, 175, 87, 197, 233, 232, 15, 225, 99, 156, 156, 160,
68
106
  80, 227, 175, 27, 57, 193, 67, 198, 62, 66, 156, 188, 235, 21, 217, 64, 251, 181, 197, 161,
69
107
  244, 175, 87, 197, 233,
70
108
  ]),
71
- 'KeyAgg list': Buffer.from([
109
+ 'KeyAgg list': new Uint8Array([
72
110
  72, 28, 151, 28, 60, 11, 70, 215, 240, 178, 117, 174, 89, 141, 78, 44, 126, 215, 49, 156,
73
111
  89, 74, 92, 110, 199, 158, 160, 212, 153, 2, 148, 240, 72, 28, 151, 28, 60, 11, 70, 215,
74
112
  240, 178, 117, 174, 89, 141, 78, 44, 126, 215, 49, 156, 89, 74, 92, 110, 199, 158, 160, 212,
75
113
  153, 2, 148, 240,
76
114
  ]),
77
- 'KeyAgg coefficient': Buffer.from([
115
+ 'KeyAgg coefficient': new Uint8Array([
78
116
  191, 201, 4, 3, 77, 28, 136, 232, 200, 14, 34, 229, 61, 36, 86, 109, 100, 130, 78, 214, 66,
79
117
  114, 129, 192, 145, 0, 249, 77, 205, 82, 201, 129, 191, 201, 4, 3, 77, 28, 136, 232, 200,
80
118
  14, 34, 229, 61, 36, 86, 109, 100, 130, 78, 214, 66, 114, 129, 192, 145, 0, 249, 77, 205,
81
119
  82, 201, 129,
82
120
  ]),
83
121
  };
122
+ /**
123
+ * Computes a BIP340-style tagged hash.
124
+ * @param prefix - The tag name
125
+ * @param data - Input data
126
+ * @returns 32-byte hash (Bytes32)
127
+ */
84
128
  export function taggedHash(prefix, data) {
85
- return sha256(Buffer.concat([TAGGED_HASH_PREFIXES[prefix], data]));
129
+ return sha256(concat([TAGGED_HASH_PREFIXES[prefix], data]));
86
130
  }
131
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAgB;IACtC,OAAO,UAAU,CAAC,IAAI,CAAY,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,IAAgB;IACjC,OAAO,KAAK,CAAC,IAAI,CAAY,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,IAAgB;IACnC,OAAO,OAAO,CAAC,IAAI,CAAY,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAgB;IACpC,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAY,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAgB;IACpC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAY,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AAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;QACxF,EAAE,EAAE,GAAG,EAAE,GAAG;KACf,CAAC;CACL,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,MAAwB,EAAE,IAAgB;IACjE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * ECC library context management with dependency injection.
3
+ * Provides initialization, access, and lifecycle management for the ECC library.
4
+ *
5
+ * @packageDocumentation
6
+ */
7
+ import type { EccLib } from './types.js';
8
+ /**
9
+ * Context class for managing the ECC library instance.
10
+ * Uses dependency injection pattern instead of global singleton.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { EccContext } from '@btc-vision/bitcoin';
15
+ * import * as secp256k1 from 'tiny-secp256k1';
16
+ *
17
+ * // Initialize once at app startup
18
+ * EccContext.init(secp256k1);
19
+ *
20
+ * // Get instance anywhere in your code
21
+ * const ecc = EccContext.get();
22
+ *
23
+ * // Clear when done (optional, for testing)
24
+ * EccContext.clear();
25
+ * ```
26
+ */
27
+ export declare class EccContext {
28
+ #private;
29
+ private constructor();
30
+ /**
31
+ * The underlying ECC library instance.
32
+ */
33
+ get lib(): EccLib;
34
+ /**
35
+ * Initializes the ECC context with the provided library.
36
+ * The library is verified before being set as active.
37
+ *
38
+ * @param lib - The ECC library instance to initialize
39
+ * @returns The initialized EccContext instance
40
+ * @throws Error if the ECC library fails verification
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * import { EccContext } from '@btc-vision/bitcoin';
45
+ * import * as secp256k1 from 'tiny-secp256k1';
46
+ *
47
+ * const context = EccContext.init(secp256k1);
48
+ * ```
49
+ */
50
+ static init(lib: EccLib): EccContext;
51
+ /**
52
+ * Gets the initialized ECC context.
53
+ *
54
+ * @returns The EccContext instance
55
+ * @throws Error if the context has not been initialized
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * import { EccContext } from '@btc-vision/bitcoin';
60
+ *
61
+ * const context = EccContext.get();
62
+ * const isValid = context.lib.isXOnlyPoint(someKey);
63
+ * ```
64
+ */
65
+ static get(): EccContext;
66
+ /**
67
+ * Clears the ECC context.
68
+ * Useful for testing or when reinitializing with a different library.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * import { EccContext } from '@btc-vision/bitcoin';
73
+ *
74
+ * EccContext.clear();
75
+ * // Context is now uninitialized
76
+ * ```
77
+ */
78
+ static clear(): void;
79
+ /**
80
+ * Checks if the ECC context has been initialized.
81
+ *
82
+ * @returns True if initialized
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * import { EccContext } from '@btc-vision/bitcoin';
87
+ *
88
+ * if (!EccContext.isInitialized()) {
89
+ * EccContext.init(secp256k1);
90
+ * }
91
+ * ```
92
+ */
93
+ static isInitialized(): boolean;
94
+ }
95
+ /**
96
+ * Initializes the ECC library with the provided instance.
97
+ * This is a convenience function that wraps EccContext.init().
98
+ * Pass `undefined` to clear the library.
99
+ *
100
+ * @param eccLib - The ECC library instance to initialize, or undefined to clear
101
+ * @throws Error if the ECC library fails verification
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * import { initEccLib } from '@btc-vision/bitcoin';
106
+ * import * as secp256k1 from 'tiny-secp256k1';
107
+ *
108
+ * // Initialize the ECC library
109
+ * initEccLib(secp256k1);
110
+ *
111
+ * // Clear the library
112
+ * initEccLib(undefined);
113
+ * ```
114
+ */
115
+ export declare function initEccLib(eccLib: EccLib | undefined): void;
116
+ /**
117
+ * Retrieves the initialized ECC library instance.
118
+ * This is a convenience function that wraps EccContext.get().lib.
119
+ *
120
+ * @returns The ECC library instance
121
+ * @throws Error if the ECC library has not been initialized
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * import { getEccLib, initEccLib } from '@btc-vision/bitcoin';
126
+ * import * as secp256k1 from 'tiny-secp256k1';
127
+ *
128
+ * initEccLib(secp256k1);
129
+ *
130
+ * const ecc = getEccLib();
131
+ * const isValid = ecc.isXOnlyPoint(somePublicKey);
132
+ * ```
133
+ */
134
+ export declare function getEccLib(): EccLib;
135
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/ecc/context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAIzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,UAAU;;IAInB,OAAO;IAIP;;OAEG;IACH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAMpC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,GAAG,IAAI,UAAU;IASxB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;IAIpB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,aAAa,IAAI,OAAO;CAGlC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAM3D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC"}
@@ -0,0 +1,232 @@
1
+ import { equals, fromHex } from '../io/index.js';
2
+ /**
3
+ * Context class for managing the ECC library instance.
4
+ * Uses dependency injection pattern instead of global singleton.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { EccContext } from '@btc-vision/bitcoin';
9
+ * import * as secp256k1 from 'tiny-secp256k1';
10
+ *
11
+ * // Initialize once at app startup
12
+ * EccContext.init(secp256k1);
13
+ *
14
+ * // Get instance anywhere in your code
15
+ * const ecc = EccContext.get();
16
+ *
17
+ * // Clear when done (optional, for testing)
18
+ * EccContext.clear();
19
+ * ```
20
+ */
21
+ export class EccContext {
22
+ static #instance;
23
+ #lib;
24
+ constructor(lib) {
25
+ this.#lib = lib;
26
+ }
27
+ /**
28
+ * The underlying ECC library instance.
29
+ */
30
+ get lib() {
31
+ return this.#lib;
32
+ }
33
+ /**
34
+ * Initializes the ECC context with the provided library.
35
+ * The library is verified before being set as active.
36
+ *
37
+ * @param lib - The ECC library instance to initialize
38
+ * @returns The initialized EccContext instance
39
+ * @throws Error if the ECC library fails verification
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import { EccContext } from '@btc-vision/bitcoin';
44
+ * import * as secp256k1 from 'tiny-secp256k1';
45
+ *
46
+ * const context = EccContext.init(secp256k1);
47
+ * ```
48
+ */
49
+ static init(lib) {
50
+ verifyEcc(lib);
51
+ EccContext.#instance = new EccContext(lib);
52
+ return EccContext.#instance;
53
+ }
54
+ /**
55
+ * Gets the initialized ECC context.
56
+ *
57
+ * @returns The EccContext instance
58
+ * @throws Error if the context has not been initialized
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * import { EccContext } from '@btc-vision/bitcoin';
63
+ *
64
+ * const context = EccContext.get();
65
+ * const isValid = context.lib.isXOnlyPoint(someKey);
66
+ * ```
67
+ */
68
+ static get() {
69
+ if (!EccContext.#instance) {
70
+ throw new Error('ECC library not initialized. Call EccContext.init() or initEccLib() first.');
71
+ }
72
+ return EccContext.#instance;
73
+ }
74
+ /**
75
+ * Clears the ECC context.
76
+ * Useful for testing or when reinitializing with a different library.
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * import { EccContext } from '@btc-vision/bitcoin';
81
+ *
82
+ * EccContext.clear();
83
+ * // Context is now uninitialized
84
+ * ```
85
+ */
86
+ static clear() {
87
+ EccContext.#instance = undefined;
88
+ }
89
+ /**
90
+ * Checks if the ECC context has been initialized.
91
+ *
92
+ * @returns True if initialized
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * import { EccContext } from '@btc-vision/bitcoin';
97
+ *
98
+ * if (!EccContext.isInitialized()) {
99
+ * EccContext.init(secp256k1);
100
+ * }
101
+ * ```
102
+ */
103
+ static isInitialized() {
104
+ return EccContext.#instance !== undefined;
105
+ }
106
+ }
107
+ /**
108
+ * Initializes the ECC library with the provided instance.
109
+ * This is a convenience function that wraps EccContext.init().
110
+ * Pass `undefined` to clear the library.
111
+ *
112
+ * @param eccLib - The ECC library instance to initialize, or undefined to clear
113
+ * @throws Error if the ECC library fails verification
114
+ *
115
+ * @example
116
+ * ```typescript
117
+ * import { initEccLib } from '@btc-vision/bitcoin';
118
+ * import * as secp256k1 from 'tiny-secp256k1';
119
+ *
120
+ * // Initialize the ECC library
121
+ * initEccLib(secp256k1);
122
+ *
123
+ * // Clear the library
124
+ * initEccLib(undefined);
125
+ * ```
126
+ */
127
+ export function initEccLib(eccLib) {
128
+ if (eccLib === undefined) {
129
+ EccContext.clear();
130
+ return;
131
+ }
132
+ EccContext.init(eccLib);
133
+ }
134
+ /**
135
+ * Retrieves the initialized ECC library instance.
136
+ * This is a convenience function that wraps EccContext.get().lib.
137
+ *
138
+ * @returns The ECC library instance
139
+ * @throws Error if the ECC library has not been initialized
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * import { getEccLib, initEccLib } from '@btc-vision/bitcoin';
144
+ * import * as secp256k1 from 'tiny-secp256k1';
145
+ *
146
+ * initEccLib(secp256k1);
147
+ *
148
+ * const ecc = getEccLib();
149
+ * const isValid = ecc.isXOnlyPoint(somePublicKey);
150
+ * ```
151
+ */
152
+ export function getEccLib() {
153
+ return EccContext.get().lib;
154
+ }
155
+ const TWEAK_ADD_VECTORS = [
156
+ {
157
+ pubkey: '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
158
+ tweak: 'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140',
159
+ parity: -1,
160
+ result: null,
161
+ },
162
+ {
163
+ pubkey: '1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b',
164
+ tweak: 'a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac',
165
+ parity: 1,
166
+ result: 'e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf',
167
+ },
168
+ {
169
+ pubkey: '2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991',
170
+ tweak: '823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47',
171
+ parity: 0,
172
+ result: '9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c',
173
+ },
174
+ ];
175
+ /**
176
+ * Verifies that the ECC library implementation is correct.
177
+ * Tests `isXOnlyPoint` and `xOnlyPointAddTweak` with known test vectors.
178
+ *
179
+ * @param ecc - The ECC library to verify
180
+ * @throws Error if any verification test fails
181
+ */
182
+ function verifyEcc(ecc) {
183
+ if (typeof ecc.isXOnlyPoint !== 'function') {
184
+ throw new Error('ECC library missing isXOnlyPoint function');
185
+ }
186
+ // Test isXOnlyPoint with valid points
187
+ const validPoints = [
188
+ '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
189
+ 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e',
190
+ 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
191
+ '0000000000000000000000000000000000000000000000000000000000000001',
192
+ ];
193
+ for (const hex of validPoints) {
194
+ if (!ecc.isXOnlyPoint(fromHex(hex))) {
195
+ throw new Error(`ECC library isXOnlyPoint failed for valid point: ${hex}`);
196
+ }
197
+ }
198
+ // Test isXOnlyPoint with invalid points
199
+ const invalidPoints = [
200
+ '0000000000000000000000000000000000000000000000000000000000000000',
201
+ 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f',
202
+ ];
203
+ for (const hex of invalidPoints) {
204
+ if (ecc.isXOnlyPoint(fromHex(hex))) {
205
+ throw new Error(`ECC library isXOnlyPoint should reject invalid point: ${hex}`);
206
+ }
207
+ }
208
+ // Test xOnlyPointAddTweak
209
+ if (typeof ecc.xOnlyPointAddTweak !== 'function') {
210
+ throw new Error('ECC library missing xOnlyPointAddTweak function');
211
+ }
212
+ for (const vector of TWEAK_ADD_VECTORS) {
213
+ const result = ecc.xOnlyPointAddTweak(fromHex(vector.pubkey), fromHex(vector.tweak));
214
+ if (vector.result === null) {
215
+ if (result !== null) {
216
+ throw new Error(`ECC library xOnlyPointAddTweak should return null for: ${vector.pubkey}`);
217
+ }
218
+ }
219
+ else {
220
+ if (result === null) {
221
+ throw new Error(`ECC library xOnlyPointAddTweak returned null unexpectedly for: ${vector.pubkey}`);
222
+ }
223
+ if (result.parity !== vector.parity) {
224
+ throw new Error(`ECC library xOnlyPointAddTweak parity mismatch for: ${vector.pubkey}`);
225
+ }
226
+ if (!equals(result.xOnlyPubkey, fromHex(vector.result))) {
227
+ throw new Error(`ECC library xOnlyPointAddTweak result mismatch for: ${vector.pubkey}`);
228
+ }
229
+ }
230
+ }
231
+ }
232
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/ecc/context.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,UAAU;IACnB,MAAM,CAAC,SAAS,CAAyB;IAChC,IAAI,CAAS;IAEtB,YAAoB,GAAW;QAC3B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAI,GAAG;QACH,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAA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MAAM,KAAK,IAAI,EAAE,CAAC;YACzB,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CACX,0DAA0D,MAAM,CAAC,MAAM,EAAE,CAC5E,CAAC;YACN,CAAC;QACL,CAAC;aAAM,CAAC;YACJ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;gBAClB,MAAM,IAAI,KAAK,CACX,kEAAkE,MAAM,CAAC,MAAM,EAAE,CACpF,CAAC;YACN,CAAC;YACD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CACX,uDAAuD,MAAM,CAAC,MAAM,EAAE,CACzE,CAAC;YACN,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;gBACtD,MAAM,IAAI,KAAK,CACX,uDAAuD,MAAM,CAAC,MAAM,EAAE,CACzE,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ECC (Elliptic Curve Cryptography) module.
3
+ *
4
+ * Provides dependency injection for the secp256k1 elliptic curve library
5
+ * required for Taproot (BIP340/BIP341) operations.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export type { EccLib, XOnlyPointAddTweakResult, Parity } from './types.js';
10
+ export { EccContext, initEccLib, getEccLib } from './context.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ecc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,YAAY,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAG3E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ECC (Elliptic Curve Cryptography) module.
3
+ *
4
+ * Provides dependency injection for the secp256k1 elliptic curve library
5
+ * required for Taproot (BIP340/BIP341) operations.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ // Context management
10
+ export { EccContext, initEccLib, getEccLib } from './context.js';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ecc/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,qBAAqB;AACrB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}