@reown/appkit-cdn 1.6.7-basic-test.8.0 → 1.6.7-core-2.0

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 (254) hide show
  1. package/dist/{add-Bo7hlhOK.js → add-DE6xsvo_.js} +2 -2
  2. package/dist/{add-Bo7hlhOK.js.map → add-DE6xsvo_.js.map} +1 -1
  3. package/dist/{all-wallets-DiYxd6h8.js → all-wallets-CaSXZUWF.js} +2 -2
  4. package/dist/{all-wallets-DiYxd6h8.js.map → all-wallets-CaSXZUWF.js.map} +1 -1
  5. package/dist/{app-store-BwOymb6f.js → app-store-CrDyy3Wa.js} +2 -2
  6. package/dist/{app-store-BwOymb6f.js.map → app-store-CrDyy3Wa.js.map} +1 -1
  7. package/dist/{appkit-7F54kjKy.js → appkit-Cly9g1o7.js} +49893 -55110
  8. package/dist/appkit-Cly9g1o7.js.map +1 -0
  9. package/dist/appkit.js +8 -8
  10. package/dist/{apple-2YTcD6RU.js → apple-BbOPLgIX.js} +2 -2
  11. package/dist/{apple-2YTcD6RU.js.map → apple-BbOPLgIX.js.map} +1 -1
  12. package/dist/{arrow-bottom-circle-W1sxGKIm.js → arrow-bottom-circle-BFTWJbEj.js} +2 -2
  13. package/dist/{arrow-bottom-circle-W1sxGKIm.js.map → arrow-bottom-circle-BFTWJbEj.js.map} +1 -1
  14. package/dist/{arrow-bottom-ZLYjQRVF.js → arrow-bottom-nxwCJBf2.js} +2 -2
  15. package/dist/{arrow-bottom-ZLYjQRVF.js.map → arrow-bottom-nxwCJBf2.js.map} +1 -1
  16. package/dist/{arrow-left-DLgnPVzk.js → arrow-left-BWlJ2qlC.js} +2 -2
  17. package/dist/{arrow-left-DLgnPVzk.js.map → arrow-left-BWlJ2qlC.js.map} +1 -1
  18. package/dist/{arrow-right-C5iPaK1O.js → arrow-right-BGkJBSWL.js} +2 -2
  19. package/dist/{arrow-right-C5iPaK1O.js.map → arrow-right-BGkJBSWL.js.map} +1 -1
  20. package/dist/{arrow-top-CKGwVtz2.js → arrow-top-CW2jDEe4.js} +2 -2
  21. package/dist/{arrow-top-CKGwVtz2.js.map → arrow-top-CW2jDEe4.js.map} +1 -1
  22. package/dist/{bank-DeTywVwC.js → bank-1GOPral2.js} +2 -2
  23. package/dist/{bank-DeTywVwC.js.map → bank-1GOPral2.js.map} +1 -1
  24. package/dist/{browser-ZHBOTr6m.js → browser-CNMKyt_S.js} +2 -2
  25. package/dist/{browser-ZHBOTr6m.js.map → browser-CNMKyt_S.js.map} +1 -1
  26. package/dist/{browser-B8BCrASu.js → browser-CRwbyiDn.js} +2 -2
  27. package/dist/{browser-B8BCrASu.js.map → browser-CRwbyiDn.js.map} +1 -1
  28. package/dist/{card-WYAxW4AU.js → card-BobtkMhO.js} +2 -2
  29. package/dist/{card-WYAxW4AU.js.map → card-BobtkMhO.js.map} +1 -1
  30. package/dist/{checkmark-D6gNkqXD.js → checkmark-9IgRwflL.js} +2 -2
  31. package/dist/{checkmark-D6gNkqXD.js.map → checkmark-9IgRwflL.js.map} +1 -1
  32. package/dist/{checkmark-bold-CVLxIhp1.js → checkmark-bold-BCsyR4P6.js} +2 -2
  33. package/dist/{checkmark-bold-CVLxIhp1.js.map → checkmark-bold-BCsyR4P6.js.map} +1 -1
  34. package/dist/{chevron-bottom-BnZrP8ng.js → chevron-bottom-hQ1dLD8u.js} +2 -2
  35. package/dist/{chevron-bottom-BnZrP8ng.js.map → chevron-bottom-hQ1dLD8u.js.map} +1 -1
  36. package/dist/{chevron-left-PQlhhfpK.js → chevron-left-B11Abfnf.js} +2 -2
  37. package/dist/{chevron-left-PQlhhfpK.js.map → chevron-left-B11Abfnf.js.map} +1 -1
  38. package/dist/{chevron-right-BHxp4jkW.js → chevron-right-Bf32y1EN.js} +2 -2
  39. package/dist/{chevron-right-BHxp4jkW.js.map → chevron-right-Bf32y1EN.js.map} +1 -1
  40. package/dist/{chevron-top-BbJGkGfR.js → chevron-top-BO8SByAy.js} +2 -2
  41. package/dist/{chevron-top-BbJGkGfR.js.map → chevron-top-BO8SByAy.js.map} +1 -1
  42. package/dist/{chrome-store-Cie71Qem.js → chrome-store-9vnZcqNu.js} +2 -2
  43. package/dist/{chrome-store-Cie71Qem.js.map → chrome-store-9vnZcqNu.js.map} +1 -1
  44. package/dist/{clock-IQBTFXEw.js → clock-riZdPcFM.js} +2 -2
  45. package/dist/{clock-IQBTFXEw.js.map → clock-riZdPcFM.js.map} +1 -1
  46. package/dist/{close-DxKbHQ06.js → close-DNxPKWKb.js} +2 -2
  47. package/dist/{close-DxKbHQ06.js.map → close-DNxPKWKb.js.map} +1 -1
  48. package/dist/{coinPlaceholder-CoskC0O6.js → coinPlaceholder-vaT6n0Dq.js} +2 -2
  49. package/dist/{coinPlaceholder-CoskC0O6.js.map → coinPlaceholder-vaT6n0Dq.js.map} +1 -1
  50. package/dist/{compass-IfPXB2uJ.js → compass-BXTAYDkL.js} +2 -2
  51. package/dist/{compass-IfPXB2uJ.js.map → compass-BXTAYDkL.js.map} +1 -1
  52. package/dist/{copy-Bjw7HZdA.js → copy-CBRaHGDQ.js} +2 -2
  53. package/dist/{copy-Bjw7HZdA.js.map → copy-CBRaHGDQ.js.map} +1 -1
  54. package/dist/{cursor-BEjLiAyG.js → cursor-d-bR9lqy.js} +2 -2
  55. package/dist/{cursor-BEjLiAyG.js.map → cursor-d-bR9lqy.js.map} +1 -1
  56. package/dist/{cursor-transparent-B4swj4oX.js → cursor-transparent-DanHbb8L.js} +2 -2
  57. package/dist/{cursor-transparent-B4swj4oX.js.map → cursor-transparent-DanHbb8L.js.map} +1 -1
  58. package/dist/{desktop-DWDJAE0j.js → desktop-Ea_pcyLe.js} +2 -2
  59. package/dist/{desktop-DWDJAE0j.js.map → desktop-Ea_pcyLe.js.map} +1 -1
  60. package/dist/{disconnect-DyBVvUlm.js → disconnect-CjRyCdF-.js} +2 -2
  61. package/dist/{disconnect-DyBVvUlm.js.map → disconnect-CjRyCdF-.js.map} +1 -1
  62. package/dist/{discord-Dy6b3RRH.js → discord-85Fgrjua.js} +2 -2
  63. package/dist/{discord-Dy6b3RRH.js.map → discord-85Fgrjua.js.map} +1 -1
  64. package/dist/{email-DghZZFyu.js → email-C29KqpqU.js} +8 -8
  65. package/dist/{email-DghZZFyu.js.map → email-C29KqpqU.js.map} +1 -1
  66. package/dist/{embedded-wallet-CGjM19AV.js → embedded-wallet-ChtJ9d8m.js} +10 -10
  67. package/dist/{embedded-wallet-CGjM19AV.js.map → embedded-wallet-ChtJ9d8m.js.map} +1 -1
  68. package/dist/{etherscan-CJk7TO4R.js → etherscan-DTm7ibk5.js} +2 -2
  69. package/dist/{etherscan-CJk7TO4R.js.map → etherscan-DTm7ibk5.js.map} +1 -1
  70. package/dist/{exclamation-triangle-DiOWokAx.js → exclamation-triangle-DGIy7zhV.js} +2 -2
  71. package/dist/{exclamation-triangle-DiOWokAx.js.map → exclamation-triangle-DGIy7zhV.js.map} +1 -1
  72. package/dist/{extension-AzZ-VQ5S.js → extension-BG9HdMPD.js} +2 -2
  73. package/dist/{extension-AzZ-VQ5S.js.map → extension-BG9HdMPD.js.map} +1 -1
  74. package/dist/{external-link-Bg6o90yA.js → external-link-Di43C1pf.js} +2 -2
  75. package/dist/{external-link-Bg6o90yA.js.map → external-link-Di43C1pf.js.map} +1 -1
  76. package/dist/{facebook-BvIKAWg3.js → facebook-CMAKZiZB.js} +2 -2
  77. package/dist/{facebook-BvIKAWg3.js.map → facebook-CMAKZiZB.js.map} +1 -1
  78. package/dist/{farcaster-CMMxDX39.js → farcaster-Dpf9c4MK.js} +2 -2
  79. package/dist/{farcaster-CMMxDX39.js.map → farcaster-Dpf9c4MK.js.map} +1 -1
  80. package/dist/{filters-CFLl0iBs.js → filters-CMFnX3RL.js} +2 -2
  81. package/dist/{filters-CFLl0iBs.js.map → filters-CMFnX3RL.js.map} +1 -1
  82. package/dist/{github-CmYncmzL.js → github-Bjk1_5qL.js} +2 -2
  83. package/dist/{github-CmYncmzL.js.map → github-Bjk1_5qL.js.map} +1 -1
  84. package/dist/{google-Ckse0W4Z.js → google-62muXda9.js} +2 -2
  85. package/dist/{google-Ckse0W4Z.js.map → google-62muXda9.js.map} +1 -1
  86. package/dist/{help-circle-BijMy4ht.js → help-circle-CTpQUk-o.js} +2 -2
  87. package/dist/{help-circle-BijMy4ht.js.map → help-circle-CTpQUk-o.js.map} +1 -1
  88. package/dist/{id-gO3BEzSg.js → id-Dp8nTGU2.js} +2 -2
  89. package/dist/{id-gO3BEzSg.js.map → id-Dp8nTGU2.js.map} +1 -1
  90. package/dist/{if-defined-BUCsuh9s.js → if-defined-DeBuBv8C.js} +78 -78
  91. package/dist/{if-defined-BUCsuh9s.js.map → if-defined-DeBuBv8C.js.map} +1 -1
  92. package/dist/{image-DxhE6Fnm.js → image-Dn9sVFNH.js} +2 -2
  93. package/dist/{image-DxhE6Fnm.js.map → image-Dn9sVFNH.js.map} +1 -1
  94. package/dist/{index-DPDvs1Rr.js → index-3AIUbrUU.js} +4 -4
  95. package/dist/{index-DPDvs1Rr.js.map → index-3AIUbrUU.js.map} +1 -1
  96. package/dist/{index-OJaV5piL.js → index-APZGoFS4.js} +3 -3
  97. package/dist/{index-OJaV5piL.js.map → index-APZGoFS4.js.map} +1 -1
  98. package/dist/{index-C9D8IpSa.js → index-B4ozkdcL.js} +3 -3
  99. package/dist/{index-C9D8IpSa.js.map → index-B4ozkdcL.js.map} +1 -1
  100. package/dist/{index-CQfiGCux.js → index-BBqt8FI3.js} +3 -3
  101. package/dist/{index-CQfiGCux.js.map → index-BBqt8FI3.js.map} +1 -1
  102. package/dist/{index-h2uWrDWR.js → index-BF2zsxDq.js} +4 -4
  103. package/dist/{index-h2uWrDWR.js.map → index-BF2zsxDq.js.map} +1 -1
  104. package/dist/{index-DnuurRsQ.js → index-BInOwLdY.js} +7 -7
  105. package/dist/{index-DnuurRsQ.js.map → index-BInOwLdY.js.map} +1 -1
  106. package/dist/{index-BL1Vtc1i.js → index-BOUiZbXW.js} +4 -4
  107. package/dist/{index-BL1Vtc1i.js.map → index-BOUiZbXW.js.map} +1 -1
  108. package/dist/{index-Bdgknjoz.js → index-BOt3v16B.js} +4 -4
  109. package/dist/{index-Bdgknjoz.js.map → index-BOt3v16B.js.map} +1 -1
  110. package/dist/{index-CGcPcD7s.js → index-BV_wsLUs.js} +3 -3
  111. package/dist/{index-CGcPcD7s.js.map → index-BV_wsLUs.js.map} +1 -1
  112. package/dist/{index-C0zB454j.js → index-BjEXOY6K.js} +3 -3
  113. package/dist/{index-C0zB454j.js.map → index-BjEXOY6K.js.map} +1 -1
  114. package/dist/{index-Clt4Gamg.js → index-BjjSQnZ5.js} +3 -3
  115. package/dist/{index-Clt4Gamg.js.map → index-BjjSQnZ5.js.map} +1 -1
  116. package/dist/{index-Bf_CKPQ4.js → index-BkE0sZOy.js} +4 -4
  117. package/dist/{index-Bf_CKPQ4.js.map → index-BkE0sZOy.js.map} +1 -1
  118. package/dist/{index-C_NCBpBW.js → index-BoR_58tP.js} +3 -3
  119. package/dist/{index-C_NCBpBW.js.map → index-BoR_58tP.js.map} +1 -1
  120. package/dist/{index-BuYXv-te.js → index-BpUy6ELp.js} +4 -4
  121. package/dist/{index-BuYXv-te.js.map → index-BpUy6ELp.js.map} +1 -1
  122. package/dist/{index-uQiw5aDt.js → index-BxTB1jb6.js} +4 -4
  123. package/dist/{index-uQiw5aDt.js.map → index-BxTB1jb6.js.map} +1 -1
  124. package/dist/{index-0sQOBosT.js → index-C3dCbvuU.js} +3 -3
  125. package/dist/{index-0sQOBosT.js.map → index-C3dCbvuU.js.map} +1 -1
  126. package/dist/{index-B3US0ze7.js → index-CIWdN6s7.js} +81 -29
  127. package/dist/index-CIWdN6s7.js.map +1 -0
  128. package/dist/{index-BtP6BgXy.js → index-CMFU2wOq.js} +3 -3
  129. package/dist/{index-BtP6BgXy.js.map → index-CMFU2wOq.js.map} +1 -1
  130. package/dist/index-CRQSbrdZ.js +3348 -0
  131. package/dist/index-CRQSbrdZ.js.map +1 -0
  132. package/dist/{index-D4uZajOt.js → index-CiZ2wBs3.js} +3 -3
  133. package/dist/{index-D4uZajOt.js.map → index-CiZ2wBs3.js.map} +1 -1
  134. package/dist/{index-DfXsC6Vx.js → index-Cjc4qIdP.js} +3 -3
  135. package/dist/{index-DfXsC6Vx.js.map → index-Cjc4qIdP.js.map} +1 -1
  136. package/dist/{index-D1vsBg_X.js → index-CmoL773p.js} +3 -3
  137. package/dist/{index-D1vsBg_X.js.map → index-CmoL773p.js.map} +1 -1
  138. package/dist/{index-_DqHUChI.js → index-CoPIlial.js} +4 -4
  139. package/dist/{index-_DqHUChI.js.map → index-CoPIlial.js.map} +1 -1
  140. package/dist/{index-DQibQFkr.js → index-D9nmWywB.js} +4 -4
  141. package/dist/{index-DQibQFkr.js.map → index-D9nmWywB.js.map} +1 -1
  142. package/dist/{index-5stOlOiL.js → index-DPRQcYF5.js} +4 -4
  143. package/dist/{index-5stOlOiL.js.map → index-DPRQcYF5.js.map} +1 -1
  144. package/dist/{index--8fCrTMB.js → index-DThB6yHY.js} +4 -4
  145. package/dist/{index--8fCrTMB.js.map → index-DThB6yHY.js.map} +1 -1
  146. package/dist/{index-BNLFpx_o.js → index-Dew3mRSJ.js} +2 -2
  147. package/dist/{index-BNLFpx_o.js.map → index-Dew3mRSJ.js.map} +1 -1
  148. package/dist/{index-Dj8pFty_.js → index-DvMegG3P.js} +3 -505
  149. package/dist/index-DvMegG3P.js.map +1 -0
  150. package/dist/{index-B7_8EBSn.js → index-Ee9KL65X.js} +7 -6
  151. package/dist/{index-B7_8EBSn.js.map → index-Ee9KL65X.js.map} +1 -1
  152. package/dist/{index-D5X2HlH8.js → index-EipIP3kf.js} +6 -6
  153. package/dist/{index-D5X2HlH8.js.map → index-EipIP3kf.js.map} +1 -1
  154. package/dist/{index-cjkE7IEF.js → index-KXOAAHza.js} +5 -5
  155. package/dist/{index-cjkE7IEF.js.map → index-KXOAAHza.js.map} +1 -1
  156. package/dist/{index-BiZ2sPMP.js → index-huLhd52f.js} +3 -3
  157. package/dist/{index-BiZ2sPMP.js.map → index-huLhd52f.js.map} +1 -1
  158. package/dist/{index.es-DWq-VIEl.js → index.es-E9oLZaOC.js} +3 -3
  159. package/dist/{index.es-DWq-VIEl.js.map → index.es-E9oLZaOC.js.map} +1 -1
  160. package/dist/{info-CSgVmziu.js → info-DQT-QmV7.js} +2 -2
  161. package/dist/{info-CSgVmziu.js.map → info-DQT-QmV7.js.map} +1 -1
  162. package/dist/{info-circle-Bzkbp00x.js → info-circle-p3wAzkW0.js} +2 -2
  163. package/dist/{info-circle-Bzkbp00x.js.map → info-circle-p3wAzkW0.js.map} +1 -1
  164. package/dist/{lightbulb-C-bkgBIb.js → lightbulb-Bnnje34R.js} +2 -2
  165. package/dist/{lightbulb-C-bkgBIb.js.map → lightbulb-Bnnje34R.js.map} +1 -1
  166. package/dist/{mail-CGmFg6fK.js → mail-5PSXCI0v.js} +2 -2
  167. package/dist/{mail-CGmFg6fK.js.map → mail-5PSXCI0v.js.map} +1 -1
  168. package/dist/{metamask-sdk-BakScGM0.js → metamask-sdk-8ZnQEZHu.js} +576 -584
  169. package/dist/metamask-sdk-8ZnQEZHu.js.map +1 -0
  170. package/dist/{mobile-DtRyE0jl.js → mobile-6mHtv3de.js} +2 -2
  171. package/dist/{mobile-DtRyE0jl.js.map → mobile-6mHtv3de.js.map} +1 -1
  172. package/dist/{more-KeHkLrDL.js → more-Dlt5sBR_.js} +2 -2
  173. package/dist/{more-KeHkLrDL.js.map → more-Dlt5sBR_.js.map} +1 -1
  174. package/dist/{native-Bp8NmofE.js → native-BhQYFetC.js} +2 -2
  175. package/dist/{native-Bp8NmofE.js.map → native-BhQYFetC.js.map} +1 -1
  176. package/dist/{network-placeholder-DOqs4Acw.js → network-placeholder-ZwUth56L.js} +2 -2
  177. package/dist/{network-placeholder-DOqs4Acw.js.map → network-placeholder-ZwUth56L.js.map} +1 -1
  178. package/dist/{nftPlaceholder-CqCnpGWd.js → nftPlaceholder-BZbdxsVy.js} +2 -2
  179. package/dist/{nftPlaceholder-CqCnpGWd.js.map → nftPlaceholder-BZbdxsVy.js.map} +1 -1
  180. package/dist/{off-BjQ1lWwI.js → off-DMjVDy9F.js} +2 -2
  181. package/dist/{off-BjQ1lWwI.js.map → off-DMjVDy9F.js.map} +1 -1
  182. package/dist/{onramp-YQOJXd7V.js → onramp-Bcn6fi9Y.js} +12 -12
  183. package/dist/{onramp-YQOJXd7V.js.map → onramp-Bcn6fi9Y.js.map} +1 -1
  184. package/dist/{play-store-gd3X2PE-.js → play-store-BB8PxYq4.js} +2 -2
  185. package/dist/{play-store-gd3X2PE-.js.map → play-store-BB8PxYq4.js.map} +1 -1
  186. package/dist/{plus-BjhhVCpY.js → plus-BQCGi8aA.js} +2 -2
  187. package/dist/{plus-BjhhVCpY.js.map → plus-BQCGi8aA.js.map} +1 -1
  188. package/dist/{qr-code-qjafSsS2.js → qr-code-CkWYDLbl.js} +2 -2
  189. package/dist/{qr-code-qjafSsS2.js.map → qr-code-CkWYDLbl.js.map} +1 -1
  190. package/dist/{receive-DkS03GRp.js → receive-BliYuS9o.js} +6 -6
  191. package/dist/{receive-DkS03GRp.js.map → receive-BliYuS9o.js.map} +1 -1
  192. package/dist/{recycle-horizontal-Chbf-42q.js → recycle-horizontal-BuvzEP2Z.js} +2 -2
  193. package/dist/{recycle-horizontal-Chbf-42q.js.map → recycle-horizontal-BuvzEP2Z.js.map} +1 -1
  194. package/dist/{refresh-B_fq24BN.js → refresh-2H3scIjP.js} +2 -2
  195. package/dist/{refresh-B_fq24BN.js.map → refresh-2H3scIjP.js.map} +1 -1
  196. package/dist/{search-CMyddrMM.js → search-C6kAa6cT.js} +2 -2
  197. package/dist/{search-CMyddrMM.js.map → search-C6kAa6cT.js.map} +1 -1
  198. package/dist/{send-DLwfVu3X.js → send-CUKUapsP.js} +2 -2
  199. package/dist/{send-DLwfVu3X.js.map → send-CUKUapsP.js.map} +1 -1
  200. package/dist/{send-5jN_SWT6.js → send-Dzhh-U1d.js} +10 -10
  201. package/dist/{send-5jN_SWT6.js.map → send-Dzhh-U1d.js.map} +1 -1
  202. package/dist/sha3-_pthIdIu.js +507 -0
  203. package/dist/sha3-_pthIdIu.js.map +1 -0
  204. package/dist/{socials-BskU39sA.js → socials-DfRR4eSa.js} +11 -11
  205. package/dist/socials-DfRR4eSa.js.map +1 -0
  206. package/dist/{swapHorizontal-CkK6Uemb.js → swapHorizontal-Comnyn0B.js} +2 -2
  207. package/dist/{swapHorizontal-CkK6Uemb.js.map → swapHorizontal-Comnyn0B.js.map} +1 -1
  208. package/dist/{swapHorizontalBold-EjmeRq01.js → swapHorizontalBold-sfM6wFJK.js} +2 -2
  209. package/dist/{swapHorizontalBold-EjmeRq01.js.map → swapHorizontalBold-sfM6wFJK.js.map} +1 -1
  210. package/dist/{swapHorizontalMedium-Dta28Hsi.js → swapHorizontalMedium-DHYNeIT9.js} +2 -2
  211. package/dist/{swapHorizontalMedium-Dta28Hsi.js.map → swapHorizontalMedium-DHYNeIT9.js.map} +1 -1
  212. package/dist/{swapHorizontalRoundedBold-c2wfDzBF.js → swapHorizontalRoundedBold-bjbYmfWO.js} +2 -2
  213. package/dist/{swapHorizontalRoundedBold-c2wfDzBF.js.map → swapHorizontalRoundedBold-bjbYmfWO.js.map} +1 -1
  214. package/dist/{swapVertical-BWZAOaFe.js → swapVertical-BxaU27nG.js} +2 -2
  215. package/dist/{swapVertical-BWZAOaFe.js.map → swapVertical-BxaU27nG.js.map} +1 -1
  216. package/dist/{swaps-CpwnRcad.js → swaps-BzTiyZmt.js} +10 -10
  217. package/dist/{swaps-CpwnRcad.js.map → swaps-BzTiyZmt.js.map} +1 -1
  218. package/dist/{telegram-DQpS1hOx.js → telegram-CiKi0tAK.js} +2 -2
  219. package/dist/{telegram-DQpS1hOx.js.map → telegram-CiKi0tAK.js.map} +1 -1
  220. package/dist/{three-dots-BIyLH-r_.js → three-dots-BJQoQYgU.js} +2 -2
  221. package/dist/{three-dots-BIyLH-r_.js.map → three-dots-BJQoQYgU.js.map} +1 -1
  222. package/dist/{transactions-ClbAR3b3.js → transactions-Bv-oGunp.js} +4 -4
  223. package/dist/{transactions-ClbAR3b3.js.map → transactions-Bv-oGunp.js.map} +1 -1
  224. package/dist/{twitch-w1fW9GUX.js → twitch-COTSMXJA.js} +2 -2
  225. package/dist/{twitch-w1fW9GUX.js.map → twitch-COTSMXJA.js.map} +1 -1
  226. package/dist/{twitterIcon-NV4rOXLM.js → twitterIcon-D_003_ON.js} +2 -2
  227. package/dist/{twitterIcon-NV4rOXLM.js.map → twitterIcon-D_003_ON.js.map} +1 -1
  228. package/dist/{verify-M1n52Kbs.js → verify-CwN_7Z4z.js} +2 -2
  229. package/dist/{verify-M1n52Kbs.js.map → verify-CwN_7Z4z.js.map} +1 -1
  230. package/dist/{verify-filled-CaH-d-6a.js → verify-filled-CMaOXVVk.js} +2 -2
  231. package/dist/{verify-filled-CaH-d-6a.js.map → verify-filled-CMaOXVVk.js.map} +1 -1
  232. package/dist/{w3m-modal-DuL53Gbm.js → w3m-modal-C3DATvc6.js} +13 -10
  233. package/dist/w3m-modal-C3DATvc6.js.map +1 -0
  234. package/dist/{wallet-Dshhbo-h.js → wallet-D84gVoa4.js} +2 -2
  235. package/dist/{wallet-Dshhbo-h.js.map → wallet-D84gVoa4.js.map} +1 -1
  236. package/dist/{wallet-placeholder-CjvKtwBY.js → wallet-placeholder-14A7hM7b.js} +2 -2
  237. package/dist/{wallet-placeholder-CjvKtwBY.js.map → wallet-placeholder-14A7hM7b.js.map} +1 -1
  238. package/dist/{walletconnect-iX57ADQX.js → walletconnect-8JXyBf8j.js} +2 -2
  239. package/dist/{walletconnect-iX57ADQX.js.map → walletconnect-8JXyBf8j.js.map} +1 -1
  240. package/dist/{warning-circle-8Hc0Cz7j.js → warning-circle-B2uvv-rW.js} +2 -2
  241. package/dist/{warning-circle-8Hc0Cz7j.js.map → warning-circle-B2uvv-rW.js.map} +1 -1
  242. package/dist/{x-CynCso4V.js → x-w1gCvlpq.js} +2 -2
  243. package/dist/{x-CynCso4V.js.map → x-w1gCvlpq.js.map} +1 -1
  244. package/package.json +11 -11
  245. package/dist/appkit-7F54kjKy.js.map +0 -1
  246. package/dist/ccip-DElUUMQ2.js +0 -160
  247. package/dist/ccip-DElUUMQ2.js.map +0 -1
  248. package/dist/index-B3US0ze7.js.map +0 -1
  249. package/dist/index-Dj8pFty_.js.map +0 -1
  250. package/dist/metamask-sdk-BakScGM0.js.map +0 -1
  251. package/dist/secp256k1-BSI-MLM-.js +0 -1705
  252. package/dist/secp256k1-BSI-MLM-.js.map +0 -1
  253. package/dist/socials-BskU39sA.js.map +0 -1
  254. package/dist/w3m-modal-DuL53Gbm.js.map +0 -1
@@ -1,1705 +0,0 @@
1
- import { b9 as Hash, ba as hash, bb as toBytes, bc as exists, bd as bytes, be as randomBytes, bf as concatBytes$1, bg as sha256 } from "./appkit-7F54kjKy.js";
2
- class HMAC extends Hash {
3
- constructor(hash$1, _key) {
4
- super();
5
- this.finished = false;
6
- this.destroyed = false;
7
- hash(hash$1);
8
- const key = toBytes(_key);
9
- this.iHash = hash$1.create();
10
- if (typeof this.iHash.update !== "function")
11
- throw new Error("Expected instance of class which extends utils.Hash");
12
- this.blockLen = this.iHash.blockLen;
13
- this.outputLen = this.iHash.outputLen;
14
- const blockLen = this.blockLen;
15
- const pad = new Uint8Array(blockLen);
16
- pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
17
- for (let i = 0; i < pad.length; i++)
18
- pad[i] ^= 54;
19
- this.iHash.update(pad);
20
- this.oHash = hash$1.create();
21
- for (let i = 0; i < pad.length; i++)
22
- pad[i] ^= 54 ^ 92;
23
- this.oHash.update(pad);
24
- pad.fill(0);
25
- }
26
- update(buf) {
27
- exists(this);
28
- this.iHash.update(buf);
29
- return this;
30
- }
31
- digestInto(out) {
32
- exists(this);
33
- bytes(out, this.outputLen);
34
- this.finished = true;
35
- this.iHash.digestInto(out);
36
- this.oHash.update(out);
37
- this.oHash.digestInto(out);
38
- this.destroy();
39
- }
40
- digest() {
41
- const out = new Uint8Array(this.oHash.outputLen);
42
- this.digestInto(out);
43
- return out;
44
- }
45
- _cloneInto(to) {
46
- to || (to = Object.create(Object.getPrototypeOf(this), {}));
47
- const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
48
- to = to;
49
- to.finished = finished;
50
- to.destroyed = destroyed;
51
- to.blockLen = blockLen;
52
- to.outputLen = outputLen;
53
- to.oHash = oHash._cloneInto(to.oHash);
54
- to.iHash = iHash._cloneInto(to.iHash);
55
- return to;
56
- }
57
- destroy() {
58
- this.destroyed = true;
59
- this.oHash.destroy();
60
- this.iHash.destroy();
61
- }
62
- }
63
- const hmac = (hash2, key, message) => new HMAC(hash2, key).update(message).digest();
64
- hmac.create = (hash2, key) => new HMAC(hash2, key);
65
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
66
- const _0n$3 = /* @__PURE__ */ BigInt(0);
67
- const _1n$4 = /* @__PURE__ */ BigInt(1);
68
- const _2n$2 = /* @__PURE__ */ BigInt(2);
69
- function isBytes(a) {
70
- return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
71
- }
72
- function abytes(item) {
73
- if (!isBytes(item))
74
- throw new Error("Uint8Array expected");
75
- }
76
- function abool(title, value) {
77
- if (typeof value !== "boolean")
78
- throw new Error(`${title} must be valid boolean, got "${value}".`);
79
- }
80
- const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
81
- function bytesToHex(bytes2) {
82
- abytes(bytes2);
83
- let hex = "";
84
- for (let i = 0; i < bytes2.length; i++) {
85
- hex += hexes[bytes2[i]];
86
- }
87
- return hex;
88
- }
89
- function numberToHexUnpadded(num) {
90
- const hex = num.toString(16);
91
- return hex.length & 1 ? `0${hex}` : hex;
92
- }
93
- function hexToNumber(hex) {
94
- if (typeof hex !== "string")
95
- throw new Error("hex string expected, got " + typeof hex);
96
- return BigInt(hex === "" ? "0" : `0x${hex}`);
97
- }
98
- const asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };
99
- function asciiToBase16(char) {
100
- if (char >= asciis._0 && char <= asciis._9)
101
- return char - asciis._0;
102
- if (char >= asciis._A && char <= asciis._F)
103
- return char - (asciis._A - 10);
104
- if (char >= asciis._a && char <= asciis._f)
105
- return char - (asciis._a - 10);
106
- return;
107
- }
108
- function hexToBytes(hex) {
109
- if (typeof hex !== "string")
110
- throw new Error("hex string expected, got " + typeof hex);
111
- const hl = hex.length;
112
- const al = hl / 2;
113
- if (hl % 2)
114
- throw new Error("padded hex string expected, got unpadded hex of length " + hl);
115
- const array = new Uint8Array(al);
116
- for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
117
- const n1 = asciiToBase16(hex.charCodeAt(hi));
118
- const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
119
- if (n1 === void 0 || n2 === void 0) {
120
- const char = hex[hi] + hex[hi + 1];
121
- throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
122
- }
123
- array[ai] = n1 * 16 + n2;
124
- }
125
- return array;
126
- }
127
- function bytesToNumberBE(bytes2) {
128
- return hexToNumber(bytesToHex(bytes2));
129
- }
130
- function bytesToNumberLE(bytes2) {
131
- abytes(bytes2);
132
- return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
133
- }
134
- function numberToBytesBE(n, len) {
135
- return hexToBytes(n.toString(16).padStart(len * 2, "0"));
136
- }
137
- function numberToBytesLE(n, len) {
138
- return numberToBytesBE(n, len).reverse();
139
- }
140
- function numberToVarBytesBE(n) {
141
- return hexToBytes(numberToHexUnpadded(n));
142
- }
143
- function ensureBytes(title, hex, expectedLength) {
144
- let res;
145
- if (typeof hex === "string") {
146
- try {
147
- res = hexToBytes(hex);
148
- } catch (e) {
149
- throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
150
- }
151
- } else if (isBytes(hex)) {
152
- res = Uint8Array.from(hex);
153
- } else {
154
- throw new Error(`${title} must be hex string or Uint8Array`);
155
- }
156
- const len = res.length;
157
- if (typeof expectedLength === "number" && len !== expectedLength)
158
- throw new Error(`${title} expected ${expectedLength} bytes, got ${len}`);
159
- return res;
160
- }
161
- function concatBytes(...arrays) {
162
- let sum = 0;
163
- for (let i = 0; i < arrays.length; i++) {
164
- const a = arrays[i];
165
- abytes(a);
166
- sum += a.length;
167
- }
168
- const res = new Uint8Array(sum);
169
- for (let i = 0, pad = 0; i < arrays.length; i++) {
170
- const a = arrays[i];
171
- res.set(a, pad);
172
- pad += a.length;
173
- }
174
- return res;
175
- }
176
- function equalBytes(a, b) {
177
- if (a.length !== b.length)
178
- return false;
179
- let diff = 0;
180
- for (let i = 0; i < a.length; i++)
181
- diff |= a[i] ^ b[i];
182
- return diff === 0;
183
- }
184
- function utf8ToBytes(str) {
185
- if (typeof str !== "string")
186
- throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
187
- return new Uint8Array(new TextEncoder().encode(str));
188
- }
189
- const isPosBig = (n) => typeof n === "bigint" && _0n$3 <= n;
190
- function inRange(n, min, max) {
191
- return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
192
- }
193
- function aInRange(title, n, min, max) {
194
- if (!inRange(n, min, max))
195
- throw new Error(`expected valid ${title}: ${min} <= n < ${max}, got ${typeof n} ${n}`);
196
- }
197
- function bitLen(n) {
198
- let len;
199
- for (len = 0; n > _0n$3; n >>= _1n$4, len += 1)
200
- ;
201
- return len;
202
- }
203
- function bitGet(n, pos) {
204
- return n >> BigInt(pos) & _1n$4;
205
- }
206
- function bitSet(n, pos, value) {
207
- return n | (value ? _1n$4 : _0n$3) << BigInt(pos);
208
- }
209
- const bitMask = (n) => (_2n$2 << BigInt(n - 1)) - _1n$4;
210
- const u8n = (data) => new Uint8Array(data);
211
- const u8fr = (arr) => Uint8Array.from(arr);
212
- function createHmacDrbg(hashLen, qByteLen, hmacFn) {
213
- if (typeof hashLen !== "number" || hashLen < 2)
214
- throw new Error("hashLen must be a number");
215
- if (typeof qByteLen !== "number" || qByteLen < 2)
216
- throw new Error("qByteLen must be a number");
217
- if (typeof hmacFn !== "function")
218
- throw new Error("hmacFn must be a function");
219
- let v = u8n(hashLen);
220
- let k = u8n(hashLen);
221
- let i = 0;
222
- const reset = () => {
223
- v.fill(1);
224
- k.fill(0);
225
- i = 0;
226
- };
227
- const h = (...b) => hmacFn(k, v, ...b);
228
- const reseed = (seed = u8n()) => {
229
- k = h(u8fr([0]), seed);
230
- v = h();
231
- if (seed.length === 0)
232
- return;
233
- k = h(u8fr([1]), seed);
234
- v = h();
235
- };
236
- const gen = () => {
237
- if (i++ >= 1e3)
238
- throw new Error("drbg: tried 1000 values");
239
- let len = 0;
240
- const out = [];
241
- while (len < qByteLen) {
242
- v = h();
243
- const sl = v.slice();
244
- out.push(sl);
245
- len += v.length;
246
- }
247
- return concatBytes(...out);
248
- };
249
- const genUntil = (seed, pred) => {
250
- reset();
251
- reseed(seed);
252
- let res = void 0;
253
- while (!(res = pred(gen())))
254
- reseed();
255
- reset();
256
- return res;
257
- };
258
- return genUntil;
259
- }
260
- const validatorFns = {
261
- bigint: (val) => typeof val === "bigint",
262
- function: (val) => typeof val === "function",
263
- boolean: (val) => typeof val === "boolean",
264
- string: (val) => typeof val === "string",
265
- stringOrUint8Array: (val) => typeof val === "string" || isBytes(val),
266
- isSafeInteger: (val) => Number.isSafeInteger(val),
267
- array: (val) => Array.isArray(val),
268
- field: (val, object) => object.Fp.isValid(val),
269
- hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
270
- };
271
- function validateObject(object, validators, optValidators = {}) {
272
- const checkField = (fieldName, type, isOptional) => {
273
- const checkVal = validatorFns[type];
274
- if (typeof checkVal !== "function")
275
- throw new Error(`Invalid validator "${type}", expected function`);
276
- const val = object[fieldName];
277
- if (isOptional && val === void 0)
278
- return;
279
- if (!checkVal(val, object)) {
280
- throw new Error(`Invalid param ${String(fieldName)}=${val} (${typeof val}), expected ${type}`);
281
- }
282
- };
283
- for (const [fieldName, type] of Object.entries(validators))
284
- checkField(fieldName, type, false);
285
- for (const [fieldName, type] of Object.entries(optValidators))
286
- checkField(fieldName, type, true);
287
- return object;
288
- }
289
- const notImplemented = () => {
290
- throw new Error("not implemented");
291
- };
292
- function memoized(fn) {
293
- const map = /* @__PURE__ */ new WeakMap();
294
- return (arg, ...args) => {
295
- const val = map.get(arg);
296
- if (val !== void 0)
297
- return val;
298
- const computed = fn(arg, ...args);
299
- map.set(arg, computed);
300
- return computed;
301
- };
302
- }
303
- const ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
304
- __proto__: null,
305
- aInRange,
306
- abool,
307
- abytes,
308
- bitGet,
309
- bitLen,
310
- bitMask,
311
- bitSet,
312
- bytesToHex,
313
- bytesToNumberBE,
314
- bytesToNumberLE,
315
- concatBytes,
316
- createHmacDrbg,
317
- ensureBytes,
318
- equalBytes,
319
- hexToBytes,
320
- hexToNumber,
321
- inRange,
322
- isBytes,
323
- memoized,
324
- notImplemented,
325
- numberToBytesBE,
326
- numberToBytesLE,
327
- numberToHexUnpadded,
328
- numberToVarBytesBE,
329
- utf8ToBytes,
330
- validateObject
331
- }, Symbol.toStringTag, { value: "Module" }));
332
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
333
- const _0n$2 = BigInt(0), _1n$3 = BigInt(1), _2n$1 = BigInt(2), _3n$1 = BigInt(3);
334
- const _4n = BigInt(4), _5n = BigInt(5), _8n = BigInt(8);
335
- BigInt(9);
336
- BigInt(16);
337
- function mod(a, b) {
338
- const result = a % b;
339
- return result >= _0n$2 ? result : b + result;
340
- }
341
- function pow(num, power, modulo) {
342
- if (modulo <= _0n$2 || power < _0n$2)
343
- throw new Error("Expected power/modulo > 0");
344
- if (modulo === _1n$3)
345
- return _0n$2;
346
- let res = _1n$3;
347
- while (power > _0n$2) {
348
- if (power & _1n$3)
349
- res = res * num % modulo;
350
- num = num * num % modulo;
351
- power >>= _1n$3;
352
- }
353
- return res;
354
- }
355
- function pow2(x, power, modulo) {
356
- let res = x;
357
- while (power-- > _0n$2) {
358
- res *= res;
359
- res %= modulo;
360
- }
361
- return res;
362
- }
363
- function invert(number, modulo) {
364
- if (number === _0n$2 || modulo <= _0n$2) {
365
- throw new Error(`invert: expected positive integers, got n=${number} mod=${modulo}`);
366
- }
367
- let a = mod(number, modulo);
368
- let b = modulo;
369
- let x = _0n$2, u = _1n$3;
370
- while (a !== _0n$2) {
371
- const q = b / a;
372
- const r = b % a;
373
- const m = x - u * q;
374
- b = a, a = r, x = u, u = m;
375
- }
376
- const gcd = b;
377
- if (gcd !== _1n$3)
378
- throw new Error("invert: does not exist");
379
- return mod(x, modulo);
380
- }
381
- function tonelliShanks(P) {
382
- const legendreC = (P - _1n$3) / _2n$1;
383
- let Q, S, Z;
384
- for (Q = P - _1n$3, S = 0; Q % _2n$1 === _0n$2; Q /= _2n$1, S++)
385
- ;
386
- for (Z = _2n$1; Z < P && pow(Z, legendreC, P) !== P - _1n$3; Z++)
387
- ;
388
- if (S === 1) {
389
- const p1div4 = (P + _1n$3) / _4n;
390
- return function tonelliFast(Fp2, n) {
391
- const root = Fp2.pow(n, p1div4);
392
- if (!Fp2.eql(Fp2.sqr(root), n))
393
- throw new Error("Cannot find square root");
394
- return root;
395
- };
396
- }
397
- const Q1div2 = (Q + _1n$3) / _2n$1;
398
- return function tonelliSlow(Fp2, n) {
399
- if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
400
- throw new Error("Cannot find square root");
401
- let r = S;
402
- let g = Fp2.pow(Fp2.mul(Fp2.ONE, Z), Q);
403
- let x = Fp2.pow(n, Q1div2);
404
- let b = Fp2.pow(n, Q);
405
- while (!Fp2.eql(b, Fp2.ONE)) {
406
- if (Fp2.eql(b, Fp2.ZERO))
407
- return Fp2.ZERO;
408
- let m = 1;
409
- for (let t2 = Fp2.sqr(b); m < r; m++) {
410
- if (Fp2.eql(t2, Fp2.ONE))
411
- break;
412
- t2 = Fp2.sqr(t2);
413
- }
414
- const ge = Fp2.pow(g, _1n$3 << BigInt(r - m - 1));
415
- g = Fp2.sqr(ge);
416
- x = Fp2.mul(x, ge);
417
- b = Fp2.mul(b, g);
418
- r = m;
419
- }
420
- return x;
421
- };
422
- }
423
- function FpSqrt(P) {
424
- if (P % _4n === _3n$1) {
425
- const p1div4 = (P + _1n$3) / _4n;
426
- return function sqrt3mod4(Fp2, n) {
427
- const root = Fp2.pow(n, p1div4);
428
- if (!Fp2.eql(Fp2.sqr(root), n))
429
- throw new Error("Cannot find square root");
430
- return root;
431
- };
432
- }
433
- if (P % _8n === _5n) {
434
- const c1 = (P - _5n) / _8n;
435
- return function sqrt5mod8(Fp2, n) {
436
- const n2 = Fp2.mul(n, _2n$1);
437
- const v = Fp2.pow(n2, c1);
438
- const nv = Fp2.mul(n, v);
439
- const i = Fp2.mul(Fp2.mul(nv, _2n$1), v);
440
- const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
441
- if (!Fp2.eql(Fp2.sqr(root), n))
442
- throw new Error("Cannot find square root");
443
- return root;
444
- };
445
- }
446
- return tonelliShanks(P);
447
- }
448
- const FIELD_FIELDS = [
449
- "create",
450
- "isValid",
451
- "is0",
452
- "neg",
453
- "inv",
454
- "sqrt",
455
- "sqr",
456
- "eql",
457
- "add",
458
- "sub",
459
- "mul",
460
- "pow",
461
- "div",
462
- "addN",
463
- "subN",
464
- "mulN",
465
- "sqrN"
466
- ];
467
- function validateField(field) {
468
- const initial = {
469
- ORDER: "bigint",
470
- MASK: "bigint",
471
- BYTES: "isSafeInteger",
472
- BITS: "isSafeInteger"
473
- };
474
- const opts = FIELD_FIELDS.reduce((map, val) => {
475
- map[val] = "function";
476
- return map;
477
- }, initial);
478
- return validateObject(field, opts);
479
- }
480
- function FpPow(f, num, power) {
481
- if (power < _0n$2)
482
- throw new Error("Expected power > 0");
483
- if (power === _0n$2)
484
- return f.ONE;
485
- if (power === _1n$3)
486
- return num;
487
- let p = f.ONE;
488
- let d = num;
489
- while (power > _0n$2) {
490
- if (power & _1n$3)
491
- p = f.mul(p, d);
492
- d = f.sqr(d);
493
- power >>= _1n$3;
494
- }
495
- return p;
496
- }
497
- function FpInvertBatch(f, nums) {
498
- const tmp = new Array(nums.length);
499
- const lastMultiplied = nums.reduce((acc, num, i) => {
500
- if (f.is0(num))
501
- return acc;
502
- tmp[i] = acc;
503
- return f.mul(acc, num);
504
- }, f.ONE);
505
- const inverted = f.inv(lastMultiplied);
506
- nums.reduceRight((acc, num, i) => {
507
- if (f.is0(num))
508
- return acc;
509
- tmp[i] = f.mul(acc, tmp[i]);
510
- return f.mul(acc, num);
511
- }, inverted);
512
- return tmp;
513
- }
514
- function nLength(n, nBitLength) {
515
- const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length;
516
- const nByteLength = Math.ceil(_nBitLength / 8);
517
- return { nBitLength: _nBitLength, nByteLength };
518
- }
519
- function Field(ORDER, bitLen2, isLE = false, redef = {}) {
520
- if (ORDER <= _0n$2)
521
- throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
522
- const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
523
- if (BYTES > 2048)
524
- throw new Error("Field lengths over 2048 bytes are not supported");
525
- const sqrtP = FpSqrt(ORDER);
526
- const f = Object.freeze({
527
- ORDER,
528
- BITS,
529
- BYTES,
530
- MASK: bitMask(BITS),
531
- ZERO: _0n$2,
532
- ONE: _1n$3,
533
- create: (num) => mod(num, ORDER),
534
- isValid: (num) => {
535
- if (typeof num !== "bigint")
536
- throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
537
- return _0n$2 <= num && num < ORDER;
538
- },
539
- is0: (num) => num === _0n$2,
540
- isOdd: (num) => (num & _1n$3) === _1n$3,
541
- neg: (num) => mod(-num, ORDER),
542
- eql: (lhs, rhs) => lhs === rhs,
543
- sqr: (num) => mod(num * num, ORDER),
544
- add: (lhs, rhs) => mod(lhs + rhs, ORDER),
545
- sub: (lhs, rhs) => mod(lhs - rhs, ORDER),
546
- mul: (lhs, rhs) => mod(lhs * rhs, ORDER),
547
- pow: (num, power) => FpPow(f, num, power),
548
- div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),
549
- // Same as above, but doesn't normalize
550
- sqrN: (num) => num * num,
551
- addN: (lhs, rhs) => lhs + rhs,
552
- subN: (lhs, rhs) => lhs - rhs,
553
- mulN: (lhs, rhs) => lhs * rhs,
554
- inv: (num) => invert(num, ORDER),
555
- sqrt: redef.sqrt || ((n) => sqrtP(f, n)),
556
- invertBatch: (lst) => FpInvertBatch(f, lst),
557
- // TODO: do we really need constant cmov?
558
- // We don't have const-time bigints anyway, so probably will be not very useful
559
- cmov: (a, b, c) => c ? b : a,
560
- toBytes: (num) => isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
561
- fromBytes: (bytes2) => {
562
- if (bytes2.length !== BYTES)
563
- throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`);
564
- return isLE ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2);
565
- }
566
- });
567
- return Object.freeze(f);
568
- }
569
- function getFieldBytesLength(fieldOrder) {
570
- if (typeof fieldOrder !== "bigint")
571
- throw new Error("field order must be bigint");
572
- const bitLength = fieldOrder.toString(2).length;
573
- return Math.ceil(bitLength / 8);
574
- }
575
- function getMinHashLength(fieldOrder) {
576
- const length = getFieldBytesLength(fieldOrder);
577
- return length + Math.ceil(length / 2);
578
- }
579
- function mapHashToField(key, fieldOrder, isLE = false) {
580
- const len = key.length;
581
- const fieldLen = getFieldBytesLength(fieldOrder);
582
- const minLen = getMinHashLength(fieldOrder);
583
- if (len < 16 || len < minLen || len > 1024)
584
- throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
585
- const num = isLE ? bytesToNumberBE(key) : bytesToNumberLE(key);
586
- const reduced = mod(num, fieldOrder - _1n$3) + _1n$3;
587
- return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
588
- }
589
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
590
- const _0n$1 = BigInt(0);
591
- const _1n$2 = BigInt(1);
592
- const pointPrecomputes = /* @__PURE__ */ new WeakMap();
593
- const pointWindowSizes = /* @__PURE__ */ new WeakMap();
594
- function wNAF(c, bits) {
595
- const constTimeNegate = (condition, item) => {
596
- const neg = item.negate();
597
- return condition ? neg : item;
598
- };
599
- const validateW = (W) => {
600
- if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
601
- throw new Error(`Wrong window size=${W}, should be [1..${bits}]`);
602
- };
603
- const opts = (W) => {
604
- validateW(W);
605
- const windows = Math.ceil(bits / W) + 1;
606
- const windowSize = 2 ** (W - 1);
607
- return { windows, windowSize };
608
- };
609
- return {
610
- constTimeNegate,
611
- // non-const time multiplication ladder
612
- unsafeLadder(elm, n) {
613
- let p = c.ZERO;
614
- let d = elm;
615
- while (n > _0n$1) {
616
- if (n & _1n$2)
617
- p = p.add(d);
618
- d = d.double();
619
- n >>= _1n$2;
620
- }
621
- return p;
622
- },
623
- /**
624
- * Creates a wNAF precomputation window. Used for caching.
625
- * Default window size is set by `utils.precompute()` and is equal to 8.
626
- * Number of precomputed points depends on the curve size:
627
- * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
628
- * - 𝑊 is the window size
629
- * - 𝑛 is the bitlength of the curve order.
630
- * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
631
- * @returns precomputed point tables flattened to a single array
632
- */
633
- precomputeWindow(elm, W) {
634
- const { windows, windowSize } = opts(W);
635
- const points = [];
636
- let p = elm;
637
- let base = p;
638
- for (let window = 0; window < windows; window++) {
639
- base = p;
640
- points.push(base);
641
- for (let i = 1; i < windowSize; i++) {
642
- base = base.add(p);
643
- points.push(base);
644
- }
645
- p = base.double();
646
- }
647
- return points;
648
- },
649
- /**
650
- * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
651
- * @param W window size
652
- * @param precomputes precomputed tables
653
- * @param n scalar (we don't check here, but should be less than curve order)
654
- * @returns real and fake (for const-time) points
655
- */
656
- wNAF(W, precomputes, n) {
657
- const { windows, windowSize } = opts(W);
658
- let p = c.ZERO;
659
- let f = c.BASE;
660
- const mask = BigInt(2 ** W - 1);
661
- const maxNumber = 2 ** W;
662
- const shiftBy = BigInt(W);
663
- for (let window = 0; window < windows; window++) {
664
- const offset = window * windowSize;
665
- let wbits = Number(n & mask);
666
- n >>= shiftBy;
667
- if (wbits > windowSize) {
668
- wbits -= maxNumber;
669
- n += _1n$2;
670
- }
671
- const offset1 = offset;
672
- const offset2 = offset + Math.abs(wbits) - 1;
673
- const cond1 = window % 2 !== 0;
674
- const cond2 = wbits < 0;
675
- if (wbits === 0) {
676
- f = f.add(constTimeNegate(cond1, precomputes[offset1]));
677
- } else {
678
- p = p.add(constTimeNegate(cond2, precomputes[offset2]));
679
- }
680
- }
681
- return { p, f };
682
- },
683
- wNAFCached(P, n, transform) {
684
- const W = pointWindowSizes.get(P) || 1;
685
- let comp = pointPrecomputes.get(P);
686
- if (!comp) {
687
- comp = this.precomputeWindow(P, W);
688
- if (W !== 1)
689
- pointPrecomputes.set(P, transform(comp));
690
- }
691
- return this.wNAF(W, comp, n);
692
- },
693
- // We calculate precomputes for elliptic curve point multiplication
694
- // using windowed method. This specifies window size and
695
- // stores precomputed values. Usually only base point would be precomputed.
696
- setWindowSize(P, W) {
697
- validateW(W);
698
- pointWindowSizes.set(P, W);
699
- pointPrecomputes.delete(P);
700
- }
701
- };
702
- }
703
- function pippenger(c, field, points, scalars) {
704
- if (!Array.isArray(points) || !Array.isArray(scalars) || scalars.length !== points.length)
705
- throw new Error("arrays of points and scalars must have equal length");
706
- scalars.forEach((s, i) => {
707
- if (!field.isValid(s))
708
- throw new Error(`wrong scalar at index ${i}`);
709
- });
710
- points.forEach((p, i) => {
711
- if (!(p instanceof c))
712
- throw new Error(`wrong point at index ${i}`);
713
- });
714
- const wbits = bitLen(BigInt(points.length));
715
- const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1;
716
- const MASK = (1 << windowSize) - 1;
717
- const buckets = new Array(MASK + 1).fill(c.ZERO);
718
- const lastBits = Math.floor((field.BITS - 1) / windowSize) * windowSize;
719
- let sum = c.ZERO;
720
- for (let i = lastBits; i >= 0; i -= windowSize) {
721
- buckets.fill(c.ZERO);
722
- for (let j = 0; j < scalars.length; j++) {
723
- const scalar = scalars[j];
724
- const wbits2 = Number(scalar >> BigInt(i) & BigInt(MASK));
725
- buckets[wbits2] = buckets[wbits2].add(points[j]);
726
- }
727
- let resI = c.ZERO;
728
- for (let j = buckets.length - 1, sumI = c.ZERO; j > 0; j--) {
729
- sumI = sumI.add(buckets[j]);
730
- resI = resI.add(sumI);
731
- }
732
- sum = sum.add(resI);
733
- if (i !== 0)
734
- for (let j = 0; j < windowSize; j++)
735
- sum = sum.double();
736
- }
737
- return sum;
738
- }
739
- function validateBasic(curve) {
740
- validateField(curve.Fp);
741
- validateObject(curve, {
742
- n: "bigint",
743
- h: "bigint",
744
- Gx: "field",
745
- Gy: "field"
746
- }, {
747
- nBitLength: "isSafeInteger",
748
- nByteLength: "isSafeInteger"
749
- });
750
- return Object.freeze({
751
- ...nLength(curve.n, curve.nBitLength),
752
- ...curve,
753
- ...{ p: curve.Fp.ORDER }
754
- });
755
- }
756
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
757
- function validateSigVerOpts(opts) {
758
- if (opts.lowS !== void 0)
759
- abool("lowS", opts.lowS);
760
- if (opts.prehash !== void 0)
761
- abool("prehash", opts.prehash);
762
- }
763
- function validatePointOpts(curve) {
764
- const opts = validateBasic(curve);
765
- validateObject(opts, {
766
- a: "field",
767
- b: "field"
768
- }, {
769
- allowedPrivateKeyLengths: "array",
770
- wrapPrivateKey: "boolean",
771
- isTorsionFree: "function",
772
- clearCofactor: "function",
773
- allowInfinityPoint: "boolean",
774
- fromBytes: "function",
775
- toBytes: "function"
776
- });
777
- const { endo, Fp: Fp2, a } = opts;
778
- if (endo) {
779
- if (!Fp2.eql(a, Fp2.ZERO)) {
780
- throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");
781
- }
782
- if (typeof endo !== "object" || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") {
783
- throw new Error("Expected endomorphism with beta: bigint and splitScalar: function");
784
- }
785
- }
786
- return Object.freeze({ ...opts });
787
- }
788
- const { bytesToNumberBE: b2n, hexToBytes: h2b } = ut;
789
- const DER = {
790
- // asn.1 DER encoding utils
791
- Err: class DERErr extends Error {
792
- constructor(m = "") {
793
- super(m);
794
- }
795
- },
796
- // Basic building block is TLV (Tag-Length-Value)
797
- _tlv: {
798
- encode: (tag, data) => {
799
- const { Err: E } = DER;
800
- if (tag < 0 || tag > 256)
801
- throw new E("tlv.encode: wrong tag");
802
- if (data.length & 1)
803
- throw new E("tlv.encode: unpadded data");
804
- const dataLen = data.length / 2;
805
- const len = numberToHexUnpadded(dataLen);
806
- if (len.length / 2 & 128)
807
- throw new E("tlv.encode: long form length too big");
808
- const lenLen = dataLen > 127 ? numberToHexUnpadded(len.length / 2 | 128) : "";
809
- return `${numberToHexUnpadded(tag)}${lenLen}${len}${data}`;
810
- },
811
- // v - value, l - left bytes (unparsed)
812
- decode(tag, data) {
813
- const { Err: E } = DER;
814
- let pos = 0;
815
- if (tag < 0 || tag > 256)
816
- throw new E("tlv.encode: wrong tag");
817
- if (data.length < 2 || data[pos++] !== tag)
818
- throw new E("tlv.decode: wrong tlv");
819
- const first = data[pos++];
820
- const isLong = !!(first & 128);
821
- let length = 0;
822
- if (!isLong)
823
- length = first;
824
- else {
825
- const lenLen = first & 127;
826
- if (!lenLen)
827
- throw new E("tlv.decode(long): indefinite length not supported");
828
- if (lenLen > 4)
829
- throw new E("tlv.decode(long): byte length is too big");
830
- const lengthBytes = data.subarray(pos, pos + lenLen);
831
- if (lengthBytes.length !== lenLen)
832
- throw new E("tlv.decode: length bytes not complete");
833
- if (lengthBytes[0] === 0)
834
- throw new E("tlv.decode(long): zero leftmost byte");
835
- for (const b of lengthBytes)
836
- length = length << 8 | b;
837
- pos += lenLen;
838
- if (length < 128)
839
- throw new E("tlv.decode(long): not minimal encoding");
840
- }
841
- const v = data.subarray(pos, pos + length);
842
- if (v.length !== length)
843
- throw new E("tlv.decode: wrong value length");
844
- return { v, l: data.subarray(pos + length) };
845
- }
846
- },
847
- // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
848
- // since we always use positive integers here. It must always be empty:
849
- // - add zero byte if exists
850
- // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
851
- _int: {
852
- encode(num) {
853
- const { Err: E } = DER;
854
- if (num < _0n)
855
- throw new E("integer: negative integers are not allowed");
856
- let hex = numberToHexUnpadded(num);
857
- if (Number.parseInt(hex[0], 16) & 8)
858
- hex = "00" + hex;
859
- if (hex.length & 1)
860
- throw new E("unexpected assertion");
861
- return hex;
862
- },
863
- decode(data) {
864
- const { Err: E } = DER;
865
- if (data[0] & 128)
866
- throw new E("Invalid signature integer: negative");
867
- if (data[0] === 0 && !(data[1] & 128))
868
- throw new E("Invalid signature integer: unnecessary leading zero");
869
- return b2n(data);
870
- }
871
- },
872
- toSig(hex) {
873
- const { Err: E, _int: int, _tlv: tlv } = DER;
874
- const data = typeof hex === "string" ? h2b(hex) : hex;
875
- abytes(data);
876
- const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
877
- if (seqLeftBytes.length)
878
- throw new E("Invalid signature: left bytes after parsing");
879
- const { v: rBytes, l: rLeftBytes } = tlv.decode(2, seqBytes);
880
- const { v: sBytes, l: sLeftBytes } = tlv.decode(2, rLeftBytes);
881
- if (sLeftBytes.length)
882
- throw new E("Invalid signature: left bytes after parsing");
883
- return { r: int.decode(rBytes), s: int.decode(sBytes) };
884
- },
885
- hexFromSig(sig) {
886
- const { _tlv: tlv, _int: int } = DER;
887
- const seq = `${tlv.encode(2, int.encode(sig.r))}${tlv.encode(2, int.encode(sig.s))}`;
888
- return tlv.encode(48, seq);
889
- }
890
- };
891
- const _0n = BigInt(0), _1n$1 = BigInt(1);
892
- BigInt(2);
893
- const _3n = BigInt(3);
894
- BigInt(4);
895
- function weierstrassPoints(opts) {
896
- const CURVE = validatePointOpts(opts);
897
- const { Fp: Fp2 } = CURVE;
898
- const Fn = Field(CURVE.n, CURVE.nBitLength);
899
- const toBytes2 = CURVE.toBytes || ((_c, point, _isCompressed) => {
900
- const a = point.toAffine();
901
- return concatBytes(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
902
- });
903
- const fromBytes = CURVE.fromBytes || ((bytes2) => {
904
- const tail = bytes2.subarray(1);
905
- const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
906
- const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
907
- return { x, y };
908
- });
909
- function weierstrassEquation(x) {
910
- const { a, b } = CURVE;
911
- const x2 = Fp2.sqr(x);
912
- const x3 = Fp2.mul(x2, x);
913
- return Fp2.add(Fp2.add(x3, Fp2.mul(x, a)), b);
914
- }
915
- if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
916
- throw new Error("bad generator point: equation left != right");
917
- function isWithinCurveOrder(num) {
918
- return inRange(num, _1n$1, CURVE.n);
919
- }
920
- function normPrivateKeyToScalar(key) {
921
- const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
922
- if (lengths && typeof key !== "bigint") {
923
- if (isBytes(key))
924
- key = bytesToHex(key);
925
- if (typeof key !== "string" || !lengths.includes(key.length))
926
- throw new Error("Invalid key");
927
- key = key.padStart(nByteLength * 2, "0");
928
- }
929
- let num;
930
- try {
931
- num = typeof key === "bigint" ? key : bytesToNumberBE(ensureBytes("private key", key, nByteLength));
932
- } catch (error) {
933
- throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);
934
- }
935
- if (wrapPrivateKey)
936
- num = mod(num, N);
937
- aInRange("private key", num, _1n$1, N);
938
- return num;
939
- }
940
- function assertPrjPoint(other) {
941
- if (!(other instanceof Point))
942
- throw new Error("ProjectivePoint expected");
943
- }
944
- const toAffineMemo = memoized((p, iz) => {
945
- const { px: x, py: y, pz: z } = p;
946
- if (Fp2.eql(z, Fp2.ONE))
947
- return { x, y };
948
- const is0 = p.is0();
949
- if (iz == null)
950
- iz = is0 ? Fp2.ONE : Fp2.inv(z);
951
- const ax = Fp2.mul(x, iz);
952
- const ay = Fp2.mul(y, iz);
953
- const zz = Fp2.mul(z, iz);
954
- if (is0)
955
- return { x: Fp2.ZERO, y: Fp2.ZERO };
956
- if (!Fp2.eql(zz, Fp2.ONE))
957
- throw new Error("invZ was invalid");
958
- return { x: ax, y: ay };
959
- });
960
- const assertValidMemo = memoized((p) => {
961
- if (p.is0()) {
962
- if (CURVE.allowInfinityPoint && !Fp2.is0(p.py))
963
- return;
964
- throw new Error("bad point: ZERO");
965
- }
966
- const { x, y } = p.toAffine();
967
- if (!Fp2.isValid(x) || !Fp2.isValid(y))
968
- throw new Error("bad point: x or y not FE");
969
- const left = Fp2.sqr(y);
970
- const right = weierstrassEquation(x);
971
- if (!Fp2.eql(left, right))
972
- throw new Error("bad point: equation left != right");
973
- if (!p.isTorsionFree())
974
- throw new Error("bad point: not in prime-order subgroup");
975
- return true;
976
- });
977
- class Point {
978
- constructor(px, py, pz) {
979
- this.px = px;
980
- this.py = py;
981
- this.pz = pz;
982
- if (px == null || !Fp2.isValid(px))
983
- throw new Error("x required");
984
- if (py == null || !Fp2.isValid(py))
985
- throw new Error("y required");
986
- if (pz == null || !Fp2.isValid(pz))
987
- throw new Error("z required");
988
- Object.freeze(this);
989
- }
990
- // Does not validate if the point is on-curve.
991
- // Use fromHex instead, or call assertValidity() later.
992
- static fromAffine(p) {
993
- const { x, y } = p || {};
994
- if (!p || !Fp2.isValid(x) || !Fp2.isValid(y))
995
- throw new Error("invalid affine point");
996
- if (p instanceof Point)
997
- throw new Error("projective point not allowed");
998
- const is0 = (i) => Fp2.eql(i, Fp2.ZERO);
999
- if (is0(x) && is0(y))
1000
- return Point.ZERO;
1001
- return new Point(x, y, Fp2.ONE);
1002
- }
1003
- get x() {
1004
- return this.toAffine().x;
1005
- }
1006
- get y() {
1007
- return this.toAffine().y;
1008
- }
1009
- /**
1010
- * Takes a bunch of Projective Points but executes only one
1011
- * inversion on all of them. Inversion is very slow operation,
1012
- * so this improves performance massively.
1013
- * Optimization: converts a list of projective points to a list of identical points with Z=1.
1014
- */
1015
- static normalizeZ(points) {
1016
- const toInv = Fp2.invertBatch(points.map((p) => p.pz));
1017
- return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine);
1018
- }
1019
- /**
1020
- * Converts hash string or Uint8Array to Point.
1021
- * @param hex short/long ECDSA hex
1022
- */
1023
- static fromHex(hex) {
1024
- const P = Point.fromAffine(fromBytes(ensureBytes("pointHex", hex)));
1025
- P.assertValidity();
1026
- return P;
1027
- }
1028
- // Multiplies generator point by privateKey.
1029
- static fromPrivateKey(privateKey) {
1030
- return Point.BASE.multiply(normPrivateKeyToScalar(privateKey));
1031
- }
1032
- // Multiscalar Multiplication
1033
- static msm(points, scalars) {
1034
- return pippenger(Point, Fn, points, scalars);
1035
- }
1036
- // "Private method", don't use it directly
1037
- _setWindowSize(windowSize) {
1038
- wnaf.setWindowSize(this, windowSize);
1039
- }
1040
- // A point on curve is valid if it conforms to equation.
1041
- assertValidity() {
1042
- assertValidMemo(this);
1043
- }
1044
- hasEvenY() {
1045
- const { y } = this.toAffine();
1046
- if (Fp2.isOdd)
1047
- return !Fp2.isOdd(y);
1048
- throw new Error("Field doesn't support isOdd");
1049
- }
1050
- /**
1051
- * Compare one point to another.
1052
- */
1053
- equals(other) {
1054
- assertPrjPoint(other);
1055
- const { px: X1, py: Y1, pz: Z1 } = this;
1056
- const { px: X2, py: Y2, pz: Z2 } = other;
1057
- const U1 = Fp2.eql(Fp2.mul(X1, Z2), Fp2.mul(X2, Z1));
1058
- const U2 = Fp2.eql(Fp2.mul(Y1, Z2), Fp2.mul(Y2, Z1));
1059
- return U1 && U2;
1060
- }
1061
- /**
1062
- * Flips point to one corresponding to (x, -y) in Affine coordinates.
1063
- */
1064
- negate() {
1065
- return new Point(this.px, Fp2.neg(this.py), this.pz);
1066
- }
1067
- // Renes-Costello-Batina exception-free doubling formula.
1068
- // There is 30% faster Jacobian formula, but it is not complete.
1069
- // https://eprint.iacr.org/2015/1060, algorithm 3
1070
- // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
1071
- double() {
1072
- const { a, b } = CURVE;
1073
- const b3 = Fp2.mul(b, _3n);
1074
- const { px: X1, py: Y1, pz: Z1 } = this;
1075
- let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO;
1076
- let t0 = Fp2.mul(X1, X1);
1077
- let t1 = Fp2.mul(Y1, Y1);
1078
- let t2 = Fp2.mul(Z1, Z1);
1079
- let t3 = Fp2.mul(X1, Y1);
1080
- t3 = Fp2.add(t3, t3);
1081
- Z3 = Fp2.mul(X1, Z1);
1082
- Z3 = Fp2.add(Z3, Z3);
1083
- X3 = Fp2.mul(a, Z3);
1084
- Y3 = Fp2.mul(b3, t2);
1085
- Y3 = Fp2.add(X3, Y3);
1086
- X3 = Fp2.sub(t1, Y3);
1087
- Y3 = Fp2.add(t1, Y3);
1088
- Y3 = Fp2.mul(X3, Y3);
1089
- X3 = Fp2.mul(t3, X3);
1090
- Z3 = Fp2.mul(b3, Z3);
1091
- t2 = Fp2.mul(a, t2);
1092
- t3 = Fp2.sub(t0, t2);
1093
- t3 = Fp2.mul(a, t3);
1094
- t3 = Fp2.add(t3, Z3);
1095
- Z3 = Fp2.add(t0, t0);
1096
- t0 = Fp2.add(Z3, t0);
1097
- t0 = Fp2.add(t0, t2);
1098
- t0 = Fp2.mul(t0, t3);
1099
- Y3 = Fp2.add(Y3, t0);
1100
- t2 = Fp2.mul(Y1, Z1);
1101
- t2 = Fp2.add(t2, t2);
1102
- t0 = Fp2.mul(t2, t3);
1103
- X3 = Fp2.sub(X3, t0);
1104
- Z3 = Fp2.mul(t2, t1);
1105
- Z3 = Fp2.add(Z3, Z3);
1106
- Z3 = Fp2.add(Z3, Z3);
1107
- return new Point(X3, Y3, Z3);
1108
- }
1109
- // Renes-Costello-Batina exception-free addition formula.
1110
- // There is 30% faster Jacobian formula, but it is not complete.
1111
- // https://eprint.iacr.org/2015/1060, algorithm 1
1112
- // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
1113
- add(other) {
1114
- assertPrjPoint(other);
1115
- const { px: X1, py: Y1, pz: Z1 } = this;
1116
- const { px: X2, py: Y2, pz: Z2 } = other;
1117
- let X3 = Fp2.ZERO, Y3 = Fp2.ZERO, Z3 = Fp2.ZERO;
1118
- const a = CURVE.a;
1119
- const b3 = Fp2.mul(CURVE.b, _3n);
1120
- let t0 = Fp2.mul(X1, X2);
1121
- let t1 = Fp2.mul(Y1, Y2);
1122
- let t2 = Fp2.mul(Z1, Z2);
1123
- let t3 = Fp2.add(X1, Y1);
1124
- let t4 = Fp2.add(X2, Y2);
1125
- t3 = Fp2.mul(t3, t4);
1126
- t4 = Fp2.add(t0, t1);
1127
- t3 = Fp2.sub(t3, t4);
1128
- t4 = Fp2.add(X1, Z1);
1129
- let t5 = Fp2.add(X2, Z2);
1130
- t4 = Fp2.mul(t4, t5);
1131
- t5 = Fp2.add(t0, t2);
1132
- t4 = Fp2.sub(t4, t5);
1133
- t5 = Fp2.add(Y1, Z1);
1134
- X3 = Fp2.add(Y2, Z2);
1135
- t5 = Fp2.mul(t5, X3);
1136
- X3 = Fp2.add(t1, t2);
1137
- t5 = Fp2.sub(t5, X3);
1138
- Z3 = Fp2.mul(a, t4);
1139
- X3 = Fp2.mul(b3, t2);
1140
- Z3 = Fp2.add(X3, Z3);
1141
- X3 = Fp2.sub(t1, Z3);
1142
- Z3 = Fp2.add(t1, Z3);
1143
- Y3 = Fp2.mul(X3, Z3);
1144
- t1 = Fp2.add(t0, t0);
1145
- t1 = Fp2.add(t1, t0);
1146
- t2 = Fp2.mul(a, t2);
1147
- t4 = Fp2.mul(b3, t4);
1148
- t1 = Fp2.add(t1, t2);
1149
- t2 = Fp2.sub(t0, t2);
1150
- t2 = Fp2.mul(a, t2);
1151
- t4 = Fp2.add(t4, t2);
1152
- t0 = Fp2.mul(t1, t4);
1153
- Y3 = Fp2.add(Y3, t0);
1154
- t0 = Fp2.mul(t5, t4);
1155
- X3 = Fp2.mul(t3, X3);
1156
- X3 = Fp2.sub(X3, t0);
1157
- t0 = Fp2.mul(t3, t1);
1158
- Z3 = Fp2.mul(t5, Z3);
1159
- Z3 = Fp2.add(Z3, t0);
1160
- return new Point(X3, Y3, Z3);
1161
- }
1162
- subtract(other) {
1163
- return this.add(other.negate());
1164
- }
1165
- is0() {
1166
- return this.equals(Point.ZERO);
1167
- }
1168
- wNAF(n) {
1169
- return wnaf.wNAFCached(this, n, Point.normalizeZ);
1170
- }
1171
- /**
1172
- * Non-constant-time multiplication. Uses double-and-add algorithm.
1173
- * It's faster, but should only be used when you don't care about
1174
- * an exposed private key e.g. sig verification, which works over *public* keys.
1175
- */
1176
- multiplyUnsafe(sc) {
1177
- aInRange("scalar", sc, _0n, CURVE.n);
1178
- const I = Point.ZERO;
1179
- if (sc === _0n)
1180
- return I;
1181
- if (sc === _1n$1)
1182
- return this;
1183
- const { endo } = CURVE;
1184
- if (!endo)
1185
- return wnaf.unsafeLadder(this, sc);
1186
- let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);
1187
- let k1p = I;
1188
- let k2p = I;
1189
- let d = this;
1190
- while (k1 > _0n || k2 > _0n) {
1191
- if (k1 & _1n$1)
1192
- k1p = k1p.add(d);
1193
- if (k2 & _1n$1)
1194
- k2p = k2p.add(d);
1195
- d = d.double();
1196
- k1 >>= _1n$1;
1197
- k2 >>= _1n$1;
1198
- }
1199
- if (k1neg)
1200
- k1p = k1p.negate();
1201
- if (k2neg)
1202
- k2p = k2p.negate();
1203
- k2p = new Point(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz);
1204
- return k1p.add(k2p);
1205
- }
1206
- /**
1207
- * Constant time multiplication.
1208
- * Uses wNAF method. Windowed method may be 10% faster,
1209
- * but takes 2x longer to generate and consumes 2x memory.
1210
- * Uses precomputes when available.
1211
- * Uses endomorphism for Koblitz curves.
1212
- * @param scalar by which the point would be multiplied
1213
- * @returns New point
1214
- */
1215
- multiply(scalar) {
1216
- const { endo, n: N } = CURVE;
1217
- aInRange("scalar", scalar, _1n$1, N);
1218
- let point, fake;
1219
- if (endo) {
1220
- const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
1221
- let { p: k1p, f: f1p } = this.wNAF(k1);
1222
- let { p: k2p, f: f2p } = this.wNAF(k2);
1223
- k1p = wnaf.constTimeNegate(k1neg, k1p);
1224
- k2p = wnaf.constTimeNegate(k2neg, k2p);
1225
- k2p = new Point(Fp2.mul(k2p.px, endo.beta), k2p.py, k2p.pz);
1226
- point = k1p.add(k2p);
1227
- fake = f1p.add(f2p);
1228
- } else {
1229
- const { p, f } = this.wNAF(scalar);
1230
- point = p;
1231
- fake = f;
1232
- }
1233
- return Point.normalizeZ([point, fake])[0];
1234
- }
1235
- /**
1236
- * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
1237
- * Not using Strauss-Shamir trick: precomputation tables are faster.
1238
- * The trick could be useful if both P and Q are not G (not in our case).
1239
- * @returns non-zero affine point
1240
- */
1241
- multiplyAndAddUnsafe(Q, a, b) {
1242
- const G = Point.BASE;
1243
- const mul = (P, a2) => a2 === _0n || a2 === _1n$1 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
1244
- const sum = mul(this, a).add(mul(Q, b));
1245
- return sum.is0() ? void 0 : sum;
1246
- }
1247
- // Converts Projective point to affine (x, y) coordinates.
1248
- // Can accept precomputed Z^-1 - for example, from invertBatch.
1249
- // (x, y, z) ∋ (x=x/z, y=y/z)
1250
- toAffine(iz) {
1251
- return toAffineMemo(this, iz);
1252
- }
1253
- isTorsionFree() {
1254
- const { h: cofactor, isTorsionFree } = CURVE;
1255
- if (cofactor === _1n$1)
1256
- return true;
1257
- if (isTorsionFree)
1258
- return isTorsionFree(Point, this);
1259
- throw new Error("isTorsionFree() has not been declared for the elliptic curve");
1260
- }
1261
- clearCofactor() {
1262
- const { h: cofactor, clearCofactor } = CURVE;
1263
- if (cofactor === _1n$1)
1264
- return this;
1265
- if (clearCofactor)
1266
- return clearCofactor(Point, this);
1267
- return this.multiplyUnsafe(CURVE.h);
1268
- }
1269
- toRawBytes(isCompressed = true) {
1270
- abool("isCompressed", isCompressed);
1271
- this.assertValidity();
1272
- return toBytes2(Point, this, isCompressed);
1273
- }
1274
- toHex(isCompressed = true) {
1275
- abool("isCompressed", isCompressed);
1276
- return bytesToHex(this.toRawBytes(isCompressed));
1277
- }
1278
- }
1279
- Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp2.ONE);
1280
- Point.ZERO = new Point(Fp2.ZERO, Fp2.ONE, Fp2.ZERO);
1281
- const _bits = CURVE.nBitLength;
1282
- const wnaf = wNAF(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits);
1283
- return {
1284
- CURVE,
1285
- ProjectivePoint: Point,
1286
- normPrivateKeyToScalar,
1287
- weierstrassEquation,
1288
- isWithinCurveOrder
1289
- };
1290
- }
1291
- function validateOpts(curve) {
1292
- const opts = validateBasic(curve);
1293
- validateObject(opts, {
1294
- hash: "hash",
1295
- hmac: "function",
1296
- randomBytes: "function"
1297
- }, {
1298
- bits2int: "function",
1299
- bits2int_modN: "function",
1300
- lowS: "boolean"
1301
- });
1302
- return Object.freeze({ lowS: true, ...opts });
1303
- }
1304
- function weierstrass(curveDef) {
1305
- const CURVE = validateOpts(curveDef);
1306
- const { Fp: Fp2, n: CURVE_ORDER } = CURVE;
1307
- const compressedLen = Fp2.BYTES + 1;
1308
- const uncompressedLen = 2 * Fp2.BYTES + 1;
1309
- function modN(a) {
1310
- return mod(a, CURVE_ORDER);
1311
- }
1312
- function invN(a) {
1313
- return invert(a, CURVE_ORDER);
1314
- }
1315
- const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder } = weierstrassPoints({
1316
- ...CURVE,
1317
- toBytes(_c, point, isCompressed) {
1318
- const a = point.toAffine();
1319
- const x = Fp2.toBytes(a.x);
1320
- const cat = concatBytes;
1321
- abool("isCompressed", isCompressed);
1322
- if (isCompressed) {
1323
- return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
1324
- } else {
1325
- return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
1326
- }
1327
- },
1328
- fromBytes(bytes2) {
1329
- const len = bytes2.length;
1330
- const head = bytes2[0];
1331
- const tail = bytes2.subarray(1);
1332
- if (len === compressedLen && (head === 2 || head === 3)) {
1333
- const x = bytesToNumberBE(tail);
1334
- if (!inRange(x, _1n$1, Fp2.ORDER))
1335
- throw new Error("Point is not on curve");
1336
- const y2 = weierstrassEquation(x);
1337
- let y;
1338
- try {
1339
- y = Fp2.sqrt(y2);
1340
- } catch (sqrtError) {
1341
- const suffix = sqrtError instanceof Error ? ": " + sqrtError.message : "";
1342
- throw new Error("Point is not on curve" + suffix);
1343
- }
1344
- const isYOdd = (y & _1n$1) === _1n$1;
1345
- const isHeadOdd = (head & 1) === 1;
1346
- if (isHeadOdd !== isYOdd)
1347
- y = Fp2.neg(y);
1348
- return { x, y };
1349
- } else if (len === uncompressedLen && head === 4) {
1350
- const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
1351
- const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
1352
- return { x, y };
1353
- } else {
1354
- throw new Error(`Point of length ${len} was invalid. Expected ${compressedLen} compressed bytes or ${uncompressedLen} uncompressed bytes`);
1355
- }
1356
- }
1357
- });
1358
- const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
1359
- function isBiggerThanHalfOrder(number) {
1360
- const HALF = CURVE_ORDER >> _1n$1;
1361
- return number > HALF;
1362
- }
1363
- function normalizeS(s) {
1364
- return isBiggerThanHalfOrder(s) ? modN(-s) : s;
1365
- }
1366
- const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to));
1367
- class Signature {
1368
- constructor(r, s, recovery) {
1369
- this.r = r;
1370
- this.s = s;
1371
- this.recovery = recovery;
1372
- this.assertValidity();
1373
- }
1374
- // pair (bytes of r, bytes of s)
1375
- static fromCompact(hex) {
1376
- const l = CURVE.nByteLength;
1377
- hex = ensureBytes("compactSignature", hex, l * 2);
1378
- return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
1379
- }
1380
- // DER encoded ECDSA signature
1381
- // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
1382
- static fromDER(hex) {
1383
- const { r, s } = DER.toSig(ensureBytes("DER", hex));
1384
- return new Signature(r, s);
1385
- }
1386
- assertValidity() {
1387
- aInRange("r", this.r, _1n$1, CURVE_ORDER);
1388
- aInRange("s", this.s, _1n$1, CURVE_ORDER);
1389
- }
1390
- addRecoveryBit(recovery) {
1391
- return new Signature(this.r, this.s, recovery);
1392
- }
1393
- recoverPublicKey(msgHash) {
1394
- const { r, s, recovery: rec } = this;
1395
- const h = bits2int_modN(ensureBytes("msgHash", msgHash));
1396
- if (rec == null || ![0, 1, 2, 3].includes(rec))
1397
- throw new Error("recovery id invalid");
1398
- const radj = rec === 2 || rec === 3 ? r + CURVE.n : r;
1399
- if (radj >= Fp2.ORDER)
1400
- throw new Error("recovery id 2 or 3 invalid");
1401
- const prefix = (rec & 1) === 0 ? "02" : "03";
1402
- const R = Point.fromHex(prefix + numToNByteStr(radj));
1403
- const ir = invN(radj);
1404
- const u1 = modN(-h * ir);
1405
- const u2 = modN(s * ir);
1406
- const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2);
1407
- if (!Q)
1408
- throw new Error("point at infinify");
1409
- Q.assertValidity();
1410
- return Q;
1411
- }
1412
- // Signatures should be low-s, to prevent malleability.
1413
- hasHighS() {
1414
- return isBiggerThanHalfOrder(this.s);
1415
- }
1416
- normalizeS() {
1417
- return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
1418
- }
1419
- // DER-encoded
1420
- toDERRawBytes() {
1421
- return hexToBytes(this.toDERHex());
1422
- }
1423
- toDERHex() {
1424
- return DER.hexFromSig({ r: this.r, s: this.s });
1425
- }
1426
- // padded bytes of r, then padded bytes of s
1427
- toCompactRawBytes() {
1428
- return hexToBytes(this.toCompactHex());
1429
- }
1430
- toCompactHex() {
1431
- return numToNByteStr(this.r) + numToNByteStr(this.s);
1432
- }
1433
- }
1434
- const utils = {
1435
- isValidPrivateKey(privateKey) {
1436
- try {
1437
- normPrivateKeyToScalar(privateKey);
1438
- return true;
1439
- } catch (error) {
1440
- return false;
1441
- }
1442
- },
1443
- normPrivateKeyToScalar,
1444
- /**
1445
- * Produces cryptographically secure private key from random of size
1446
- * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
1447
- */
1448
- randomPrivateKey: () => {
1449
- const length = getMinHashLength(CURVE.n);
1450
- return mapHashToField(CURVE.randomBytes(length), CURVE.n);
1451
- },
1452
- /**
1453
- * Creates precompute table for an arbitrary EC point. Makes point "cached".
1454
- * Allows to massively speed-up `point.multiply(scalar)`.
1455
- * @returns cached point
1456
- * @example
1457
- * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
1458
- * fast.multiply(privKey); // much faster ECDH now
1459
- */
1460
- precompute(windowSize = 8, point = Point.BASE) {
1461
- point._setWindowSize(windowSize);
1462
- point.multiply(BigInt(3));
1463
- return point;
1464
- }
1465
- };
1466
- function getPublicKey(privateKey, isCompressed = true) {
1467
- return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);
1468
- }
1469
- function isProbPub(item) {
1470
- const arr = isBytes(item);
1471
- const str = typeof item === "string";
1472
- const len = (arr || str) && item.length;
1473
- if (arr)
1474
- return len === compressedLen || len === uncompressedLen;
1475
- if (str)
1476
- return len === 2 * compressedLen || len === 2 * uncompressedLen;
1477
- if (item instanceof Point)
1478
- return true;
1479
- return false;
1480
- }
1481
- function getSharedSecret(privateA, publicB, isCompressed = true) {
1482
- if (isProbPub(privateA))
1483
- throw new Error("first arg must be private key");
1484
- if (!isProbPub(publicB))
1485
- throw new Error("second arg must be public key");
1486
- const b = Point.fromHex(publicB);
1487
- return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
1488
- }
1489
- const bits2int = CURVE.bits2int || function(bytes2) {
1490
- const num = bytesToNumberBE(bytes2);
1491
- const delta = bytes2.length * 8 - CURVE.nBitLength;
1492
- return delta > 0 ? num >> BigInt(delta) : num;
1493
- };
1494
- const bits2int_modN = CURVE.bits2int_modN || function(bytes2) {
1495
- return modN(bits2int(bytes2));
1496
- };
1497
- const ORDER_MASK = bitMask(CURVE.nBitLength);
1498
- function int2octets(num) {
1499
- aInRange(`num < 2^${CURVE.nBitLength}`, num, _0n, ORDER_MASK);
1500
- return numberToBytesBE(num, CURVE.nByteLength);
1501
- }
1502
- function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
1503
- if (["recovered", "canonical"].some((k) => k in opts))
1504
- throw new Error("sign() legacy options not supported");
1505
- const { hash: hash2, randomBytes: randomBytes2 } = CURVE;
1506
- let { lowS, prehash, extraEntropy: ent } = opts;
1507
- if (lowS == null)
1508
- lowS = true;
1509
- msgHash = ensureBytes("msgHash", msgHash);
1510
- validateSigVerOpts(opts);
1511
- if (prehash)
1512
- msgHash = ensureBytes("prehashed msgHash", hash2(msgHash));
1513
- const h1int = bits2int_modN(msgHash);
1514
- const d = normPrivateKeyToScalar(privateKey);
1515
- const seedArgs = [int2octets(d), int2octets(h1int)];
1516
- if (ent != null && ent !== false) {
1517
- const e = ent === true ? randomBytes2(Fp2.BYTES) : ent;
1518
- seedArgs.push(ensureBytes("extraEntropy", e));
1519
- }
1520
- const seed = concatBytes(...seedArgs);
1521
- const m = h1int;
1522
- function k2sig(kBytes) {
1523
- const k = bits2int(kBytes);
1524
- if (!isWithinCurveOrder(k))
1525
- return;
1526
- const ik = invN(k);
1527
- const q = Point.BASE.multiply(k).toAffine();
1528
- const r = modN(q.x);
1529
- if (r === _0n)
1530
- return;
1531
- const s = modN(ik * modN(m + r * d));
1532
- if (s === _0n)
1533
- return;
1534
- let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n$1);
1535
- let normS = s;
1536
- if (lowS && isBiggerThanHalfOrder(s)) {
1537
- normS = normalizeS(s);
1538
- recovery ^= 1;
1539
- }
1540
- return new Signature(r, normS, recovery);
1541
- }
1542
- return { seed, k2sig };
1543
- }
1544
- const defaultSigOpts = { lowS: CURVE.lowS, prehash: false };
1545
- const defaultVerOpts = { lowS: CURVE.lowS, prehash: false };
1546
- function sign(msgHash, privKey, opts = defaultSigOpts) {
1547
- const { seed, k2sig } = prepSig(msgHash, privKey, opts);
1548
- const C = CURVE;
1549
- const drbg = createHmacDrbg(C.hash.outputLen, C.nByteLength, C.hmac);
1550
- return drbg(seed, k2sig);
1551
- }
1552
- Point.BASE._setWindowSize(8);
1553
- function verify(signature, msgHash, publicKey, opts = defaultVerOpts) {
1554
- var _a;
1555
- const sg = signature;
1556
- msgHash = ensureBytes("msgHash", msgHash);
1557
- publicKey = ensureBytes("publicKey", publicKey);
1558
- if ("strict" in opts)
1559
- throw new Error("options.strict was renamed to lowS");
1560
- validateSigVerOpts(opts);
1561
- const { lowS, prehash } = opts;
1562
- let _sig = void 0;
1563
- let P;
1564
- try {
1565
- if (typeof sg === "string" || isBytes(sg)) {
1566
- try {
1567
- _sig = Signature.fromDER(sg);
1568
- } catch (derError) {
1569
- if (!(derError instanceof DER.Err))
1570
- throw derError;
1571
- _sig = Signature.fromCompact(sg);
1572
- }
1573
- } else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") {
1574
- const { r: r2, s: s2 } = sg;
1575
- _sig = new Signature(r2, s2);
1576
- } else {
1577
- throw new Error("PARSE");
1578
- }
1579
- P = Point.fromHex(publicKey);
1580
- } catch (error) {
1581
- if (error.message === "PARSE")
1582
- throw new Error(`signature must be Signature instance, Uint8Array or hex string`);
1583
- return false;
1584
- }
1585
- if (lowS && _sig.hasHighS())
1586
- return false;
1587
- if (prehash)
1588
- msgHash = CURVE.hash(msgHash);
1589
- const { r, s } = _sig;
1590
- const h = bits2int_modN(msgHash);
1591
- const is = invN(s);
1592
- const u1 = modN(h * is);
1593
- const u2 = modN(r * is);
1594
- const R = (_a = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)) == null ? void 0 : _a.toAffine();
1595
- if (!R)
1596
- return false;
1597
- const v = modN(R.x);
1598
- return v === r;
1599
- }
1600
- return {
1601
- CURVE,
1602
- getPublicKey,
1603
- getSharedSecret,
1604
- sign,
1605
- verify,
1606
- ProjectivePoint: Point,
1607
- Signature,
1608
- utils
1609
- };
1610
- }
1611
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1612
- function getHash(hash2) {
1613
- return {
1614
- hash: hash2,
1615
- hmac: (key, ...msgs) => hmac(hash2, key, concatBytes$1(...msgs)),
1616
- randomBytes
1617
- };
1618
- }
1619
- function createCurve(curveDef, defHash) {
1620
- const create = (hash2) => weierstrass({ ...curveDef, ...getHash(hash2) });
1621
- return Object.freeze({ ...create(defHash), create });
1622
- }
1623
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1624
- const secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
1625
- const secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
1626
- const _1n = BigInt(1);
1627
- const _2n = BigInt(2);
1628
- const divNearest = (a, b) => (a + b / _2n) / b;
1629
- function sqrtMod(y) {
1630
- const P = secp256k1P;
1631
- const _3n2 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
1632
- const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);
1633
- const b2 = y * y * y % P;
1634
- const b3 = b2 * b2 * y % P;
1635
- const b6 = pow2(b3, _3n2, P) * b3 % P;
1636
- const b9 = pow2(b6, _3n2, P) * b3 % P;
1637
- const b11 = pow2(b9, _2n, P) * b2 % P;
1638
- const b22 = pow2(b11, _11n, P) * b11 % P;
1639
- const b44 = pow2(b22, _22n, P) * b22 % P;
1640
- const b88 = pow2(b44, _44n, P) * b44 % P;
1641
- const b176 = pow2(b88, _88n, P) * b88 % P;
1642
- const b220 = pow2(b176, _44n, P) * b44 % P;
1643
- const b223 = pow2(b220, _3n2, P) * b3 % P;
1644
- const t1 = pow2(b223, _23n, P) * b22 % P;
1645
- const t2 = pow2(t1, _6n, P) * b2 % P;
1646
- const root = pow2(t2, _2n, P);
1647
- if (!Fp.eql(Fp.sqr(root), y))
1648
- throw new Error("Cannot find square root");
1649
- return root;
1650
- }
1651
- const Fp = Field(secp256k1P, void 0, void 0, { sqrt: sqrtMod });
1652
- const secp256k1 = createCurve({
1653
- a: BigInt(0),
1654
- // equation params: a, b
1655
- b: BigInt(7),
1656
- // Seem to be rigid: bitcointalk.org/index.php?topic=289795.msg3183975#msg3183975
1657
- Fp,
1658
- // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n
1659
- n: secp256k1N,
1660
- // Curve order, total count of valid points in the field
1661
- // Base point (x, y) aka generator point
1662
- Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
1663
- Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
1664
- h: BigInt(1),
1665
- // Cofactor
1666
- lowS: true,
1667
- // Allow only low-S signatures by default in sign() and verify()
1668
- /**
1669
- * secp256k1 belongs to Koblitz curves: it has efficiently computable endomorphism.
1670
- * Endomorphism uses 2x less RAM, speeds up precomputation by 2x and ECDH / key recovery by 20%.
1671
- * For precomputed wNAF it trades off 1/2 init time & 1/3 ram for 20% perf hit.
1672
- * Explanation: https://gist.github.com/paulmillr/eb670806793e84df628a7c434a873066
1673
- */
1674
- endo: {
1675
- beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
1676
- splitScalar: (k) => {
1677
- const n = secp256k1N;
1678
- const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
1679
- const b1 = -_1n * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
1680
- const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
1681
- const b2 = a1;
1682
- const POW_2_128 = BigInt("0x100000000000000000000000000000000");
1683
- const c1 = divNearest(b2 * k, n);
1684
- const c2 = divNearest(-b1 * k, n);
1685
- let k1 = mod(k - c1 * a1 - c2 * a2, n);
1686
- let k2 = mod(-c1 * b1 - c2 * b2, n);
1687
- const k1neg = k1 > POW_2_128;
1688
- const k2neg = k2 > POW_2_128;
1689
- if (k1neg)
1690
- k1 = n - k1;
1691
- if (k2neg)
1692
- k2 = n - k2;
1693
- if (k1 > POW_2_128 || k2 > POW_2_128) {
1694
- throw new Error("splitScalar: Endomorphism failed, k=" + k);
1695
- }
1696
- return { k1neg, k1, k2neg, k2 };
1697
- }
1698
- }
1699
- }, sha256);
1700
- BigInt(0);
1701
- secp256k1.ProjectivePoint;
1702
- export {
1703
- secp256k1
1704
- };
1705
- //# sourceMappingURL=secp256k1-BSI-MLM-.js.map