ccxt 4.5.60 → 4.5.62

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 (521) hide show
  1. package/README.md +56 -54
  2. package/dist/ccxt.browser.min.js +4 -4
  3. package/dist/cjs/ccxt.js +6 -2
  4. package/dist/cjs/src/aftermath.js +1 -1
  5. package/dist/cjs/src/apex.js +2 -2
  6. package/dist/cjs/src/ascendex.js +1 -1
  7. package/dist/cjs/src/aster.js +3 -4
  8. package/dist/cjs/src/backpack.js +1 -1
  9. package/dist/cjs/src/base/Exchange.js +6 -38
  10. package/dist/cjs/src/base/functions/crypto.js +72 -15
  11. package/dist/cjs/src/base/functions/rsa.js +25 -10
  12. package/dist/cjs/src/base/functions.js +1 -0
  13. package/dist/cjs/src/bequant.js +1 -1
  14. package/dist/cjs/src/bigone.js +1 -1
  15. package/dist/cjs/src/binance.js +1 -1
  16. package/dist/cjs/src/bingx.js +4 -4
  17. package/dist/cjs/src/bit2c.js +1 -1
  18. package/dist/cjs/src/bitbank.js +1 -1
  19. package/dist/cjs/src/bitbns.js +1 -1
  20. package/dist/cjs/src/bitfinex.js +5 -5
  21. package/dist/cjs/src/bitflyer.js +1 -1
  22. package/dist/cjs/src/bitget.js +2 -2
  23. package/dist/cjs/src/bithumb.js +1 -1
  24. package/dist/cjs/src/bitmart.js +2 -2
  25. package/dist/cjs/src/bitmex.js +3 -3
  26. package/dist/cjs/src/bitopro.js +1 -1
  27. package/dist/cjs/src/bitrue.js +1 -1
  28. package/dist/cjs/src/bitso.js +2 -2
  29. package/dist/cjs/src/bitstamp.js +1 -1
  30. package/dist/cjs/src/bittrade.js +2 -2
  31. package/dist/cjs/src/bitvavo.js +2 -2
  32. package/dist/cjs/src/blockchaincom.js +1 -1
  33. package/dist/cjs/src/blofin.js +3 -4
  34. package/dist/cjs/src/btcbox.js +1 -1
  35. package/dist/cjs/src/btcmarkets.js +1 -1
  36. package/dist/cjs/src/btcturk.js +2 -2
  37. package/dist/cjs/src/bullish.js +1 -1
  38. package/dist/cjs/src/bybit.js +1 -1
  39. package/dist/cjs/src/bydfi.js +1 -1
  40. package/dist/cjs/src/cex.js +2 -2
  41. package/dist/cjs/src/coinbase.js +1 -1
  42. package/dist/cjs/src/coinbaseexchange.js +2 -2
  43. package/dist/cjs/src/coincheck.js +2 -2
  44. package/dist/cjs/src/coinex.js +1 -1
  45. package/dist/cjs/src/coinmate.js +1 -1
  46. package/dist/cjs/src/coinmetro.js +1 -1
  47. package/dist/cjs/src/coinone.js +1 -1
  48. package/dist/cjs/src/coinsph.js +1 -1
  49. package/dist/cjs/src/coinspot.js +1 -1
  50. package/dist/cjs/src/cryptocom.js +1 -1
  51. package/dist/cjs/src/cryptomus.js +2 -2
  52. package/dist/cjs/src/deepcoin.js +1 -1
  53. package/dist/cjs/src/delta.js +1 -1
  54. package/dist/cjs/src/deribit.js +1 -1
  55. package/dist/cjs/src/derive.js +2 -3
  56. package/dist/cjs/src/digifinex.js +1 -1
  57. package/dist/cjs/src/dydx.js +2 -2
  58. package/dist/cjs/src/exmo.js +1 -1
  59. package/dist/cjs/src/extended.js +5 -5
  60. package/dist/cjs/src/foxbit.js +1 -1
  61. package/dist/cjs/src/gate.js +3 -3
  62. package/dist/cjs/src/gateeu.js +60 -0
  63. package/dist/cjs/src/gemini.js +1 -1
  64. package/dist/cjs/src/grvt.js +1 -1
  65. package/dist/cjs/src/hashkey.js +2 -2
  66. package/dist/cjs/src/hibachi.js +1 -1
  67. package/dist/cjs/src/hitbtc.js +1 -1
  68. package/dist/cjs/src/hollaex.js +1 -1
  69. package/dist/cjs/src/htx.js +1 -1
  70. package/dist/cjs/src/hyperliquid.js +1 -1
  71. package/dist/cjs/src/independentreserve.js +1 -1
  72. package/dist/cjs/src/indodax.js +1 -1
  73. package/dist/cjs/src/kraken.js +1 -1
  74. package/dist/cjs/src/kucoin.js +1 -1
  75. package/dist/cjs/src/latoken.js +1 -1
  76. package/dist/cjs/src/lbank.js +1 -1
  77. package/dist/cjs/src/lighter.js +1 -1
  78. package/dist/cjs/src/luno.js +2 -2
  79. package/dist/cjs/src/mercado.js +1 -1
  80. package/dist/cjs/src/mexc.js +1 -1
  81. package/dist/cjs/src/modetrade.js +3 -5
  82. package/dist/cjs/src/ndax.js +1 -1
  83. package/dist/cjs/src/novadax.js +1 -1
  84. package/dist/cjs/src/okx.js +1 -1
  85. package/dist/cjs/src/onetrading.js +2 -2
  86. package/dist/cjs/src/p2b.js +2 -3
  87. package/dist/cjs/src/pacifica.js +2 -2
  88. package/dist/cjs/src/paradex.js +1 -1
  89. package/dist/cjs/src/paymium.js +1 -1
  90. package/dist/cjs/src/phemex.js +1 -1
  91. package/dist/cjs/src/poloniex.js +1 -1
  92. package/dist/cjs/src/pro/aftermath.js +1 -1
  93. package/dist/cjs/src/pro/alpaca.js +1 -1
  94. package/dist/cjs/src/pro/apex.js +2 -2
  95. package/dist/cjs/src/pro/ascendex.js +1 -1
  96. package/dist/cjs/src/pro/aster.js +4 -4
  97. package/dist/cjs/src/pro/backpack.js +4 -4
  98. package/dist/cjs/src/pro/binance.js +5 -5
  99. package/dist/cjs/src/pro/bingx.js +2 -2
  100. package/dist/cjs/src/pro/bitfinex.js +1 -1
  101. package/dist/cjs/src/pro/bitget.js +4 -4
  102. package/dist/cjs/src/pro/bitmart.js +4 -4
  103. package/dist/cjs/src/pro/bitmex.js +2 -2
  104. package/dist/cjs/src/pro/bitopro.js +1 -1
  105. package/dist/cjs/src/pro/bitstamp.js +1 -1
  106. package/dist/cjs/src/pro/bittrade.js +1 -1
  107. package/dist/cjs/src/pro/bitvavo.js +1 -1
  108. package/dist/cjs/src/pro/blockchaincom.js +1 -1
  109. package/dist/cjs/src/pro/blofin.js +2 -2
  110. package/dist/cjs/src/pro/bullish.js +1 -1
  111. package/dist/cjs/src/pro/bybit.js +4 -4
  112. package/dist/cjs/src/pro/bydfi.js +4 -4
  113. package/dist/cjs/src/pro/cex.js +1 -1
  114. package/dist/cjs/src/pro/coinbase.js +3 -3
  115. package/dist/cjs/src/pro/coinbaseexchange.js +2 -2
  116. package/dist/cjs/src/pro/coinbaseinternational.js +2 -2
  117. package/dist/cjs/src/pro/coincheck.js +1 -1
  118. package/dist/cjs/src/pro/coinex.js +2 -2
  119. package/dist/cjs/src/pro/coinone.js +1 -1
  120. package/dist/cjs/src/pro/cryptocom.js +4 -4
  121. package/dist/cjs/src/pro/deepcoin.js +2 -2
  122. package/dist/cjs/src/pro/deribit.js +2 -2
  123. package/dist/cjs/src/pro/derive.js +2 -2
  124. package/dist/cjs/src/pro/dydx.js +2 -2
  125. package/dist/cjs/src/pro/exmo.js +1 -1
  126. package/dist/cjs/src/pro/extended.js +1 -1
  127. package/dist/cjs/src/pro/gate.js +46 -15
  128. package/dist/cjs/src/pro/gateeu.js +32 -0
  129. package/dist/cjs/src/pro/gemini.js +2 -3
  130. package/dist/cjs/src/pro/grvt.js +2 -2
  131. package/dist/cjs/src/pro/hashkey.js +1 -1
  132. package/dist/cjs/src/pro/hitbtc.js +1 -1
  133. package/dist/cjs/src/pro/hollaex.js +1 -1
  134. package/dist/cjs/src/pro/htx.js +440 -102
  135. package/dist/cjs/src/pro/hyperliquid.js +2 -2
  136. package/dist/cjs/src/pro/independentreserve.js +1 -1
  137. package/dist/cjs/src/pro/kraken.js +2 -2
  138. package/dist/cjs/src/pro/krakenfutures.js +2 -2
  139. package/dist/cjs/src/pro/kucoin.js +4 -4
  140. package/dist/cjs/src/pro/lighter.js +2 -2
  141. package/dist/cjs/src/pro/luno.js +1 -1
  142. package/dist/cjs/src/pro/mexc.js +2 -2
  143. package/dist/cjs/src/pro/modetrade.js +1 -1
  144. package/dist/cjs/src/pro/ndax.js +1 -1
  145. package/dist/cjs/src/pro/okx.js +4 -4
  146. package/dist/cjs/src/pro/onetrading.js +1 -1
  147. package/dist/cjs/src/pro/p2b.js +1 -1
  148. package/dist/cjs/src/pro/pacifica.js +2 -2
  149. package/dist/cjs/src/pro/paradex.js +1 -1
  150. package/dist/cjs/src/pro/phemex.js +1 -1
  151. package/dist/cjs/src/pro/poloniex.js +1 -1
  152. package/dist/cjs/src/pro/toobit.js +2 -2
  153. package/dist/cjs/src/pro/upbit.js +1 -1
  154. package/dist/cjs/src/pro/weex.js +4 -4
  155. package/dist/cjs/src/pro/whitebit.js +1 -1
  156. package/dist/cjs/src/pro/woo.js +2 -2
  157. package/dist/cjs/src/pro/woofipro.js +1 -1
  158. package/dist/cjs/src/tokocrypto.js +1 -1
  159. package/dist/cjs/src/toobit.js +2 -2
  160. package/dist/cjs/src/upbit.js +1 -1
  161. package/dist/cjs/src/weex.js +2 -2
  162. package/dist/cjs/src/whitebit.js +1 -1
  163. package/dist/cjs/src/woo.js +1 -1
  164. package/dist/cjs/src/woofipro.js +2 -4
  165. package/dist/cjs/src/xt.js +1 -1
  166. package/dist/cjs/src/zaif.js +2 -2
  167. package/dist/cjs/src/zebpay.js +2 -2
  168. package/js/ccxt.d.ts +8 -2
  169. package/js/ccxt.js +6 -3
  170. package/js/src/abstract/gateeu.d.ts +346 -0
  171. package/js/src/{static_dependencies/jsencrypt/index.js → abstract/gateeu.js} +5 -3
  172. package/js/src/aftermath.d.ts +1 -1
  173. package/js/src/aftermath.js +1 -1
  174. package/js/src/apex.d.ts +1 -1
  175. package/js/src/apex.js +2 -2
  176. package/js/src/ascendex.d.ts +1 -1
  177. package/js/src/ascendex.js +1 -1
  178. package/js/src/aster.d.ts +1 -1
  179. package/js/src/aster.js +3 -4
  180. package/js/src/backpack.js +1 -1
  181. package/js/src/base/Exchange.d.ts +1 -1
  182. package/js/src/base/Exchange.js +6 -38
  183. package/js/src/base/functions/crypto.d.ts +2 -1
  184. package/js/src/base/functions/crypto.js +72 -16
  185. package/js/src/base/functions/rsa.js +18 -7
  186. package/js/src/bequant.js +1 -1
  187. package/js/src/bigone.d.ts +1 -1
  188. package/js/src/bigone.js +1 -1
  189. package/js/src/binance.d.ts +1 -1
  190. package/js/src/binance.js +1 -1
  191. package/js/src/bingx.d.ts +1 -1
  192. package/js/src/bingx.js +4 -4
  193. package/js/src/bit2c.d.ts +1 -1
  194. package/js/src/bit2c.js +1 -1
  195. package/js/src/bitbank.d.ts +1 -1
  196. package/js/src/bitbank.js +1 -1
  197. package/js/src/bitbns.d.ts +1 -1
  198. package/js/src/bitbns.js +1 -1
  199. package/js/src/bitfinex.d.ts +1 -1
  200. package/js/src/bitfinex.js +5 -5
  201. package/js/src/bitflyer.d.ts +1 -1
  202. package/js/src/bitflyer.js +1 -1
  203. package/js/src/bitget.d.ts +1 -1
  204. package/js/src/bitget.js +2 -2
  205. package/js/src/bithumb.d.ts +1 -1
  206. package/js/src/bithumb.js +1 -1
  207. package/js/src/bitmart.d.ts +1 -1
  208. package/js/src/bitmart.js +2 -2
  209. package/js/src/bitmex.d.ts +1 -1
  210. package/js/src/bitmex.js +3 -3
  211. package/js/src/bitopro.d.ts +1 -1
  212. package/js/src/bitopro.js +1 -1
  213. package/js/src/bitrue.d.ts +1 -1
  214. package/js/src/bitrue.js +1 -1
  215. package/js/src/bitso.d.ts +1 -1
  216. package/js/src/bitso.js +2 -2
  217. package/js/src/bitstamp.d.ts +1 -1
  218. package/js/src/bitstamp.js +1 -1
  219. package/js/src/bittrade.d.ts +1 -1
  220. package/js/src/bittrade.js +2 -2
  221. package/js/src/bitvavo.d.ts +1 -1
  222. package/js/src/bitvavo.js +2 -2
  223. package/js/src/blockchaincom.d.ts +1 -1
  224. package/js/src/blockchaincom.js +1 -1
  225. package/js/src/blofin.d.ts +1 -1
  226. package/js/src/blofin.js +3 -4
  227. package/js/src/btcbox.d.ts +1 -1
  228. package/js/src/btcbox.js +1 -1
  229. package/js/src/btcmarkets.d.ts +1 -1
  230. package/js/src/btcmarkets.js +1 -1
  231. package/js/src/btcturk.d.ts +1 -1
  232. package/js/src/btcturk.js +2 -2
  233. package/js/src/bullish.d.ts +1 -1
  234. package/js/src/bullish.js +1 -1
  235. package/js/src/bybit.d.ts +1 -1
  236. package/js/src/bybit.js +1 -1
  237. package/js/src/bydfi.js +1 -1
  238. package/js/src/cex.d.ts +1 -1
  239. package/js/src/cex.js +2 -2
  240. package/js/src/coinbase.d.ts +1 -1
  241. package/js/src/coinbase.js +1 -1
  242. package/js/src/coinbaseexchange.d.ts +1 -1
  243. package/js/src/coinbaseexchange.js +2 -2
  244. package/js/src/coincheck.d.ts +1 -1
  245. package/js/src/coincheck.js +2 -2
  246. package/js/src/coinex.d.ts +1 -1
  247. package/js/src/coinex.js +1 -1
  248. package/js/src/coinmate.d.ts +1 -1
  249. package/js/src/coinmate.js +1 -1
  250. package/js/src/coinmetro.d.ts +1 -1
  251. package/js/src/coinmetro.js +1 -1
  252. package/js/src/coinone.d.ts +1 -1
  253. package/js/src/coinone.js +1 -1
  254. package/js/src/coinsph.d.ts +1 -1
  255. package/js/src/coinsph.js +1 -1
  256. package/js/src/coinspot.d.ts +1 -1
  257. package/js/src/coinspot.js +1 -1
  258. package/js/src/cryptocom.d.ts +1 -1
  259. package/js/src/cryptocom.js +1 -1
  260. package/js/src/cryptomus.d.ts +1 -1
  261. package/js/src/cryptomus.js +2 -2
  262. package/js/src/deepcoin.d.ts +1 -1
  263. package/js/src/deepcoin.js +1 -1
  264. package/js/src/delta.d.ts +1 -1
  265. package/js/src/delta.js +1 -1
  266. package/js/src/deribit.d.ts +1 -1
  267. package/js/src/deribit.js +1 -1
  268. package/js/src/derive.js +2 -3
  269. package/js/src/digifinex.d.ts +1 -1
  270. package/js/src/digifinex.js +1 -1
  271. package/js/src/dydx.d.ts +1 -1
  272. package/js/src/dydx.js +2 -2
  273. package/js/src/exmo.d.ts +1 -1
  274. package/js/src/exmo.js +1 -1
  275. package/js/src/extended.d.ts +1 -1
  276. package/js/src/extended.js +5 -5
  277. package/js/src/foxbit.d.ts +1 -1
  278. package/js/src/foxbit.js +1 -1
  279. package/js/src/gate.d.ts +1 -1
  280. package/js/src/gate.js +3 -3
  281. package/js/src/gateeu.d.ts +4 -0
  282. package/js/src/gateeu.js +59 -0
  283. package/js/src/gemini.d.ts +1 -1
  284. package/js/src/gemini.js +1 -1
  285. package/js/src/grvt.js +1 -1
  286. package/js/src/hashkey.d.ts +1 -1
  287. package/js/src/hashkey.js +2 -2
  288. package/js/src/hibachi.js +1 -1
  289. package/js/src/hitbtc.d.ts +1 -1
  290. package/js/src/hitbtc.js +1 -1
  291. package/js/src/hollaex.d.ts +1 -1
  292. package/js/src/hollaex.js +1 -1
  293. package/js/src/htx.d.ts +1 -1
  294. package/js/src/htx.js +1 -1
  295. package/js/src/hyperliquid.d.ts +1 -1
  296. package/js/src/hyperliquid.js +1 -1
  297. package/js/src/independentreserve.d.ts +1 -1
  298. package/js/src/independentreserve.js +1 -1
  299. package/js/src/indodax.d.ts +1 -1
  300. package/js/src/indodax.js +1 -1
  301. package/js/src/kraken.d.ts +1 -1
  302. package/js/src/kraken.js +1 -1
  303. package/js/src/kucoin.d.ts +1 -1
  304. package/js/src/kucoin.js +1 -1
  305. package/js/src/latoken.d.ts +1 -1
  306. package/js/src/latoken.js +1 -1
  307. package/js/src/lbank.d.ts +1 -1
  308. package/js/src/lbank.js +1 -1
  309. package/js/src/lighter.d.ts +1 -1
  310. package/js/src/lighter.js +1 -1
  311. package/js/src/luno.d.ts +1 -1
  312. package/js/src/luno.js +2 -2
  313. package/js/src/mercado.d.ts +1 -1
  314. package/js/src/mercado.js +1 -1
  315. package/js/src/mexc.d.ts +1 -1
  316. package/js/src/mexc.js +1 -1
  317. package/js/src/modetrade.d.ts +1 -1
  318. package/js/src/modetrade.js +3 -5
  319. package/js/src/ndax.d.ts +1 -1
  320. package/js/src/ndax.js +1 -1
  321. package/js/src/novadax.d.ts +1 -1
  322. package/js/src/novadax.js +1 -1
  323. package/js/src/okx.d.ts +1 -1
  324. package/js/src/okx.js +1 -1
  325. package/js/src/onetrading.d.ts +1 -1
  326. package/js/src/onetrading.js +2 -2
  327. package/js/src/p2b.d.ts +1 -1
  328. package/js/src/p2b.js +2 -3
  329. package/js/src/pacifica.d.ts +1 -1
  330. package/js/src/pacifica.js +2 -2
  331. package/js/src/paradex.d.ts +1 -1
  332. package/js/src/paradex.js +1 -1
  333. package/js/src/paymium.d.ts +1 -1
  334. package/js/src/paymium.js +1 -1
  335. package/js/src/phemex.d.ts +1 -1
  336. package/js/src/phemex.js +1 -1
  337. package/js/src/poloniex.d.ts +1 -1
  338. package/js/src/poloniex.js +1 -1
  339. package/js/src/pro/aftermath.d.ts +1 -1
  340. package/js/src/pro/aftermath.js +1 -1
  341. package/js/src/pro/alpaca.d.ts +1 -1
  342. package/js/src/pro/alpaca.js +1 -1
  343. package/js/src/pro/apex.d.ts +2 -2
  344. package/js/src/pro/apex.js +2 -2
  345. package/js/src/pro/ascendex.d.ts +1 -1
  346. package/js/src/pro/ascendex.js +1 -1
  347. package/js/src/pro/aster.d.ts +4 -4
  348. package/js/src/pro/aster.js +4 -4
  349. package/js/src/pro/backpack.d.ts +4 -4
  350. package/js/src/pro/backpack.js +4 -4
  351. package/js/src/pro/binance.d.ts +5 -5
  352. package/js/src/pro/binance.js +5 -5
  353. package/js/src/pro/bingx.d.ts +2 -2
  354. package/js/src/pro/bingx.js +2 -2
  355. package/js/src/pro/bitfinex.d.ts +1 -1
  356. package/js/src/pro/bitfinex.js +1 -1
  357. package/js/src/pro/bitget.d.ts +4 -4
  358. package/js/src/pro/bitget.js +4 -4
  359. package/js/src/pro/bitmart.d.ts +4 -4
  360. package/js/src/pro/bitmart.js +4 -4
  361. package/js/src/pro/bitmex.d.ts +2 -2
  362. package/js/src/pro/bitmex.js +2 -2
  363. package/js/src/pro/bitopro.d.ts +1 -1
  364. package/js/src/pro/bitopro.js +1 -1
  365. package/js/src/pro/bitstamp.d.ts +1 -1
  366. package/js/src/pro/bitstamp.js +1 -1
  367. package/js/src/pro/bittrade.d.ts +1 -1
  368. package/js/src/pro/bittrade.js +1 -1
  369. package/js/src/pro/bitvavo.d.ts +1 -1
  370. package/js/src/pro/bitvavo.js +1 -1
  371. package/js/src/pro/blockchaincom.d.ts +1 -1
  372. package/js/src/pro/blockchaincom.js +1 -1
  373. package/js/src/pro/blofin.d.ts +2 -2
  374. package/js/src/pro/blofin.js +2 -2
  375. package/js/src/pro/bullish.d.ts +1 -1
  376. package/js/src/pro/bullish.js +1 -1
  377. package/js/src/pro/bybit.d.ts +4 -4
  378. package/js/src/pro/bybit.js +4 -4
  379. package/js/src/pro/bydfi.d.ts +4 -4
  380. package/js/src/pro/bydfi.js +4 -4
  381. package/js/src/pro/cex.d.ts +1 -1
  382. package/js/src/pro/cex.js +1 -1
  383. package/js/src/pro/coinbase.d.ts +3 -3
  384. package/js/src/pro/coinbase.js +3 -3
  385. package/js/src/pro/coinbaseexchange.d.ts +2 -2
  386. package/js/src/pro/coinbaseexchange.js +2 -2
  387. package/js/src/pro/coinbaseinternational.d.ts +2 -2
  388. package/js/src/pro/coinbaseinternational.js +2 -2
  389. package/js/src/pro/coincheck.d.ts +1 -1
  390. package/js/src/pro/coincheck.js +1 -1
  391. package/js/src/pro/coinex.d.ts +2 -2
  392. package/js/src/pro/coinex.js +2 -2
  393. package/js/src/pro/coinone.d.ts +1 -1
  394. package/js/src/pro/coinone.js +1 -1
  395. package/js/src/pro/cryptocom.d.ts +4 -4
  396. package/js/src/pro/cryptocom.js +4 -4
  397. package/js/src/pro/deepcoin.d.ts +2 -2
  398. package/js/src/pro/deepcoin.js +2 -2
  399. package/js/src/pro/deribit.d.ts +2 -2
  400. package/js/src/pro/deribit.js +2 -2
  401. package/js/src/pro/derive.d.ts +2 -2
  402. package/js/src/pro/derive.js +2 -2
  403. package/js/src/pro/dydx.d.ts +2 -2
  404. package/js/src/pro/dydx.js +2 -2
  405. package/js/src/pro/exmo.d.ts +1 -1
  406. package/js/src/pro/exmo.js +1 -1
  407. package/js/src/pro/extended.d.ts +1 -1
  408. package/js/src/pro/extended.js +1 -1
  409. package/js/src/pro/gate.d.ts +3 -2
  410. package/js/src/pro/gate.js +46 -15
  411. package/js/src/pro/gateeu.d.ts +4 -0
  412. package/js/src/pro/gateeu.js +31 -0
  413. package/js/src/pro/gemini.d.ts +2 -2
  414. package/js/src/pro/gemini.js +2 -3
  415. package/js/src/pro/grvt.d.ts +2 -2
  416. package/js/src/pro/grvt.js +2 -2
  417. package/js/src/pro/hashkey.d.ts +1 -1
  418. package/js/src/pro/hashkey.js +1 -1
  419. package/js/src/pro/hitbtc.d.ts +1 -1
  420. package/js/src/pro/hitbtc.js +1 -1
  421. package/js/src/pro/hollaex.d.ts +1 -1
  422. package/js/src/pro/hollaex.js +1 -1
  423. package/js/src/pro/htx.d.ts +9 -8
  424. package/js/src/pro/htx.js +440 -100
  425. package/js/src/pro/hyperliquid.d.ts +2 -2
  426. package/js/src/pro/hyperliquid.js +2 -2
  427. package/js/src/pro/independentreserve.d.ts +1 -1
  428. package/js/src/pro/independentreserve.js +1 -1
  429. package/js/src/pro/kraken.d.ts +2 -2
  430. package/js/src/pro/kraken.js +2 -2
  431. package/js/src/pro/krakenfutures.d.ts +2 -2
  432. package/js/src/pro/krakenfutures.js +2 -2
  433. package/js/src/pro/kucoin.d.ts +4 -4
  434. package/js/src/pro/kucoin.js +4 -4
  435. package/js/src/pro/lighter.d.ts +2 -2
  436. package/js/src/pro/lighter.js +2 -2
  437. package/js/src/pro/luno.d.ts +1 -1
  438. package/js/src/pro/luno.js +1 -1
  439. package/js/src/pro/mexc.d.ts +2 -2
  440. package/js/src/pro/mexc.js +2 -2
  441. package/js/src/pro/modetrade.d.ts +1 -1
  442. package/js/src/pro/modetrade.js +1 -1
  443. package/js/src/pro/ndax.d.ts +1 -1
  444. package/js/src/pro/ndax.js +1 -1
  445. package/js/src/pro/okx.d.ts +4 -4
  446. package/js/src/pro/okx.js +4 -4
  447. package/js/src/pro/onetrading.d.ts +1 -1
  448. package/js/src/pro/onetrading.js +1 -1
  449. package/js/src/pro/p2b.d.ts +1 -1
  450. package/js/src/pro/p2b.js +1 -1
  451. package/js/src/pro/pacifica.d.ts +2 -2
  452. package/js/src/pro/pacifica.js +2 -2
  453. package/js/src/pro/paradex.d.ts +1 -1
  454. package/js/src/pro/paradex.js +1 -1
  455. package/js/src/pro/phemex.d.ts +1 -1
  456. package/js/src/pro/phemex.js +1 -1
  457. package/js/src/pro/poloniex.d.ts +1 -1
  458. package/js/src/pro/poloniex.js +1 -1
  459. package/js/src/pro/toobit.d.ts +2 -2
  460. package/js/src/pro/toobit.js +2 -2
  461. package/js/src/pro/upbit.d.ts +1 -1
  462. package/js/src/pro/upbit.js +1 -1
  463. package/js/src/pro/weex.d.ts +4 -4
  464. package/js/src/pro/weex.js +4 -4
  465. package/js/src/pro/whitebit.d.ts +1 -1
  466. package/js/src/pro/whitebit.js +1 -1
  467. package/js/src/pro/woo.d.ts +2 -2
  468. package/js/src/pro/woo.js +2 -2
  469. package/js/src/pro/woofipro.d.ts +1 -1
  470. package/js/src/pro/woofipro.js +1 -1
  471. package/js/src/tokocrypto.d.ts +1 -1
  472. package/js/src/tokocrypto.js +1 -1
  473. package/js/src/toobit.d.ts +1 -1
  474. package/js/src/toobit.js +2 -2
  475. package/js/src/upbit.d.ts +1 -1
  476. package/js/src/upbit.js +1 -1
  477. package/js/src/weex.d.ts +1 -1
  478. package/js/src/weex.js +2 -2
  479. package/js/src/whitebit.d.ts +1 -1
  480. package/js/src/whitebit.js +1 -1
  481. package/js/src/woo.d.ts +1 -1
  482. package/js/src/woo.js +1 -1
  483. package/js/src/woofipro.d.ts +1 -1
  484. package/js/src/woofipro.js +2 -4
  485. package/js/src/xt.js +1 -1
  486. package/js/src/zaif.d.ts +1 -1
  487. package/js/src/zaif.js +2 -2
  488. package/js/src/zebpay.d.ts +1 -1
  489. package/js/src/zebpay.js +2 -2
  490. package/package.json +18 -8
  491. package/js/src/static_dependencies/jsencrypt/JSEncrypt.d.ts +0 -116
  492. package/js/src/static_dependencies/jsencrypt/JSEncrypt.js +0 -194
  493. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +0 -142
  494. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.js +0 -307
  495. package/js/src/static_dependencies/jsencrypt/index.d.ts +0 -3
  496. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +0 -51
  497. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.js +0 -565
  498. package/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.d.ts +0 -5
  499. package/js/src/static_dependencies/jsencrypt/lib/asn1js/base64.js +0 -94
  500. package/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.d.ts +0 -3
  501. package/js/src/static_dependencies/jsencrypt/lib/asn1js/hex.js +0 -70
  502. package/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.d.ts +0 -9
  503. package/js/src/static_dependencies/jsencrypt/lib/asn1js/int10.js +0 -91
  504. package/js/src/static_dependencies/jsencrypt/lib/asn1js/oids.d.ts +0 -9778
  505. package/js/src/static_dependencies/jsencrypt/lib/asn1js/oids.js +0 -1968
  506. package/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.d.ts +0 -3
  507. package/js/src/static_dependencies/jsencrypt/lib/jsbn/base64.js +0 -25
  508. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +0 -101
  509. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.js +0 -1757
  510. package/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.d.ts +0 -10
  511. package/js/src/static_dependencies/jsencrypt/lib/jsbn/prng4.js +0 -50
  512. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.d.ts +0 -3
  513. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rng.js +0 -80
  514. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.d.ts +0 -23
  515. package/js/src/static_dependencies/jsencrypt/lib/jsbn/rsa.js +0 -377
  516. package/js/src/static_dependencies/jsencrypt/lib/jsbn/util.d.ts +0 -7
  517. package/js/src/static_dependencies/jsencrypt/lib/jsbn/util.js +0 -64
  518. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.d.ts +0 -24
  519. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +0 -1627
  520. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.d.ts +0 -5
  521. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/yahoo.js +0 -75
@@ -1,194 +0,0 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
- import { b64tohex, hex2b64 } from "./lib/jsbn/base64.js";
8
- import { JSEncryptRSAKey } from "./JSEncryptRSAKey.js";
9
- const version = typeof process !== 'undefined'
10
- ? process.env?.npm_package_version
11
- : undefined;
12
- /**
13
- *
14
- * @param {object} [options = {}] - An object to customize JSEncrypt behaviour
15
- * possible parameters are:
16
- * - default_key_size {number} default: 1024 the key size in bit
17
- * - default_public_exponent {string} default: '010001' the hexadecimal representation of the public exponent
18
- * - log {boolean} default: false whether log warn/error or not
19
- * @constructor
20
- */
21
- export class JSEncrypt {
22
- constructor(options = {}) {
23
- options = options || {};
24
- this.default_key_size = options.default_key_size
25
- ? parseInt(options.default_key_size, 10)
26
- : 1024;
27
- this.default_public_exponent = options.default_public_exponent || "010001"; // 65537 default openssl public exponent for rsa key type
28
- this.log = options.log || false;
29
- // The private and public key.
30
- this.key = null;
31
- }
32
- static { this.version = version; }
33
- /**
34
- * Method to set the rsa key parameter (one method is enough to set both the public
35
- * and the private key, since the private key contains the public key paramenters)
36
- * Log a warning if logs are enabled
37
- * @param {Object|string} key the pem encoded string or an object (with or without header/footer)
38
- * @public
39
- */
40
- setKey(key) {
41
- if (this.log && this.key) {
42
- console.warn("A key was already set, overriding existing.");
43
- }
44
- this.key = new JSEncryptRSAKey(key);
45
- }
46
- /**
47
- * Proxy method for setKey, for api compatibility
48
- * @see setKey
49
- * @public
50
- */
51
- setPrivateKey(privkey) {
52
- // Create the key.
53
- this.setKey(privkey);
54
- }
55
- /**
56
- * Proxy method for setKey, for api compatibility
57
- * @see setKey
58
- * @public
59
- */
60
- setPublicKey(pubkey) {
61
- // Sets the public key.
62
- this.setKey(pubkey);
63
- }
64
- /**
65
- * Proxy method for RSAKey object's decrypt, decrypt the string using the private
66
- * components of the rsa key object. Note that if the object was not set will be created
67
- * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
68
- * @param {string} str base64 encoded crypted string to decrypt
69
- * @return {string} the decrypted string
70
- * @public
71
- */
72
- decrypt(str) {
73
- // Return the decrypted string.
74
- try {
75
- return this.getKey().decrypt(b64tohex(str));
76
- }
77
- catch (ex) {
78
- return false;
79
- }
80
- }
81
- /**
82
- * Proxy method for RSAKey object's encrypt, encrypt the string using the public
83
- * components of the rsa key object. Note that if the object was not set will be created
84
- * on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
85
- * @param {string} str the string to encrypt
86
- * @return {string} the encrypted string encoded in base64
87
- * @public
88
- */
89
- encrypt(str) {
90
- // Return the encrypted string.
91
- try {
92
- return hex2b64(this.getKey().encrypt(str));
93
- }
94
- catch (ex) {
95
- return false;
96
- }
97
- }
98
- /**
99
- * Proxy method for RSAKey object's sign.
100
- * @param {string} str the string to sign
101
- * @param {function} digestMethod hash method
102
- * @param {string} digestName the name of the hash algorithm
103
- * @return {string} the signature encoded in base64
104
- * @public
105
- */
106
- sign(str, digestMethod, digestName) {
107
- // return the RSA signature of 'str' in 'hex' format.
108
- try {
109
- return hex2b64(this.getKey().sign(str, digestMethod, digestName));
110
- }
111
- catch (ex) {
112
- return false;
113
- }
114
- }
115
- /**
116
- * Proxy method for RSAKey object's verify.
117
- * @param {string} str the string to verify
118
- * @param {string} signature the signature encoded in base64 to compare the string to
119
- * @param {function} digestMethod hash method
120
- * @return {boolean} whether the data and signature match
121
- * @public
122
- */
123
- verify(str, signature, digestMethod) {
124
- // Return the decrypted 'digest' of the signature.
125
- try {
126
- return this.getKey().verify(str, b64tohex(signature), digestMethod);
127
- }
128
- catch (ex) {
129
- return false;
130
- }
131
- }
132
- /**
133
- * Getter for the current JSEncryptRSAKey object. If it doesn't exists a new object
134
- * will be created and returned
135
- * @param {callback} [cb] the callback to be called if we want the key to be generated
136
- * in an async fashion
137
- * @returns {JSEncryptRSAKey} the JSEncryptRSAKey object
138
- * @public
139
- */
140
- getKey(cb) {
141
- // Only create new if it does not exist.
142
- if (!this.key) {
143
- // Get a new private key.
144
- this.key = new JSEncryptRSAKey();
145
- if (cb && {}.toString.call(cb) === "[object Function]") {
146
- this.key.generateAsync(this.default_key_size, this.default_public_exponent, cb);
147
- return;
148
- }
149
- // Generate the key.
150
- this.key.generate(this.default_key_size, this.default_public_exponent);
151
- }
152
- return this.key;
153
- }
154
- /**
155
- * Returns the pem encoded representation of the private key
156
- * If the key doesn't exists a new key will be created
157
- * @returns {string} pem encoded representation of the private key WITH header and footer
158
- * @public
159
- */
160
- getPrivateKey() {
161
- // Return the private representation of this key.
162
- return this.getKey().getPrivateKey();
163
- }
164
- /**
165
- * Returns the pem encoded representation of the private key
166
- * If the key doesn't exists a new key will be created
167
- * @returns {string} pem encoded representation of the private key WITHOUT header and footer
168
- * @public
169
- */
170
- getPrivateKeyB64() {
171
- // Return the private representation of this key.
172
- return this.getKey().getPrivateBaseKeyB64();
173
- }
174
- /**
175
- * Returns the pem encoded representation of the public key
176
- * If the key doesn't exists a new key will be created
177
- * @returns {string} pem encoded representation of the public key WITH header and footer
178
- * @public
179
- */
180
- getPublicKey() {
181
- // Return the private representation of this key.
182
- return this.getKey().getPublicKey();
183
- }
184
- /**
185
- * Returns the pem encoded representation of the public key
186
- * If the key doesn't exists a new key will be created
187
- * @returns {string} pem encoded representation of the public key WITHOUT header and footer
188
- * @public
189
- */
190
- getPublicKeyB64() {
191
- // Return the private representation of this key.
192
- return this.getKey().getPublicBaseKeyB64();
193
- }
194
- }
@@ -1,142 +0,0 @@
1
- import { RSAKey } from "./lib/jsbn/rsa.js";
2
- /**
3
- * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.
4
- * This object is just a decorator for parsing the key parameter
5
- * @param {string|Object} key - The key in string format, or an object containing
6
- * the parameters needed to build a RSAKey object.
7
- * @constructor
8
- */
9
- export declare class JSEncryptRSAKey extends RSAKey {
10
- constructor(key?: string);
11
- /**
12
- * Method to parse a pem encoded string containing both a public or private key.
13
- * The method will translate the pem encoded string in a der encoded string and
14
- * will parse private key and public key parameters. This method accepts public key
15
- * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).
16
- *
17
- * @todo Check how many rsa formats use the same format of pkcs #1.
18
- *
19
- * The format is defined as:
20
- * PublicKeyInfo ::= SEQUENCE {
21
- * algorithm AlgorithmIdentifier,
22
- * PublicKey BIT STRING
23
- * }
24
- * Where AlgorithmIdentifier is:
25
- * AlgorithmIdentifier ::= SEQUENCE {
26
- * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
27
- * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
28
- * }
29
- * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
30
- * RSAPublicKey ::= SEQUENCE {
31
- * modulus INTEGER, -- n
32
- * publicExponent INTEGER -- e
33
- * }
34
- * it's possible to examine the structure of the keys obtained from openssl using
35
- * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/
36
- * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer
37
- * @private
38
- */
39
- parseKey(pem: string): boolean;
40
- /**
41
- * Translate rsa parameters in a hex encoded string representing the rsa key.
42
- *
43
- * The translation follow the ASN.1 notation :
44
- * RSAPrivateKey ::= SEQUENCE {
45
- * version Version,
46
- * modulus INTEGER, -- n
47
- * publicExponent INTEGER, -- e
48
- * privateExponent INTEGER, -- d
49
- * prime1 INTEGER, -- p
50
- * prime2 INTEGER, -- q
51
- * exponent1 INTEGER, -- d mod (p1)
52
- * exponent2 INTEGER, -- d mod (q-1)
53
- * coefficient INTEGER, -- (inverse of q) mod p
54
- * }
55
- * @returns {string} DER Encoded String representing the rsa private key
56
- * @private
57
- */
58
- getPrivateBaseKey(): any;
59
- /**
60
- * base64 (pem) encoded version of the DER encoded representation
61
- * @returns {string} pem encoded representation without header and footer
62
- * @public
63
- */
64
- getPrivateBaseKeyB64(): string;
65
- /**
66
- * Translate rsa parameters in a hex encoded string representing the rsa public key.
67
- * The representation follow the ASN.1 notation :
68
- * PublicKeyInfo ::= SEQUENCE {
69
- * algorithm AlgorithmIdentifier,
70
- * PublicKey BIT STRING
71
- * }
72
- * Where AlgorithmIdentifier is:
73
- * AlgorithmIdentifier ::= SEQUENCE {
74
- * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
75
- * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
76
- * }
77
- * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
78
- * RSAPublicKey ::= SEQUENCE {
79
- * modulus INTEGER, -- n
80
- * publicExponent INTEGER -- e
81
- * }
82
- * @returns {string} DER Encoded String representing the rsa public key
83
- * @private
84
- */
85
- getPublicBaseKey(): any;
86
- /**
87
- * base64 (pem) encoded version of the DER encoded representation
88
- * @returns {string} pem encoded representation without header and footer
89
- * @public
90
- */
91
- getPublicBaseKeyB64(): string;
92
- /**
93
- * wrap the string in block of width chars. The default value for rsa keys is 64
94
- * characters.
95
- * @param {string} str the pem encoded string without header and footer
96
- * @param {Number} [width=64] - the length the string has to be wrapped at
97
- * @returns {string}
98
- * @private
99
- */
100
- static wordwrap(str: string, width?: number): string;
101
- /**
102
- * Retrieve the pem encoded private key
103
- * @returns {string} the pem encoded private key with header/footer
104
- * @public
105
- */
106
- getPrivateKey(): string;
107
- /**
108
- * Retrieve the pem encoded public key
109
- * @returns {string} the pem encoded public key with header/footer
110
- * @public
111
- */
112
- getPublicKey(): string;
113
- /**
114
- * Check if the object contains the necessary parameters to populate the rsa modulus
115
- * and public exponent parameters.
116
- * @param {object} [obj={}] - An object that may contain the two public key
117
- * parameters
118
- * @returns {boolean} true if the object contains both the modulus and the public exponent
119
- * properties (n and e)
120
- * @todo check for types of n and e. N should be a parseable bigInt object, E should
121
- * be a parseable integer number
122
- * @private
123
- */
124
- static hasPublicKeyProperty(obj: object): boolean;
125
- /**
126
- * Check if the object contains ALL the parameters of an RSA key.
127
- * @param {object} [obj={}] - An object that may contain nine rsa key
128
- * parameters
129
- * @returns {boolean} true if the object contains all the parameters needed
130
- * @todo check for types of the parameters all the parameters but the public exponent
131
- * should be parseable bigint objects, the public exponent should be a parseable integer number
132
- * @private
133
- */
134
- static hasPrivateKeyProperty(obj: object): boolean;
135
- /**
136
- * Parse the properties of obj in the current rsa object. Obj should AT LEAST
137
- * include the modulus and public exponent (n, e) parameters.
138
- * @param {object} obj - the object containing rsa parameters
139
- * @private
140
- */
141
- parsePropertiesFrom(obj: any): void;
142
- }
@@ -1,307 +0,0 @@
1
- // ----------------------------------------------------------------------------
2
-
3
- // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
- // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
- // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
-
7
- import { hex2b64 } from "./lib/jsbn/base64.js";
8
- import { Hex } from "./lib/asn1js/hex.js";
9
- import { Base64 } from "./lib/asn1js/base64.js";
10
- import { ASN1 } from "./lib/asn1js/asn1.js";
11
- import { RSAKey } from "./lib/jsbn/rsa.js";
12
- import { parseBigInt } from "./lib/jsbn/jsbn.js";
13
- import { KJUR } from "./lib/jsrsasign/asn1-1.0.js";
14
- /**
15
- * Create a new JSEncryptRSAKey that extends Tom Wu's RSA key object.
16
- * This object is just a decorator for parsing the key parameter
17
- * @param {string|Object} key - The key in string format, or an object containing
18
- * the parameters needed to build a RSAKey object.
19
- * @constructor
20
- */
21
- export class JSEncryptRSAKey extends RSAKey {
22
- constructor(key) {
23
- super();
24
- // Call the super constructor.
25
- // RSAKey.call(this);
26
- // If a key key was provided.
27
- if (key) {
28
- // If this is a string...
29
- if (typeof key === "string") {
30
- this.parseKey(key);
31
- }
32
- else if (JSEncryptRSAKey.hasPrivateKeyProperty(key) ||
33
- JSEncryptRSAKey.hasPublicKeyProperty(key)) {
34
- // Set the values for the key.
35
- this.parsePropertiesFrom(key);
36
- }
37
- }
38
- }
39
- /**
40
- * Method to parse a pem encoded string containing both a public or private key.
41
- * The method will translate the pem encoded string in a der encoded string and
42
- * will parse private key and public key parameters. This method accepts public key
43
- * in the rsaencryption pkcs #1 format (oid: 1.2.840.113549.1.1.1).
44
- *
45
- * @todo Check how many rsa formats use the same format of pkcs #1.
46
- *
47
- * The format is defined as:
48
- * PublicKeyInfo ::= SEQUENCE {
49
- * algorithm AlgorithmIdentifier,
50
- * PublicKey BIT STRING
51
- * }
52
- * Where AlgorithmIdentifier is:
53
- * AlgorithmIdentifier ::= SEQUENCE {
54
- * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
55
- * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
56
- * }
57
- * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
58
- * RSAPublicKey ::= SEQUENCE {
59
- * modulus INTEGER, -- n
60
- * publicExponent INTEGER -- e
61
- * }
62
- * it's possible to examine the structure of the keys obtained from openssl using
63
- * an asn.1 dumper as the one used here to parse the components: http://lapo.it/asn1js/
64
- * @argument {string} pem the pem encoded string, can include the BEGIN/END header/footer
65
- * @private
66
- */
67
- parseKey(pem) {
68
- try {
69
- let modulus = 0;
70
- let public_exponent = 0;
71
- const reHex = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/;
72
- const der = reHex.test(pem) ? Hex.decode(pem) : Base64.unarmor(pem);
73
- let asn1 = ASN1.decode(der);
74
- // Fixes a bug with OpenSSL 1.0+ private keys
75
- if (asn1.sub.length === 3) {
76
- asn1 = asn1.sub[2].sub[0];
77
- }
78
- if (asn1.sub.length === 9) {
79
- // Parse the private key.
80
- modulus = asn1.sub[1].getHexStringValue(); // bigint
81
- this.n = parseBigInt(modulus, 16);
82
- public_exponent = asn1.sub[2].getHexStringValue(); // int
83
- this.e = parseInt(public_exponent, 16);
84
- const private_exponent = asn1.sub[3].getHexStringValue(); // bigint
85
- this.d = parseBigInt(private_exponent, 16);
86
- const prime1 = asn1.sub[4].getHexStringValue(); // bigint
87
- this.p = parseBigInt(prime1, 16);
88
- const prime2 = asn1.sub[5].getHexStringValue(); // bigint
89
- this.q = parseBigInt(prime2, 16);
90
- const exponent1 = asn1.sub[6].getHexStringValue(); // bigint
91
- this.dmp1 = parseBigInt(exponent1, 16);
92
- const exponent2 = asn1.sub[7].getHexStringValue(); // bigint
93
- this.dmq1 = parseBigInt(exponent2, 16);
94
- const coefficient = asn1.sub[8].getHexStringValue(); // bigint
95
- this.coeff = parseBigInt(coefficient, 16);
96
- }
97
- else if (asn1.sub.length === 2) {
98
- if (asn1.sub[0].sub) {
99
- // Parse ASN.1 SubjectPublicKeyInfo type as defined by X.509
100
- var bit_string = asn1.sub[1];
101
- var sequence = bit_string.sub[0];
102
- modulus = sequence.sub[0].getHexStringValue();
103
- this.n = parseBigInt(modulus, 16);
104
- public_exponent = sequence.sub[1].getHexStringValue();
105
- this.e = parseInt(public_exponent, 16);
106
- }
107
- else {
108
- // Parse ASN.1 RSAPublicKey type as defined by PKCS #1
109
- modulus = asn1.sub[0].getHexStringValue();
110
- this.n = parseBigInt(modulus, 16);
111
- public_exponent = asn1.sub[1].getHexStringValue();
112
- this.e = parseInt(public_exponent, 16);
113
- }
114
- }
115
- else {
116
- return false;
117
- }
118
- return true;
119
- }
120
- catch (ex) {
121
- return false;
122
- }
123
- }
124
- /**
125
- * Translate rsa parameters in a hex encoded string representing the rsa key.
126
- *
127
- * The translation follow the ASN.1 notation :
128
- * RSAPrivateKey ::= SEQUENCE {
129
- * version Version,
130
- * modulus INTEGER, -- n
131
- * publicExponent INTEGER, -- e
132
- * privateExponent INTEGER, -- d
133
- * prime1 INTEGER, -- p
134
- * prime2 INTEGER, -- q
135
- * exponent1 INTEGER, -- d mod (p1)
136
- * exponent2 INTEGER, -- d mod (q-1)
137
- * coefficient INTEGER, -- (inverse of q) mod p
138
- * }
139
- * @returns {string} DER Encoded String representing the rsa private key
140
- * @private
141
- */
142
- getPrivateBaseKey() {
143
- const options = {
144
- array: [
145
- new KJUR.asn1.DERInteger({ int: 0 }),
146
- new KJUR.asn1.DERInteger({ bigint: this.n }),
147
- new KJUR.asn1.DERInteger({ int: this.e }),
148
- new KJUR.asn1.DERInteger({ bigint: this.d }),
149
- new KJUR.asn1.DERInteger({ bigint: this.p }),
150
- new KJUR.asn1.DERInteger({ bigint: this.q }),
151
- new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),
152
- new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),
153
- new KJUR.asn1.DERInteger({ bigint: this.coeff }),
154
- ],
155
- };
156
- const seq = new KJUR.asn1.DERSequence(options);
157
- return seq.getEncodedHex();
158
- }
159
- /**
160
- * base64 (pem) encoded version of the DER encoded representation
161
- * @returns {string} pem encoded representation without header and footer
162
- * @public
163
- */
164
- getPrivateBaseKeyB64() {
165
- return hex2b64(this.getPrivateBaseKey());
166
- }
167
- /**
168
- * Translate rsa parameters in a hex encoded string representing the rsa public key.
169
- * The representation follow the ASN.1 notation :
170
- * PublicKeyInfo ::= SEQUENCE {
171
- * algorithm AlgorithmIdentifier,
172
- * PublicKey BIT STRING
173
- * }
174
- * Where AlgorithmIdentifier is:
175
- * AlgorithmIdentifier ::= SEQUENCE {
176
- * algorithm OBJECT IDENTIFIER, the OID of the enc algorithm
177
- * parameters ANY DEFINED BY algorithm OPTIONAL (NULL for PKCS #1)
178
- * }
179
- * and PublicKey is a SEQUENCE encapsulated in a BIT STRING
180
- * RSAPublicKey ::= SEQUENCE {
181
- * modulus INTEGER, -- n
182
- * publicExponent INTEGER -- e
183
- * }
184
- * @returns {string} DER Encoded String representing the rsa public key
185
- * @private
186
- */
187
- getPublicBaseKey() {
188
- const first_sequence = new KJUR.asn1.DERSequence({
189
- array: [
190
- new KJUR.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }), // RSA Encryption pkcs #1 oid
191
- new KJUR.asn1.DERNull(),
192
- ],
193
- });
194
- const second_sequence = new KJUR.asn1.DERSequence({
195
- array: [
196
- new KJUR.asn1.DERInteger({ bigint: this.n }),
197
- new KJUR.asn1.DERInteger({ int: this.e }),
198
- ],
199
- });
200
- const bit_string = new KJUR.asn1.DERBitString({
201
- hex: "00" + second_sequence.getEncodedHex(),
202
- });
203
- const seq = new KJUR.asn1.DERSequence({
204
- array: [first_sequence, bit_string],
205
- });
206
- return seq.getEncodedHex();
207
- }
208
- /**
209
- * base64 (pem) encoded version of the DER encoded representation
210
- * @returns {string} pem encoded representation without header and footer
211
- * @public
212
- */
213
- getPublicBaseKeyB64() {
214
- return hex2b64(this.getPublicBaseKey());
215
- }
216
- /**
217
- * wrap the string in block of width chars. The default value for rsa keys is 64
218
- * characters.
219
- * @param {string} str the pem encoded string without header and footer
220
- * @param {Number} [width=64] - the length the string has to be wrapped at
221
- * @returns {string}
222
- * @private
223
- */
224
- static wordwrap(str, width) {
225
- width = width || 64;
226
- if (!str) {
227
- return str;
228
- }
229
- const regex = "(.{1," + width + "})( +|$\n?)|(.{1," + width + "})";
230
- return str.match(RegExp(regex, "g")).join("\n");
231
- }
232
- /**
233
- * Retrieve the pem encoded private key
234
- * @returns {string} the pem encoded private key with header/footer
235
- * @public
236
- */
237
- getPrivateKey() {
238
- let key = "-----BEGIN RSA PRIVATE KEY-----\n";
239
- key += JSEncryptRSAKey.wordwrap(this.getPrivateBaseKeyB64()) + "\n";
240
- key += "-----END RSA PRIVATE KEY-----";
241
- return key;
242
- }
243
- /**
244
- * Retrieve the pem encoded public key
245
- * @returns {string} the pem encoded public key with header/footer
246
- * @public
247
- */
248
- getPublicKey() {
249
- let key = "-----BEGIN PUBLIC KEY-----\n";
250
- key += JSEncryptRSAKey.wordwrap(this.getPublicBaseKeyB64()) + "\n";
251
- key += "-----END PUBLIC KEY-----";
252
- return key;
253
- }
254
- /**
255
- * Check if the object contains the necessary parameters to populate the rsa modulus
256
- * and public exponent parameters.
257
- * @param {object} [obj={}] - An object that may contain the two public key
258
- * parameters
259
- * @returns {boolean} true if the object contains both the modulus and the public exponent
260
- * properties (n and e)
261
- * @todo check for types of n and e. N should be a parseable bigInt object, E should
262
- * be a parseable integer number
263
- * @private
264
- */
265
- static hasPublicKeyProperty(obj) {
266
- obj = obj || {};
267
- return obj.hasOwnProperty("n") && obj.hasOwnProperty("e");
268
- }
269
- /**
270
- * Check if the object contains ALL the parameters of an RSA key.
271
- * @param {object} [obj={}] - An object that may contain nine rsa key
272
- * parameters
273
- * @returns {boolean} true if the object contains all the parameters needed
274
- * @todo check for types of the parameters all the parameters but the public exponent
275
- * should be parseable bigint objects, the public exponent should be a parseable integer number
276
- * @private
277
- */
278
- static hasPrivateKeyProperty(obj) {
279
- obj = obj || {};
280
- return (obj.hasOwnProperty("n") &&
281
- obj.hasOwnProperty("e") &&
282
- obj.hasOwnProperty("d") &&
283
- obj.hasOwnProperty("p") &&
284
- obj.hasOwnProperty("q") &&
285
- obj.hasOwnProperty("dmp1") &&
286
- obj.hasOwnProperty("dmq1") &&
287
- obj.hasOwnProperty("coeff"));
288
- }
289
- /**
290
- * Parse the properties of obj in the current rsa object. Obj should AT LEAST
291
- * include the modulus and public exponent (n, e) parameters.
292
- * @param {object} obj - the object containing rsa parameters
293
- * @private
294
- */
295
- parsePropertiesFrom(obj) {
296
- this.n = obj.n;
297
- this.e = obj.e;
298
- if (obj.hasOwnProperty("d")) {
299
- this.d = obj.d;
300
- this.p = obj.p;
301
- this.q = obj.q;
302
- this.dmp1 = obj.dmp1;
303
- this.dmq1 = obj.dmq1;
304
- this.coeff = obj.coeff;
305
- }
306
- }
307
- }
@@ -1,3 +0,0 @@
1
- import { JSEncrypt } from './JSEncrypt.js';
2
- export { JSEncrypt };
3
- export default JSEncrypt;