@directcryptopay/sdk 0.2.1 → 0.2.3

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 (228) hide show
  1. package/dist/ExchangeController-CPMQq6Q-.js +217 -0
  2. package/dist/HelpersUtil-DfMFC7Bf.js +120 -0
  3. package/dist/NavigationUtil-kj9LEOOd.js +8 -0
  4. package/dist/PhArrowCircleDown-lsK25DCk.js +73 -0
  5. package/dist/PhArrowClockwise-NeKHZ1co.js +73 -0
  6. package/dist/PhArrowDown-C9AkNvLs.js +73 -0
  7. package/dist/PhArrowLeft-RNfIQP1X.js +73 -0
  8. package/dist/PhArrowRight-DM1tna0G.js +73 -0
  9. package/dist/PhArrowSquareOut-S5XYbAZj.js +73 -0
  10. package/dist/PhArrowUp-DmktzOWy.js +73 -0
  11. package/dist/PhArrowUpRight-BkNeW_5i.js +73 -0
  12. package/dist/PhArrowsClockwise-CQ4pG76b.js +73 -0
  13. package/dist/PhArrowsDownUp-H6gxaNM6.js +73 -0
  14. package/dist/PhArrowsLeftRight-DZSsfMR6.js +73 -0
  15. package/dist/PhBank-4_9QzqIB.js +73 -0
  16. package/dist/PhBrowser-B-JSznId.js +73 -0
  17. package/dist/PhCaretDown-vV5oHMNi.js +73 -0
  18. package/dist/PhCaretLeft-BLo6Y_f4.js +73 -0
  19. package/dist/PhCaretRight-CqQN4TT3.js +73 -0
  20. package/dist/PhCaretUp-Df7UCAHy.js +73 -0
  21. package/dist/PhCheck-gtpfK4ed.js +73 -0
  22. package/dist/PhCircleHalf-Uq7dwDYw.js +73 -0
  23. package/dist/PhClock-SDCW-NmF.js +73 -0
  24. package/dist/PhCompass-B7hgtdx-.js +73 -0
  25. package/dist/PhCopy-BcnhyXCy.js +73 -0
  26. package/dist/PhCreditCard-BJjByVgu.js +73 -0
  27. package/dist/PhCurrencyDollar-B7ZXqXBy.js +73 -0
  28. package/dist/PhDesktop-B3VKPuJx.js +73 -0
  29. package/dist/PhDeviceMobile-Bnd0TYEH.js +73 -0
  30. package/dist/PhDotsThree-yyMWyZ-R.js +73 -0
  31. package/dist/PhEnvelope-67uzHbI9.js +73 -0
  32. package/dist/PhFunnelSimple-B-DCsloI.js +73 -0
  33. package/dist/PhGlobe-TMm_6qGk.js +73 -0
  34. package/dist/PhIdentificationCard-CePPD2xc.js +73 -0
  35. package/dist/PhImage-gY96WtHR.js +73 -0
  36. package/dist/PhInfo-DRQM_ZDP.js +73 -0
  37. package/dist/PhLightbulb-B0TxPfZ1.js +73 -0
  38. package/dist/PhMagnifyingGlass-B8si5_6W.js +73 -0
  39. package/dist/PhPaperPlaneRight-DVu5PLYd.js +73 -0
  40. package/dist/PhPlus-BfTsQnUz.js +73 -0
  41. package/dist/PhPower-CxYUGOWn.js +73 -0
  42. package/dist/PhPuzzlePiece-CQ4wh0gV.js +73 -0
  43. package/dist/PhQrCode-BuJ97NYJ.js +73 -0
  44. package/dist/PhQuestion-kJoP8Mja.js +73 -0
  45. package/dist/PhQuestionMark-C46ZkFpu.js +73 -0
  46. package/dist/PhSealCheck-Eh8jVqSN.js +73 -0
  47. package/dist/PhSignOut-jk97OSVt.js +73 -0
  48. package/dist/PhSpinner-CiYOhwMg.js +73 -0
  49. package/dist/PhTrash-pxerMqzd.js +73 -0
  50. package/dist/PhUser-BMg0VV4A.js +73 -0
  51. package/dist/PhVault-DYQvx5A-.js +73 -0
  52. package/dist/PhWarning-NLC5Mj87.js +73 -0
  53. package/dist/PhWarningCircle-Ch2jU9fA.js +73 -0
  54. package/dist/PhX-Bx4wpwm3.js +73 -0
  55. package/dist/SwapController-Cti0Cyxa.js +457 -0
  56. package/dist/{ccip-BIGqktC1.js → ccip-CKZd2XJ7.js} +4 -4
  57. package/dist/data-capture-7D5CL385.js +490 -0
  58. package/dist/dcp-sdk.umd.js +7400 -6589
  59. package/dist/email-AmK0INbZ.js +344 -0
  60. package/dist/embedded-wallet-Pn0I_XLn.js +820 -0
  61. package/dist/features-x8XNprEe.js +274 -0
  62. package/dist/{hashTypedData-ZH9ZnWu3.js → hashTypedData-B50-z0AA.js} +6 -6
  63. package/dist/if-defined-CdZSZ6UL.js +10 -0
  64. package/dist/index-4ewUtPPp.js +7981 -0
  65. package/dist/{index-D6h-qfpt.js → index-51l86yqx.js} +5 -5
  66. package/dist/index-B6K56LF_.js +85 -0
  67. package/dist/index-BAmv9PxJ.js +257 -0
  68. package/dist/index-BEswjY9r.js +117 -0
  69. package/dist/index-BSKRq56S.js +355 -0
  70. package/dist/index-BaygXQxx.js +172 -0
  71. package/dist/index-BcPxaHr5.js +118 -0
  72. package/dist/index-Bjt7nGaJ.js +199 -0
  73. package/dist/{index-D5r0iSq4.js → index-BkTSyAJb.js} +1 -1
  74. package/dist/index-Bmnl7l2U.js +555 -0
  75. package/dist/index-BvPvouSq.js +56 -0
  76. package/dist/index-C-6iznUO.js +174 -0
  77. package/dist/index-C4M5s_AM.js +228 -0
  78. package/dist/index-CEqcN8QP.js +1175 -0
  79. package/dist/{index-CPTcEPbD.js → index-CM3YaYca.js} +296 -298
  80. package/dist/{index-f3LXSfM5.js → index-CclBLA5r.js} +56 -142
  81. package/dist/index-ChTxJOiF.js +46 -0
  82. package/dist/index-CmAv0Tzr.js +86 -0
  83. package/dist/index-CmvoKY4x.js +125 -0
  84. package/dist/{index-BdSIrl-R.js → index-D7PmdQ9B.js} +578 -570
  85. package/dist/{index-DobBVPe4.js → index-D7k2Pc4e.js} +481 -236
  86. package/dist/index-D7lmgqUR.js +153 -0
  87. package/dist/index-DG_-qYze.js +107 -0
  88. package/dist/{index-Dy4NyE6l.js → index-DHot9Fdb.js} +7 -7
  89. package/dist/index-DV2LrPtU.js +123 -0
  90. package/dist/index-DYBaJQ2W.js +65 -0
  91. package/dist/{index-BJ7cbG3N.js → index-D_8VUmn1.js} +36688 -40208
  92. package/dist/index-D_gLn3rT.js +100 -0
  93. package/dist/index-DqcVUSC9.js +62 -0
  94. package/dist/index-I7VDqINw.js +128 -0
  95. package/dist/index-Oz72I9VP.js +209 -0
  96. package/dist/index-UclsHkJ0.js +118 -0
  97. package/dist/index-X8zir_1j.js +110 -0
  98. package/dist/index-XvlWKGCu.js +1281 -0
  99. package/dist/index-dO97xPlt.js +171 -0
  100. package/dist/{index-5mp7WkhV.js → index-uBeF6OAB.js} +2 -2
  101. package/dist/index-zeA_RiCV.js +159 -0
  102. package/dist/index.js +1 -1
  103. package/dist/{localBatchGatewayRequest-CjGcn5nM.js → localBatchGatewayRequest-BUZHGdjw.js} +1 -1
  104. package/dist/onramp-CdnBuF0r.js +855 -0
  105. package/dist/{parseSignature-S8VEpRHC.js → parseSignature-CcyTNGr4.js} +2312 -2313
  106. package/dist/pay-with-exchange-CSM6WCOV.js +525 -0
  107. package/dist/property-Bd8U3_QP.js +618 -0
  108. package/dist/receive-DooMu4Dx.js +232 -0
  109. package/dist/ref-CpgjXAw7.js +107 -0
  110. package/dist/send-3T7CyYic.js +1166 -0
  111. package/dist/socials-Dt-iHL17.js +620 -0
  112. package/dist/swaps-CjA9Es42.js +1760 -0
  113. package/dist/{transactions-DujFkB-M.js → transactions-nRm9DVzn.js} +10 -10
  114. package/dist/w3m-modal-NV25AXhM.js +1706 -0
  115. package/package.json +3 -3
  116. package/dist/ConstantsUtil-B-_-u8aQ.js +0 -6
  117. package/dist/add-sji6scSD.js +0 -19
  118. package/dist/all-wallets-B4H-890E.js +0 -10
  119. package/dist/app-store-Z433s97G.js +0 -21
  120. package/dist/apple-b8Lxj7nb.js +0 -22
  121. package/dist/arrow-bottom-M9oWWo_9.js +0 -12
  122. package/dist/arrow-bottom-circle-N9c4CXY1.js +0 -15
  123. package/dist/arrow-left-Dw8AKfwf.js +0 -12
  124. package/dist/arrow-right-DwLQZSC_.js +0 -12
  125. package/dist/arrow-top-zhUjkBe1.js +0 -12
  126. package/dist/bank-CbQdnILK.js +0 -18
  127. package/dist/browser-xAqNwt7z.js +0 -18
  128. package/dist/card-Dr1QBmWp.js +0 -18
  129. package/dist/checkmark-BhT1dTgG.js +0 -15
  130. package/dist/checkmark-bold-CPB29wqQ.js +0 -12
  131. package/dist/chevron-bottom-BhNyx2II.js +0 -12
  132. package/dist/chevron-left-CGuEjQlY.js +0 -12
  133. package/dist/chevron-right-CvIRRsqZ.js +0 -12
  134. package/dist/chevron-top-RSzCqjBd.js +0 -12
  135. package/dist/chrome-store-Cs8dAgs0.js +0 -65
  136. package/dist/clock-fhZO5otC.js +0 -12
  137. package/dist/close-BPuztrdR.js +0 -12
  138. package/dist/coinPlaceholder-C8X2i7Kh.js +0 -12
  139. package/dist/compass-WMc5huk0.js +0 -12
  140. package/dist/copy-DVAeT17y.js +0 -19
  141. package/dist/cursor-BJ4YLXfy.js +0 -7
  142. package/dist/cursor-transparent-DN2fLQN4.js +0 -16
  143. package/dist/desktop-6avxisBw.js +0 -13
  144. package/dist/disconnect-AReVI8Gk.js +0 -12
  145. package/dist/discord-CxrI30BZ.js +0 -21
  146. package/dist/email-B8dIIaay.js +0 -696
  147. package/dist/embedded-wallet-C_5hF7rM.js +0 -468
  148. package/dist/etherscan-BnAy8cIF.js +0 -10
  149. package/dist/exclamation-triangle-Bu7nHwx9.js +0 -8
  150. package/dist/extension-F0LIhvcf.js +0 -12
  151. package/dist/external-link-CP6phyaM.js +0 -12
  152. package/dist/facebook-BtQ-Io2y.js +0 -30
  153. package/dist/farcaster-BmaN1ugd.js +0 -16
  154. package/dist/filters-DpEwoOmy.js +0 -12
  155. package/dist/github-q7qO9V-b.js +0 -22
  156. package/dist/google-DH_ZE8bW.js +0 -22
  157. package/dist/help-circle-BAQVmKas.js +0 -16
  158. package/dist/id-Cj68Zwgo.js +0 -16
  159. package/dist/if-defined-CNte9B3N.js +0 -744
  160. package/dist/image-BKJDw6N-.js +0 -8
  161. package/dist/index-7toZMdtG.js +0 -573
  162. package/dist/index-B1uKzdvN.js +0 -170
  163. package/dist/index-BHFZVF-b.js +0 -257
  164. package/dist/index-BKwa5JSA.js +0 -559
  165. package/dist/index-BP4B9VUt.js +0 -54
  166. package/dist/index-BVdzXHpO.js +0 -181
  167. package/dist/index-BYND0GJ9.js +0 -146
  168. package/dist/index-BaJ0zEbh.js +0 -97
  169. package/dist/index-Bh0MPFwP.js +0 -58
  170. package/dist/index-Bsh7_qTp.js +0 -511
  171. package/dist/index-BwnXTNNg.js +0 -199
  172. package/dist/index-C0kPDbg_.js +0 -77
  173. package/dist/index-CKikVKe2.js +0 -75
  174. package/dist/index-ChVh0Hkp.js +0 -243
  175. package/dist/index-Cle_NnnS.js +0 -305
  176. package/dist/index-CmWdvIFT.js +0 -51
  177. package/dist/index-D2AMA8Bu.js +0 -65
  178. package/dist/index-DAUM8CO4.js +0 -65
  179. package/dist/index-DGjZW6uR.js +0 -78
  180. package/dist/index-DQe94z7X.js +0 -265
  181. package/dist/index-DTo6w99t.js +0 -7864
  182. package/dist/index-DYdXjap2.js +0 -320
  183. package/dist/index-DceCxNV5.js +0 -181
  184. package/dist/index-Uw9cSw0q.js +0 -294
  185. package/dist/index-qiuyrukh.js +0 -45
  186. package/dist/index-zddvaohA.js +0 -78
  187. package/dist/info-RfPsmroW.js +0 -7
  188. package/dist/info-circle-DFKHB_ZN.js +0 -16
  189. package/dist/lightbulb-B-Bykj9X.js +0 -7
  190. package/dist/mail-mBAgGuw5.js +0 -12
  191. package/dist/mobile-Dhh3ndkf.js +0 -13
  192. package/dist/more-D1h7UTvg.js +0 -15
  193. package/dist/network-placeholder-Dqynvc-t.js +0 -18
  194. package/dist/nftPlaceholder-Df7MW4MM.js +0 -12
  195. package/dist/off-BmG3cHTX.js +0 -12
  196. package/dist/onramp-C401Aenb.js +0 -1279
  197. package/dist/play-store-4q1fzL_P.js +0 -36
  198. package/dist/plus-603Gs3yG.js +0 -17
  199. package/dist/qr-code-Dgwhf6M1.js +0 -10
  200. package/dist/receive-CYXbbEUR.js +0 -186
  201. package/dist/recycle-horizontal-Bu8zZ563.js +0 -13
  202. package/dist/ref-DpmKRWBK.js +0 -41
  203. package/dist/refresh-BMZFu0mu.js +0 -12
  204. package/dist/reown-logo-BXph7ThY.js +0 -16
  205. package/dist/search-Cm_V42Y_.js +0 -12
  206. package/dist/secp256k1-C0iX1TUr.js +0 -1510
  207. package/dist/secp256k1-DOQBqE4Z.js +0 -1302
  208. package/dist/send-BSMYxDuP.js +0 -19
  209. package/dist/send-C8EeIzRB.js +0 -1038
  210. package/dist/socials-DQrHQajs.js +0 -574
  211. package/dist/swapHorizontal-98rnJewS.js +0 -12
  212. package/dist/swapHorizontalBold-C299FjEt.js +0 -12
  213. package/dist/swapHorizontalMedium-Cqm6i4WJ.js +0 -20
  214. package/dist/swapHorizontalRoundedBold-De7hFfqZ.js +0 -12
  215. package/dist/swapVertical-DSL75l8L.js +0 -12
  216. package/dist/swaps-BuTNp65Y.js +0 -1637
  217. package/dist/telegram-cJP7hgUb.js +0 -20
  218. package/dist/three-dots-DHnEh28O.js +0 -9
  219. package/dist/twitch-CR2iGcBo.js +0 -22
  220. package/dist/twitterIcon-E5TAQjOn.js +0 -10
  221. package/dist/verify-DEukUJp0.js +0 -12
  222. package/dist/verify-filled-BXsx1i_p.js +0 -12
  223. package/dist/w3m-modal-Bm7BqVng.js +0 -1037
  224. package/dist/wallet-CzyyvdrT.js +0 -12
  225. package/dist/wallet-placeholder-BrcmyGEe.js +0 -18
  226. package/dist/walletconnect-BSYogWiE.js +0 -36
  227. package/dist/warning-circle-Cgp2BW3m.js +0 -16
  228. package/dist/x-BJinLpTw.js +0 -16
@@ -1,1302 +0,0 @@
1
- import { dj as le, dk as de, dl as he, dm as we, dn as _t, dp as ge, dq as me, dr as pe, ds as ye, dt as be } from "./index-BJ7cbG3N.js";
2
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- const zt = /* @__PURE__ */ BigInt(0), Ot = /* @__PURE__ */ BigInt(1);
4
- function lt(e) {
5
- return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
6
- }
7
- function Zt(e) {
8
- if (!lt(e))
9
- throw new Error("Uint8Array expected");
10
- }
11
- function at(e, n) {
12
- if (typeof n != "boolean")
13
- throw new Error(e + " boolean expected, got " + n);
14
- }
15
- function ht(e) {
16
- const n = e.toString(16);
17
- return n.length & 1 ? "0" + n : n;
18
- }
19
- function Wt(e) {
20
- if (typeof e != "string")
21
- throw new Error("hex string expected, got " + typeof e);
22
- return e === "" ? zt : BigInt("0x" + e);
23
- }
24
- const Dt = (
25
- // @ts-ignore
26
- typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function"
27
- ), Ee = /* @__PURE__ */ Array.from({ length: 256 }, (e, n) => n.toString(16).padStart(2, "0"));
28
- function ut(e) {
29
- if (Zt(e), Dt)
30
- return e.toHex();
31
- let n = "";
32
- for (let t = 0; t < e.length; t++)
33
- n += Ee[e[t]];
34
- return n;
35
- }
36
- const D = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
37
- function kt(e) {
38
- if (e >= D._0 && e <= D._9)
39
- return e - D._0;
40
- if (e >= D.A && e <= D.F)
41
- return e - (D.A - 10);
42
- if (e >= D.a && e <= D.f)
43
- return e - (D.a - 10);
44
- }
45
- function wt(e) {
46
- if (typeof e != "string")
47
- throw new Error("hex string expected, got " + typeof e);
48
- if (Dt)
49
- return Uint8Array.fromHex(e);
50
- const n = e.length, t = n / 2;
51
- if (n % 2)
52
- throw new Error("hex string expected, got unpadded hex of length " + n);
53
- const r = new Uint8Array(t);
54
- for (let i = 0, s = 0; i < t; i++, s += 2) {
55
- const c = kt(e.charCodeAt(s)), u = kt(e.charCodeAt(s + 1));
56
- if (c === void 0 || u === void 0) {
57
- const o = e[s] + e[s + 1];
58
- throw new Error('hex string expected, got non-hex character "' + o + '" at index ' + s);
59
- }
60
- r[i] = c * 16 + u;
61
- }
62
- return r;
63
- }
64
- function et(e) {
65
- return Wt(ut(e));
66
- }
67
- function Gt(e) {
68
- return Zt(e), Wt(ut(Uint8Array.from(e).reverse()));
69
- }
70
- function dt(e, n) {
71
- return wt(e.toString(16).padStart(n * 2, "0"));
72
- }
73
- function Xt(e, n) {
74
- return dt(e, n).reverse();
75
- }
76
- function P(e, n, t) {
77
- let r;
78
- if (typeof n == "string")
79
- try {
80
- r = wt(n);
81
- } catch (s) {
82
- throw new Error(e + " must be hex string or Uint8Array, cause: " + s);
83
- }
84
- else if (lt(n))
85
- r = Uint8Array.from(n);
86
- else
87
- throw new Error(e + " must be hex string or Uint8Array");
88
- const i = r.length;
89
- if (typeof t == "number" && i !== t)
90
- throw new Error(e + " of length " + t + " expected, got " + i);
91
- return r;
92
- }
93
- function gt(...e) {
94
- let n = 0;
95
- for (let r = 0; r < e.length; r++) {
96
- const i = e[r];
97
- Zt(i), n += i.length;
98
- }
99
- const t = new Uint8Array(n);
100
- for (let r = 0, i = 0; r < e.length; r++) {
101
- const s = e[r];
102
- t.set(s, i), i += s.length;
103
- }
104
- return t;
105
- }
106
- const Et = (e) => typeof e == "bigint" && zt <= e;
107
- function Tt(e, n, t) {
108
- return Et(e) && Et(n) && Et(t) && n <= e && e < t;
109
- }
110
- function it(e, n, t, r) {
111
- if (!Tt(n, t, r))
112
- throw new Error("expected valid " + e + ": " + t + " <= n < " + r + ", got " + n);
113
- }
114
- function Be(e) {
115
- let n;
116
- for (n = 0; e > zt; e >>= Ot, n += 1)
117
- ;
118
- return n;
119
- }
120
- const mt = (e) => (Ot << BigInt(e)) - Ot, Bt = (e) => new Uint8Array(e), Ct = (e) => Uint8Array.from(e);
121
- function ve(e, n, t) {
122
- if (typeof e != "number" || e < 2)
123
- throw new Error("hashLen must be a number");
124
- if (typeof n != "number" || n < 2)
125
- throw new Error("qByteLen must be a number");
126
- if (typeof t != "function")
127
- throw new Error("hmacFn must be a function");
128
- let r = Bt(e), i = Bt(e), s = 0;
129
- const c = () => {
130
- r.fill(1), i.fill(0), s = 0;
131
- }, u = (...A) => t(i, r, ...A), o = (A = Bt(0)) => {
132
- i = u(Ct([0]), A), r = u(), A.length !== 0 && (i = u(Ct([1]), A), r = u());
133
- }, d = () => {
134
- if (s++ >= 1e3)
135
- throw new Error("drbg: tried 1000 values");
136
- let A = 0;
137
- const N = [];
138
- for (; A < n; ) {
139
- r = u();
140
- const R = r.slice();
141
- N.push(R), A += r.length;
142
- }
143
- return gt(...N);
144
- };
145
- return (A, N) => {
146
- c(), o(A);
147
- let R;
148
- for (; !(R = N(d())); )
149
- o();
150
- return c(), R;
151
- };
152
- }
153
- const xe = {
154
- bigint: (e) => typeof e == "bigint",
155
- function: (e) => typeof e == "function",
156
- boolean: (e) => typeof e == "boolean",
157
- string: (e) => typeof e == "string",
158
- stringOrUint8Array: (e) => typeof e == "string" || lt(e),
159
- isSafeInteger: (e) => Number.isSafeInteger(e),
160
- array: (e) => Array.isArray(e),
161
- field: (e, n) => n.Fp.isValid(e),
162
- hash: (e) => typeof e == "function" && Number.isSafeInteger(e.outputLen)
163
- };
164
- function pt(e, n, t = {}) {
165
- const r = (i, s, c) => {
166
- const u = xe[s];
167
- if (typeof u != "function")
168
- throw new Error("invalid validator function");
169
- const o = e[i];
170
- if (!(c && o === void 0) && !u(o, e))
171
- throw new Error("param " + String(i) + " is invalid. Expected " + s + ", got " + o);
172
- };
173
- for (const [i, s] of Object.entries(n))
174
- r(i, s, !1);
175
- for (const [i, s] of Object.entries(t))
176
- r(i, s, !0);
177
- return e;
178
- }
179
- function Vt(e) {
180
- const n = /* @__PURE__ */ new WeakMap();
181
- return (t, ...r) => {
182
- const i = n.get(t);
183
- if (i !== void 0)
184
- return i;
185
- const s = e(t, ...r);
186
- return n.set(t, s), s;
187
- };
188
- }
189
- class Ft extends le {
190
- constructor(n, t) {
191
- super(), this.finished = !1, this.destroyed = !1, de(n);
192
- const r = he(t);
193
- if (this.iHash = n.create(), typeof this.iHash.update != "function")
194
- throw new Error("Expected instance of class which extends utils.Hash");
195
- this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
196
- const i = this.blockLen, s = new Uint8Array(i);
197
- s.set(r.length > i ? n.create().update(r).digest() : r);
198
- for (let c = 0; c < s.length; c++)
199
- s[c] ^= 54;
200
- this.iHash.update(s), this.oHash = n.create();
201
- for (let c = 0; c < s.length; c++)
202
- s[c] ^= 106;
203
- this.oHash.update(s), we(s);
204
- }
205
- update(n) {
206
- return _t(this), this.iHash.update(n), this;
207
- }
208
- digestInto(n) {
209
- _t(this), ge(n, this.outputLen), this.finished = !0, this.iHash.digestInto(n), this.oHash.update(n), this.oHash.digestInto(n), this.destroy();
210
- }
211
- digest() {
212
- const n = new Uint8Array(this.oHash.outputLen);
213
- return this.digestInto(n), n;
214
- }
215
- _cloneInto(n) {
216
- n || (n = Object.create(Object.getPrototypeOf(this), {}));
217
- const { oHash: t, iHash: r, finished: i, destroyed: s, blockLen: c, outputLen: u } = this;
218
- return n = n, n.finished = i, n.destroyed = s, n.blockLen = c, n.outputLen = u, n.oHash = t._cloneInto(n.oHash), n.iHash = r._cloneInto(n.iHash), n;
219
- }
220
- clone() {
221
- return this._cloneInto();
222
- }
223
- destroy() {
224
- this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
225
- }
226
- }
227
- const Qt = (e, n, t) => new Ft(e, n).update(t).digest();
228
- Qt.create = (e, n) => new Ft(e, n);
229
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
230
- const M = BigInt(0), C = BigInt(1), tt = /* @__PURE__ */ BigInt(2), Se = /* @__PURE__ */ BigInt(3), Jt = /* @__PURE__ */ BigInt(4), te = /* @__PURE__ */ BigInt(5), ee = /* @__PURE__ */ BigInt(8);
231
- function j(e, n) {
232
- const t = e % n;
233
- return t >= M ? t : n + t;
234
- }
235
- function Y(e, n, t) {
236
- let r = e;
237
- for (; n-- > M; )
238
- r *= r, r %= t;
239
- return r;
240
- }
241
- function qt(e, n) {
242
- if (e === M)
243
- throw new Error("invert: expected non-zero number");
244
- if (n <= M)
245
- throw new Error("invert: expected positive modulus, got " + n);
246
- let t = j(e, n), r = n, i = M, s = C;
247
- for (; t !== M; ) {
248
- const u = r / t, o = r % t, d = i - s * u;
249
- r = t, t = o, i = s, s = d;
250
- }
251
- if (r !== C)
252
- throw new Error("invert: does not exist");
253
- return j(i, n);
254
- }
255
- function ne(e, n) {
256
- const t = (e.ORDER + C) / Jt, r = e.pow(n, t);
257
- if (!e.eql(e.sqr(r), n))
258
- throw new Error("Cannot find square root");
259
- return r;
260
- }
261
- function Ae(e, n) {
262
- const t = (e.ORDER - te) / ee, r = e.mul(n, tt), i = e.pow(r, t), s = e.mul(n, i), c = e.mul(e.mul(s, tt), i), u = e.mul(s, e.sub(c, e.ONE));
263
- if (!e.eql(e.sqr(u), n))
264
- throw new Error("Cannot find square root");
265
- return u;
266
- }
267
- function Ie(e) {
268
- if (e < BigInt(3))
269
- throw new Error("sqrt is not defined for small field");
270
- let n = e - C, t = 0;
271
- for (; n % tt === M; )
272
- n /= tt, t++;
273
- let r = tt;
274
- const i = Ut(e);
275
- for (; jt(i, r) === 1; )
276
- if (r++ > 1e3)
277
- throw new Error("Cannot find square root: probably non-prime P");
278
- if (t === 1)
279
- return ne;
280
- let s = i.pow(r, n);
281
- const c = (n + C) / tt;
282
- return function(o, d) {
283
- if (o.is0(d))
284
- return d;
285
- if (jt(o, d) !== 1)
286
- throw new Error("Cannot find square root");
287
- let m = t, A = o.mul(o.ONE, s), N = o.pow(d, n), R = o.pow(d, c);
288
- for (; !o.eql(N, o.ONE); ) {
289
- if (o.is0(N))
290
- return o.ZERO;
291
- let z = 1, g = o.sqr(N);
292
- for (; !o.eql(g, o.ONE); )
293
- if (z++, g = o.sqr(g), z === m)
294
- throw new Error("Cannot find square root");
295
- const _ = C << BigInt(m - z - 1), Z = o.pow(A, _);
296
- m = z, A = o.sqr(Z), N = o.mul(N, A), R = o.mul(R, Z);
297
- }
298
- return R;
299
- };
300
- }
301
- function Ne(e) {
302
- return e % Jt === Se ? ne : e % ee === te ? Ae : Ie(e);
303
- }
304
- const Oe = [
305
- "create",
306
- "isValid",
307
- "is0",
308
- "neg",
309
- "inv",
310
- "sqrt",
311
- "sqr",
312
- "eql",
313
- "add",
314
- "sub",
315
- "mul",
316
- "pow",
317
- "div",
318
- "addN",
319
- "subN",
320
- "mulN",
321
- "sqrN"
322
- ];
323
- function qe(e) {
324
- const n = {
325
- ORDER: "bigint",
326
- MASK: "bigint",
327
- BYTES: "isSafeInteger",
328
- BITS: "isSafeInteger"
329
- }, t = Oe.reduce((r, i) => (r[i] = "function", r), n);
330
- return pt(e, t);
331
- }
332
- function He(e, n, t) {
333
- if (t < M)
334
- throw new Error("invalid exponent, negatives unsupported");
335
- if (t === M)
336
- return e.ONE;
337
- if (t === C)
338
- return n;
339
- let r = e.ONE, i = n;
340
- for (; t > M; )
341
- t & C && (r = e.mul(r, i)), i = e.sqr(i), t >>= C;
342
- return r;
343
- }
344
- function re(e, n, t = !1) {
345
- const r = new Array(n.length).fill(t ? e.ZERO : void 0), i = n.reduce((c, u, o) => e.is0(u) ? c : (r[o] = c, e.mul(c, u)), e.ONE), s = e.inv(i);
346
- return n.reduceRight((c, u, o) => e.is0(u) ? c : (r[o] = e.mul(c, r[o]), e.mul(c, u)), s), r;
347
- }
348
- function jt(e, n) {
349
- const t = (e.ORDER - C) / tt, r = e.pow(n, t), i = e.eql(r, e.ONE), s = e.eql(r, e.ZERO), c = e.eql(r, e.neg(e.ONE));
350
- if (!i && !s && !c)
351
- throw new Error("invalid Legendre symbol result");
352
- return i ? 1 : s ? 0 : -1;
353
- }
354
- function oe(e, n) {
355
- n !== void 0 && me(n);
356
- const t = n !== void 0 ? n : e.toString(2).length, r = Math.ceil(t / 8);
357
- return { nBitLength: t, nByteLength: r };
358
- }
359
- function Ut(e, n, t = !1, r = {}) {
360
- if (e <= M)
361
- throw new Error("invalid field: expected ORDER > 0, got " + e);
362
- const { nBitLength: i, nByteLength: s } = oe(e, n);
363
- if (s > 2048)
364
- throw new Error("invalid field: expected ORDER of <= 2048 bytes");
365
- let c;
366
- const u = Object.freeze({
367
- ORDER: e,
368
- isLE: t,
369
- BITS: i,
370
- BYTES: s,
371
- MASK: mt(i),
372
- ZERO: M,
373
- ONE: C,
374
- create: (o) => j(o, e),
375
- isValid: (o) => {
376
- if (typeof o != "bigint")
377
- throw new Error("invalid field element: expected bigint, got " + typeof o);
378
- return M <= o && o < e;
379
- },
380
- is0: (o) => o === M,
381
- isOdd: (o) => (o & C) === C,
382
- neg: (o) => j(-o, e),
383
- eql: (o, d) => o === d,
384
- sqr: (o) => j(o * o, e),
385
- add: (o, d) => j(o + d, e),
386
- sub: (o, d) => j(o - d, e),
387
- mul: (o, d) => j(o * d, e),
388
- pow: (o, d) => He(u, o, d),
389
- div: (o, d) => j(o * qt(d, e), e),
390
- // Same as above, but doesn't normalize
391
- sqrN: (o) => o * o,
392
- addN: (o, d) => o + d,
393
- subN: (o, d) => o - d,
394
- mulN: (o, d) => o * d,
395
- inv: (o) => qt(o, e),
396
- sqrt: r.sqrt || ((o) => (c || (c = Ne(e)), c(u, o))),
397
- toBytes: (o) => t ? Xt(o, s) : dt(o, s),
398
- fromBytes: (o) => {
399
- if (o.length !== s)
400
- throw new Error("Field.fromBytes: expected " + s + " bytes, got " + o.length);
401
- return t ? Gt(o) : et(o);
402
- },
403
- // TODO: we don't need it here, move out to separate fn
404
- invertBatch: (o) => re(u, o),
405
- // We can't move this out because Fp6, Fp12 implement it
406
- // and it's unclear what to return in there.
407
- cmov: (o, d, m) => m ? d : o
408
- });
409
- return Object.freeze(u);
410
- }
411
- function ie(e) {
412
- if (typeof e != "bigint")
413
- throw new Error("field order must be bigint");
414
- const n = e.toString(2).length;
415
- return Math.ceil(n / 8);
416
- }
417
- function se(e) {
418
- const n = ie(e);
419
- return n + Math.ceil(n / 2);
420
- }
421
- function Le(e, n, t = !1) {
422
- const r = e.length, i = ie(n), s = se(n);
423
- if (r < 16 || r < s || r > 1024)
424
- throw new Error("expected " + s + "-1024 bytes of input, got " + r);
425
- const c = t ? Gt(e) : et(e), u = j(c, n - C) + C;
426
- return t ? Xt(u, i) : dt(u, i);
427
- }
428
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
429
- const Mt = BigInt(0), Ht = BigInt(1);
430
- function vt(e, n) {
431
- const t = n.negate();
432
- return e ? t : n;
433
- }
434
- function ce(e, n) {
435
- if (!Number.isSafeInteger(e) || e <= 0 || e > n)
436
- throw new Error("invalid window size, expected [1.." + n + "], got W=" + e);
437
- }
438
- function xt(e, n) {
439
- ce(e, n);
440
- const t = Math.ceil(n / e) + 1, r = 2 ** (e - 1), i = 2 ** e, s = mt(e), c = BigInt(e);
441
- return { windows: t, windowSize: r, mask: s, maxNumber: i, shiftBy: c };
442
- }
443
- function Yt(e, n, t) {
444
- const { windowSize: r, mask: i, maxNumber: s, shiftBy: c } = t;
445
- let u = Number(e & i), o = e >> c;
446
- u > r && (u -= s, o += Ht);
447
- const d = n * r, m = d + Math.abs(u) - 1, A = u === 0, N = u < 0, R = n % 2 !== 0;
448
- return { nextN: o, offset: m, isZero: A, isNeg: N, isNegF: R, offsetF: d };
449
- }
450
- function Re(e, n) {
451
- if (!Array.isArray(e))
452
- throw new Error("array expected");
453
- e.forEach((t, r) => {
454
- if (!(t instanceof n))
455
- throw new Error("invalid point at index " + r);
456
- });
457
- }
458
- function ze(e, n) {
459
- if (!Array.isArray(e))
460
- throw new Error("array of scalars expected");
461
- e.forEach((t, r) => {
462
- if (!n.isValid(t))
463
- throw new Error("invalid scalar at index " + r);
464
- });
465
- }
466
- const St = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakMap();
467
- function At(e) {
468
- return fe.get(e) || 1;
469
- }
470
- function Ze(e, n) {
471
- return {
472
- constTimeNegate: vt,
473
- hasPrecomputes(t) {
474
- return At(t) !== 1;
475
- },
476
- // non-const time multiplication ladder
477
- unsafeLadder(t, r, i = e.ZERO) {
478
- let s = t;
479
- for (; r > Mt; )
480
- r & Ht && (i = i.add(s)), s = s.double(), r >>= Ht;
481
- return i;
482
- },
483
- /**
484
- * Creates a wNAF precomputation window. Used for caching.
485
- * Default window size is set by `utils.precompute()` and is equal to 8.
486
- * Number of precomputed points depends on the curve size:
487
- * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
488
- * - 𝑊 is the window size
489
- * - 𝑛 is the bitlength of the curve order.
490
- * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
491
- * @param elm Point instance
492
- * @param W window size
493
- * @returns precomputed point tables flattened to a single array
494
- */
495
- precomputeWindow(t, r) {
496
- const { windows: i, windowSize: s } = xt(r, n), c = [];
497
- let u = t, o = u;
498
- for (let d = 0; d < i; d++) {
499
- o = u, c.push(o);
500
- for (let m = 1; m < s; m++)
501
- o = o.add(u), c.push(o);
502
- u = o.double();
503
- }
504
- return c;
505
- },
506
- /**
507
- * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
508
- * @param W window size
509
- * @param precomputes precomputed tables
510
- * @param n scalar (we don't check here, but should be less than curve order)
511
- * @returns real and fake (for const-time) points
512
- */
513
- wNAF(t, r, i) {
514
- let s = e.ZERO, c = e.BASE;
515
- const u = xt(t, n);
516
- for (let o = 0; o < u.windows; o++) {
517
- const { nextN: d, offset: m, isZero: A, isNeg: N, isNegF: R, offsetF: z } = Yt(i, o, u);
518
- i = d, A ? c = c.add(vt(R, r[z])) : s = s.add(vt(N, r[m]));
519
- }
520
- return { p: s, f: c };
521
- },
522
- /**
523
- * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
524
- * @param W window size
525
- * @param precomputes precomputed tables
526
- * @param n scalar (we don't check here, but should be less than curve order)
527
- * @param acc accumulator point to add result of multiplication
528
- * @returns point
529
- */
530
- wNAFUnsafe(t, r, i, s = e.ZERO) {
531
- const c = xt(t, n);
532
- for (let u = 0; u < c.windows && i !== Mt; u++) {
533
- const { nextN: o, offset: d, isZero: m, isNeg: A } = Yt(i, u, c);
534
- if (i = o, !m) {
535
- const N = r[d];
536
- s = s.add(A ? N.negate() : N);
537
- }
538
- }
539
- return s;
540
- },
541
- getPrecomputes(t, r, i) {
542
- let s = St.get(r);
543
- return s || (s = this.precomputeWindow(r, t), t !== 1 && St.set(r, i(s))), s;
544
- },
545
- wNAFCached(t, r, i) {
546
- const s = At(t);
547
- return this.wNAF(s, this.getPrecomputes(s, t, i), r);
548
- },
549
- wNAFCachedUnsafe(t, r, i, s) {
550
- const c = At(t);
551
- return c === 1 ? this.unsafeLadder(t, r, s) : this.wNAFUnsafe(c, this.getPrecomputes(c, t, i), r, s);
552
- },
553
- // We calculate precomputes for elliptic curve point multiplication
554
- // using windowed method. This specifies window size and
555
- // stores precomputed values. Usually only base point would be precomputed.
556
- setWindowSize(t, r) {
557
- ce(r, n), fe.set(t, r), St.delete(t);
558
- }
559
- };
560
- }
561
- function Te(e, n, t, r) {
562
- Re(t, e), ze(r, n);
563
- const i = t.length, s = r.length;
564
- if (i !== s)
565
- throw new Error("arrays of points and scalars must have equal length");
566
- const c = e.ZERO, u = Be(BigInt(i));
567
- let o = 1;
568
- u > 12 ? o = u - 3 : u > 4 ? o = u - 2 : u > 0 && (o = 2);
569
- const d = mt(o), m = new Array(Number(d) + 1).fill(c), A = Math.floor((n.BITS - 1) / o) * o;
570
- let N = c;
571
- for (let R = A; R >= 0; R -= o) {
572
- m.fill(c);
573
- for (let g = 0; g < s; g++) {
574
- const _ = r[g], Z = Number(_ >> BigInt(R) & d);
575
- m[Z] = m[Z].add(t[g]);
576
- }
577
- let z = c;
578
- for (let g = m.length - 1, _ = c; g > 0; g--)
579
- _ = _.add(m[g]), z = z.add(_);
580
- if (N = N.add(z), R !== 0)
581
- for (let g = 0; g < o; g++)
582
- N = N.double();
583
- }
584
- return N;
585
- }
586
- function ae(e) {
587
- return qe(e.Fp), pt(e, {
588
- n: "bigint",
589
- h: "bigint",
590
- Gx: "field",
591
- Gy: "field"
592
- }, {
593
- nBitLength: "isSafeInteger",
594
- nByteLength: "isSafeInteger"
595
- }), Object.freeze({
596
- ...oe(e.n, e.nBitLength),
597
- ...e,
598
- p: e.Fp.ORDER
599
- });
600
- }
601
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
602
- function Pt(e) {
603
- e.lowS !== void 0 && at("lowS", e.lowS), e.prehash !== void 0 && at("prehash", e.prehash);
604
- }
605
- function Ue(e) {
606
- const n = ae(e);
607
- pt(n, {
608
- a: "field",
609
- b: "field"
610
- }, {
611
- allowInfinityPoint: "boolean",
612
- allowedPrivateKeyLengths: "array",
613
- clearCofactor: "function",
614
- fromBytes: "function",
615
- isTorsionFree: "function",
616
- toBytes: "function",
617
- wrapPrivateKey: "boolean"
618
- });
619
- const { endo: t, Fp: r, a: i } = n;
620
- if (t) {
621
- if (!r.eql(i, r.ZERO))
622
- throw new Error("invalid endo: CURVE.a must be 0");
623
- if (typeof t != "object" || typeof t.beta != "bigint" || typeof t.splitScalar != "function")
624
- throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
625
- }
626
- return Object.freeze({ ...n });
627
- }
628
- class _e extends Error {
629
- constructor(n = "") {
630
- super(n);
631
- }
632
- }
633
- const G = {
634
- // asn.1 DER encoding utils
635
- Err: _e,
636
- // Basic building block is TLV (Tag-Length-Value)
637
- _tlv: {
638
- encode: (e, n) => {
639
- const { Err: t } = G;
640
- if (e < 0 || e > 256)
641
- throw new t("tlv.encode: wrong tag");
642
- if (n.length & 1)
643
- throw new t("tlv.encode: unpadded data");
644
- const r = n.length / 2, i = ht(r);
645
- if (i.length / 2 & 128)
646
- throw new t("tlv.encode: long form length too big");
647
- const s = r > 127 ? ht(i.length / 2 | 128) : "";
648
- return ht(e) + s + i + n;
649
- },
650
- // v - value, l - left bytes (unparsed)
651
- decode(e, n) {
652
- const { Err: t } = G;
653
- let r = 0;
654
- if (e < 0 || e > 256)
655
- throw new t("tlv.encode: wrong tag");
656
- if (n.length < 2 || n[r++] !== e)
657
- throw new t("tlv.decode: wrong tlv");
658
- const i = n[r++], s = !!(i & 128);
659
- let c = 0;
660
- if (!s)
661
- c = i;
662
- else {
663
- const o = i & 127;
664
- if (!o)
665
- throw new t("tlv.decode(long): indefinite length not supported");
666
- if (o > 4)
667
- throw new t("tlv.decode(long): byte length is too big");
668
- const d = n.subarray(r, r + o);
669
- if (d.length !== o)
670
- throw new t("tlv.decode: length bytes not complete");
671
- if (d[0] === 0)
672
- throw new t("tlv.decode(long): zero leftmost byte");
673
- for (const m of d)
674
- c = c << 8 | m;
675
- if (r += o, c < 128)
676
- throw new t("tlv.decode(long): not minimal encoding");
677
- }
678
- const u = n.subarray(r, r + c);
679
- if (u.length !== c)
680
- throw new t("tlv.decode: wrong value length");
681
- return { v: u, l: n.subarray(r + c) };
682
- }
683
- },
684
- // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
685
- // since we always use positive integers here. It must always be empty:
686
- // - add zero byte if exists
687
- // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
688
- _int: {
689
- encode(e) {
690
- const { Err: n } = G;
691
- if (e < X)
692
- throw new n("integer: negative integers are not allowed");
693
- let t = ht(e);
694
- if (Number.parseInt(t[0], 16) & 8 && (t = "00" + t), t.length & 1)
695
- throw new n("unexpected DER parsing assertion: unpadded hex");
696
- return t;
697
- },
698
- decode(e) {
699
- const { Err: n } = G;
700
- if (e[0] & 128)
701
- throw new n("invalid signature integer: negative");
702
- if (e[0] === 0 && !(e[1] & 128))
703
- throw new n("invalid signature integer: unnecessary leading zero");
704
- return et(e);
705
- }
706
- },
707
- toSig(e) {
708
- const { Err: n, _int: t, _tlv: r } = G, i = P("signature", e), { v: s, l: c } = r.decode(48, i);
709
- if (c.length)
710
- throw new n("invalid signature: left bytes after parsing");
711
- const { v: u, l: o } = r.decode(2, s), { v: d, l: m } = r.decode(2, o);
712
- if (m.length)
713
- throw new n("invalid signature: left bytes after parsing");
714
- return { r: t.decode(u), s: t.decode(d) };
715
- },
716
- hexFromSig(e) {
717
- const { _tlv: n, _int: t } = G, r = n.encode(2, t.encode(e.r)), i = n.encode(2, t.encode(e.s)), s = r + i;
718
- return n.encode(48, s);
719
- }
720
- };
721
- function It(e, n) {
722
- return ut(dt(e, n));
723
- }
724
- const X = BigInt(0), T = BigInt(1);
725
- BigInt(2);
726
- const Nt = BigInt(3), ke = BigInt(4);
727
- function Ce(e) {
728
- const n = Ue(e), { Fp: t } = n, r = Ut(n.n, n.nBitLength), i = n.toBytes || ((x, f, h) => {
729
- const p = f.toAffine();
730
- return gt(Uint8Array.from([4]), t.toBytes(p.x), t.toBytes(p.y));
731
- }), s = n.fromBytes || ((x) => {
732
- const f = x.subarray(1), h = t.fromBytes(f.subarray(0, t.BYTES)), p = t.fromBytes(f.subarray(t.BYTES, 2 * t.BYTES));
733
- return { x: h, y: p };
734
- });
735
- function c(x) {
736
- const { a: f, b: h } = n, p = t.sqr(x), B = t.mul(p, x);
737
- return t.add(t.add(B, t.mul(x, f)), h);
738
- }
739
- function u(x, f) {
740
- const h = t.sqr(f), p = c(x);
741
- return t.eql(h, p);
742
- }
743
- if (!u(n.Gx, n.Gy))
744
- throw new Error("bad curve params: generator point");
745
- const o = t.mul(t.pow(n.a, Nt), ke), d = t.mul(t.sqr(n.b), BigInt(27));
746
- if (t.is0(t.add(o, d)))
747
- throw new Error("bad curve params: a or b");
748
- function m(x) {
749
- return Tt(x, T, n.n);
750
- }
751
- function A(x) {
752
- const { allowedPrivateKeyLengths: f, nByteLength: h, wrapPrivateKey: p, n: B } = n;
753
- if (f && typeof x != "bigint") {
754
- if (lt(x) && (x = ut(x)), typeof x != "string" || !f.includes(x.length))
755
- throw new Error("invalid private key");
756
- x = x.padStart(h * 2, "0");
757
- }
758
- let O;
759
- try {
760
- O = typeof x == "bigint" ? x : et(P("private key", x, h));
761
- } catch {
762
- throw new Error("invalid private key, expected hex or " + h + " bytes, got " + typeof x);
763
- }
764
- return p && (O = j(O, B)), it("private key", O, T, B), O;
765
- }
766
- function N(x) {
767
- if (!(x instanceof g))
768
- throw new Error("ProjectivePoint expected");
769
- }
770
- const R = Vt((x, f) => {
771
- const { px: h, py: p, pz: B } = x;
772
- if (t.eql(B, t.ONE))
773
- return { x: h, y: p };
774
- const O = x.is0();
775
- f == null && (f = O ? t.ONE : t.inv(B));
776
- const H = t.mul(h, f), q = t.mul(p, f), y = t.mul(B, f);
777
- if (O)
778
- return { x: t.ZERO, y: t.ZERO };
779
- if (!t.eql(y, t.ONE))
780
- throw new Error("invZ was invalid");
781
- return { x: H, y: q };
782
- }), z = Vt((x) => {
783
- if (x.is0()) {
784
- if (n.allowInfinityPoint && !t.is0(x.py))
785
- return;
786
- throw new Error("bad point: ZERO");
787
- }
788
- const { x: f, y: h } = x.toAffine();
789
- if (!t.isValid(f) || !t.isValid(h))
790
- throw new Error("bad point: x or y not FE");
791
- if (!u(f, h))
792
- throw new Error("bad point: equation left != right");
793
- if (!x.isTorsionFree())
794
- throw new Error("bad point: not in prime-order subgroup");
795
- return !0;
796
- });
797
- class g {
798
- constructor(f, h, p) {
799
- if (f == null || !t.isValid(f))
800
- throw new Error("x required");
801
- if (h == null || !t.isValid(h) || t.is0(h))
802
- throw new Error("y required");
803
- if (p == null || !t.isValid(p))
804
- throw new Error("z required");
805
- this.px = f, this.py = h, this.pz = p, Object.freeze(this);
806
- }
807
- // Does not validate if the point is on-curve.
808
- // Use fromHex instead, or call assertValidity() later.
809
- static fromAffine(f) {
810
- const { x: h, y: p } = f || {};
811
- if (!f || !t.isValid(h) || !t.isValid(p))
812
- throw new Error("invalid affine point");
813
- if (f instanceof g)
814
- throw new Error("projective point not allowed");
815
- const B = (O) => t.eql(O, t.ZERO);
816
- return B(h) && B(p) ? g.ZERO : new g(h, p, t.ONE);
817
- }
818
- get x() {
819
- return this.toAffine().x;
820
- }
821
- get y() {
822
- return this.toAffine().y;
823
- }
824
- /**
825
- * Takes a bunch of Projective Points but executes only one
826
- * inversion on all of them. Inversion is very slow operation,
827
- * so this improves performance massively.
828
- * Optimization: converts a list of projective points to a list of identical points with Z=1.
829
- */
830
- static normalizeZ(f) {
831
- const h = re(t, f.map((p) => p.pz));
832
- return f.map((p, B) => p.toAffine(h[B])).map(g.fromAffine);
833
- }
834
- /**
835
- * Converts hash string or Uint8Array to Point.
836
- * @param hex short/long ECDSA hex
837
- */
838
- static fromHex(f) {
839
- const h = g.fromAffine(s(P("pointHex", f)));
840
- return h.assertValidity(), h;
841
- }
842
- // Multiplies generator point by privateKey.
843
- static fromPrivateKey(f) {
844
- return g.BASE.multiply(A(f));
845
- }
846
- // Multiscalar Multiplication
847
- static msm(f, h) {
848
- return Te(g, r, f, h);
849
- }
850
- // "Private method", don't use it directly
851
- _setWindowSize(f) {
852
- $.setWindowSize(this, f);
853
- }
854
- // A point on curve is valid if it conforms to equation.
855
- assertValidity() {
856
- z(this);
857
- }
858
- hasEvenY() {
859
- const { y: f } = this.toAffine();
860
- if (t.isOdd)
861
- return !t.isOdd(f);
862
- throw new Error("Field doesn't support isOdd");
863
- }
864
- /**
865
- * Compare one point to another.
866
- */
867
- equals(f) {
868
- N(f);
869
- const { px: h, py: p, pz: B } = this, { px: O, py: H, pz: q } = f, y = t.eql(t.mul(h, q), t.mul(O, B)), I = t.eql(t.mul(p, q), t.mul(H, B));
870
- return y && I;
871
- }
872
- /**
873
- * Flips point to one corresponding to (x, -y) in Affine coordinates.
874
- */
875
- negate() {
876
- return new g(this.px, t.neg(this.py), this.pz);
877
- }
878
- // Renes-Costello-Batina exception-free doubling formula.
879
- // There is 30% faster Jacobian formula, but it is not complete.
880
- // https://eprint.iacr.org/2015/1060, algorithm 3
881
- // Cost: 8M + 3S + 3*a + 2*b3 + 15add.
882
- double() {
883
- const { a: f, b: h } = n, p = t.mul(h, Nt), { px: B, py: O, pz: H } = this;
884
- let q = t.ZERO, y = t.ZERO, I = t.ZERO, b = t.mul(B, B), U = t.mul(O, O), l = t.mul(H, H), a = t.mul(B, O);
885
- return a = t.add(a, a), I = t.mul(B, H), I = t.add(I, I), q = t.mul(f, I), y = t.mul(p, l), y = t.add(q, y), q = t.sub(U, y), y = t.add(U, y), y = t.mul(q, y), q = t.mul(a, q), I = t.mul(p, I), l = t.mul(f, l), a = t.sub(b, l), a = t.mul(f, a), a = t.add(a, I), I = t.add(b, b), b = t.add(I, b), b = t.add(b, l), b = t.mul(b, a), y = t.add(y, b), l = t.mul(O, H), l = t.add(l, l), b = t.mul(l, a), q = t.sub(q, b), I = t.mul(l, U), I = t.add(I, I), I = t.add(I, I), new g(q, y, I);
886
- }
887
- // Renes-Costello-Batina exception-free addition formula.
888
- // There is 30% faster Jacobian formula, but it is not complete.
889
- // https://eprint.iacr.org/2015/1060, algorithm 1
890
- // Cost: 12M + 0S + 3*a + 3*b3 + 23add.
891
- add(f) {
892
- N(f);
893
- const { px: h, py: p, pz: B } = this, { px: O, py: H, pz: q } = f;
894
- let y = t.ZERO, I = t.ZERO, b = t.ZERO;
895
- const U = n.a, l = t.mul(n.b, Nt);
896
- let a = t.mul(h, O), w = t.mul(p, H), S = t.mul(B, q), E = t.add(h, p), v = t.add(O, H);
897
- E = t.mul(E, v), v = t.add(a, w), E = t.sub(E, v), v = t.add(h, B);
898
- let L = t.add(O, q);
899
- return v = t.mul(v, L), L = t.add(a, S), v = t.sub(v, L), L = t.add(p, B), y = t.add(H, q), L = t.mul(L, y), y = t.add(w, S), L = t.sub(L, y), b = t.mul(U, v), y = t.mul(l, S), b = t.add(y, b), y = t.sub(w, b), b = t.add(w, b), I = t.mul(y, b), w = t.add(a, a), w = t.add(w, a), S = t.mul(U, S), v = t.mul(l, v), w = t.add(w, S), S = t.sub(a, S), S = t.mul(U, S), v = t.add(v, S), a = t.mul(w, v), I = t.add(I, a), a = t.mul(L, v), y = t.mul(E, y), y = t.sub(y, a), a = t.mul(E, w), b = t.mul(L, b), b = t.add(b, a), new g(y, I, b);
900
- }
901
- subtract(f) {
902
- return this.add(f.negate());
903
- }
904
- is0() {
905
- return this.equals(g.ZERO);
906
- }
907
- wNAF(f) {
908
- return $.wNAFCached(this, f, g.normalizeZ);
909
- }
910
- /**
911
- * Non-constant-time multiplication. Uses double-and-add algorithm.
912
- * It's faster, but should only be used when you don't care about
913
- * an exposed private key e.g. sig verification, which works over *public* keys.
914
- */
915
- multiplyUnsafe(f) {
916
- const { endo: h, n: p } = n;
917
- it("scalar", f, X, p);
918
- const B = g.ZERO;
919
- if (f === X)
920
- return B;
921
- if (this.is0() || f === T)
922
- return this;
923
- if (!h || $.hasPrecomputes(this))
924
- return $.wNAFCachedUnsafe(this, f, g.normalizeZ);
925
- let { k1neg: O, k1: H, k2neg: q, k2: y } = h.splitScalar(f), I = B, b = B, U = this;
926
- for (; H > X || y > X; )
927
- H & T && (I = I.add(U)), y & T && (b = b.add(U)), U = U.double(), H >>= T, y >>= T;
928
- return O && (I = I.negate()), q && (b = b.negate()), b = new g(t.mul(b.px, h.beta), b.py, b.pz), I.add(b);
929
- }
930
- /**
931
- * Constant time multiplication.
932
- * Uses wNAF method. Windowed method may be 10% faster,
933
- * but takes 2x longer to generate and consumes 2x memory.
934
- * Uses precomputes when available.
935
- * Uses endomorphism for Koblitz curves.
936
- * @param scalar by which the point would be multiplied
937
- * @returns New point
938
- */
939
- multiply(f) {
940
- const { endo: h, n: p } = n;
941
- it("scalar", f, T, p);
942
- let B, O;
943
- if (h) {
944
- const { k1neg: H, k1: q, k2neg: y, k2: I } = h.splitScalar(f);
945
- let { p: b, f: U } = this.wNAF(q), { p: l, f: a } = this.wNAF(I);
946
- b = $.constTimeNegate(H, b), l = $.constTimeNegate(y, l), l = new g(t.mul(l.px, h.beta), l.py, l.pz), B = b.add(l), O = U.add(a);
947
- } else {
948
- const { p: H, f: q } = this.wNAF(f);
949
- B = H, O = q;
950
- }
951
- return g.normalizeZ([B, O])[0];
952
- }
953
- /**
954
- * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
955
- * Not using Strauss-Shamir trick: precomputation tables are faster.
956
- * The trick could be useful if both P and Q are not G (not in our case).
957
- * @returns non-zero affine point
958
- */
959
- multiplyAndAddUnsafe(f, h, p) {
960
- const B = g.BASE, O = (q, y) => y === X || y === T || !q.equals(B) ? q.multiplyUnsafe(y) : q.multiply(y), H = O(this, h).add(O(f, p));
961
- return H.is0() ? void 0 : H;
962
- }
963
- // Converts Projective point to affine (x, y) coordinates.
964
- // Can accept precomputed Z^-1 - for example, from invertBatch.
965
- // (x, y, z) ∋ (x=x/z, y=y/z)
966
- toAffine(f) {
967
- return R(this, f);
968
- }
969
- isTorsionFree() {
970
- const { h: f, isTorsionFree: h } = n;
971
- if (f === T)
972
- return !0;
973
- if (h)
974
- return h(g, this);
975
- throw new Error("isTorsionFree() has not been declared for the elliptic curve");
976
- }
977
- clearCofactor() {
978
- const { h: f, clearCofactor: h } = n;
979
- return f === T ? this : h ? h(g, this) : this.multiplyUnsafe(n.h);
980
- }
981
- toRawBytes(f = !0) {
982
- return at("isCompressed", f), this.assertValidity(), i(g, this, f);
983
- }
984
- toHex(f = !0) {
985
- return at("isCompressed", f), ut(this.toRawBytes(f));
986
- }
987
- }
988
- g.BASE = new g(n.Gx, n.Gy, t.ONE), g.ZERO = new g(t.ZERO, t.ONE, t.ZERO);
989
- const { endo: _, nBitLength: Z } = n, $ = Ze(g, _ ? Math.ceil(Z / 2) : Z);
990
- return {
991
- CURVE: n,
992
- ProjectivePoint: g,
993
- normPrivateKeyToScalar: A,
994
- weierstrassEquation: c,
995
- isWithinCurveOrder: m
996
- };
997
- }
998
- function Ve(e) {
999
- const n = ae(e);
1000
- return pt(n, {
1001
- hash: "hash",
1002
- hmac: "function",
1003
- randomBytes: "function"
1004
- }, {
1005
- bits2int: "function",
1006
- bits2int_modN: "function",
1007
- lowS: "boolean"
1008
- }), Object.freeze({ lowS: !0, ...n });
1009
- }
1010
- function je(e) {
1011
- const n = Ve(e), { Fp: t, n: r, nByteLength: i, nBitLength: s } = n, c = t.BYTES + 1, u = 2 * t.BYTES + 1;
1012
- function o(l) {
1013
- return j(l, r);
1014
- }
1015
- function d(l) {
1016
- return qt(l, r);
1017
- }
1018
- const { ProjectivePoint: m, normPrivateKeyToScalar: A, weierstrassEquation: N, isWithinCurveOrder: R } = Ce({
1019
- ...n,
1020
- toBytes(l, a, w) {
1021
- const S = a.toAffine(), E = t.toBytes(S.x), v = gt;
1022
- return at("isCompressed", w), w ? v(Uint8Array.from([a.hasEvenY() ? 2 : 3]), E) : v(Uint8Array.from([4]), E, t.toBytes(S.y));
1023
- },
1024
- fromBytes(l) {
1025
- const a = l.length, w = l[0], S = l.subarray(1);
1026
- if (a === c && (w === 2 || w === 3)) {
1027
- const E = et(S);
1028
- if (!Tt(E, T, t.ORDER))
1029
- throw new Error("Point is not on curve");
1030
- const v = N(E);
1031
- let L;
1032
- try {
1033
- L = t.sqrt(v);
1034
- } catch (K) {
1035
- const V = K instanceof Error ? ": " + K.message : "";
1036
- throw new Error("Point is not on curve" + V);
1037
- }
1038
- const k = (L & T) === T;
1039
- return (w & 1) === 1 !== k && (L = t.neg(L)), { x: E, y: L };
1040
- } else if (a === u && w === 4) {
1041
- const E = t.fromBytes(S.subarray(0, t.BYTES)), v = t.fromBytes(S.subarray(t.BYTES, 2 * t.BYTES));
1042
- return { x: E, y: v };
1043
- } else {
1044
- const E = c, v = u;
1045
- throw new Error("invalid Point, expected length of " + E + ", or uncompressed " + v + ", got " + a);
1046
- }
1047
- }
1048
- });
1049
- function z(l) {
1050
- const a = r >> T;
1051
- return l > a;
1052
- }
1053
- function g(l) {
1054
- return z(l) ? o(-l) : l;
1055
- }
1056
- const _ = (l, a, w) => et(l.slice(a, w));
1057
- class Z {
1058
- constructor(a, w, S) {
1059
- it("r", a, T, r), it("s", w, T, r), this.r = a, this.s = w, S != null && (this.recovery = S), Object.freeze(this);
1060
- }
1061
- // pair (bytes of r, bytes of s)
1062
- static fromCompact(a) {
1063
- const w = i;
1064
- return a = P("compactSignature", a, w * 2), new Z(_(a, 0, w), _(a, w, 2 * w));
1065
- }
1066
- // DER encoded ECDSA signature
1067
- // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
1068
- static fromDER(a) {
1069
- const { r: w, s: S } = G.toSig(P("DER", a));
1070
- return new Z(w, S);
1071
- }
1072
- /**
1073
- * @todo remove
1074
- * @deprecated
1075
- */
1076
- assertValidity() {
1077
- }
1078
- addRecoveryBit(a) {
1079
- return new Z(this.r, this.s, a);
1080
- }
1081
- recoverPublicKey(a) {
1082
- const { r: w, s: S, recovery: E } = this, v = B(P("msgHash", a));
1083
- if (E == null || ![0, 1, 2, 3].includes(E))
1084
- throw new Error("recovery id invalid");
1085
- const L = E === 2 || E === 3 ? w + n.n : w;
1086
- if (L >= t.ORDER)
1087
- throw new Error("recovery id 2 or 3 invalid");
1088
- const k = (E & 1) === 0 ? "02" : "03", W = m.fromHex(k + It(L, t.BYTES)), K = d(L), V = o(-v * K), nt = o(S * K), F = m.BASE.multiplyAndAddUnsafe(W, V, nt);
1089
- if (!F)
1090
- throw new Error("point at infinify");
1091
- return F.assertValidity(), F;
1092
- }
1093
- // Signatures should be low-s, to prevent malleability.
1094
- hasHighS() {
1095
- return z(this.s);
1096
- }
1097
- normalizeS() {
1098
- return this.hasHighS() ? new Z(this.r, o(-this.s), this.recovery) : this;
1099
- }
1100
- // DER-encoded
1101
- toDERRawBytes() {
1102
- return wt(this.toDERHex());
1103
- }
1104
- toDERHex() {
1105
- return G.hexFromSig(this);
1106
- }
1107
- // padded bytes of r, then padded bytes of s
1108
- toCompactRawBytes() {
1109
- return wt(this.toCompactHex());
1110
- }
1111
- toCompactHex() {
1112
- const a = i;
1113
- return It(this.r, a) + It(this.s, a);
1114
- }
1115
- }
1116
- const $ = {
1117
- isValidPrivateKey(l) {
1118
- try {
1119
- return A(l), !0;
1120
- } catch {
1121
- return !1;
1122
- }
1123
- },
1124
- normPrivateKeyToScalar: A,
1125
- /**
1126
- * Produces cryptographically secure private key from random of size
1127
- * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.
1128
- */
1129
- randomPrivateKey: () => {
1130
- const l = se(n.n);
1131
- return Le(n.randomBytes(l), n.n);
1132
- },
1133
- /**
1134
- * Creates precompute table for an arbitrary EC point. Makes point "cached".
1135
- * Allows to massively speed-up `point.multiply(scalar)`.
1136
- * @returns cached point
1137
- * @example
1138
- * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
1139
- * fast.multiply(privKey); // much faster ECDH now
1140
- */
1141
- precompute(l = 8, a = m.BASE) {
1142
- return a._setWindowSize(l), a.multiply(BigInt(3)), a;
1143
- }
1144
- };
1145
- function x(l, a = !0) {
1146
- return m.fromPrivateKey(l).toRawBytes(a);
1147
- }
1148
- function f(l) {
1149
- if (typeof l == "bigint")
1150
- return !1;
1151
- if (l instanceof m)
1152
- return !0;
1153
- const w = P("key", l).length, S = t.BYTES, E = S + 1, v = 2 * S + 1;
1154
- if (!(n.allowedPrivateKeyLengths || i === E))
1155
- return w === E || w === v;
1156
- }
1157
- function h(l, a, w = !0) {
1158
- if (f(l) === !0)
1159
- throw new Error("first arg must be private key");
1160
- if (f(a) === !1)
1161
- throw new Error("second arg must be public key");
1162
- return m.fromHex(a).multiply(A(l)).toRawBytes(w);
1163
- }
1164
- const p = n.bits2int || function(l) {
1165
- if (l.length > 8192)
1166
- throw new Error("input is too large");
1167
- const a = et(l), w = l.length * 8 - s;
1168
- return w > 0 ? a >> BigInt(w) : a;
1169
- }, B = n.bits2int_modN || function(l) {
1170
- return o(p(l));
1171
- }, O = mt(s);
1172
- function H(l) {
1173
- return it("num < 2^" + s, l, X, O), dt(l, i);
1174
- }
1175
- function q(l, a, w = y) {
1176
- if (["recovered", "canonical"].some((Q) => Q in w))
1177
- throw new Error("sign() legacy options not supported");
1178
- const { hash: S, randomBytes: E } = n;
1179
- let { lowS: v, prehash: L, extraEntropy: k } = w;
1180
- v == null && (v = !0), l = P("msgHash", l), Pt(w), L && (l = P("prehashed msgHash", S(l)));
1181
- const W = B(l), K = A(a), V = [H(K), H(W)];
1182
- if (k != null && k !== !1) {
1183
- const Q = k === !0 ? E(t.BYTES) : k;
1184
- V.push(P("extraEntropy", Q));
1185
- }
1186
- const nt = gt(...V), F = W;
1187
- function yt(Q) {
1188
- const rt = p(Q);
1189
- if (!R(rt))
1190
- return;
1191
- const bt = d(rt), st = m.BASE.multiply(rt).toAffine(), J = o(st.x);
1192
- if (J === X)
1193
- return;
1194
- const ct = o(bt * o(F + J * K));
1195
- if (ct === X)
1196
- return;
1197
- let ft = (st.x === J ? 0 : 2) | Number(st.y & T), ot = ct;
1198
- return v && z(ct) && (ot = g(ct), ft ^= 1), new Z(J, ot, ft);
1199
- }
1200
- return { seed: nt, k2sig: yt };
1201
- }
1202
- const y = { lowS: n.lowS, prehash: !1 }, I = { lowS: n.lowS, prehash: !1 };
1203
- function b(l, a, w = y) {
1204
- const { seed: S, k2sig: E } = q(l, a, w), v = n;
1205
- return ve(v.hash.outputLen, v.nByteLength, v.hmac)(S, E);
1206
- }
1207
- m.BASE._setWindowSize(8);
1208
- function U(l, a, w, S = I) {
1209
- var ft;
1210
- const E = l;
1211
- a = P("msgHash", a), w = P("publicKey", w);
1212
- const { lowS: v, prehash: L, format: k } = S;
1213
- if (Pt(S), "strict" in S)
1214
- throw new Error("options.strict was renamed to lowS");
1215
- if (k !== void 0 && k !== "compact" && k !== "der")
1216
- throw new Error("format must be compact or der");
1217
- const W = typeof E == "string" || lt(E), K = !W && !k && typeof E == "object" && E !== null && typeof E.r == "bigint" && typeof E.s == "bigint";
1218
- if (!W && !K)
1219
- throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
1220
- let V, nt;
1221
- try {
1222
- if (K && (V = new Z(E.r, E.s)), W) {
1223
- try {
1224
- k !== "compact" && (V = Z.fromDER(E));
1225
- } catch (ot) {
1226
- if (!(ot instanceof G.Err))
1227
- throw ot;
1228
- }
1229
- !V && k !== "der" && (V = Z.fromCompact(E));
1230
- }
1231
- nt = m.fromHex(w);
1232
- } catch {
1233
- return !1;
1234
- }
1235
- if (!V || v && V.hasHighS())
1236
- return !1;
1237
- L && (a = n.hash(a));
1238
- const { r: F, s: yt } = V, Q = B(a), rt = d(yt), bt = o(Q * rt), st = o(F * rt), J = (ft = m.BASE.multiplyAndAddUnsafe(nt, bt, st)) == null ? void 0 : ft.toAffine();
1239
- return J ? o(J.x) === F : !1;
1240
- }
1241
- return {
1242
- CURVE: n,
1243
- getPublicKey: x,
1244
- getSharedSecret: h,
1245
- sign: b,
1246
- verify: U,
1247
- ProjectivePoint: m,
1248
- Signature: Z,
1249
- utils: $
1250
- };
1251
- }
1252
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1253
- function Me(e) {
1254
- return {
1255
- hash: e,
1256
- hmac: (n, ...t) => Qt(e, n, ye(...t)),
1257
- randomBytes: pe
1258
- };
1259
- }
1260
- function Ye(e, n) {
1261
- const t = (r) => je({ ...e, ...Me(r) });
1262
- return { ...t(n), create: t };
1263
- }
1264
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1265
- const ue = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), Kt = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), Pe = BigInt(0), Ke = BigInt(1), Lt = BigInt(2), $t = (e, n) => (e + n / Lt) / n;
1266
- function $e(e) {
1267
- const n = ue, t = BigInt(3), r = BigInt(6), i = BigInt(11), s = BigInt(22), c = BigInt(23), u = BigInt(44), o = BigInt(88), d = e * e * e % n, m = d * d * e % n, A = Y(m, t, n) * m % n, N = Y(A, t, n) * m % n, R = Y(N, Lt, n) * d % n, z = Y(R, i, n) * R % n, g = Y(z, s, n) * z % n, _ = Y(g, u, n) * g % n, Z = Y(_, o, n) * _ % n, $ = Y(Z, u, n) * g % n, x = Y($, t, n) * m % n, f = Y(x, c, n) * z % n, h = Y(f, r, n) * d % n, p = Y(h, Lt, n);
1268
- if (!Rt.eql(Rt.sqr(p), e))
1269
- throw new Error("Cannot find square root");
1270
- return p;
1271
- }
1272
- const Rt = Ut(ue, void 0, void 0, { sqrt: $e }), We = Ye({
1273
- a: Pe,
1274
- b: BigInt(7),
1275
- Fp: Rt,
1276
- n: Kt,
1277
- Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
1278
- Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
1279
- h: BigInt(1),
1280
- lowS: !0,
1281
- // Allow only low-S signatures by default in sign() and verify()
1282
- endo: {
1283
- // Endomorphism, see above
1284
- beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
1285
- splitScalar: (e) => {
1286
- const n = Kt, t = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -Ke * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), i = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), s = t, c = BigInt("0x100000000000000000000000000000000"), u = $t(s * e, n), o = $t(-r * e, n);
1287
- let d = j(e - u * t - o * i, n), m = j(-u * r - o * s, n);
1288
- const A = d > c, N = m > c;
1289
- if (A && (d = n - d), N && (m = n - m), d > c || m > c)
1290
- throw new Error("splitScalar: Endomorphism failed, k=" + e);
1291
- return { k1neg: A, k1: d, k2neg: N, k2: m };
1292
- }
1293
- }
1294
- }, be), Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1295
- __proto__: null,
1296
- secp256k1: We
1297
- }, Symbol.toStringTag, { value: "Module" }));
1298
- export {
1299
- Ge as a,
1300
- Qt as h,
1301
- We as s
1302
- };