@aptos-labs/ts-sdk 1.8.0 → 1.9.1-plugin.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (413) hide show
  1. package/README.md +1 -1
  2. package/dist/common/index.d.ts +1204 -969
  3. package/dist/common/index.js +26 -26
  4. package/dist/common/index.js.map +1 -1
  5. package/dist/esm/api/account.d.mts +12 -6
  6. package/dist/esm/api/account.mjs +1 -1
  7. package/dist/esm/api/ans.d.mts +11 -12
  8. package/dist/esm/api/ans.mjs +1 -1
  9. package/dist/esm/api/aptos.d.mts +13 -14
  10. package/dist/esm/api/aptos.mjs +1 -1
  11. package/dist/esm/api/aptosConfig.d.mts +7 -0
  12. package/dist/esm/api/aptosConfig.mjs +1 -1
  13. package/dist/esm/api/coin.d.mts +13 -13
  14. package/dist/esm/api/coin.mjs +1 -1
  15. package/dist/esm/api/digitalAsset.d.mts +20 -10
  16. package/dist/esm/api/digitalAsset.mjs +1 -1
  17. package/dist/esm/api/event.mjs +1 -1
  18. package/dist/esm/api/faucet.mjs +1 -1
  19. package/dist/esm/api/fungibleAsset.d.mts +9 -10
  20. package/dist/esm/api/fungibleAsset.mjs +1 -1
  21. package/dist/esm/api/general.mjs +1 -1
  22. package/dist/esm/api/index.d.mts +13 -14
  23. package/dist/esm/api/index.mjs +1 -1
  24. package/dist/esm/api/staking.mjs +1 -1
  25. package/dist/esm/api/transaction.d.mts +5 -6
  26. package/dist/esm/api/transaction.mjs +1 -1
  27. package/dist/esm/api/transactionSubmission/build.d.mts +8 -8
  28. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/management.d.mts +11 -12
  30. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  31. package/dist/esm/api/transactionSubmission/sign.d.mts +11 -12
  32. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  33. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  34. package/dist/esm/api/transactionSubmission/simulate.d.mts +11 -11
  35. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  36. package/dist/esm/api/transactionSubmission/submit.d.mts +6 -6
  37. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  38. package/dist/esm/api/utils.mjs +1 -1
  39. package/dist/esm/assetUploader/assetUploader.d.mts +109 -0
  40. package/dist/esm/assetUploader/assetUploader.mjs +2 -0
  41. package/dist/esm/assetUploader/index.d.mts +24 -0
  42. package/dist/esm/assetUploader/index.mjs +2 -0
  43. package/dist/esm/assetUploader/irys.d.mts +64 -0
  44. package/dist/esm/assetUploader/irys.mjs +2 -0
  45. package/dist/esm/bcs/index.mjs +1 -1
  46. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  47. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  48. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  49. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  50. package/dist/esm/bcs/serializer.mjs +1 -1
  51. package/dist/esm/chunk-2RRFFRBV.mjs +2 -0
  52. package/dist/esm/chunk-2RRFFRBV.mjs.map +1 -0
  53. package/dist/esm/chunk-4LUWUDBX.mjs +2 -0
  54. package/dist/esm/{chunk-O57QZZF2.mjs → chunk-53UNV6UP.mjs} +2 -2
  55. package/dist/esm/chunk-53UNV6UP.mjs.map +1 -0
  56. package/dist/esm/{chunk-7D5LHQNS.mjs → chunk-5PIO6MFF.mjs} +2 -2
  57. package/dist/esm/{chunk-VKZCIGKY.mjs → chunk-6TUHLGW3.mjs} +2 -2
  58. package/dist/esm/{chunk-ENDUXRTK.mjs → chunk-7KPEDF2R.mjs} +2 -2
  59. package/dist/esm/chunk-AJRBTHDS.mjs +2 -0
  60. package/dist/esm/chunk-AJRBTHDS.mjs.map +1 -0
  61. package/dist/esm/chunk-AXVVJKE4.mjs +2 -0
  62. package/dist/esm/chunk-BKWJ4G7T.mjs +2 -0
  63. package/dist/esm/{chunk-VRSUCKJA.mjs.map → chunk-BKWJ4G7T.mjs.map} +1 -1
  64. package/dist/esm/{chunk-NL72WE3E.mjs → chunk-BZMO6Q6L.mjs} +2 -2
  65. package/dist/esm/chunk-CNEVWSWR.mjs +2 -0
  66. package/dist/esm/chunk-CNEVWSWR.mjs.map +1 -0
  67. package/dist/esm/chunk-CUWAGKEP.mjs +2 -0
  68. package/dist/esm/chunk-CUWAGKEP.mjs.map +1 -0
  69. package/dist/esm/chunk-DQHNZBA5.mjs +2 -0
  70. package/dist/esm/chunk-DQHNZBA5.mjs.map +1 -0
  71. package/dist/esm/{chunk-XBVORX5O.mjs → chunk-FAAWSTXC.mjs} +2 -2
  72. package/dist/esm/{chunk-AFPJ2XXN.mjs → chunk-FHWAJCJR.mjs} +2 -2
  73. package/dist/esm/{chunk-VPQ46CAO.mjs → chunk-GE7VQ5NZ.mjs} +2 -2
  74. package/dist/esm/{chunk-6FBKUTGF.mjs → chunk-GHYE26Q5.mjs} +2 -2
  75. package/dist/esm/chunk-GTCDSGOA.mjs +2 -0
  76. package/dist/esm/chunk-GTCDSGOA.mjs.map +1 -0
  77. package/dist/esm/chunk-H2FRCXQ6.mjs +2 -0
  78. package/dist/esm/chunk-H2FRCXQ6.mjs.map +1 -0
  79. package/dist/esm/chunk-HEPV52CH.mjs +2 -0
  80. package/dist/esm/chunk-HEPV52CH.mjs.map +1 -0
  81. package/dist/esm/chunk-HIUJDWMR.mjs +2 -0
  82. package/dist/esm/{chunk-MEPX7Z2Z.mjs.map → chunk-HIUJDWMR.mjs.map} +1 -1
  83. package/dist/esm/{chunk-2H5Z5EHH.mjs → chunk-HKAJ5N25.mjs} +2 -2
  84. package/dist/esm/chunk-HRKLPZL5.mjs +2 -0
  85. package/dist/esm/chunk-HRKLPZL5.mjs.map +1 -0
  86. package/dist/esm/{chunk-PJNPLRPR.mjs → chunk-HWTX3HVX.mjs} +2 -2
  87. package/dist/esm/chunk-IFVMIUMO.mjs +2 -0
  88. package/dist/esm/{chunk-6SRENFWH.mjs → chunk-IMYKTNDV.mjs} +2 -2
  89. package/dist/esm/{chunk-PMWH5IGI.mjs → chunk-ITALFUWD.mjs} +2 -2
  90. package/dist/esm/chunk-JB7ZOUYL.mjs +2 -0
  91. package/dist/esm/{chunk-2WFMD6C6.mjs → chunk-JMR7G5DT.mjs} +2 -2
  92. package/dist/esm/{chunk-S64WKSMI.mjs → chunk-JOIUR5QW.mjs} +2 -2
  93. package/dist/esm/{chunk-F7CR75CJ.mjs → chunk-JPG25VX2.mjs} +2 -2
  94. package/dist/esm/{chunk-F7CR75CJ.mjs.map → chunk-JPG25VX2.mjs.map} +1 -1
  95. package/dist/esm/{chunk-4OI7MPFH.mjs → chunk-K5XJKIFT.mjs} +2 -2
  96. package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
  97. package/dist/esm/{chunk-Q5HK3U64.mjs → chunk-L4PAU62E.mjs} +2 -2
  98. package/dist/esm/chunk-L7ORFGZ7.mjs +1 -0
  99. package/dist/esm/chunk-LG7RJQ57.mjs +2 -0
  100. package/dist/esm/chunk-LKKOIIBF.mjs +2 -0
  101. package/dist/esm/chunk-LKKOIIBF.mjs.map +1 -0
  102. package/dist/esm/chunk-M6TKSJ4I.mjs +2 -0
  103. package/dist/esm/chunk-ML7VTAHR.mjs +2 -0
  104. package/dist/esm/chunk-ML7VTAHR.mjs.map +1 -0
  105. package/dist/esm/{chunk-2DNPRIS5.mjs → chunk-MVWTTVQZ.mjs} +2 -2
  106. package/dist/esm/chunk-NA2H44NE.mjs +2 -0
  107. package/dist/esm/{chunk-CVEJHRAU.mjs → chunk-NCDLIACO.mjs} +1 -1
  108. package/dist/esm/chunk-NCDLIACO.mjs.map +1 -0
  109. package/dist/esm/chunk-NF35PRGD.mjs +2 -0
  110. package/dist/esm/{chunk-XZYPAQCU.mjs.map → chunk-NF35PRGD.mjs.map} +1 -1
  111. package/dist/esm/{chunk-R56OJ4XC.mjs → chunk-NYGCJ6EJ.mjs} +2 -2
  112. package/dist/esm/{chunk-PIXE7MN5.mjs → chunk-NZGON5TY.mjs} +2 -2
  113. package/dist/esm/chunk-O4EVRHDH.mjs +2 -0
  114. package/dist/esm/chunk-O4EVRHDH.mjs.map +1 -0
  115. package/dist/esm/{chunk-Y4AKS4CY.mjs → chunk-O5Q3RSEJ.mjs} +2 -2
  116. package/dist/esm/chunk-OP4VV2UO.mjs +2 -0
  117. package/dist/esm/chunk-OP4VV2UO.mjs.map +1 -0
  118. package/dist/esm/chunk-OYQRQC4Z.mjs +2 -0
  119. package/dist/esm/chunk-OYQRQC4Z.mjs.map +1 -0
  120. package/dist/esm/chunk-P3CMSOX6.mjs +2 -0
  121. package/dist/esm/chunk-P3CMSOX6.mjs.map +1 -0
  122. package/dist/esm/{chunk-LATJGGVX.mjs → chunk-PATJMQAG.mjs} +2 -2
  123. package/dist/esm/chunk-PEOCYUOO.mjs +2 -0
  124. package/dist/esm/chunk-PEOCYUOO.mjs.map +1 -0
  125. package/dist/esm/chunk-PISONN6H.mjs +2 -0
  126. package/dist/esm/chunk-PISONN6H.mjs.map +1 -0
  127. package/dist/esm/chunk-Q6YMSZLY.mjs +2 -0
  128. package/dist/esm/{chunk-SRZTA6QH.mjs.map → chunk-Q6YMSZLY.mjs.map} +1 -1
  129. package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
  130. package/dist/esm/chunk-QE4ASJ5K.mjs.map +1 -0
  131. package/dist/esm/{chunk-SXIFL5DQ.mjs → chunk-RC5K63LK.mjs} +2 -2
  132. package/dist/esm/chunk-RZNFFGTD.mjs +2 -0
  133. package/dist/esm/chunk-RZNFFGTD.mjs.map +1 -0
  134. package/dist/esm/{chunk-QGIJNA37.mjs → chunk-SKF6E6X7.mjs} +2 -2
  135. package/dist/esm/{chunk-ENKMOALS.mjs → chunk-SPKBGDFY.mjs} +2 -2
  136. package/dist/esm/chunk-SPKBGDFY.mjs.map +1 -0
  137. package/dist/esm/chunk-TWHTXYMB.mjs +2 -0
  138. package/dist/esm/{chunk-JQVT2K7G.mjs → chunk-UCFIV5UD.mjs} +2 -2
  139. package/dist/esm/{chunk-JJ6Y35DF.mjs → chunk-UFD443TT.mjs} +2 -2
  140. package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
  141. package/dist/esm/chunk-UVSRX4SV.mjs.map +1 -0
  142. package/dist/esm/{chunk-M3WNE7MU.mjs → chunk-UVTSJ2KP.mjs} +2 -2
  143. package/dist/esm/{chunk-KJGQ4ILY.mjs → chunk-UZ3SFWTM.mjs} +2 -2
  144. package/dist/esm/{chunk-V2FPYAK7.mjs → chunk-VPN3KEVB.mjs} +2 -2
  145. package/dist/esm/chunk-VQM4LMCW.mjs +2 -0
  146. package/dist/esm/{chunk-W4UDMBMU.mjs → chunk-VWWR2UAQ.mjs} +2 -2
  147. package/dist/esm/{chunk-F7MOQC7Z.mjs → chunk-VZJ62XF7.mjs} +2 -2
  148. package/dist/esm/{chunk-N4RBQZ2B.mjs → chunk-W2XLZW4Y.mjs} +2 -2
  149. package/dist/esm/{chunk-FRLPX47J.mjs → chunk-XH4B5K6W.mjs} +2 -2
  150. package/dist/esm/{chunk-4M46AWXX.mjs → chunk-XSCYT6TT.mjs} +2 -2
  151. package/dist/esm/{chunk-EUHPML5E.mjs → chunk-XSYZX66A.mjs} +2 -2
  152. package/dist/esm/{chunk-SPOHAEHR.mjs → chunk-YTHL7EKV.mjs} +2 -2
  153. package/dist/esm/{chunk-Q3HAJVCM.mjs → chunk-YXUOYXGZ.mjs} +2 -2
  154. package/dist/esm/chunk-ZAMLI7FP.mjs +2 -0
  155. package/dist/esm/chunk-ZAMLI7FP.mjs.map +1 -0
  156. package/dist/esm/client/core.mjs +1 -1
  157. package/dist/esm/client/get.mjs +1 -1
  158. package/dist/esm/client/index.mjs +1 -1
  159. package/dist/esm/client/post.mjs +1 -1
  160. package/dist/esm/client/types.mjs +1 -1
  161. package/dist/esm/core/account/Account.d.mts +20 -0
  162. package/dist/esm/core/account/Account.mjs +2 -0
  163. package/dist/esm/core/account/Account.mjs.map +1 -0
  164. package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
  165. package/dist/esm/core/account/Ed25519Account.mjs +2 -0
  166. package/dist/esm/core/account/Ed25519Account.mjs.map +1 -0
  167. package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
  168. package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
  169. package/dist/esm/core/account/SingleKeyAccount.mjs.map +1 -0
  170. package/dist/esm/core/account/index.d.mts +305 -0
  171. package/dist/esm/core/account/index.mjs +2 -0
  172. package/dist/esm/core/account/index.mjs.map +1 -0
  173. package/dist/esm/core/accountAddress.mjs +1 -1
  174. package/dist/esm/core/authenticationKey.d.mts +7 -68
  175. package/dist/esm/core/authenticationKey.mjs +1 -1
  176. package/dist/esm/core/common.mjs +1 -1
  177. package/dist/esm/core/crypto/ed25519.d.mts +49 -61
  178. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  179. package/dist/esm/core/crypto/index.d.mts +9 -6
  180. package/dist/esm/core/crypto/index.mjs +1 -1
  181. package/dist/esm/core/crypto/multiEd25519.d.mts +17 -14
  182. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  183. package/dist/esm/core/crypto/multiKey.d.mts +70 -17
  184. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  185. package/dist/esm/core/crypto/privateKey.d.mts +35 -0
  186. package/dist/esm/core/crypto/privateKey.mjs +2 -0
  187. package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
  188. package/dist/esm/core/crypto/publicKey.d.mts +13 -0
  189. package/dist/esm/core/crypto/publicKey.mjs +2 -0
  190. package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
  191. package/dist/esm/core/crypto/secp256k1.d.mts +43 -67
  192. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  193. package/dist/esm/core/crypto/signature.d.mts +28 -0
  194. package/dist/esm/core/crypto/signature.mjs +2 -0
  195. package/dist/esm/core/crypto/signature.mjs.map +1 -0
  196. package/dist/esm/core/crypto/singleKey.d.mts +68 -0
  197. package/dist/esm/core/crypto/singleKey.mjs +2 -0
  198. package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
  199. package/dist/esm/core/hex.mjs +1 -1
  200. package/dist/esm/core/index.d.mts +9 -8
  201. package/dist/esm/core/index.mjs +1 -1
  202. package/dist/esm/index.d.mts +10 -8
  203. package/dist/esm/index.mjs +1 -1
  204. package/dist/esm/internal/account.d.mts +9 -3
  205. package/dist/esm/internal/account.mjs +1 -1
  206. package/dist/esm/internal/ans.d.mts +10 -11
  207. package/dist/esm/internal/ans.mjs +1 -1
  208. package/dist/esm/internal/coin.d.mts +12 -12
  209. package/dist/esm/internal/coin.mjs +1 -1
  210. package/dist/esm/internal/digitalAsset.d.mts +17 -14
  211. package/dist/esm/internal/digitalAsset.mjs +1 -1
  212. package/dist/esm/internal/event.d.mts +2 -2
  213. package/dist/esm/internal/event.mjs +1 -1
  214. package/dist/esm/internal/faucet.d.mts +4 -4
  215. package/dist/esm/internal/faucet.mjs +1 -1
  216. package/dist/esm/internal/fungibleAsset.d.mts +10 -11
  217. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  218. package/dist/esm/internal/general.mjs +1 -1
  219. package/dist/esm/internal/staking.d.mts +3 -3
  220. package/dist/esm/internal/staking.mjs +1 -1
  221. package/dist/esm/internal/transaction.mjs +1 -1
  222. package/dist/esm/internal/transactionSubmission.d.mts +12 -13
  223. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  224. package/dist/esm/publicKey-B3XRNhHO.d.mts +113 -0
  225. package/dist/esm/transactions/authenticator/account.d.mts +6 -4
  226. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  227. package/dist/esm/transactions/authenticator/index.d.mts +6 -6
  228. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  229. package/dist/esm/transactions/authenticator/transaction.d.mts +5 -5
  230. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  231. package/dist/esm/transactions/index.d.mts +6 -7
  232. package/dist/esm/transactions/index.mjs +1 -1
  233. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  234. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  235. package/dist/esm/transactions/instances/index.d.mts +4 -4
  236. package/dist/esm/transactions/instances/index.mjs +1 -1
  237. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  238. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  239. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  240. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +2 -1
  241. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  242. package/dist/esm/transactions/instances/signedTransaction.d.mts +8 -8
  243. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  244. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  245. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  246. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +11 -5
  247. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  248. package/dist/esm/transactions/management/index.d.mts +11 -12
  249. package/dist/esm/transactions/management/index.mjs +1 -1
  250. package/dist/esm/transactions/management/transactionWorker.d.mts +11 -12
  251. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  252. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +10 -10
  253. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  254. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -10
  255. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  256. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +8 -8
  257. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  258. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +9 -10
  259. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  260. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  261. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  262. package/dist/esm/transactions/types.d.mts +9 -9
  263. package/dist/esm/types/index.d.mts +1 -0
  264. package/dist/esm/types/index.mjs +1 -1
  265. package/dist/esm/utils/const.d.mts +1 -2
  266. package/dist/esm/utils/const.mjs +1 -1
  267. package/dist/esm/utils/index.d.mts +1 -1
  268. package/dist/esm/utils/index.mjs +1 -1
  269. package/dist/esm/version.d.mts +1 -1
  270. package/dist/esm/version.mjs +1 -1
  271. package/package.json +11 -4
  272. package/src/api/aptosConfig.ts +11 -2
  273. package/src/api/digitalAsset.ts +20 -0
  274. package/src/assetUploader/assetUploader.ts +87 -0
  275. package/src/assetUploader/index.ts +1 -0
  276. package/src/assetUploader/irys.ts +102 -0
  277. package/src/core/account/Account.ts +245 -0
  278. package/src/core/account/Ed25519Account.ts +88 -0
  279. package/src/core/account/SingleKeyAccount.ts +120 -0
  280. package/src/core/account/index.ts +3 -0
  281. package/src/core/authenticationKey.ts +18 -52
  282. package/src/core/crypto/ed25519.ts +118 -104
  283. package/src/core/crypto/index.ts +6 -5
  284. package/src/core/crypto/multiEd25519.ts +98 -44
  285. package/src/core/crypto/multiKey.ts +192 -34
  286. package/src/core/crypto/privateKey.ts +25 -0
  287. package/src/core/crypto/publicKey.ts +52 -0
  288. package/src/core/crypto/secp256k1.ts +108 -111
  289. package/src/core/crypto/signature.ts +46 -0
  290. package/src/core/crypto/singleKey.ts +180 -0
  291. package/src/index.ts +1 -0
  292. package/src/internal/account.ts +5 -3
  293. package/src/internal/digitalAsset.ts +26 -0
  294. package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +0 -1
  295. package/src/transactions/authenticator/account.ts +1 -2
  296. package/src/transactions/instances/rotationProofChallenge.ts +1 -1
  297. package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -21
  298. package/src/transactions/types.ts +1 -1
  299. package/src/types/index.ts +2 -0
  300. package/src/utils/const.ts +0 -4
  301. package/src/version.ts +1 -1
  302. package/dist/browser/index.d.ts +0 -6997
  303. package/dist/browser/index.global.js +0 -483
  304. package/dist/browser/index.global.js.map +0 -1
  305. package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
  306. package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
  307. package/dist/esm/chunk-7IGH7N52.mjs +0 -2
  308. package/dist/esm/chunk-7IGH7N52.mjs.map +0 -1
  309. package/dist/esm/chunk-B2ZKW23W.mjs +0 -2
  310. package/dist/esm/chunk-CCUD52OF.mjs +0 -2
  311. package/dist/esm/chunk-CCUD52OF.mjs.map +0 -1
  312. package/dist/esm/chunk-CVEJHRAU.mjs.map +0 -1
  313. package/dist/esm/chunk-ENKMOALS.mjs.map +0 -1
  314. package/dist/esm/chunk-ERWQOVBF.mjs +0 -2
  315. package/dist/esm/chunk-ERWQOVBF.mjs.map +0 -1
  316. package/dist/esm/chunk-FBFMQZTM.mjs +0 -2
  317. package/dist/esm/chunk-FBFMQZTM.mjs.map +0 -1
  318. package/dist/esm/chunk-FBPNHF54.mjs +0 -2
  319. package/dist/esm/chunk-FP5DPRYL.mjs +0 -2
  320. package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
  321. package/dist/esm/chunk-GD4ULEBC.mjs +0 -2
  322. package/dist/esm/chunk-GD5TZLBF.mjs +0 -2
  323. package/dist/esm/chunk-HHJBCGAQ.mjs +0 -2
  324. package/dist/esm/chunk-HHJBCGAQ.mjs.map +0 -1
  325. package/dist/esm/chunk-I7WRJY7K.mjs +0 -2
  326. package/dist/esm/chunk-I7WRJY7K.mjs.map +0 -1
  327. package/dist/esm/chunk-IHCIKE42.mjs +0 -2
  328. package/dist/esm/chunk-LHJSG5NE.mjs +0 -2
  329. package/dist/esm/chunk-LHJSG5NE.mjs.map +0 -1
  330. package/dist/esm/chunk-MEPX7Z2Z.mjs +0 -2
  331. package/dist/esm/chunk-NWRKJFHV.mjs +0 -2
  332. package/dist/esm/chunk-O57QZZF2.mjs.map +0 -1
  333. package/dist/esm/chunk-PPTG6BDV.mjs +0 -2
  334. package/dist/esm/chunk-QKTV6AZ7.mjs +0 -2
  335. package/dist/esm/chunk-QRQAR6XO.mjs +0 -2
  336. package/dist/esm/chunk-S3FBGS3W.mjs +0 -2
  337. package/dist/esm/chunk-S3FBGS3W.mjs.map +0 -1
  338. package/dist/esm/chunk-SBMJNU2O.mjs +0 -2
  339. package/dist/esm/chunk-SBMJNU2O.mjs.map +0 -1
  340. package/dist/esm/chunk-SRZTA6QH.mjs +0 -2
  341. package/dist/esm/chunk-UCHGKGCF.mjs +0 -2
  342. package/dist/esm/chunk-UCHGKGCF.mjs.map +0 -1
  343. package/dist/esm/chunk-UIVJXLRM.mjs +0 -1
  344. package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
  345. package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
  346. package/dist/esm/chunk-VRSUCKJA.mjs +0 -2
  347. package/dist/esm/chunk-XZYPAQCU.mjs +0 -2
  348. package/dist/esm/chunk-YL2EDK5M.mjs +0 -2
  349. package/dist/esm/chunk-YL2EDK5M.mjs.map +0 -1
  350. package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
  351. package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
  352. package/dist/esm/core/account.d.mts +0 -184
  353. package/dist/esm/core/account.mjs +0 -2
  354. package/dist/esm/core/crypto/anyPublicKey.d.mts +0 -59
  355. package/dist/esm/core/crypto/anyPublicKey.mjs +0 -2
  356. package/dist/esm/core/crypto/anySignature.d.mts +0 -31
  357. package/dist/esm/core/crypto/anySignature.mjs +0 -2
  358. package/dist/esm/core/crypto/asymmetricCrypto.d.mts +0 -74
  359. package/dist/esm/core/crypto/asymmetricCrypto.mjs +0 -2
  360. package/src/core/account.ts +0 -282
  361. package/src/core/crypto/anyPublicKey.ts +0 -92
  362. package/src/core/crypto/anySignature.ts +0 -56
  363. package/src/core/crypto/asymmetricCrypto.ts +0 -77
  364. /package/dist/esm/{chunk-UIVJXLRM.mjs.map → assetUploader/assetUploader.mjs.map} +0 -0
  365. /package/dist/esm/{core/account.mjs.map → assetUploader/index.mjs.map} +0 -0
  366. /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → assetUploader/irys.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-PPTG6BDV.mjs.map → chunk-4LUWUDBX.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-7D5LHQNS.mjs.map → chunk-5PIO6MFF.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-VKZCIGKY.mjs.map → chunk-6TUHLGW3.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-ENDUXRTK.mjs.map → chunk-7KPEDF2R.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-GD4ULEBC.mjs.map → chunk-AXVVJKE4.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-NL72WE3E.mjs.map → chunk-BZMO6Q6L.mjs.map} +0 -0
  373. /package/dist/esm/{chunk-XBVORX5O.mjs.map → chunk-FAAWSTXC.mjs.map} +0 -0
  374. /package/dist/esm/{chunk-AFPJ2XXN.mjs.map → chunk-FHWAJCJR.mjs.map} +0 -0
  375. /package/dist/esm/{chunk-VPQ46CAO.mjs.map → chunk-GE7VQ5NZ.mjs.map} +0 -0
  376. /package/dist/esm/{chunk-6FBKUTGF.mjs.map → chunk-GHYE26Q5.mjs.map} +0 -0
  377. /package/dist/esm/{chunk-2H5Z5EHH.mjs.map → chunk-HKAJ5N25.mjs.map} +0 -0
  378. /package/dist/esm/{chunk-PJNPLRPR.mjs.map → chunk-HWTX3HVX.mjs.map} +0 -0
  379. /package/dist/esm/{chunk-B2ZKW23W.mjs.map → chunk-IFVMIUMO.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-6SRENFWH.mjs.map → chunk-IMYKTNDV.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-PMWH5IGI.mjs.map → chunk-ITALFUWD.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-JB7ZOUYL.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-2WFMD6C6.mjs.map → chunk-JMR7G5DT.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-S64WKSMI.mjs.map → chunk-JOIUR5QW.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-4OI7MPFH.mjs.map → chunk-K5XJKIFT.mjs.map} +0 -0
  386. /package/dist/esm/{core/crypto/anySignature.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
  387. /package/dist/esm/{chunk-Q5HK3U64.mjs.map → chunk-L4PAU62E.mjs.map} +0 -0
  388. /package/dist/esm/{core/crypto/asymmetricCrypto.mjs.map → chunk-L7ORFGZ7.mjs.map} +0 -0
  389. /package/dist/esm/{chunk-FBPNHF54.mjs.map → chunk-LG7RJQ57.mjs.map} +0 -0
  390. /package/dist/esm/{chunk-IHCIKE42.mjs.map → chunk-M6TKSJ4I.mjs.map} +0 -0
  391. /package/dist/esm/{chunk-2DNPRIS5.mjs.map → chunk-MVWTTVQZ.mjs.map} +0 -0
  392. /package/dist/esm/{chunk-GD5TZLBF.mjs.map → chunk-NA2H44NE.mjs.map} +0 -0
  393. /package/dist/esm/{chunk-R56OJ4XC.mjs.map → chunk-NYGCJ6EJ.mjs.map} +0 -0
  394. /package/dist/esm/{chunk-PIXE7MN5.mjs.map → chunk-NZGON5TY.mjs.map} +0 -0
  395. /package/dist/esm/{chunk-Y4AKS4CY.mjs.map → chunk-O5Q3RSEJ.mjs.map} +0 -0
  396. /package/dist/esm/{chunk-LATJGGVX.mjs.map → chunk-PATJMQAG.mjs.map} +0 -0
  397. /package/dist/esm/{chunk-SXIFL5DQ.mjs.map → chunk-RC5K63LK.mjs.map} +0 -0
  398. /package/dist/esm/{chunk-QGIJNA37.mjs.map → chunk-SKF6E6X7.mjs.map} +0 -0
  399. /package/dist/esm/{chunk-QKTV6AZ7.mjs.map → chunk-TWHTXYMB.mjs.map} +0 -0
  400. /package/dist/esm/{chunk-JQVT2K7G.mjs.map → chunk-UCFIV5UD.mjs.map} +0 -0
  401. /package/dist/esm/{chunk-JJ6Y35DF.mjs.map → chunk-UFD443TT.mjs.map} +0 -0
  402. /package/dist/esm/{chunk-M3WNE7MU.mjs.map → chunk-UVTSJ2KP.mjs.map} +0 -0
  403. /package/dist/esm/{chunk-KJGQ4ILY.mjs.map → chunk-UZ3SFWTM.mjs.map} +0 -0
  404. /package/dist/esm/{chunk-V2FPYAK7.mjs.map → chunk-VPN3KEVB.mjs.map} +0 -0
  405. /package/dist/esm/{chunk-QRQAR6XO.mjs.map → chunk-VQM4LMCW.mjs.map} +0 -0
  406. /package/dist/esm/{chunk-W4UDMBMU.mjs.map → chunk-VWWR2UAQ.mjs.map} +0 -0
  407. /package/dist/esm/{chunk-F7MOQC7Z.mjs.map → chunk-VZJ62XF7.mjs.map} +0 -0
  408. /package/dist/esm/{chunk-N4RBQZ2B.mjs.map → chunk-W2XLZW4Y.mjs.map} +0 -0
  409. /package/dist/esm/{chunk-FRLPX47J.mjs.map → chunk-XH4B5K6W.mjs.map} +0 -0
  410. /package/dist/esm/{chunk-4M46AWXX.mjs.map → chunk-XSCYT6TT.mjs.map} +0 -0
  411. /package/dist/esm/{chunk-EUHPML5E.mjs.map → chunk-XSYZX66A.mjs.map} +0 -0
  412. /package/dist/esm/{chunk-SPOHAEHR.mjs.map → chunk-YTHL7EKV.mjs.map} +0 -0
  413. /package/dist/esm/{chunk-Q3HAJVCM.mjs.map → chunk-YXUOYXGZ.mjs.map} +0 -0
@@ -1,74 +0,0 @@
1
- import { HexInput } from '../../types/index.mjs';
2
- import { Serializable, Serializer } from '../../bcs/serializer.mjs';
3
- import '../../utils/apiEndpoints.mjs';
4
- import '../../types/indexer.mjs';
5
- import '../../types/generated/operations.mjs';
6
- import '../../types/generated/types.mjs';
7
- import '../hex.mjs';
8
- import '../common.mjs';
9
-
10
- /**
11
- * An abstract representation of a public key. All Asymmetric key pairs will use this to
12
- * verify signatures and for authentication keys.
13
- */
14
- declare abstract class PublicKey extends Serializable {
15
- /**
16
- * Verifies that the private key associated with this public key signed the message with the given signature.
17
- * @param args.message The message that was signed
18
- * @param args.signature The signature to verify
19
- */
20
- abstract verifySignature(args: {
21
- message: HexInput;
22
- signature: Signature;
23
- }): boolean;
24
- /**
25
- * Get the raw public key bytes
26
- */
27
- abstract toUint8Array(): Uint8Array;
28
- /**
29
- * Get the public key as a hex string with a 0x prefix e.g. 0x123456...
30
- */
31
- abstract toString(): string;
32
- abstract serialize(serializer: Serializer): void;
33
- }
34
- /**
35
- * An abstract representation of a private key. This is used to sign transactions and
36
- * derive the public key associated.
37
- */
38
- declare abstract class PrivateKey extends Serializable {
39
- /**
40
- * Sign a message with the key
41
- * @param message The message to sign
42
- */
43
- abstract sign(message: HexInput): Signature;
44
- /**
45
- * Get the raw private key bytes
46
- */
47
- abstract toUint8Array(): Uint8Array;
48
- /**
49
- * Get the private key as a hex string with a 0x prefix e.g. 0x123456...
50
- */
51
- abstract toString(): string;
52
- abstract serialize(serializer: Serializer): void;
53
- /**
54
- * Derives the public key associated with the private key
55
- */
56
- abstract publicKey(): PublicKey;
57
- }
58
- /**
59
- * An abstract representation of a signature. This is the product of signing a
60
- * message and can be used with the PublicKey to verify the signature.
61
- */
62
- declare abstract class Signature extends Serializable {
63
- /**
64
- * Get the raw signature bytes
65
- */
66
- abstract toUint8Array(): Uint8Array;
67
- /**
68
- * Get the signature as a hex string with a 0x prefix e.g. 0x123456...
69
- */
70
- abstract toString(): string;
71
- abstract serialize(serializer: Serializer): void;
72
- }
73
-
74
- export { PrivateKey, PublicKey, Signature };
@@ -1,2 +0,0 @@
1
- import{a,b,c}from"../../chunk-V6JFR2CB.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-PPTG6BDV.mjs";import"../../chunk-B2ZKW23W.mjs";import"../../chunk-F7MOQC7Z.mjs";import"../../chunk-VRSUCKJA.mjs";import"../../chunk-6IFMQ5AS.mjs";import"../../chunk-N4RBQZ2B.mjs";import"../../chunk-NL72WE3E.mjs";import"../../chunk-FBPNHF54.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-CVEJHRAU.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FVA2OPG4.mjs";export{b as PrivateKey,a as PublicKey,c as Signature};
2
- //# sourceMappingURL=asymmetricCrypto.mjs.map
@@ -1,282 +0,0 @@
1
- // Copyright © Aptos Foundation
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { AccountAddress } from "./accountAddress";
5
- import { AuthenticationKey } from "./authenticationKey";
6
- import { PrivateKey, PublicKey, Signature } from "./crypto/asymmetricCrypto";
7
- import { Ed25519PrivateKey, Ed25519PublicKey } from "./crypto/ed25519";
8
- import { MultiEd25519PublicKey } from "./crypto/multiEd25519";
9
- import { Secp256k1PrivateKey, Secp256k1PublicKey } from "./crypto/secp256k1";
10
- import { Hex } from "./hex";
11
- import { GenerateAccount, HexInput, SigningScheme, SigningSchemeInput } from "../types";
12
- import { AnyPublicKey } from "./crypto/anyPublicKey";
13
-
14
- /**
15
- * Class for creating and managing account on Aptos network
16
- *
17
- * Use this class to create accounts, sign transactions, and more.
18
- * Note: Creating an account instance does not create the account on-chain.
19
- *
20
- * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
21
- * `Legacy` and `Unified` authentications.
22
- *
23
- * @Legacy includes `ED25519` and `MultiED25519`
24
- * @Unified includes `SingleSender` and `MultiSender`, where currently
25
- * `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports
26
- * `MultiED25519`.
27
- *
28
- * In TypeScript SDK, we support all of these options:
29
- *
30
- * @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument
31
- * that lets you generate new keys conforming to the Unified authentication.
32
- *
33
- * @fromPrivateKey derives an account by a provided private key and address, with an optional
34
- * `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.
35
- *
36
- * @fromDerivationPath derives an account with bip44 path and mnemonics,
37
- *
38
- */
39
- export class Account {
40
- /**
41
- * Public key associated with the account
42
- */
43
- readonly publicKey: PublicKey;
44
-
45
- /**
46
- * Private key associated with the account
47
- */
48
- readonly privateKey: PrivateKey;
49
-
50
- /**
51
- * Account address associated with the account
52
- */
53
- readonly accountAddress: AccountAddress;
54
-
55
- /**
56
- * Signing scheme used to sign transactions
57
- */
58
- readonly signingScheme: SigningScheme;
59
-
60
- /**
61
- * constructor for Account
62
- *
63
- * Need to update this to use the new crypto library if new schemes are added.
64
- *
65
- * @param args.privateKey PrivateKey - private key of the account
66
- * @param args.address AccountAddress - address of the account
67
- * @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.
68
- * Defaults to deriving an authentication key with the legacy scheme.
69
- *
70
- * This method is private because it should only be called by the factory static methods.
71
- * @returns Account
72
- */
73
- private constructor(args: { privateKey: PrivateKey; address: AccountAddress; legacy?: boolean }) {
74
- const { privateKey, address, legacy } = args;
75
- const useLegacy = legacy ?? true;
76
-
77
- // Derive the public key from the private key
78
- this.publicKey = privateKey.publicKey();
79
-
80
- // Derive the signing scheme from the public key
81
- if (this.publicKey instanceof Ed25519PublicKey) {
82
- if (useLegacy) {
83
- this.signingScheme = SigningScheme.Ed25519;
84
- } else {
85
- this.publicKey = new AnyPublicKey(this.publicKey);
86
- this.signingScheme = SigningScheme.SingleKey;
87
- }
88
- } else if (this.publicKey instanceof MultiEd25519PublicKey) {
89
- this.signingScheme = SigningScheme.MultiEd25519;
90
- } else if (this.publicKey instanceof Secp256k1PublicKey) {
91
- this.publicKey = new AnyPublicKey(this.publicKey);
92
- this.signingScheme = SigningScheme.SingleKey;
93
- } else {
94
- throw new Error("Can not create new Account, unsupported public key type");
95
- }
96
-
97
- this.privateKey = privateKey;
98
- this.accountAddress = address;
99
- }
100
-
101
- /**
102
- * Derives an account with random private key and address.
103
- *
104
- * Default generation is using the Legacy ED25519 key
105
- *
106
- * @param args optional. Unify GenerateAccount type for Legacy and Unified keys
107
- *
108
- * Account input type to generate an account using Legacy
109
- * Ed25519 or MultiEd25519 keys or without a specified `scheme`.
110
- * ```
111
- * GenerateAccountWithLegacyKey = {
112
- * scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;
113
- * legacy: true;
114
- * };
115
- * ```
116
- *
117
- * Account input type to generate an account using Unified
118
- * Secp256k1Ecdsa key
119
- * In this case `legacy` is always false
120
- * ```
121
- * GenerateAccountWithUnifiedKey = {
122
- * scheme: SigningSchemeInput.Secp256k1Ecdsa;
123
- * legacy?: false;
124
- * };
125
- * ```
126
- *
127
- * @returns Account with the given signing scheme
128
- */
129
- static generate(args?: GenerateAccount): Account {
130
- const useLegacy = args?.legacy ?? true;
131
-
132
- let privateKey: PrivateKey;
133
- let publicKey: PublicKey;
134
-
135
- switch (args?.scheme) {
136
- case SigningSchemeInput.Secp256k1Ecdsa:
137
- privateKey = Secp256k1PrivateKey.generate();
138
- publicKey = new AnyPublicKey(privateKey.publicKey());
139
- break;
140
- default:
141
- privateKey = Ed25519PrivateKey.generate();
142
- if (useLegacy === false) {
143
- publicKey = new AnyPublicKey(privateKey.publicKey());
144
- } else {
145
- publicKey = privateKey.publicKey();
146
- }
147
- }
148
- const authKey = AuthenticationKey.fromPublicKey({ publicKey });
149
-
150
- const address = authKey.derivedAddress();
151
- return new Account({ privateKey, address, legacy: args?.legacy });
152
- }
153
-
154
- /**
155
- * Instantiates an account given a private key.
156
- *
157
- * This is used as a local calculation and therefore is used to instantiate an `Account`
158
- * that has not had its authentication key rotated.
159
- *
160
- * @param privateKey PrivateKey - private key of the account
161
- * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
162
- * to generating a Legacy Ed25519 keypair
163
- *
164
- * @returns Account
165
- */
166
- static fromPrivateKey(args: { privateKey: PrivateKey; legacy?: boolean }): Account {
167
- const { privateKey, legacy } = args;
168
- const useLegacy = legacy ?? true;
169
-
170
- let publicKey;
171
- if (privateKey instanceof Secp256k1PrivateKey) {
172
- // Secp256k1 single sender
173
- publicKey = new AnyPublicKey(privateKey.publicKey());
174
- } else if (privateKey instanceof Ed25519PrivateKey) {
175
- // legacy Ed25519
176
- if (useLegacy) {
177
- publicKey = privateKey.publicKey();
178
- } else {
179
- // Ed25519 single sender
180
- publicKey = new AnyPublicKey(privateKey.publicKey());
181
- }
182
- } else {
183
- throw new Error(`Unsupported private key ${privateKey}`);
184
- }
185
-
186
- const authKey = AuthenticationKey.fromPublicKey({ publicKey });
187
- const address = authKey.derivedAddress();
188
- return new Account({ privateKey, address, legacy: useLegacy });
189
- }
190
-
191
- /**
192
- * Instantiates an account given a private key and a specified account address.
193
- * This is primarily used to instantiate an `Account` that has had its authentication key rotated.
194
- *
195
- * @param args.privateKey PrivateKey - the underlying private key for the account
196
- * @param args.address AccountAddress - The account address the `Account` will sign for
197
- * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
198
- * to generating a Legacy Ed25519 keypair
199
- *
200
- * @returns Account
201
- */
202
- static fromPrivateKeyAndAddress(args: {
203
- privateKey: PrivateKey;
204
- address: AccountAddress;
205
- legacy?: boolean;
206
- }): Account {
207
- const { privateKey, address, legacy } = args;
208
- return new Account({ privateKey, address, legacy });
209
- }
210
-
211
- /**
212
- * Derives an account with bip44 path and mnemonics,
213
- *
214
- * @param args.scheme The signing scheme to derive with
215
- * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
216
- * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
217
- * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
218
- * @param args.mnemonic the mnemonic seed phrase of the account
219
- * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
220
- * to generating a Legacy Ed25519 keypair
221
- *
222
- * @returns Account
223
- */
224
- static fromDerivationPath(args: {
225
- scheme: SigningSchemeInput;
226
- path: string;
227
- mnemonic: string;
228
- legacy?: boolean;
229
- }): Account {
230
- const { path, mnemonic, scheme, legacy } = args;
231
- let privateKey: PrivateKey;
232
- switch (scheme) {
233
- case SigningSchemeInput.Secp256k1Ecdsa:
234
- privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);
235
- break;
236
- case SigningSchemeInput.Ed25519:
237
- privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);
238
- break;
239
- default:
240
- throw new Error(`Unsupported scheme ${scheme}`);
241
- }
242
- return Account.fromPrivateKey({ privateKey, legacy });
243
- }
244
-
245
- /**
246
- * This key enables account owners to rotate their private key(s)
247
- * associated with the account without changing the address that hosts their account.
248
- * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
249
- *
250
- * @param args.publicKey PublicKey - public key of the account
251
- * @returns The authentication key for the associated account
252
- */
253
- static authKey(args: { publicKey: PublicKey }): AuthenticationKey {
254
- const { publicKey } = args;
255
- return AuthenticationKey.fromPublicKey({ publicKey });
256
- }
257
-
258
- /**
259
- * Sign the given message with the private key.
260
- *
261
- * TODO: Add sign transaction or specific types
262
- *
263
- * @param data in HexInput format
264
- * @returns Signature
265
- */
266
- sign(data: HexInput): Signature {
267
- return this.privateKey.sign(data);
268
- }
269
-
270
- /**
271
- * Verify the given message and signature with the public key.
272
- *
273
- * @param args.message raw message data in HexInput format
274
- * @param args.signature signed message Signature
275
- * @returns
276
- */
277
- verifySignature(args: { message: HexInput; signature: Signature }): boolean {
278
- const { message, signature } = args;
279
- const rawMessage = Hex.fromHexInput(message).toUint8Array();
280
- return this.publicKey.verifySignature({ message: rawMessage, signature });
281
- }
282
- }
@@ -1,92 +0,0 @@
1
- import { Serializer, Deserializer } from "../../bcs";
2
- import { AnyPublicKeyVariant, HexInput } from "../../types";
3
- import { AnySignature } from "./anySignature";
4
- import { PublicKey } from "./asymmetricCrypto";
5
- import { Ed25519PublicKey } from "./ed25519";
6
- import { Secp256k1PublicKey } from "./secp256k1";
7
-
8
- /**
9
- * Represents any public key supported by Aptos.
10
- *
11
- * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
12
- * `Legacy` and `Unified` authentication keys.
13
- *
14
- * Any unified authentication key is represented in the SDK as `AnyPublicKey`.
15
- */
16
- export class AnyPublicKey extends PublicKey {
17
- /**
18
- * Reference to the inner public key
19
- */
20
- public readonly publicKey: PublicKey;
21
-
22
- constructor(publicKey: PublicKey) {
23
- super();
24
- this.publicKey = publicKey;
25
- }
26
-
27
- /**
28
- * Get the public key in bytes (Uint8Array).
29
- *
30
- * @returns Uint8Array representation of the public key
31
- */
32
- toUint8Array(): Uint8Array {
33
- return this.publicKey.toUint8Array();
34
- }
35
-
36
- /**
37
- * Get the public key as a hex string with the 0x prefix.
38
- *
39
- * @returns string representation of the public key
40
- */
41
- toString(): string {
42
- return this.publicKey.toString();
43
- }
44
-
45
- /**
46
- * Verifies a signed data with a public key
47
- *
48
- * @param args.message message
49
- * @param args.signature The signature
50
- * @returns true if the signature is valid
51
- */
52
- verifySignature(args: { message: HexInput; signature: AnySignature }): boolean {
53
- const { message, signature } = args;
54
- return this.publicKey.verifySignature({ message, signature });
55
- }
56
-
57
- serialize(serializer: Serializer): void {
58
- if (this.publicKey instanceof Ed25519PublicKey) {
59
- serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Ed25519);
60
- this.publicKey.serialize(serializer);
61
- } else if (this.publicKey instanceof Secp256k1PublicKey) {
62
- serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Secp256k1);
63
- this.publicKey.serialize(serializer);
64
- } else {
65
- throw new Error("Unknown public key type");
66
- }
67
- }
68
-
69
- static deserialize(deserializer: Deserializer): AnyPublicKey {
70
- const index = deserializer.deserializeUleb128AsU32();
71
- switch (index) {
72
- case AnyPublicKeyVariant.Ed25519:
73
- return new AnyPublicKey(Ed25519PublicKey.load(deserializer));
74
- case AnyPublicKeyVariant.Secp256k1:
75
- return new AnyPublicKey(Secp256k1PublicKey.load(deserializer));
76
- default:
77
- throw new Error(`Unknown variant index for AnyPublicKey: ${index}`);
78
- }
79
- }
80
-
81
- static isPublicKey(publicKey: PublicKey): publicKey is AnyPublicKey {
82
- return publicKey instanceof AnyPublicKey;
83
- }
84
-
85
- isEd25519(): this is Ed25519PublicKey {
86
- return this.publicKey instanceof Ed25519PublicKey;
87
- }
88
-
89
- isSecp256k1PublicKey(): this is Secp256k1PublicKey {
90
- return this.publicKey instanceof Secp256k1PublicKey;
91
- }
92
- }
@@ -1,56 +0,0 @@
1
- import { Serializer, Deserializer } from "../../bcs";
2
- import { AnySignatureVariant } from "../../types";
3
- import { Signature } from "./asymmetricCrypto";
4
- import { Ed25519Signature } from "./ed25519";
5
- import { Secp256k1Signature } from "./secp256k1";
6
-
7
- export class AnySignature extends Signature {
8
- public readonly signature: Signature;
9
-
10
- constructor(signature: Signature) {
11
- super();
12
- this.signature = signature;
13
- }
14
-
15
- /**
16
- * Get the public key in bytes (Uint8Array).
17
- *
18
- * @returns Uint8Array representation of the public key
19
- */
20
- toUint8Array(): Uint8Array {
21
- return this.signature.toUint8Array();
22
- }
23
-
24
- /**
25
- * Get the public key as a hex string with the 0x prefix.
26
- *
27
- * @returns string representation of the public key
28
- */
29
- toString(): string {
30
- return this.signature.toString();
31
- }
32
-
33
- serialize(serializer: Serializer): void {
34
- if (this.signature instanceof Ed25519Signature) {
35
- serializer.serializeU32AsUleb128(AnySignatureVariant.Ed25519);
36
- this.signature.serialize(serializer);
37
- } else if (this.signature instanceof Secp256k1Signature) {
38
- serializer.serializeU32AsUleb128(AnySignatureVariant.Secp256k1);
39
- this.signature.serialize(serializer);
40
- } else {
41
- throw new Error("Unknown signature type");
42
- }
43
- }
44
-
45
- static deserialize(deserializer: Deserializer): AnySignature {
46
- const index = deserializer.deserializeUleb128AsU32();
47
- switch (index) {
48
- case AnySignatureVariant.Ed25519:
49
- return new AnySignature(Ed25519Signature.load(deserializer));
50
- case AnySignatureVariant.Secp256k1:
51
- return new AnySignature(Secp256k1Signature.load(deserializer));
52
- default:
53
- throw new Error(`Unknown variant index for AnySignature: ${index}`);
54
- }
55
- }
56
- }
@@ -1,77 +0,0 @@
1
- // Copyright © Aptos Foundation
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { Serializable, Serializer } from "../../bcs";
5
- import { HexInput } from "../../types";
6
-
7
- /**
8
- * An abstract representation of a public key. All Asymmetric key pairs will use this to
9
- * verify signatures and for authentication keys.
10
- */
11
- export abstract class PublicKey extends Serializable {
12
- /**
13
- * Verifies that the private key associated with this public key signed the message with the given signature.
14
- * @param args.message The message that was signed
15
- * @param args.signature The signature to verify
16
- */
17
- abstract verifySignature(args: { message: HexInput; signature: Signature }): boolean;
18
-
19
- /**
20
- * Get the raw public key bytes
21
- */
22
- abstract toUint8Array(): Uint8Array;
23
-
24
- /**
25
- * Get the public key as a hex string with a 0x prefix e.g. 0x123456...
26
- */
27
- abstract toString(): string;
28
-
29
- abstract serialize(serializer: Serializer): void;
30
- }
31
-
32
- /**
33
- * An abstract representation of a private key. This is used to sign transactions and
34
- * derive the public key associated.
35
- */
36
- export abstract class PrivateKey extends Serializable {
37
- /**
38
- * Sign a message with the key
39
- * @param message The message to sign
40
- */
41
- abstract sign(message: HexInput): Signature;
42
-
43
- /**
44
- * Get the raw private key bytes
45
- */
46
- abstract toUint8Array(): Uint8Array;
47
-
48
- /**
49
- * Get the private key as a hex string with a 0x prefix e.g. 0x123456...
50
- */
51
- abstract toString(): string;
52
-
53
- abstract serialize(serializer: Serializer): void;
54
-
55
- /**
56
- * Derives the public key associated with the private key
57
- */
58
- abstract publicKey(): PublicKey;
59
- }
60
-
61
- /**
62
- * An abstract representation of a signature. This is the product of signing a
63
- * message and can be used with the PublicKey to verify the signature.
64
- */
65
- export abstract class Signature extends Serializable {
66
- /**
67
- * Get the raw signature bytes
68
- */
69
- abstract toUint8Array(): Uint8Array;
70
-
71
- /**
72
- * Get the signature as a hex string with a 0x prefix e.g. 0x123456...
73
- */
74
- abstract toString(): string;
75
-
76
- abstract serialize(serializer: Serializer): void;
77
- }