@helios-lang/effect 0.1.15 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/dist/Cardano/CoinSelection.js +130 -0
  2. package/dist/Cardano/CoinSelection.js.map +1 -0
  3. package/dist/{Ledger → Cardano/Ledger}/Address.js +30 -20
  4. package/dist/Cardano/Ledger/Address.js.map +1 -0
  5. package/dist/{Ledger → Cardano/Ledger}/AssetClass.js +16 -11
  6. package/dist/Cardano/Ledger/AssetClass.js.map +1 -0
  7. package/dist/Cardano/Ledger/Assets.js +235 -0
  8. package/dist/Cardano/Ledger/Assets.js.map +1 -0
  9. package/dist/Cardano/Ledger/Credential.js +53 -0
  10. package/dist/Cardano/Ledger/Credential.js.map +1 -0
  11. package/dist/Cardano/Ledger/DCert.js +117 -0
  12. package/dist/Cardano/Ledger/DCert.js.map +1 -0
  13. package/dist/Cardano/Ledger/DatumHash.js +25 -0
  14. package/dist/Cardano/Ledger/DatumHash.js.map +1 -0
  15. package/dist/Cardano/Ledger/MintingPolicy.js +40 -0
  16. package/dist/Cardano/Ledger/MintingPolicy.js.map +1 -0
  17. package/dist/Cardano/Ledger/NativeScript.js +140 -0
  18. package/dist/Cardano/Ledger/NativeScript.js.map +1 -0
  19. package/dist/Cardano/Ledger/PubKey.js +22 -0
  20. package/dist/Cardano/Ledger/PubKey.js.map +1 -0
  21. package/dist/{Ledger → Cardano/Ledger}/PubKeyHash.js +5 -5
  22. package/dist/Cardano/Ledger/PubKeyHash.js.map +1 -0
  23. package/dist/Cardano/Ledger/Redeemer.js +155 -0
  24. package/dist/Cardano/Ledger/Redeemer.js.map +1 -0
  25. package/dist/Cardano/Ledger/RewardAddress.js +93 -0
  26. package/dist/Cardano/Ledger/RewardAddress.js.map +1 -0
  27. package/dist/Cardano/Ledger/Signature.js +23 -0
  28. package/dist/Cardano/Ledger/Signature.js.map +1 -0
  29. package/dist/Cardano/Ledger/Tx.js +498 -0
  30. package/dist/Cardano/Ledger/Tx.js.map +1 -0
  31. package/dist/Cardano/Ledger/TxHash.js +38 -0
  32. package/dist/Cardano/Ledger/TxHash.js.map +1 -0
  33. package/dist/Cardano/Ledger/TxOutput.js +167 -0
  34. package/dist/Cardano/Ledger/TxOutput.js.map +1 -0
  35. package/dist/{Ledger → Cardano/Ledger}/TxOutputDatum.js +44 -8
  36. package/dist/Cardano/Ledger/TxOutputDatum.js.map +1 -0
  37. package/dist/Cardano/Ledger/UTxO.js +100 -0
  38. package/dist/Cardano/Ledger/UTxO.js.map +1 -0
  39. package/dist/{Ledger → Cardano/Ledger}/UTxORef.js +28 -6
  40. package/dist/Cardano/Ledger/UTxORef.js.map +1 -0
  41. package/dist/{Ledger → Cardano/Ledger}/ValidatorHash.js +5 -5
  42. package/dist/Cardano/Ledger/ValidatorHash.js.map +1 -0
  43. package/dist/{Ledger → Cardano/Ledger}/index.js +5 -0
  44. package/dist/Cardano/Ledger/index.js.map +1 -0
  45. package/dist/Cardano/Network/IsMainnet.js.map +1 -0
  46. package/dist/{Network → Cardano/Network}/Params.js +27 -3
  47. package/dist/Cardano/Network/Params.js.map +1 -0
  48. package/dist/Cardano/Network/UTxO.js +20 -0
  49. package/dist/Cardano/Network/UTxO.js.map +1 -0
  50. package/dist/Cardano/Network/UTxOsAt.js +4 -0
  51. package/dist/Cardano/Network/UTxOsAt.js.map +1 -0
  52. package/dist/Cardano/Network/errors.js +33 -0
  53. package/dist/Cardano/Network/errors.js.map +1 -0
  54. package/dist/{Network → Cardano/Network}/index.js +1 -0
  55. package/dist/Cardano/Network/index.js.map +1 -0
  56. package/dist/Cardano/TxBuilder.js +946 -0
  57. package/dist/Cardano/TxBuilder.js.map +1 -0
  58. package/dist/Cardano/Uplc/Builtins.js +1820 -0
  59. package/dist/Cardano/Uplc/Builtins.js.map +1 -0
  60. package/dist/Cardano/Uplc/Cek.js +716 -0
  61. package/dist/Cardano/Uplc/Cek.js.map +1 -0
  62. package/dist/Cardano/Uplc/Cost.js +956 -0
  63. package/dist/Cardano/Uplc/Cost.js.map +1 -0
  64. package/dist/{Uplc → Cardano/Uplc}/Data.js +143 -22
  65. package/dist/Cardano/Uplc/Data.js.map +1 -0
  66. package/dist/Cardano/Uplc/Script.js +118 -0
  67. package/dist/Cardano/Uplc/Script.js.map +1 -0
  68. package/dist/Cardano/Uplc/ScriptContext.js +259 -0
  69. package/dist/Cardano/Uplc/ScriptContext.js.map +1 -0
  70. package/dist/Cardano/Uplc/Term.js +384 -0
  71. package/dist/Cardano/Uplc/Term.js.map +1 -0
  72. package/dist/Cardano/Uplc/Type.js +131 -0
  73. package/dist/Cardano/Uplc/Type.js.map +1 -0
  74. package/dist/Cardano/Uplc/Value.js +315 -0
  75. package/dist/Cardano/Uplc/Value.js.map +1 -0
  76. package/dist/Cardano/Uplc/index.js +7 -0
  77. package/dist/Cardano/Uplc/index.js.map +1 -0
  78. package/dist/Cardano/index.js +6 -0
  79. package/dist/Cardano/index.js.map +1 -0
  80. package/dist/{internal → Codecs}/Base32.js +2 -2
  81. package/dist/Codecs/Base32.js.map +1 -0
  82. package/dist/{Bech32.js → Codecs/Bech32.js} +2 -2
  83. package/dist/Codecs/Bech32.js.map +1 -0
  84. package/dist/Codecs/BigEndian.js.map +1 -0
  85. package/dist/Codecs/Bits.js.map +1 -0
  86. package/dist/{internal → Codecs}/Bytes.js +23 -12
  87. package/dist/Codecs/Bytes.js.map +1 -0
  88. package/dist/{Cbor.js → Codecs/Cbor.js} +559 -328
  89. package/dist/Codecs/Cbor.js.map +1 -0
  90. package/dist/{internal → Codecs}/Flat.js +16 -0
  91. package/dist/Codecs/Flat.js.map +1 -0
  92. package/dist/Codecs/Float.js.map +1 -0
  93. package/dist/Codecs/LittleEndian.js +27 -0
  94. package/dist/Codecs/LittleEndian.js.map +1 -0
  95. package/dist/Codecs/Uint64.js +89 -0
  96. package/dist/Codecs/Uint64.js.map +1 -0
  97. package/dist/{internal → Codecs}/Utf8.js +7 -2
  98. package/dist/Codecs/Utf8.js.map +1 -0
  99. package/dist/Codecs/ZigZag.js +26 -0
  100. package/dist/Codecs/ZigZag.js.map +1 -0
  101. package/dist/Codecs/index.js +8 -0
  102. package/dist/Codecs/index.js.map +1 -0
  103. package/dist/Crypto/Blake2b.js +156 -0
  104. package/dist/Crypto/Blake2b.js.map +1 -0
  105. package/dist/Crypto/Curve.js +92 -0
  106. package/dist/Crypto/Curve.js.map +1 -0
  107. package/dist/Crypto/Ed25519.js +323 -0
  108. package/dist/Crypto/Ed25519.js.map +1 -0
  109. package/dist/Crypto/EdDSA.js +222 -0
  110. package/dist/Crypto/EdDSA.js.map +1 -0
  111. package/dist/Crypto/Field.js +323 -0
  112. package/dist/Crypto/Field.js.map +1 -0
  113. package/dist/Crypto/Hmac.js +51 -0
  114. package/dist/Crypto/Hmac.js.map +1 -0
  115. package/dist/Crypto/Keccak.js +167 -0
  116. package/dist/Crypto/Keccak.js.map +1 -0
  117. package/dist/Crypto/Pbkdf2.js +45 -0
  118. package/dist/Crypto/Pbkdf2.js.map +1 -0
  119. package/dist/Crypto/Sha2_256.js +200 -0
  120. package/dist/Crypto/Sha2_256.js.map +1 -0
  121. package/dist/Crypto/Sha2_512.js +264 -0
  122. package/dist/Crypto/Sha2_512.js.map +1 -0
  123. package/dist/Crypto/Sha3_256.js +10 -0
  124. package/dist/Crypto/Sha3_256.js.map +1 -0
  125. package/dist/Crypto/errors.js +9 -0
  126. package/dist/Crypto/errors.js.map +1 -0
  127. package/dist/Crypto/index.js +12 -0
  128. package/dist/Crypto/index.js.map +1 -0
  129. package/dist/index.js +3 -5
  130. package/dist/index.js.map +1 -1
  131. package/package.json +24 -6
  132. package/tsconfig.build.json +1 -1
  133. package/tsconfig.build.tsbuildinfo +1 -1
  134. package/tsconfig.tsbuildinfo +1 -1
  135. package/types/Cardano/CoinSelection.d.ts +26 -0
  136. package/types/Cardano/CoinSelection.d.ts.map +1 -0
  137. package/types/{Ledger → Cardano/Ledger}/Address.d.ts +7 -6
  138. package/types/Cardano/Ledger/Address.d.ts.map +1 -0
  139. package/types/{Ledger → Cardano/Ledger}/AssetClass.d.ts +2 -2
  140. package/types/Cardano/Ledger/AssetClass.d.ts.map +1 -0
  141. package/types/Cardano/Ledger/Assets.d.ts +114 -0
  142. package/types/Cardano/Ledger/Assets.d.ts.map +1 -0
  143. package/types/{Ledger → Cardano/Ledger}/Credential.d.ts +10 -4
  144. package/types/Cardano/Ledger/Credential.d.ts.map +1 -0
  145. package/types/Cardano/Ledger/DCert.d.ts +40 -0
  146. package/types/Cardano/Ledger/DCert.d.ts.map +1 -0
  147. package/types/{Ledger → Cardano/Ledger}/DatumHash.d.ts +6 -5
  148. package/types/Cardano/Ledger/DatumHash.d.ts.map +1 -0
  149. package/types/{Ledger → Cardano/Ledger}/MintingPolicy.d.ts +11 -8
  150. package/types/Cardano/Ledger/MintingPolicy.d.ts.map +1 -0
  151. package/types/Cardano/Ledger/NativeScript.d.ts +105 -0
  152. package/types/Cardano/Ledger/NativeScript.d.ts.map +1 -0
  153. package/types/Cardano/Ledger/PubKey.d.ts +41 -0
  154. package/types/Cardano/Ledger/PubKey.d.ts.map +1 -0
  155. package/types/{Ledger → Cardano/Ledger}/PubKeyHash.d.ts +5 -5
  156. package/types/Cardano/Ledger/PubKeyHash.d.ts.map +1 -0
  157. package/types/Cardano/Ledger/Redeemer.d.ts +303 -0
  158. package/types/Cardano/Ledger/Redeemer.d.ts.map +1 -0
  159. package/types/Cardano/Ledger/RewardAddress.d.ts +60 -0
  160. package/types/Cardano/Ledger/RewardAddress.d.ts.map +1 -0
  161. package/types/Cardano/Ledger/Signature.d.ts +13 -0
  162. package/types/Cardano/Ledger/Signature.d.ts.map +1 -0
  163. package/types/Cardano/Ledger/Tx.d.ts +375 -0
  164. package/types/Cardano/Ledger/Tx.d.ts.map +1 -0
  165. package/types/{Ledger → Cardano/Ledger}/TxHash.d.ts +35 -5
  166. package/types/Cardano/Ledger/TxHash.d.ts.map +1 -0
  167. package/types/Cardano/Ledger/TxOutput.d.ts +438 -0
  168. package/types/Cardano/Ledger/TxOutput.d.ts.map +1 -0
  169. package/types/Cardano/Ledger/TxOutputDatum.d.ts +98 -0
  170. package/types/Cardano/Ledger/TxOutputDatum.d.ts.map +1 -0
  171. package/types/Cardano/Ledger/UTxO.d.ts +1420 -0
  172. package/types/Cardano/Ledger/UTxO.d.ts.map +1 -0
  173. package/types/Cardano/Ledger/UTxORef.d.ts +222 -0
  174. package/types/Cardano/Ledger/UTxORef.d.ts.map +1 -0
  175. package/types/{Ledger → Cardano/Ledger}/ValidatorHash.d.ts +5 -5
  176. package/types/Cardano/Ledger/ValidatorHash.d.ts.map +1 -0
  177. package/types/{Ledger → Cardano/Ledger}/index.d.ts +5 -0
  178. package/types/Cardano/Ledger/index.d.ts.map +1 -0
  179. package/types/Cardano/Network/IsMainnet.d.ts.map +1 -0
  180. package/types/{Network → Cardano/Network}/Params.d.ts +32 -4
  181. package/types/Cardano/Network/Params.d.ts.map +1 -0
  182. package/types/Cardano/Network/UTxO.d.ts +15 -0
  183. package/types/Cardano/Network/UTxO.d.ts.map +1 -0
  184. package/types/Cardano/Network/UTxOsAt.d.ts +9 -0
  185. package/types/Cardano/Network/UTxOsAt.d.ts.map +1 -0
  186. package/types/Cardano/Network/errors.d.ts +39 -0
  187. package/types/Cardano/Network/errors.d.ts.map +1 -0
  188. package/types/{Network → Cardano/Network}/index.d.ts +1 -0
  189. package/types/Cardano/Network/index.d.ts.map +1 -0
  190. package/types/Cardano/TxBuilder.d.ts +261 -0
  191. package/types/Cardano/TxBuilder.d.ts.map +1 -0
  192. package/types/Cardano/Uplc/Builtins.d.ts +163 -0
  193. package/types/Cardano/Uplc/Builtins.d.ts.map +1 -0
  194. package/types/Cardano/Uplc/Cek.d.ts +165 -0
  195. package/types/Cardano/Uplc/Cek.d.ts.map +1 -0
  196. package/types/Cardano/Uplc/Cost.d.ts +93 -0
  197. package/types/Cardano/Uplc/Cost.d.ts.map +1 -0
  198. package/types/{Uplc → Cardano/Uplc}/Data.d.ts +149 -15
  199. package/types/Cardano/Uplc/Data.d.ts.map +1 -0
  200. package/types/Cardano/Uplc/Script.d.ts +87 -0
  201. package/types/Cardano/Uplc/Script.d.ts.map +1 -0
  202. package/types/Cardano/Uplc/ScriptContext.d.ts +21 -0
  203. package/types/Cardano/Uplc/ScriptContext.d.ts.map +1 -0
  204. package/types/Cardano/Uplc/Term.d.ts +454 -0
  205. package/types/Cardano/Uplc/Term.d.ts.map +1 -0
  206. package/types/Cardano/Uplc/Type.d.ts +29 -0
  207. package/types/Cardano/Uplc/Type.d.ts.map +1 -0
  208. package/types/Cardano/Uplc/Value.d.ts +152 -0
  209. package/types/Cardano/Uplc/Value.d.ts.map +1 -0
  210. package/types/Cardano/Uplc/index.d.ts +7 -0
  211. package/types/Cardano/Uplc/index.d.ts.map +1 -0
  212. package/types/Cardano/index.d.ts +6 -0
  213. package/types/Cardano/index.d.ts.map +1 -0
  214. package/types/Codecs/Base32.d.ts.map +1 -0
  215. package/types/Codecs/Bech32.d.ts.map +1 -0
  216. package/types/Codecs/BigEndian.d.ts.map +1 -0
  217. package/types/Codecs/Bits.d.ts.map +1 -0
  218. package/types/{internal → Codecs}/Bytes.d.ts +7 -6
  219. package/types/Codecs/Bytes.d.ts.map +1 -0
  220. package/types/{Cbor.d.ts → Codecs/Cbor.d.ts} +77 -55
  221. package/types/Codecs/Cbor.d.ts.map +1 -0
  222. package/types/{internal → Codecs}/Flat.d.ts +2 -0
  223. package/types/Codecs/Flat.d.ts.map +1 -0
  224. package/types/Codecs/Float.d.ts.map +1 -0
  225. package/types/Codecs/LittleEndian.d.ts +18 -0
  226. package/types/Codecs/LittleEndian.d.ts.map +1 -0
  227. package/types/Codecs/Uint64.d.ts +16 -0
  228. package/types/Codecs/Uint64.d.ts.map +1 -0
  229. package/types/{internal → Codecs}/Utf8.d.ts +2 -2
  230. package/types/Codecs/Utf8.d.ts.map +1 -0
  231. package/types/Codecs/ZigZag.d.ts +3 -0
  232. package/types/Codecs/ZigZag.d.ts.map +1 -0
  233. package/types/Codecs/index.d.ts +8 -0
  234. package/types/Codecs/index.d.ts.map +1 -0
  235. package/types/Crypto/Blake2b.d.ts +16 -0
  236. package/types/Crypto/Blake2b.d.ts.map +1 -0
  237. package/types/Crypto/Curve.d.ts +161 -0
  238. package/types/Crypto/Curve.d.ts.map +1 -0
  239. package/types/Crypto/Ed25519.d.ts +155 -0
  240. package/types/Crypto/Ed25519.d.ts.map +1 -0
  241. package/types/Crypto/EdDSA.d.ts +159 -0
  242. package/types/Crypto/EdDSA.d.ts.map +1 -0
  243. package/types/Crypto/Field.d.ts +273 -0
  244. package/types/Crypto/Field.d.ts.map +1 -0
  245. package/types/Crypto/Hmac.d.ts +20 -0
  246. package/types/Crypto/Hmac.d.ts.map +1 -0
  247. package/types/Crypto/Keccak.d.ts +16 -0
  248. package/types/Crypto/Keccak.d.ts.map +1 -0
  249. package/types/Crypto/Pbkdf2.d.ts +15 -0
  250. package/types/Crypto/Pbkdf2.d.ts.map +1 -0
  251. package/types/Crypto/Sha2_256.d.ts +36 -0
  252. package/types/Crypto/Sha2_256.d.ts.map +1 -0
  253. package/types/Crypto/Sha2_512.d.ts +31 -0
  254. package/types/Crypto/Sha2_512.d.ts.map +1 -0
  255. package/types/Crypto/Sha3_256.d.ts +8 -0
  256. package/types/Crypto/Sha3_256.d.ts.map +1 -0
  257. package/types/Crypto/errors.d.ts +10 -0
  258. package/types/Crypto/errors.d.ts.map +1 -0
  259. package/types/Crypto/index.d.ts +12 -0
  260. package/types/Crypto/index.d.ts.map +1 -0
  261. package/types/index.d.ts +3 -5
  262. package/types/index.d.ts.map +1 -1
  263. package/dist/Address.js +0 -13
  264. package/dist/Address.js.map +0 -1
  265. package/dist/Bech32.js.map +0 -1
  266. package/dist/Cbor.js.map +0 -1
  267. package/dist/Ledger/Address.js.map +0 -1
  268. package/dist/Ledger/AssetClass.js.map +0 -1
  269. package/dist/Ledger/Assets.js +0 -120
  270. package/dist/Ledger/Assets.js.map +0 -1
  271. package/dist/Ledger/Credential.js +0 -17
  272. package/dist/Ledger/Credential.js.map +0 -1
  273. package/dist/Ledger/DatumHash.js +0 -21
  274. package/dist/Ledger/DatumHash.js.map +0 -1
  275. package/dist/Ledger/IsMainnet.js +0 -4
  276. package/dist/Ledger/IsMainnet.js.map +0 -1
  277. package/dist/Ledger/MintingPolicy.js +0 -45
  278. package/dist/Ledger/MintingPolicy.js.map +0 -1
  279. package/dist/Ledger/NetworkParams.js +0 -40
  280. package/dist/Ledger/NetworkParams.js.map +0 -1
  281. package/dist/Ledger/PubKeyHash.js.map +0 -1
  282. package/dist/Ledger/TxHash.js +0 -23
  283. package/dist/Ledger/TxHash.js.map +0 -1
  284. package/dist/Ledger/TxId.js +0 -23
  285. package/dist/Ledger/TxId.js.map +0 -1
  286. package/dist/Ledger/TxInput.js +0 -51
  287. package/dist/Ledger/TxInput.js.map +0 -1
  288. package/dist/Ledger/TxOutput.js +0 -118
  289. package/dist/Ledger/TxOutput.js.map +0 -1
  290. package/dist/Ledger/TxOutputDatum.js.map +0 -1
  291. package/dist/Ledger/TxOutputId.js +0 -55
  292. package/dist/Ledger/TxOutputId.js.map +0 -1
  293. package/dist/Ledger/UTxO.js +0 -43
  294. package/dist/Ledger/UTxO.js.map +0 -1
  295. package/dist/Ledger/UTxORef.js.map +0 -1
  296. package/dist/Ledger/ValidatorHash.js.map +0 -1
  297. package/dist/Ledger/index.js.map +0 -1
  298. package/dist/Network/IsMainnet.js.map +0 -1
  299. package/dist/Network/Params.js.map +0 -1
  300. package/dist/Network/UTxOsAt.js +0 -4
  301. package/dist/Network/UTxOsAt.js.map +0 -1
  302. package/dist/Network/errors.js +0 -16
  303. package/dist/Network/errors.js.map +0 -1
  304. package/dist/Network/index.js.map +0 -1
  305. package/dist/Uplc/Cek.js +0 -3
  306. package/dist/Uplc/Cek.js.map +0 -1
  307. package/dist/Uplc/Data.js.map +0 -1
  308. package/dist/Uplc/DataSchema.js +0 -118
  309. package/dist/Uplc/DataSchema.js.map +0 -1
  310. package/dist/Uplc/Primitive.js +0 -23
  311. package/dist/Uplc/Primitive.js.map +0 -1
  312. package/dist/Uplc/index.js +0 -3
  313. package/dist/Uplc/index.js.map +0 -1
  314. package/dist/internal/Base32.js.map +0 -1
  315. package/dist/internal/BigEndian.js.map +0 -1
  316. package/dist/internal/Bits.js.map +0 -1
  317. package/dist/internal/Bytes.js.map +0 -1
  318. package/dist/internal/Flat.js.map +0 -1
  319. package/dist/internal/Float.js.map +0 -1
  320. package/dist/internal/Utf8.js.map +0 -1
  321. package/tsconfig.check.tsbuildinfo +0 -1
  322. package/types/Address.d.ts +0 -5
  323. package/types/Address.d.ts.map +0 -1
  324. package/types/Bech32.d.ts.map +0 -1
  325. package/types/Cbor.d.ts.map +0 -1
  326. package/types/Ledger/Address.d.ts.map +0 -1
  327. package/types/Ledger/AssetClass.d.ts.map +0 -1
  328. package/types/Ledger/Assets.d.ts +0 -70
  329. package/types/Ledger/Assets.d.ts.map +0 -1
  330. package/types/Ledger/Credential.d.ts.map +0 -1
  331. package/types/Ledger/DatumHash.d.ts.map +0 -1
  332. package/types/Ledger/IsMainnet.d.ts +0 -6
  333. package/types/Ledger/IsMainnet.d.ts.map +0 -1
  334. package/types/Ledger/MintingPolicy.d.ts.map +0 -1
  335. package/types/Ledger/NetworkParams.d.ts +0 -40
  336. package/types/Ledger/NetworkParams.d.ts.map +0 -1
  337. package/types/Ledger/PubKeyHash.d.ts.map +0 -1
  338. package/types/Ledger/TxHash.d.ts.map +0 -1
  339. package/types/Ledger/TxId.d.ts +0 -70
  340. package/types/Ledger/TxId.d.ts.map +0 -1
  341. package/types/Ledger/TxInput.d.ts +0 -55
  342. package/types/Ledger/TxInput.d.ts.map +0 -1
  343. package/types/Ledger/TxOutput.d.ts +0 -63
  344. package/types/Ledger/TxOutput.d.ts.map +0 -1
  345. package/types/Ledger/TxOutputDatum.d.ts +0 -41
  346. package/types/Ledger/TxOutputDatum.d.ts.map +0 -1
  347. package/types/Ledger/TxOutputId.d.ts +0 -133
  348. package/types/Ledger/TxOutputId.d.ts.map +0 -1
  349. package/types/Ledger/UTxO.d.ts +0 -55
  350. package/types/Ledger/UTxO.d.ts.map +0 -1
  351. package/types/Ledger/UTxORef.d.ts +0 -133
  352. package/types/Ledger/UTxORef.d.ts.map +0 -1
  353. package/types/Ledger/ValidatorHash.d.ts.map +0 -1
  354. package/types/Ledger/index.d.ts.map +0 -1
  355. package/types/Network/IsMainnet.d.ts.map +0 -1
  356. package/types/Network/Params.d.ts.map +0 -1
  357. package/types/Network/UTxOsAt.d.ts +0 -9
  358. package/types/Network/UTxOsAt.d.ts.map +0 -1
  359. package/types/Network/errors.d.ts +0 -18
  360. package/types/Network/errors.d.ts.map +0 -1
  361. package/types/Network/index.d.ts.map +0 -1
  362. package/types/Uplc/Cek.d.ts +0 -72
  363. package/types/Uplc/Cek.d.ts.map +0 -1
  364. package/types/Uplc/Data.d.ts.map +0 -1
  365. package/types/Uplc/DataSchema.d.ts +0 -227
  366. package/types/Uplc/DataSchema.d.ts.map +0 -1
  367. package/types/Uplc/Primitive.d.ts +0 -26
  368. package/types/Uplc/Primitive.d.ts.map +0 -1
  369. package/types/Uplc/index.d.ts +0 -3
  370. package/types/Uplc/index.d.ts.map +0 -1
  371. package/types/internal/Base32.d.ts.map +0 -1
  372. package/types/internal/BigEndian.d.ts.map +0 -1
  373. package/types/internal/Bits.d.ts.map +0 -1
  374. package/types/internal/Bytes.d.ts.map +0 -1
  375. package/types/internal/Flat.d.ts.map +0 -1
  376. package/types/internal/Float.d.ts.map +0 -1
  377. package/types/internal/Utf8.d.ts.map +0 -1
  378. /package/dist/{Network → Cardano/Network}/IsMainnet.js +0 -0
  379. /package/dist/{internal → Codecs}/BigEndian.js +0 -0
  380. /package/dist/{internal → Codecs}/Bits.js +0 -0
  381. /package/dist/{internal → Codecs}/Float.js +0 -0
  382. /package/types/{Network → Cardano/Network}/IsMainnet.d.ts +0 -0
  383. /package/types/{internal → Codecs}/Base32.d.ts +0 -0
  384. /package/types/{Bech32.d.ts → Codecs/Bech32.d.ts} +0 -0
  385. /package/types/{internal → Codecs}/BigEndian.d.ts +0 -0
  386. /package/types/{internal → Codecs}/Bits.d.ts +0 -0
  387. /package/types/{internal → Codecs}/Float.d.ts +0 -0
@@ -0,0 +1,323 @@
1
+ import { Either, Encoding } from "effect";
2
+ import * as Bits from "../Codecs/Bits.js";
3
+ import * as Bytes from "../Codecs/Bytes.js";
4
+ import * as LittleEndian from "../Codecs/LittleEndian.js";
5
+ import { EdDSA } from "./EdDSA.js";
6
+ import { FieldHelper, ScalarField } from "./Field.js";
7
+ /**
8
+ * @param bytes
9
+ * @param truncate
10
+ * Force `bytes` to 32 bytes long, applying special padding to first and 32nd byte
11
+ * @returns
12
+ * A DecodeException if `bytes` is empty
13
+ */
14
+ export function decodeScalar(bytes, truncate = false) {
15
+ if (truncate) {
16
+ bytes = bytes.slice(0, 32);
17
+ bytes[0] &= 0b11111000;
18
+ bytes[31] &= 0b00111111;
19
+ bytes[31] |= 0b01000000;
20
+ }
21
+ return LittleEndian.decode(bytes);
22
+ }
23
+ /**
24
+ * @param bytes
25
+ * @returns
26
+ * A DecodeException if `bytes` is empty
27
+ */
28
+ export function decodePrivateKey(bytes) {
29
+ return decodeScalar(bytes, true);
30
+ }
31
+ /**
32
+ * @param x
33
+ * @returns
34
+ */
35
+ export function encodeScalar(x) {
36
+ return new Uint8Array(LittleEndian.encode32(x));
37
+ }
38
+ /**
39
+ * The formula for the twisted Edwards curve is:
40
+ * -x^2 + y^2 = 1 - d*x^2*y^2
41
+ * Calculating x from this we get (only y is stored in the encoded point):
42
+ * y^2 - 1 = x^2*(1 - d*y^2)
43
+ * x = sqrt((y^2 - 1)/(1 - d*y^2))
44
+ * @param bytes
45
+ * @returns
46
+ * A DecodeException if `bytes` isn't exactly 32 long
47
+ */
48
+ export const decodePoint = (bytes) => Either.gen(function* () {
49
+ if (bytes.length != 32) {
50
+ return yield* Either.left(Encoding.DecodeException(Bytes.toHex(bytes), `expected 32 bytes for encoded point, got ${bytes.length}`));
51
+ }
52
+ const tmp = bytes.slice();
53
+ tmp[31] = tmp[31] & 0b01111111;
54
+ // here we know that `tmp` isn't empty, so `decodeScalar()` can't throw an error
55
+ const y = Either.getOrThrow(decodeScalar(tmp));
56
+ const finalBit = Bits.getBit(Array.from(bytes), 255);
57
+ const y2 = y * y;
58
+ const x2 = (y2 - 1n) * F.invert(1n + D * y2);
59
+ // sqrt
60
+ let x = sqrt(x2);
61
+ if (!x) {
62
+ throw new Error("sqrt not defined on Ed25519 field, unable to recover X");
63
+ }
64
+ // if odd state not equal, make odd state same
65
+ if (Number(x & 1n) != finalBit) {
66
+ x = F.negate(x);
67
+ }
68
+ return { x, y };
69
+ });
70
+ /**
71
+ * @param point
72
+ * @returns
73
+ */
74
+ export function encodePoint(point) {
75
+ const { x, y } = point;
76
+ const evenOdd = Number(x & 1n); // 0: even, 1: odd
77
+ const bytes = encodeScalar(y);
78
+ // last bit is determined by x
79
+ bytes[31] = (bytes[31] & 0b011111111) | (evenOdd * 0b10000000);
80
+ return bytes;
81
+ }
82
+ // Decimal representations of large numbers because that's most common in literature
83
+ // Curve coordinate prime number.
84
+ // 255 bits so last bit can instead be used to encode sign
85
+ // (i.e. 32 byte compressed format for points which is neede by publicKey and first part of signature)
86
+ // operations on point coordinates are modulo P
87
+ export const P = 57896044618658097711785492504343953926634992332820282019728792003956564819949n; // ipowi(255n) - 19n, hence 25519
88
+ // A prime number that is <= the number of unique points on the curve
89
+ // operations on point multiplication factors are modulo N
90
+ export const N = 7237005577332262213973186563042994240857116359379907606001950938285454250989n; // ipow2(252n) + 27742317777372353535851937790883648493n;
91
+ // d parameter of affine twisted Edwards curve
92
+ // The formula for the twisted Edwards curve is:
93
+ // -x^2 + y^2 = 1 - d*x^2*y^2
94
+ // Note: the negative number is already included in this parameter
95
+ export const D = /* @__PURE__ */ (() => -4513249062541557337682894930092624173785641285191125241628941591882900924598840740n)(); // -121665n/121666n == -121665n * invert(121666n)
96
+ // Generator point
97
+ export const G = {
98
+ x: 15112221349535400772501151409588531511454012693041857206046113283949847762202n, // recovered from Gy
99
+ y: 46316835694926478169428394003475163141307993866256225615783033603165251855960n // (4n*invert(5n)) % P
100
+ };
101
+ const F = /* @__PURE__ */ (() => new FieldHelper(new ScalarField(P)))();
102
+ // (P + 3n)/8n
103
+ const P38 = 7237005577332262213973186563042994240829374041602535252466099000494570602494n;
104
+ // pow(2n, (P + 1n)/4n, P);
105
+ const SQRT2P14 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n;
106
+ function sqrt(a) {
107
+ let r = F.pow(a, P38);
108
+ const r2 = F.multiply(r, r);
109
+ if (!F.equals(r2, a)) {
110
+ r = F.multiply(r, SQRT2P14);
111
+ }
112
+ return r;
113
+ }
114
+ class AffineCurve {
115
+ constructor() { }
116
+ get ZERO() {
117
+ return {
118
+ x: 0n,
119
+ y: 1n
120
+ };
121
+ }
122
+ /**
123
+ * @param a
124
+ * @param b
125
+ * @returns
126
+ */
127
+ equals(a, b) {
128
+ return F.equals(a.x, b.x) && F.equals(a.y, b.y);
129
+ }
130
+ /**
131
+ * @param point
132
+ * @returns
133
+ */
134
+ negate(point) {
135
+ return {
136
+ x: F.negate(point.x),
137
+ y: point.y
138
+ };
139
+ }
140
+ /**
141
+ * @param point
142
+ * @returns
143
+ */
144
+ isValidPoint(point) {
145
+ const { x, y } = point;
146
+ // TODO: can we use F.square() ?
147
+ const xx = x * x;
148
+ const yy = y * y;
149
+ return F.equals(-xx + yy - 1n, D * xx * yy);
150
+ }
151
+ /**
152
+ * @param a
153
+ * @param b
154
+ * @returns
155
+ */
156
+ add(a, b) {
157
+ const { x: x1, y: y1 } = a;
158
+ const { x: x2, y: y2 } = b;
159
+ const dxxyy = D * x1 * x2 * y1 * y2;
160
+ const x3 = F.multiply(x1 * y2 + x2 * y1, F.invert(1n + dxxyy));
161
+ const y3 = F.multiply(y1 * y2 + x1 * x2, F.invert(1n - dxxyy));
162
+ return { x: x3, y: y3 };
163
+ }
164
+ /**
165
+ * @param point
166
+ * @returns
167
+ */
168
+ fromAffine(point) {
169
+ return point;
170
+ }
171
+ /**
172
+ * @param point
173
+ * @returns
174
+ */
175
+ toAffine(point) {
176
+ return point;
177
+ }
178
+ }
179
+ export const affineCurve = new AffineCurve();
180
+ class ExtendedCurve {
181
+ constructor() { }
182
+ get ZERO() {
183
+ return { x: 0n, y: 1n, z: 1n, t: 0n };
184
+ }
185
+ /**
186
+ * @param point
187
+ * @returns
188
+ */
189
+ isValidPoint(point) {
190
+ if (this.equals(this.ZERO, point)) {
191
+ return true;
192
+ }
193
+ else {
194
+ const zInverse = F.invert(point.z);
195
+ const x = F.multiply(point.x, zInverse);
196
+ const y = F.multiply(point.y, zInverse);
197
+ const xx = x * x;
198
+ const yy = y * y;
199
+ return F.equals(-xx + yy - 1n, D * xx * yy);
200
+ }
201
+ }
202
+ /**
203
+ * @param a
204
+ * @param b
205
+ * @returns
206
+ */
207
+ equals(a, b) {
208
+ return (F.multiply(a.x, b.z) == F.multiply(b.x, a.z) &&
209
+ F.multiply(a.y, b.z) == F.multiply(b.y, a.z));
210
+ }
211
+ /**
212
+ * @param point
213
+ * @returns
214
+ */
215
+ negate(point) {
216
+ return {
217
+ x: F.negate(point.x),
218
+ y: point.y,
219
+ z: point.z,
220
+ t: F.negate(point.t)
221
+ };
222
+ }
223
+ /**
224
+ * @param point1
225
+ * @param point2
226
+ * @returns
227
+ */
228
+ add(point1, point2) {
229
+ const { x: x1, y: y1, z: z1, t: t1 } = point1;
230
+ const { x: x2, y: y2, z: z2, t: t2 } = point2;
231
+ const a = F.multiply(x1, x2);
232
+ const b = F.multiply(y1, y2);
233
+ const c = F.multiply(D * t1, t2);
234
+ const d = F.multiply(z1, z2);
235
+ const e = F.add((x1 + y1) * (x2 + y2), -a - b);
236
+ const f = F.add(d, -c);
237
+ const g = F.add(d, c);
238
+ const h = F.add(a, b);
239
+ const x3 = F.multiply(e, f);
240
+ const y3 = F.multiply(g, h);
241
+ const z3 = F.multiply(f, g);
242
+ const t3 = F.multiply(e, h);
243
+ return { x: x3, y: y3, z: z3, t: t3 };
244
+ }
245
+ /**
246
+ * @param point
247
+ * @returns
248
+ */
249
+ toAffine(point) {
250
+ if (this.equals(this.ZERO, point)) {
251
+ return { x: 0n, y: 1n };
252
+ }
253
+ else {
254
+ const zInverse = F.invert(point.z);
255
+ return {
256
+ x: F.multiply(point.x, zInverse),
257
+ y: F.multiply(point.y, zInverse)
258
+ };
259
+ }
260
+ }
261
+ /**
262
+ * @param point
263
+ * @returns
264
+ */
265
+ fromAffine(point) {
266
+ const { x, y } = point;
267
+ return {
268
+ x,
269
+ y,
270
+ z: 1n,
271
+ t: F.multiply(x, y)
272
+ };
273
+ }
274
+ }
275
+ export const extendedCurve = /* @__PURE__ */ (() => new ExtendedCurve())();
276
+ const algorithm = /* @__PURE__ */ (() => new EdDSA(extendedCurve, G, new ScalarField(N), {
277
+ decodePoint,
278
+ encodePoint,
279
+ decodePrivateKey,
280
+ decodeScalar,
281
+ encodeScalar
282
+ }))();
283
+ /**
284
+ * @param privateKey
285
+ * Must be 64 bytes long
286
+ * @param hashPrivateKey
287
+ * Defaults to true, set to false when used in Bip32 algorithm
288
+ * @returns
289
+ * 32 byte public key, or BadPrivateKeyLength if private key isn't 64 bytes long
290
+ */
291
+ export function derivePublicKey(privateKey, hashPrivateKey = true) {
292
+ return algorithm.derivePublicKey(privateKey, hashPrivateKey);
293
+ }
294
+ /**
295
+ * Sign the message.
296
+ * Even though this implementation isn't constant time, it isn't vulnerable to a timing attack (see detailed notes in EdDSA implementation)
297
+ * @param message
298
+ * @param privateKeyBytes
299
+ * @param hashPrivateKey
300
+ * Defaults to true, Bip32 passes this as false
301
+ * @returns
302
+ * 64 byte signature, or BadPrivateKeyLength if private key isn't 64 bytes long
303
+ */
304
+ export function sign(message, privateKey, hashPrivateKey = true) {
305
+ return algorithm.sign(message, privateKey, hashPrivateKey);
306
+ }
307
+ /**
308
+ * @param signature
309
+ * @param message
310
+ * @param publicKey
311
+ * @returns
312
+ * - `true` if the signature is correct.
313
+ * - `false`:
314
+ * - if the signature is incorrect
315
+ * - if the signature doesn't lie on the curve,
316
+ * - if the publicKey doesn't lie on the curve
317
+ * - BadPublicKeyLength if publicKey isn't 32 bytes long
318
+ * - BadSignatureLength if signature isn't 64 bytes long
319
+ */
320
+ export function verify(signature, message, publicKey) {
321
+ return algorithm.verify(signature, message, publicKey);
322
+ }
323
+ //# sourceMappingURL=Ed25519.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ed25519.js","sourceRoot":"","sources":["../../src/Crypto/Ed25519.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAA;AAC3C,OAAO,KAAK,YAAY,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAIL,KAAK,EACN,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAiB,EACjB,WAAoB,KAAK;IAEzB,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAE1B,KAAK,CAAC,CAAC,CAAC,IAAI,UAAU,CAAA;QACtB,KAAK,CAAC,EAAE,CAAC,IAAI,UAAU,CAAA;QACvB,KAAK,CAAC,EAAE,CAAC,IAAI,UAAU,CAAA;IACzB,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAiB;IAEjB,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,C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,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC,EAAE,CAAA;AAE1E,MAAM,SAAS,GAAG,eAAe,CAAC,CAAC,GAAG,EAAE,CACtC,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE;IAC9C,WAAW;IACX,WAAW;IACX,gBAAgB;IAChB,YAAY;IACZ,YAAY;CACb,CAAC,CAAC,EAAE,CAAA;AAEP;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAsB,EACtB,iBAA0B,IAAI;IAE9B,OAAO,SAAS,CAAC,eAAe,CAAC,UAAU,EAAE,cAAc,CAAC,CAAA;AAC9D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,IAAI,CAClB,OAAmB,EACnB,UAAsB,EACtB,iBAA0B,IAAI;IAE9B,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,cAAc,CAAC,CAAA;AAC5D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,MAAM,CACpB,SAAqB,EACrB,OAAmB,EACnB,SAAqB;IAErB,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;AACxD,CAAC"}
@@ -0,0 +1,222 @@
1
+ import { Data, Either } from "effect";
2
+ import { CurveHelper } from "./Curve.js";
3
+ import * as Sha2_512 from "./Sha2_512.js";
4
+ export class BadPrivateKeyLength extends Data.TaggedError("Crypto.EdDSA.BadPrivateKeyLength") {
5
+ constructor(privateKey) {
6
+ super({
7
+ message: `expected extended privateKey with a length of 64 bytes, this privateKey is ${privateKey.length} bytes long (hint: pass hashPrivateKey = true)`
8
+ });
9
+ }
10
+ }
11
+ export class BadSignatureLength extends Data.TaggedError("Crypto.EdDSA.BadSignatureLength") {
12
+ constructor(signature) {
13
+ super({ message: `unexpected signature length ${signature.length}` });
14
+ }
15
+ }
16
+ export class BadPublicKeyLength extends Data.TaggedError("Crypto.EdDSA.BadPublicKeyLength") {
17
+ constructor(publicKey) {
18
+ super({ message: `unexpected publicKey length ${publicKey.length}` });
19
+ }
20
+ }
21
+ /**
22
+ * Edwards Digital Signing Algorithm
23
+ *
24
+ * Symbols based on the book "Elliptic Curves in Cryptography" by I.F. Blake, G. Seroussi and N.P. Smart
25
+ * See page 4 for an overview of the DSA algorithm.
26
+ * This book along with the first few sections of "Cryptography: An Introduction" by N.P. Smart are
27
+ * recommended reads in order to understand better the concepts of "scalars" and "CurvePoint" and
28
+ * their arithmatic over finite fields.
29
+ *
30
+ * Notation:
31
+ * privateKey: 64 bytes, first 32 bytes form the scalar integer `x`, the latter bytes are used for private nonce generation
32
+ * publicKey: 32 bytes
33
+ * x: bigint scalar representation of privateKey
34
+ * g: generator BASE point
35
+ * h: CurvePoint representation of publicKey
36
+ * m: (hashed) message, kept as bytes
37
+ * k: a practically random number, created by applying a one-way function to the message and part of the private key
38
+ * a: first part of signature
39
+ * b: second part of signature
40
+ * `*`: group multiplication of a CurvePoint by a scalar integer, or multiplication of 2 scalars (depending on context)
41
+ * `+`: CurvePoint addition or scalar addition depending on context
42
+ * `.`: byte concatenation
43
+ * `[n:N]`: slice bytes
44
+ * `f(a,h,m)`: a one-way function for publicy known information
45
+ * `mod()`: take modulo of a scalar wrt. the order of the Curve
46
+ * `hash()`: Sha512 hash function
47
+ * `encodeScalar`: turn a scalar integer into bytes
48
+ * `decodeScalar`: turn bytes into a scalar integer
49
+ * `encodePoint`: turn a CurvePoint into bytes
50
+ * `decodePoint`: turn bytes into a CurvePoint
51
+ *
52
+ * The algorithm below is approached from an additive perspective.
53
+ *
54
+ * 1. Generate 64 random private key bytes
55
+ * privateKey = random(64)
56
+ * 2. Generate the associated scalar `x`:
57
+ * x = decodeScalar(privateKey[0:32])
58
+ * 3. Generate public key CurvePoint:
59
+ * h = g*x
60
+ * 4. Encode public key:
61
+ * publicKey = encodePoint(h)
62
+ * 5. Create first part of a signature:
63
+ * k = decodeScalar(hash(privateKey[32:64] . m))
64
+ * a = g*k
65
+ * signature[0:32] = encodePoint(a)
66
+ * 6. Create second part of a signature:
67
+ * f(a,h,m) = decodeScalar(hash(signature[0:32] . publicKey . m))
68
+ * b = mod(k + f(a,h,m)*x)
69
+ * signature[32:64] = encodeScalar(b)
70
+ * 7. Verify a signature:
71
+ * a = decodePoint(signature[0:32])
72
+ * b = decodeScalar(signature[32:64])
73
+ * h = decodePoint(publicKey)
74
+ * f(a,h,m) = decodeScalar(hash(signature[0:32] . publicKey . m))
75
+ * g*b === a + h*f(a,h,m)
76
+ *
77
+ * We can show that this works by substituting the private calculations done upon signing (the arithmatic takes care of the mod() operator):
78
+ * g*(k + f(a,h,m)*x) === g*k + h*f(a,h,m)
79
+ * g*k + g*x*f(a,h,m) === g*k + h*f(a,h,m)
80
+ *
81
+ * We know that `g*x == h`, QED.
82
+ *
83
+ * The arithmatic details are handled by the CurvePoint class
84
+ */
85
+ export class EdDSA {
86
+ curve;
87
+ G;
88
+ Z;
89
+ codec;
90
+ /**
91
+ * @param curve
92
+ */
93
+ constructor(curve, G, Z, pointCodec) {
94
+ this.curve = curve;
95
+ this.G = G;
96
+ this.Z = Z;
97
+ this.codec = pointCodec;
98
+ }
99
+ /**
100
+ * Combination hash and decodeCurveInt
101
+ * @param bytes
102
+ * @returns
103
+ */
104
+ oneWay(...chunks) {
105
+ const l = chunks.reduce((prev, chunk) => chunk.length + prev, 0);
106
+ const bytes = new Uint8Array(l);
107
+ let offset = 0;
108
+ chunks.forEach((chunk) => {
109
+ bytes.set(chunk, offset);
110
+ offset += chunk.length;
111
+ });
112
+ return Either.getOrThrow(this.codec.decodeScalar(Sha2_512.hashSync(bytes)));
113
+ }
114
+ /**
115
+ * @param privateKeyBytes
116
+ * @param hashPrivateKey
117
+ * Defaults to true, set to false
118
+ * when used in Bip32 algorithm
119
+ * @returns 32 byte public key.
120
+ */
121
+ derivePublicKey(privateKeyBytes, hashPrivateKey = true) {
122
+ if (hashPrivateKey) {
123
+ privateKeyBytes = Sha2_512.hashSync(privateKeyBytes);
124
+ }
125
+ else {
126
+ if (privateKeyBytes.length != 64) {
127
+ return Either.left(new BadPrivateKeyLength(privateKeyBytes));
128
+ }
129
+ }
130
+ // we know that `privateKeyBytes` isn't empty, so `decodePrivateKey()` should never throw an error
131
+ const privateKey = Either.getOrThrow(this.codec.decodePrivateKey(privateKeyBytes));
132
+ const curveHelper = new CurveHelper(this.curve);
133
+ const publicKey = curveHelper.scale(this.curve.fromAffine(this.G), privateKey);
134
+ const publicKeyBytes = this.codec.encodePoint(this.curve.toAffine(publicKey));
135
+ return Either.right(publicKeyBytes);
136
+ }
137
+ /**
138
+ * Sign the message.
139
+ * Even though this implementation isn't constant time, it isn't vulnerable to a timing attack (see detailed notes in implementation below)
140
+ * @param message
141
+ * @param privateKeyBytes
142
+ * @param hashPrivateKey
143
+ * Defaults to true, Bip32 passes this as false
144
+ * @returns
145
+ * 64 byte signature.
146
+ */
147
+ sign(message, privateKeyBytes, hashPrivateKey = true) {
148
+ if (hashPrivateKey) {
149
+ privateKeyBytes = Sha2_512.hashSync(privateKeyBytes);
150
+ }
151
+ else {
152
+ if (privateKeyBytes.length != 64) {
153
+ return Either.left(new BadPrivateKeyLength(privateKeyBytes));
154
+ }
155
+ }
156
+ // Extract privateKey as integer
157
+ // (Not vulnerable to timing attack because there is no mixing with the message,
158
+ // so always takes the same amount of time for the same privateKey)
159
+ const privateKey = Either.getOrThrow(this.codec.decodePrivateKey(privateKeyBytes));
160
+ const curveHelper = new CurveHelper(this.curve);
161
+ // For convenience calculate publicKey here
162
+ // (Not vulnerable to timing attack because there is no mixing with the message,
163
+ // so always takes the same amount of time for the same privateKey)
164
+ const publicKey = curveHelper.scale(this.curve.fromAffine(this.G), privateKey);
165
+ const publicKeyBytes = this.codec.encodePoint(this.curve.toAffine(publicKey));
166
+ // Generate a practically random number
167
+ // (Not vulnerable to timing attack because sha2_512 runtime only depends on message length,
168
+ // so timing doesn't expose any bytes of the privateKey)
169
+ const k = this.oneWay(privateKeyBytes.slice(32, 64), message);
170
+ // First part of the signature
171
+ // (Not vulnerable to timing attack because variations in the message create huge random variations in k)
172
+ const a = curveHelper.scale(this.curve.fromAffine(this.G), k);
173
+ const aEncoded = this.codec.encodePoint(this.curve.toAffine(a));
174
+ // Second part of the signature
175
+ // (Not vulnerable to timing attack.
176
+ // Even though f is known publicly and changes with each message,
177
+ // and the f * x operation isn't constant time (bigint ops in JS aren't constant time),
178
+ // k also changes with each message, and the [k]BASE operation above
179
+ // is much more expensive than multiplying two big ints)
180
+ const f = this.oneWay(aEncoded, publicKeyBytes, message);
181
+ const b = this.Z.add(k, f * privateKey);
182
+ const bEncoded = this.codec.encodeScalar(b);
183
+ return Either.right(new Uint8Array(Array.from(aEncoded).concat(Array.from(bEncoded))));
184
+ }
185
+ /**
186
+ * Returns `true` if the signature is correct.
187
+ * Returns `false`:
188
+ * * if the signature is incorrect
189
+ * * if the signature doesn't lie on the curve,
190
+ * * if the publicKey doesn't lie on the curve
191
+ * Throw an error:
192
+ * * signature isn't 64 bytes long
193
+ * * publickey isn't 32 bytes long (asserted inside `decodePoint()`)
194
+ * @param signature
195
+ * @param message
196
+ * @param publicKey
197
+ * @returns
198
+ */
199
+ verify(signature, message, publicKey) {
200
+ if (signature.length != 64) {
201
+ return Either.left(new BadSignatureLength(signature));
202
+ }
203
+ const a = this.curve.fromAffine(Either.getOrThrow(this.codec.decodePoint(signature.slice(0, 32))));
204
+ if (!this.curve.isValidPoint(a)) {
205
+ return Either.right(false);
206
+ }
207
+ const b = Either.getOrThrow(this.codec.decodeScalar(signature.slice(32, 64)));
208
+ if (publicKey.length != 32) {
209
+ return Either.left(new BadPublicKeyLength(publicKey));
210
+ }
211
+ const h = this.curve.fromAffine(Either.getOrThrow(this.codec.decodePoint(publicKey)));
212
+ if (!this.curve.isValidPoint(h)) {
213
+ return Either.right(false);
214
+ }
215
+ const f = this.oneWay(signature.slice(0, 32), publicKey, message);
216
+ const curveHelper = new CurveHelper(this.curve);
217
+ const left = curveHelper.scale(this.curve.fromAffine(this.G), b);
218
+ const right = this.curve.add(a, curveHelper.scale(h, f));
219
+ return Either.right(this.curve.equals(left, right));
220
+ }
221
+ }
222
+ //# sourceMappingURL=EdDSA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EdDSA.js","sourceRoot":"","sources":["../../src/Crypto/EdDSA.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAY,MAAM,QAAQ,CAAA;AAC/C,OAAO,EAAc,WAAW,EAAgB,MAAM,YAAY,CAAA;AAClE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAGzC,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CACvD,kCAAkC,CAGlC;IACA,YAAY,UAAsB;QAChC,KAAK,CAAC;YACJ,OAAO,EAAE,8EAA8E,UAAU,CAAC,MAAM,gDAAgD;SACzJ,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,IAAI,CAAC,WAAW,CACtD,iCAAiC,CAGjC;IACA,YAAY,SAAqB;QAC/B,KAAK,CAAC,EAAE,OAAO,EAAE,+BAA+B,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACvE,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,IAAI,CAAC,WAAW,CACtD,iCAAiC,CAGjC;IACA,YAAY,SAAqB;QAC/B,KAAK,CAAC,EAAE,OAAO,EAAE,+BAA+B,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IACvE,CAAC;CACF;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,OAAO,KAAK;IACP,KAAK,CAAkB;IACvB,CAAC,CAA0B;IAC3B,C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