@atomicfinance/types 4.0.0 → 4.0.2

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 (510) hide show
  1. package/.turbo/turbo-lint.log +1 -0
  2. package/.yalc/@node-dlc/bitcoin/.nyc_output/982e80bf-a70c-452f-b63d-d749ae385531.json +1 -0
  3. package/.yalc/@node-dlc/bitcoin/.nyc_output/processinfo/982e80bf-a70c-452f-b63d-d749ae385531.json +1 -0
  4. package/.yalc/@node-dlc/bitcoin/.nyc_output/processinfo/index.json +1 -0
  5. package/.yalc/@node-dlc/bitcoin/README.md +11 -0
  6. package/.yalc/@node-dlc/bitcoin/__tests__/bitcoin/amount.spec.ts +330 -0
  7. package/.yalc/@node-dlc/bitcoin/__tests__/bitcoin/value.spec.ts +320 -0
  8. package/.yalc/@node-dlc/bitcoin/__tests__/tsconfig.json +8 -0
  9. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Amount.ts.html +290 -0
  10. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Base58.ts.html +269 -0
  11. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Base58Check.ts.html +182 -0
  12. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/BitcoinError.ts.html +173 -0
  13. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/BitcoinErrorCode.ts.html +110 -0
  14. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/HashByteOrder.ts.html +143 -0
  15. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/HashValue.ts.html +350 -0
  16. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/LexicographicalSorters.ts.html +191 -0
  17. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/LockTime.ts.html +386 -0
  18. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/OpCodes.ts.html +437 -0
  19. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/OutPoint.ts.html +383 -0
  20. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Script.ts.html +1607 -0
  21. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Sequence.ts.html +713 -0
  22. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/SigHashType.ts.html +137 -0
  23. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Stack.ts.html +323 -0
  24. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/TimeLockMode.ts.html +128 -0
  25. package/.yalc/@node-dlc/{messaging/coverage/lcov-report/lib/serde/SerdeUtils.ts.html → bitcoin/coverage/lcov-report/Tx.ts.html} +617 -491
  26. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/TxBuilder.ts.html +971 -0
  27. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/TxIn.ts.html +425 -0
  28. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/TxOut.ts.html +341 -0
  29. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Value.ts.html +683 -0
  30. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Wif.ts.html +311 -0
  31. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/Witness.ts.html +275 -0
  32. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/base.css +224 -0
  33. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/block-navigation.js +79 -0
  34. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/favicon.png +0 -0
  35. package/.yalc/@node-dlc/{messaging/coverage/lcov-report/lib/serde → bitcoin/coverage/lcov-report}/index.html +45 -30
  36. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/index.ts.html +164 -0
  37. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/prettify.css +1 -0
  38. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/prettify.js +2 -0
  39. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  40. package/.yalc/@node-dlc/bitcoin/coverage/lcov-report/sorter.js +170 -0
  41. package/.yalc/@node-dlc/bitcoin/coverage/lcov.info +123 -0
  42. package/.yalc/@node-dlc/bitcoin/dist/Amount.d.ts +48 -0
  43. package/.yalc/@node-dlc/bitcoin/dist/Amount.js +68 -0
  44. package/.yalc/@node-dlc/bitcoin/dist/Amount.js.map +1 -0
  45. package/.yalc/@node-dlc/bitcoin/dist/Base58.d.ts +22 -0
  46. package/.yalc/@node-dlc/bitcoin/dist/Base58.js +62 -0
  47. package/.yalc/@node-dlc/bitcoin/dist/Base58.js.map +1 -0
  48. package/.yalc/@node-dlc/bitcoin/dist/Base58Check.d.ts +14 -0
  49. package/.yalc/@node-dlc/bitcoin/dist/Base58Check.js +36 -0
  50. package/.yalc/@node-dlc/bitcoin/dist/Base58Check.js.map +1 -0
  51. package/.yalc/@node-dlc/bitcoin/dist/BitcoinError.d.ts +6 -0
  52. package/.yalc/@node-dlc/bitcoin/dist/BitcoinError.js +36 -0
  53. package/.yalc/@node-dlc/bitcoin/dist/BitcoinError.js.map +1 -0
  54. package/.yalc/@node-dlc/bitcoin/dist/BitcoinErrorCode.d.ts +10 -0
  55. package/.yalc/@node-dlc/bitcoin/dist/BitcoinErrorCode.js +15 -0
  56. package/.yalc/@node-dlc/bitcoin/dist/BitcoinErrorCode.js.map +1 -0
  57. package/.yalc/@node-dlc/bitcoin/dist/Block.d.ts +19 -0
  58. package/.yalc/@node-dlc/bitcoin/dist/Block.js +3 -0
  59. package/.yalc/@node-dlc/bitcoin/dist/Block.js.map +1 -0
  60. package/.yalc/@node-dlc/bitcoin/dist/HashByteOrder.d.ts +20 -0
  61. package/.yalc/@node-dlc/bitcoin/dist/HashByteOrder.js +25 -0
  62. package/.yalc/@node-dlc/bitcoin/dist/HashByteOrder.js.map +1 -0
  63. package/.yalc/@node-dlc/bitcoin/dist/HashValue.d.ts +55 -0
  64. package/.yalc/@node-dlc/bitcoin/dist/HashValue.js +82 -0
  65. package/.yalc/@node-dlc/bitcoin/dist/HashValue.js.map +1 -0
  66. package/.yalc/@node-dlc/bitcoin/dist/ICloneable.d.ts +3 -0
  67. package/.yalc/@node-dlc/bitcoin/dist/ICloneable.js +3 -0
  68. package/.yalc/@node-dlc/bitcoin/dist/ICloneable.js.map +1 -0
  69. package/.yalc/@node-dlc/bitcoin/dist/LexicographicalSorters.d.ts +18 -0
  70. package/.yalc/@node-dlc/bitcoin/dist/LexicographicalSorters.js +41 -0
  71. package/.yalc/@node-dlc/bitcoin/dist/LexicographicalSorters.js.map +1 -0
  72. package/.yalc/@node-dlc/bitcoin/dist/LockTime.d.ts +61 -0
  73. package/.yalc/@node-dlc/bitcoin/dist/LockTime.js +94 -0
  74. package/.yalc/@node-dlc/bitcoin/dist/LockTime.js.map +1 -0
  75. package/.yalc/@node-dlc/bitcoin/dist/OpCodes.d.ts +102 -0
  76. package/.yalc/@node-dlc/bitcoin/dist/OpCodes.js +116 -0
  77. package/.yalc/@node-dlc/bitcoin/dist/OpCodes.js.map +1 -0
  78. package/.yalc/@node-dlc/bitcoin/dist/OutPoint.d.ts +57 -0
  79. package/.yalc/@node-dlc/bitcoin/dist/OutPoint.js +88 -0
  80. package/.yalc/@node-dlc/bitcoin/dist/OutPoint.js.map +1 -0
  81. package/.yalc/@node-dlc/bitcoin/dist/Script.d.ts +185 -0
  82. package/.yalc/@node-dlc/bitcoin/dist/Script.js +404 -0
  83. package/.yalc/@node-dlc/bitcoin/dist/Script.js.map +1 -0
  84. package/.yalc/@node-dlc/bitcoin/dist/ScriptCmd.d.ts +3 -0
  85. package/.yalc/@node-dlc/bitcoin/dist/ScriptCmd.js +3 -0
  86. package/.yalc/@node-dlc/bitcoin/dist/ScriptCmd.js.map +1 -0
  87. package/.yalc/@node-dlc/bitcoin/dist/Sequence.d.ts +116 -0
  88. package/.yalc/@node-dlc/bitcoin/dist/Sequence.js +187 -0
  89. package/.yalc/@node-dlc/bitcoin/dist/Sequence.js.map +1 -0
  90. package/.yalc/@node-dlc/bitcoin/dist/SigHashType.d.ts +7 -0
  91. package/.yalc/@node-dlc/bitcoin/dist/SigHashType.js +27 -0
  92. package/.yalc/@node-dlc/bitcoin/dist/SigHashType.js.map +1 -0
  93. package/.yalc/@node-dlc/bitcoin/dist/SizeResult.d.ts +5 -0
  94. package/.yalc/@node-dlc/bitcoin/dist/SizeResult.js +3 -0
  95. package/.yalc/@node-dlc/bitcoin/dist/SizeResult.js.map +1 -0
  96. package/.yalc/@node-dlc/bitcoin/dist/Sorter.d.ts +1 -0
  97. package/.yalc/@node-dlc/bitcoin/dist/Sorter.js +3 -0
  98. package/.yalc/@node-dlc/bitcoin/dist/Sorter.js.map +1 -0
  99. package/.yalc/@node-dlc/bitcoin/dist/Stack.d.ts +15 -0
  100. package/.yalc/@node-dlc/bitcoin/dist/Stack.js +77 -0
  101. package/.yalc/@node-dlc/bitcoin/dist/Stack.js.map +1 -0
  102. package/.yalc/@node-dlc/bitcoin/dist/TimeLockMode.d.ts +15 -0
  103. package/.yalc/@node-dlc/bitcoin/dist/TimeLockMode.js +20 -0
  104. package/.yalc/@node-dlc/bitcoin/dist/TimeLockMode.js.map +1 -0
  105. package/.yalc/@node-dlc/bitcoin/dist/Tx.d.ts +150 -0
  106. package/.yalc/@node-dlc/bitcoin/dist/Tx.js +408 -0
  107. package/.yalc/@node-dlc/bitcoin/dist/Tx.js.map +1 -0
  108. package/.yalc/@node-dlc/bitcoin/dist/TxBuilder.d.ts +110 -0
  109. package/.yalc/@node-dlc/bitcoin/dist/TxBuilder.js +238 -0
  110. package/.yalc/@node-dlc/bitcoin/dist/TxBuilder.js.map +1 -0
  111. package/.yalc/@node-dlc/bitcoin/dist/TxIn.d.ts +71 -0
  112. package/.yalc/@node-dlc/bitcoin/dist/TxIn.js +79 -0
  113. package/.yalc/@node-dlc/bitcoin/dist/TxIn.js.map +1 -0
  114. package/.yalc/@node-dlc/bitcoin/dist/TxOut.d.ts +57 -0
  115. package/.yalc/@node-dlc/bitcoin/dist/TxOut.js +68 -0
  116. package/.yalc/@node-dlc/bitcoin/dist/TxOut.js.map +1 -0
  117. package/.yalc/@node-dlc/bitcoin/dist/Value.d.ts +122 -0
  118. package/.yalc/@node-dlc/bitcoin/dist/Value.js +180 -0
  119. package/.yalc/@node-dlc/bitcoin/dist/Value.js.map +1 -0
  120. package/.yalc/@node-dlc/bitcoin/dist/Wif.d.ts +41 -0
  121. package/.yalc/@node-dlc/bitcoin/dist/Wif.js +62 -0
  122. package/.yalc/@node-dlc/bitcoin/dist/Wif.js.map +1 -0
  123. package/.yalc/@node-dlc/bitcoin/dist/Witness.d.ts +41 -0
  124. package/.yalc/@node-dlc/bitcoin/dist/Witness.js +63 -0
  125. package/.yalc/@node-dlc/bitcoin/dist/Witness.js.map +1 -0
  126. package/.yalc/@node-dlc/bitcoin/dist/index.d.ts +28 -0
  127. package/.yalc/@node-dlc/bitcoin/dist/index.js +45 -0
  128. package/.yalc/@node-dlc/bitcoin/dist/index.js.map +1 -0
  129. package/.yalc/@node-dlc/bitcoin/lib/Amount.ts +70 -0
  130. package/.yalc/@node-dlc/bitcoin/lib/Base58.ts +63 -0
  131. package/.yalc/@node-dlc/bitcoin/lib/Base58Check.ts +34 -0
  132. package/.yalc/@node-dlc/bitcoin/lib/BitcoinError.ts +31 -0
  133. package/.yalc/@node-dlc/bitcoin/lib/BitcoinErrorCode.ts +10 -0
  134. package/.yalc/@node-dlc/bitcoin/lib/Block.ts +20 -0
  135. package/.yalc/@node-dlc/bitcoin/lib/HashByteOrder.ts +21 -0
  136. package/.yalc/@node-dlc/bitcoin/lib/HashValue.ts +90 -0
  137. package/.yalc/@node-dlc/bitcoin/lib/ICloneable.ts +3 -0
  138. package/.yalc/@node-dlc/bitcoin/lib/LexicographicalSorters.ts +37 -0
  139. package/.yalc/@node-dlc/bitcoin/lib/LockTime.ts +102 -0
  140. package/.yalc/@node-dlc/bitcoin/lib/OpCodes.ts +119 -0
  141. package/.yalc/@node-dlc/bitcoin/lib/OutPoint.ts +101 -0
  142. package/.yalc/@node-dlc/bitcoin/lib/Script.ts +509 -0
  143. package/.yalc/@node-dlc/bitcoin/lib/ScriptCmd.ts +3 -0
  144. package/.yalc/@node-dlc/bitcoin/lib/Sequence.ts +211 -0
  145. package/.yalc/@node-dlc/bitcoin/lib/SigHashType.ts +19 -0
  146. package/.yalc/@node-dlc/bitcoin/lib/SizeResult.ts +5 -0
  147. package/.yalc/@node-dlc/bitcoin/lib/Sorter.ts +1 -0
  148. package/.yalc/@node-dlc/bitcoin/lib/Stack.ts +81 -0
  149. package/.yalc/@node-dlc/bitcoin/lib/TimeLockMode.ts +16 -0
  150. package/.yalc/@node-dlc/bitcoin/lib/Tx.ts +480 -0
  151. package/.yalc/@node-dlc/bitcoin/lib/TxBuilder.ts +297 -0
  152. package/.yalc/@node-dlc/bitcoin/lib/TxIn.ts +115 -0
  153. package/.yalc/@node-dlc/bitcoin/lib/TxOut.ts +87 -0
  154. package/.yalc/@node-dlc/bitcoin/lib/Value.ts +201 -0
  155. package/.yalc/@node-dlc/bitcoin/lib/Wif.ts +77 -0
  156. package/.yalc/@node-dlc/bitcoin/lib/Witness.ts +65 -0
  157. package/.yalc/@node-dlc/bitcoin/lib/index.ts +28 -0
  158. package/.yalc/@node-dlc/bitcoin/package.json +31 -0
  159. package/.yalc/@node-dlc/bitcoin/tsconfig.json +8 -0
  160. package/.yalc/@node-dlc/bitcoin/yalc.sig +1 -0
  161. package/.yalc/@node-dlc/messaging/.nyc_output/83d37f9d-cecf-4c52-a753-115ff80bbca0.json +1 -0
  162. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/83d37f9d-cecf-4c52-a753-115ff80bbca0.json +1 -0
  163. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/index.json +1 -1
  164. package/.yalc/@node-dlc/messaging/__tests__/_test-utils.ts +1 -0
  165. package/.yalc/@node-dlc/messaging/__tests__/compatibility/dlcspecs-compatibility.spec.ts +13 -47
  166. package/.yalc/@node-dlc/messaging/__tests__/compatibility/rust-dlc-cross-language.spec.ts +166 -253
  167. package/.yalc/@node-dlc/messaging/__tests__/compatibility/true-serialization-compatibility.spec.ts +214 -483
  168. package/.yalc/@node-dlc/messaging/__tests__/messages/ContractDescriptor.spec.ts +3 -1
  169. package/.yalc/@node-dlc/messaging/__tests__/messages/ContractInfo.spec.ts +1 -1
  170. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcAccept.spec.ts +72 -0
  171. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcInput.spec.ts +111 -0
  172. package/.yalc/@node-dlc/messaging/__tests__/messages/DlcOffer.spec.ts +99 -37
  173. package/.yalc/@node-dlc/messaging/__tests__/messages/FundingInput.spec.ts +148 -63
  174. package/.yalc/@node-dlc/messaging/__tests__/messages/OracleAttestation.spec.ts +2 -4
  175. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderAccept.spec.ts +7 -9
  176. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderNegotiationFields.spec.ts +135 -52
  177. package/.yalc/@node-dlc/messaging/__tests__/messages/OrderPositionInfo.spec.ts +6 -6
  178. package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutCurvePiece.spec.ts +1 -1
  179. package/.yalc/@node-dlc/messaging/__tests__/messages/PayoutFunction.spec.ts +1 -1
  180. package/.yalc/@node-dlc/messaging/__tests__/serialize/F64.spec.ts +1 -0
  181. package/.yalc/@node-dlc/messaging/coverage/lcov-report/index.html +31 -31
  182. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/MessageType.ts.html +11 -5
  183. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainManager.ts.html +6 -3
  184. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/ChainMemoryStore.ts.html +1 -1
  185. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/chain/index.html +1 -1
  186. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/Address.ts.html +1 -1
  187. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/domain/index.html +1 -1
  188. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.html +9 -9
  189. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/index.ts.html +11 -8
  190. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/IrcMessage.ts.html +1 -1
  191. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/irc/index.html +1 -1
  192. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/AddressCache.ts.html +1 -1
  193. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/BatchFundingGroup.ts.html +1 -1
  194. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignatures.ts.html +22 -22
  195. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CetAdaptorSignaturesV0.ts.html +46 -37
  196. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/CloseTLV.ts.html +344 -0
  197. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractDescriptor.ts.html +61 -70
  198. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ContractInfo.ts.html +59 -44
  199. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcAccept.ts.html +251 -119
  200. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCancel.ts.html +1 -1
  201. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcClose.ts.html +12 -3
  202. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcCloseMetadata.ts.html +2 -11
  203. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcIds.ts.html +1 -1
  204. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcInfo.ts.html +1 -1
  205. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcInput.ts.html +581 -0
  206. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcMessage.ts.html +1 -1
  207. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcOffer.ts.html +307 -127
  208. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcSign.ts.html +61 -46
  209. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/DlcTransactions.ts.html +1 -1
  210. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/EventDescriptor.ts.html +67 -52
  211. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingInput.ts.html +202 -70
  212. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignatures.ts.html +15 -15
  213. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/FundingSignaturesV0.ts.html +47 -77
  214. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NegotiationFields.ts.html +16 -4
  215. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/NodeAnnouncementMessage.ts.html +3 -3
  216. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncement.ts.html +22 -22
  217. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAnnouncementV0.ts.html +48 -270
  218. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestation.ts.html +1 -1
  219. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleAttestationV0.ts.html +113 -404
  220. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEvent.ts.html +49 -49
  221. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainer.ts.html +1 -1
  222. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventContainerV0.ts.html +22 -22
  223. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleEventV0.ts.html +61 -385
  224. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifier.ts.html +1 -1
  225. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleIdentifierV0.ts.html +1 -1
  226. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfo.ts.html +46 -25
  227. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OracleInfoV0.ts.html +55 -1378
  228. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderAccept.ts.html +68 -23
  229. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderIrcInfo.ts.html +1 -1
  230. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderMetadata.ts.html +1 -1
  231. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderNegotiationFields.ts.html +266 -107
  232. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderOffer.ts.html +31 -34
  233. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/OrderPositionInfo.ts.html +19 -88
  234. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutCurvePiece.ts.html +36 -21
  235. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/PayoutFunction.ts.html +34 -28
  236. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervals.ts.html +18 -15
  237. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/RoundingIntervalsV0.ts.html +75 -129
  238. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/ScriptWitnessV0.ts.html +6 -6
  239. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/messages/index.html +84 -69
  240. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/F64.ts.html +8 -53
  241. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/deserializeTlv.ts.html +1 -1
  242. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/getTlv.ts.html +9 -9
  243. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/serialize/index.html +15 -15
  244. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/util.ts.html +22 -10
  245. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/index.html +1 -1
  246. package/.yalc/@node-dlc/messaging/coverage/lcov-report/lib/validation/validate.ts.html +1 -1
  247. package/.yalc/@node-dlc/messaging/coverage/lcov.info +3049 -2826
  248. package/.yalc/@node-dlc/messaging/dist/MessageType.d.ts +2 -1
  249. package/.yalc/@node-dlc/messaging/dist/MessageType.js +2 -1
  250. package/.yalc/@node-dlc/messaging/dist/MessageType.js.map +1 -1
  251. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js +1 -0
  252. package/.yalc/@node-dlc/messaging/dist/chain/ChainManager.js.map +1 -1
  253. package/.yalc/@node-dlc/messaging/dist/index.d.ts +5 -4
  254. package/.yalc/@node-dlc/messaging/dist/index.js +5 -4
  255. package/.yalc/@node-dlc/messaging/dist/index.js.map +1 -1
  256. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignaturesV0.d.ts +42 -0
  257. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignaturesV0.js +68 -0
  258. package/.yalc/@node-dlc/messaging/dist/messages/CetAdaptorSignaturesV0.js.map +1 -0
  259. package/.yalc/@node-dlc/messaging/dist/messages/CloseTLV.d.ts +38 -0
  260. package/.yalc/@node-dlc/messaging/dist/messages/CloseTLV.js +59 -0
  261. package/.yalc/@node-dlc/messaging/dist/messages/CloseTLV.js.map +1 -0
  262. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.d.ts +11 -12
  263. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js +0 -1
  264. package/.yalc/@node-dlc/messaging/dist/messages/ContractDescriptor.js.map +1 -1
  265. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.d.ts +10 -10
  266. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js +5 -1
  267. package/.yalc/@node-dlc/messaging/dist/messages/ContractInfo.js.map +1 -1
  268. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.d.ts +15 -0
  269. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js +46 -5
  270. package/.yalc/@node-dlc/messaging/dist/messages/DlcAccept.js.map +1 -1
  271. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js +6 -2
  272. package/.yalc/@node-dlc/messaging/dist/messages/DlcClose.js.map +1 -1
  273. package/.yalc/@node-dlc/messaging/dist/messages/DlcCloseMetadata.js.map +1 -1
  274. package/.yalc/@node-dlc/messaging/dist/messages/DlcInput.d.ts +56 -0
  275. package/.yalc/@node-dlc/messaging/dist/messages/DlcInput.js +135 -0
  276. package/.yalc/@node-dlc/messaging/dist/messages/DlcInput.js.map +1 -0
  277. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.d.ts +16 -1
  278. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js +50 -5
  279. package/.yalc/@node-dlc/messaging/dist/messages/DlcOffer.js.map +1 -1
  280. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js +11 -3
  281. package/.yalc/@node-dlc/messaging/dist/messages/DlcSign.js.map +1 -1
  282. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.d.ts +7 -6
  283. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js +3 -0
  284. package/.yalc/@node-dlc/messaging/dist/messages/EventDescriptor.js.map +1 -1
  285. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.d.ts +7 -0
  286. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js +31 -1
  287. package/.yalc/@node-dlc/messaging/dist/messages/FundingInput.js.map +1 -1
  288. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignaturesV0.d.ts +34 -0
  289. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignaturesV0.js +72 -0
  290. package/.yalc/@node-dlc/messaging/dist/messages/FundingSignaturesV0.js.map +1 -0
  291. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.d.ts +2 -2
  292. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js +4 -0
  293. package/.yalc/@node-dlc/messaging/dist/messages/NegotiationFields.js.map +1 -1
  294. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncementV0.d.ts +47 -0
  295. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncementV0.js +76 -0
  296. package/.yalc/@node-dlc/messaging/dist/messages/OracleAnnouncementV0.js.map +1 -0
  297. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestationV0.d.ts +48 -0
  298. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestationV0.js +100 -0
  299. package/.yalc/@node-dlc/messaging/dist/messages/OracleAttestationV0.js.map +1 -0
  300. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainerV0.d.ts +32 -0
  301. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainerV0.js +67 -0
  302. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventContainerV0.js.map +1 -0
  303. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventV0.d.ts +54 -0
  304. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventV0.js +100 -0
  305. package/.yalc/@node-dlc/messaging/dist/messages/OracleEventV0.js.map +1 -0
  306. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.d.ts +8 -6
  307. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js +3 -0
  308. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfo.js.map +1 -1
  309. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.d.ts +15 -141
  310. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js +21 -350
  311. package/.yalc/@node-dlc/messaging/dist/messages/OracleInfoV0.js.map +1 -1
  312. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.d.ts +3 -2
  313. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js +22 -7
  314. package/.yalc/@node-dlc/messaging/dist/messages/OrderAccept.js.map +1 -1
  315. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.d.ts +48 -36
  316. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js +97 -50
  317. package/.yalc/@node-dlc/messaging/dist/messages/OrderNegotiationFields.js.map +1 -1
  318. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.d.ts +1 -1
  319. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js +1 -1
  320. package/.yalc/@node-dlc/messaging/dist/messages/OrderOffer.js.map +1 -1
  321. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.d.ts +7 -13
  322. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js +11 -25
  323. package/.yalc/@node-dlc/messaging/dist/messages/OrderPositionInfo.js.map +1 -1
  324. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js +5 -0
  325. package/.yalc/@node-dlc/messaging/dist/messages/PayoutCurvePiece.js.map +1 -1
  326. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js +4 -1
  327. package/.yalc/@node-dlc/messaging/dist/messages/PayoutFunction.js.map +1 -1
  328. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js +1 -0
  329. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervals.js.map +1 -1
  330. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervalsV0.d.ts +47 -0
  331. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervalsV0.js +86 -0
  332. package/.yalc/@node-dlc/messaging/dist/messages/RoundingIntervalsV0.js.map +1 -0
  333. package/.yalc/@node-dlc/messaging/dist/serialize/F64.d.ts +0 -8
  334. package/.yalc/@node-dlc/messaging/dist/serialize/F64.js +0 -13
  335. package/.yalc/@node-dlc/messaging/dist/serialize/F64.js.map +1 -1
  336. package/.yalc/@node-dlc/messaging/dist/util.d.ts +1 -1
  337. package/.yalc/@node-dlc/messaging/dist/util.js +2 -0
  338. package/.yalc/@node-dlc/messaging/dist/util.js.map +1 -1
  339. package/.yalc/@node-dlc/messaging/lib/MessageType.ts +3 -1
  340. package/.yalc/@node-dlc/messaging/lib/chain/ChainManager.ts +1 -0
  341. package/.yalc/@node-dlc/messaging/lib/index.ts +5 -4
  342. package/.yalc/@node-dlc/messaging/lib/messages/ContractDescriptor.ts +15 -16
  343. package/.yalc/@node-dlc/messaging/lib/messages/ContractInfo.ts +17 -12
  344. package/.yalc/@node-dlc/messaging/lib/messages/DlcAccept.ts +50 -6
  345. package/.yalc/@node-dlc/messaging/lib/messages/DlcClose.ts +4 -1
  346. package/.yalc/@node-dlc/messaging/lib/messages/DlcCloseMetadata.ts +0 -3
  347. package/.yalc/@node-dlc/messaging/lib/messages/DlcInput.ts +167 -0
  348. package/.yalc/@node-dlc/messaging/lib/messages/DlcOffer.ts +67 -7
  349. package/.yalc/@node-dlc/messaging/lib/messages/DlcSign.ts +5 -0
  350. package/.yalc/@node-dlc/messaging/lib/messages/EventDescriptor.ts +12 -7
  351. package/.yalc/@node-dlc/messaging/lib/messages/FundingInput.ts +45 -1
  352. package/.yalc/@node-dlc/messaging/lib/messages/NegotiationFields.ts +6 -2
  353. package/.yalc/@node-dlc/messaging/lib/messages/NodeAnnouncementMessage.ts +2 -2
  354. package/.yalc/@node-dlc/messaging/lib/messages/OracleInfo.ts +15 -8
  355. package/.yalc/@node-dlc/messaging/lib/messages/OrderAccept.ts +28 -13
  356. package/.yalc/@node-dlc/messaging/lib/messages/OrderNegotiationFields.ts +127 -74
  357. package/.yalc/@node-dlc/messaging/lib/messages/OrderOffer.ts +2 -3
  358. package/.yalc/@node-dlc/messaging/lib/messages/OrderPositionInfo.ts +10 -33
  359. package/.yalc/@node-dlc/messaging/lib/messages/PayoutCurvePiece.ts +5 -0
  360. package/.yalc/@node-dlc/messaging/lib/messages/PayoutFunction.ts +2 -0
  361. package/.yalc/@node-dlc/messaging/lib/messages/RoundingIntervals.ts +1 -0
  362. package/.yalc/@node-dlc/messaging/lib/serialize/F64.ts +0 -15
  363. package/.yalc/@node-dlc/messaging/lib/serialize/readTlvs.ts +1 -1
  364. package/.yalc/@node-dlc/messaging/lib/util.ts +5 -1
  365. package/.yalc/@node-dlc/messaging/package.json +8 -8
  366. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_3_test.json +76 -74
  367. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_3_of_5_test.json +90 -88
  368. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_3_of_5_test.json +162 -160
  369. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_5_of_5_test.json +162 -160
  370. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_3_of_5_test.json +164 -162
  371. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_and_numerical_with_diff_5_of_5_test.json +164 -162
  372. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/enum_single_oracle_test.json +60 -58
  373. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_hyperbola_test.json +71 -69
  374. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/single_oracle_numerical_test.json +71 -69
  375. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_five_oracle_numerical_with_diff_test.json +119 -117
  376. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_test.json +95 -93
  377. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/three_of_three_oracle_numerical_with_diff_test.json +97 -95
  378. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_test.json +117 -115
  379. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs/two_of_five_oracle_numerical_with_diff_test.json +119 -117
  380. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_3_of_3_test.json +210 -0
  381. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_3_of_5_test.json +468 -0
  382. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_and_numerical_3_of_5_test.json +1517 -0
  383. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_and_numerical_5_of_5_test.json +545 -0
  384. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_and_numerical_with_diff_3_of_5_test.json +4761 -0
  385. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_and_numerical_with_diff_5_of_5_test.json +2169 -0
  386. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/enum_single_oracle_test.json +164 -0
  387. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/single_oracle_numerical_hyperbola_test.json +502 -0
  388. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/single_oracle_numerical_test.json +262 -0
  389. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/three_of_five_oracle_numerical_with_diff_test.json +4382 -0
  390. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/three_of_three_oracle_numerical_test.json +324 -0
  391. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/three_of_three_oracle_numerical_with_diff_test.json +652 -0
  392. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/two_of_five_oracle_numerical_test.json +1138 -0
  393. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250718_132453/two_of_five_oracle_numerical_with_diff_test.json +2222 -0
  394. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_3_of_3_test.json +212 -0
  395. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_3_of_5_test.json +470 -0
  396. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_and_numerical_3_of_5_test.json +1519 -0
  397. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_and_numerical_5_of_5_test.json +547 -0
  398. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_and_numerical_with_diff_3_of_5_test.json +4763 -0
  399. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_and_numerical_with_diff_5_of_5_test.json +2171 -0
  400. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/enum_single_oracle_test.json +166 -0
  401. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/single_oracle_numerical_hyperbola_test.json +504 -0
  402. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/single_oracle_numerical_test.json +264 -0
  403. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/three_of_five_oracle_numerical_with_diff_test.json +4384 -0
  404. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/three_of_three_oracle_numerical_test.json +326 -0
  405. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/three_of_three_oracle_numerical_with_diff_test.json +654 -0
  406. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/two_of_five_oracle_numerical_test.json +1140 -0
  407. package/.yalc/@node-dlc/messaging/test_vectors/dlcspecs_backup_20250719_185952/two_of_five_oracle_numerical_with_diff_test.json +2224 -0
  408. package/.yalc/@node-dlc/messaging/yalc.sig +1 -1
  409. package/.yalc/@node-dlc/noise/.eslintrc +6 -0
  410. package/.yalc/@node-dlc/noise/.nyc_output/cce169d2-1730-4a39-9e05-4edcd8b14961.json +1 -0
  411. package/.yalc/@node-dlc/noise/.nyc_output/processinfo/cce169d2-1730-4a39-9e05-4edcd8b14961.json +1 -0
  412. package/.yalc/@node-dlc/noise/.nyc_output/processinfo/index.json +1 -0
  413. package/.yalc/@node-dlc/noise/README.md +165 -0
  414. package/.yalc/@node-dlc/noise/__integration__/ping-pong.spec.ts +85 -0
  415. package/.yalc/@node-dlc/noise/__tests__/noise-server.spec.ts +82 -0
  416. package/.yalc/@node-dlc/noise/__tests__/noise-socket.spec.ts +574 -0
  417. package/.yalc/@node-dlc/noise/__tests__/noise-state.spec.ts +485 -0
  418. package/.yalc/@node-dlc/noise/coverage/lcov-report/base.css +224 -0
  419. package/.yalc/@node-dlc/noise/coverage/lcov-report/block-navigation.js +79 -0
  420. package/.yalc/@node-dlc/noise/coverage/lcov-report/favicon.png +0 -0
  421. package/.yalc/@node-dlc/noise/coverage/lcov-report/handshake-state.ts.html +230 -0
  422. package/.yalc/@node-dlc/noise/coverage/lcov-report/index.html +201 -0
  423. package/.yalc/@node-dlc/noise/coverage/lcov-report/index.ts.html +344 -0
  424. package/.yalc/@node-dlc/noise/coverage/lcov-report/noise-error.ts.html +89 -0
  425. package/.yalc/@node-dlc/noise/coverage/lcov-report/noise-server.ts.html +485 -0
  426. package/.yalc/@node-dlc/noise/coverage/lcov-report/noise-socket.ts.html +1223 -0
  427. package/.yalc/@node-dlc/noise/coverage/lcov-report/noise-state.ts.html +1523 -0
  428. package/.yalc/@node-dlc/noise/coverage/lcov-report/prettify.css +1 -0
  429. package/.yalc/@node-dlc/noise/coverage/lcov-report/prettify.js +2 -0
  430. package/.yalc/@node-dlc/noise/coverage/lcov-report/read-state.ts.html +95 -0
  431. package/.yalc/@node-dlc/noise/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  432. package/.yalc/@node-dlc/noise/coverage/lcov-report/sorter.js +170 -0
  433. package/.yalc/@node-dlc/noise/coverage/lcov.info +565 -0
  434. package/.yalc/@node-dlc/noise/dist/handshake-state.d.ts +46 -0
  435. package/.yalc/@node-dlc/noise/dist/handshake-state.js +51 -0
  436. package/.yalc/@node-dlc/noise/dist/handshake-state.js.map +1 -0
  437. package/.yalc/@node-dlc/noise/dist/index.d.ts +46 -0
  438. package/.yalc/@node-dlc/noise/dist/index.js +69 -0
  439. package/.yalc/@node-dlc/noise/dist/index.js.map +1 -0
  440. package/.yalc/@node-dlc/noise/dist/noise-error.d.ts +3 -0
  441. package/.yalc/@node-dlc/noise/dist/noise-error.js +11 -0
  442. package/.yalc/@node-dlc/noise/dist/noise-error.js.map +1 -0
  443. package/.yalc/@node-dlc/noise/dist/noise-server-listen-options.d.ts +23 -0
  444. package/.yalc/@node-dlc/noise/dist/noise-server-listen-options.js +3 -0
  445. package/.yalc/@node-dlc/noise/dist/noise-server-listen-options.js.map +1 -0
  446. package/.yalc/@node-dlc/noise/dist/noise-server-options.d.ts +13 -0
  447. package/.yalc/@node-dlc/noise/dist/noise-server-options.js +3 -0
  448. package/.yalc/@node-dlc/noise/dist/noise-server-options.js.map +1 -0
  449. package/.yalc/@node-dlc/noise/dist/noise-server.d.ts +71 -0
  450. package/.yalc/@node-dlc/noise/dist/noise-server.js +125 -0
  451. package/.yalc/@node-dlc/noise/dist/noise-server.js.map +1 -0
  452. package/.yalc/@node-dlc/noise/dist/noise-socket-options.d.ts +28 -0
  453. package/.yalc/@node-dlc/noise/dist/noise-socket-options.js +3 -0
  454. package/.yalc/@node-dlc/noise/dist/noise-socket-options.js.map +1 -0
  455. package/.yalc/@node-dlc/noise/dist/noise-socket.d.ts +98 -0
  456. package/.yalc/@node-dlc/noise/dist/noise-socket.js +278 -0
  457. package/.yalc/@node-dlc/noise/dist/noise-socket.js.map +1 -0
  458. package/.yalc/@node-dlc/noise/dist/noise-state-options.d.ts +16 -0
  459. package/.yalc/@node-dlc/noise/dist/noise-state-options.js +3 -0
  460. package/.yalc/@node-dlc/noise/dist/noise-state-options.js.map +1 -0
  461. package/.yalc/@node-dlc/noise/dist/noise-state.d.ts +164 -0
  462. package/.yalc/@node-dlc/noise/dist/noise-state.js +304 -0
  463. package/.yalc/@node-dlc/noise/dist/noise-state.js.map +1 -0
  464. package/.yalc/@node-dlc/noise/dist/read-state.d.ts +5 -0
  465. package/.yalc/@node-dlc/noise/dist/read-state.js +10 -0
  466. package/.yalc/@node-dlc/noise/dist/read-state.js.map +1 -0
  467. package/.yalc/@node-dlc/noise/lib/handshake-state.ts +50 -0
  468. package/.yalc/@node-dlc/noise/lib/index.ts +88 -0
  469. package/.yalc/@node-dlc/noise/lib/noise-error.ts +3 -0
  470. package/.yalc/@node-dlc/noise/lib/noise-server-listen-options.ts +25 -0
  471. package/.yalc/@node-dlc/noise/lib/noise-server-options.ts +13 -0
  472. package/.yalc/@node-dlc/noise/lib/noise-server.ts +135 -0
  473. package/.yalc/@node-dlc/noise/lib/noise-socket-options.ts +32 -0
  474. package/.yalc/@node-dlc/noise/lib/noise-socket.ts +381 -0
  475. package/.yalc/@node-dlc/noise/lib/noise-state-options.ts +18 -0
  476. package/.yalc/@node-dlc/noise/lib/noise-state.ts +481 -0
  477. package/.yalc/@node-dlc/noise/lib/read-state.ts +5 -0
  478. package/.yalc/@node-dlc/noise/package.json +35 -0
  479. package/.yalc/@node-dlc/noise/tsconfig-build.json +7 -0
  480. package/.yalc/@node-dlc/noise/tsconfig.json +4 -0
  481. package/.yalc/@node-dlc/noise/yalc.sig +1 -0
  482. package/CHANGELOG.md +45 -5
  483. package/dist/dlc.d.ts +99 -2
  484. package/dist/index.d.ts +1 -1
  485. package/dist/index.js +2 -1
  486. package/dist/index.js.map +1 -1
  487. package/dist/models/Amount.js +4 -2
  488. package/dist/models/Amount.js.map +1 -1
  489. package/dist/models/Input.d.ts +30 -1
  490. package/dist/models/Input.js +45 -9
  491. package/dist/models/Input.js.map +1 -1
  492. package/dist/models/Outcome.js +1 -0
  493. package/dist/models/Outcome.js.map +1 -1
  494. package/dist/models/Utxo.d.ts +3 -3
  495. package/dist/models/Utxo.js +11 -13
  496. package/dist/models/Utxo.js.map +1 -1
  497. package/dist/transaction.js.map +1 -1
  498. package/lib/block.ts +1 -0
  499. package/lib/dlc.ts +125 -1
  500. package/lib/index.ts +7 -1
  501. package/lib/models/Amount.ts +4 -1
  502. package/lib/models/Input.ts +75 -8
  503. package/lib/models/Outcome.ts +1 -0
  504. package/lib/models/Utxo.ts +21 -13
  505. package/lib/transaction.ts +1 -0
  506. package/lib/wallet.ts +1 -0
  507. package/package.json +4 -4
  508. package/yalc.lock +12 -2
  509. package/.yalc/@node-dlc/messaging/.nyc_output/2cf48009-1094-4275-bb91-c164c932feb6.json +0 -1
  510. package/.yalc/@node-dlc/messaging/.nyc_output/processinfo/2cf48009-1094-4275-bb91-c164c932feb6.json +0 -1
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NoiseState = void 0;
4
+ const crypto_1 = require("@node-dlc/crypto");
5
+ const crypto_2 = require("@node-dlc/crypto");
6
+ class NoiseState {
7
+ /**
8
+ * State machine for perforing noise-protocol handshake, message
9
+ * encryption and decryption, and key rotation.
10
+ */
11
+ constructor({ ls, es, logger }) {
12
+ /**
13
+ * The official protocol name for the Lightning variant of Noise. This
14
+ * value is mixed into the iniitialiization function to start the
15
+ * handshake.
16
+ */
17
+ this.protocolName = Buffer.from('Noise_XK_secp256k1_ChaChaPoly_SHA256');
18
+ /**
19
+ * Appended to the hash of the protocolName during initialization.
20
+ */
21
+ this.prologue = Buffer.from('lightning');
22
+ this.logger = logger;
23
+ this.ls = ls;
24
+ this.lpk = (0, crypto_2.getPublicKey)(ls);
25
+ this.es = es;
26
+ this.epk = (0, crypto_2.getPublicKey)(es);
27
+ }
28
+ /**
29
+ * Initiator Act1 is the starting point for the authenticated key exchange
30
+ * handshake. The initiator attempts to satisfy an implicit challenge by the
31
+ * responder: knowledge of the static public key of the responder. It also
32
+ * transmits the initiators ephemeral key.
33
+ * @param rpk remote public key
34
+ * @return Buffer that is 50 bytes
35
+ */
36
+ initiatorAct1(rpk) {
37
+ if (this.logger)
38
+ this.logger.debug('initiator act1');
39
+ this.rpk = rpk;
40
+ this._initialize(this.rpk);
41
+ // 2. h = SHA-256(h || epk)
42
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, this.epk]));
43
+ // 3. es = ECDH(e.priv, rs)
44
+ const ss = (0, crypto_1.ecdh)(this.rpk, this.es);
45
+ // 4. ck, temp_k1 = HKDF(ck, es)
46
+ const tempK1 = (0, crypto_1.hkdf)(ss, 64, this.ck);
47
+ this.ck = tempK1.slice(0, 32);
48
+ this.tempK1 = tempK1.slice(32);
49
+ // 5. c = encryptWithAD(temp_k1, 0, h, zero)
50
+ const c = (0, crypto_1.ccpEncrypt)(this.tempK1, Buffer.alloc(12), this.h, Buffer.alloc(0));
51
+ // 6. h = SHA-256(h || c)
52
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, c]));
53
+ // 7. m = 0 || epk || c
54
+ const m = Buffer.concat([Buffer.alloc(1), this.epk, c]);
55
+ return m;
56
+ }
57
+ /**
58
+ * Initiator Act2 handles the response generated by the receiver's
59
+ * Act1, a 50-byte message. The responder's ephemeral key is extacted
60
+ * from the message during this phase.
61
+ *
62
+ * @param m 50-byte message from responder's act1
63
+ */
64
+ initiatorAct2(m) {
65
+ if (this.logger)
66
+ this.logger.debug('initiator act2');
67
+ // 1. read exactly 50 bytes off the stream
68
+ if (m.length !== 50)
69
+ throw new Error('ACT2_READ_FAILED');
70
+ // 2. parse th read message m into v, re, and c
71
+ const v = m.slice(0, 1)[0];
72
+ const re = m.slice(1, 34);
73
+ const c = m.slice(34);
74
+ // 2a. convert re to public key
75
+ this.repk = re;
76
+ // 3. assert version is known version
77
+ if (v !== 0)
78
+ throw new Error('ACT2_BAD_VERSION');
79
+ // 4. sha256(h || re.serializedCompressed');
80
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, this.repk]));
81
+ // 5. ss = ECDH(re, e.priv);
82
+ const ss = (0, crypto_1.ecdh)(this.repk, this.es);
83
+ // 6. ck, temp_k2 = HKDF(cd, ss)
84
+ const tempK2 = (0, crypto_1.hkdf)(ss, 64, this.ck);
85
+ this.ck = tempK2.slice(0, 32);
86
+ this.tempK2 = tempK2.slice(32);
87
+ // 7. p = decryptWithAD()
88
+ (0, crypto_1.ccpDecrypt)(this.tempK2, Buffer.alloc(12), this.h, c);
89
+ // 8. h = sha256(h || c)
90
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, c]));
91
+ }
92
+ /**
93
+ * Initiator Act3 is the final phase in the authenticated
94
+ * key agreement. This act is executed only if act 2
95
+ * was successful. The initiator transports its static public key
96
+ * to the responder.
97
+ */
98
+ initiatorAct3() {
99
+ if (this.logger)
100
+ this.logger.debug('initiator act3');
101
+ // 1. c = encryptWithAD(temp_k2, 1, h, lpk)
102
+ const c = (0, crypto_1.ccpEncrypt)(this.tempK2, Buffer.from([0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), this.h, this.lpk);
103
+ // 2. h = sha256(h || c)
104
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, c]));
105
+ // 3. ss = ECDH(re, s.priv)
106
+ const ss = (0, crypto_1.ecdh)(this.repk, this.ls);
107
+ // 4. ck, temp_k3 = HKDF(ck, ss)
108
+ const tempK3 = (0, crypto_1.hkdf)(ss, 64, this.ck);
109
+ this.ck = tempK3.slice(0, 32);
110
+ this.tempK3 = tempK3.slice(32);
111
+ // 5. t = encryptWithAD(temp_k3, 0, h, zero)
112
+ const t = (0, crypto_1.ccpEncrypt)(this.tempK3, Buffer.alloc(12), this.h, Buffer.alloc(0));
113
+ // 6. sk, rk = hkdf(ck, zero)
114
+ const sk = (0, crypto_1.hkdf)(Buffer.alloc(0), 64, this.ck);
115
+ this.rk = sk.slice(32);
116
+ this.sk = sk.slice(0, 32);
117
+ // 7. rn = 0, sn = 0
118
+ this.sn = Buffer.alloc(12);
119
+ this.rn = Buffer.alloc(12);
120
+ // 8. send m = 0 || c || t
121
+ const m = Buffer.concat([Buffer.alloc(1), c, t]);
122
+ return m;
123
+ }
124
+ /**
125
+ * Receiver Act1 extracts the initiators ephemeral key. It also
126
+ * validates that the initiator knows the receivers public key.
127
+ * @param m 50-byte message sent by the initiator
128
+ */
129
+ receiveAct1(m) {
130
+ this._initialize(this.lpk);
131
+ if (this.logger)
132
+ this.logger.debug('receive act1');
133
+ // 1. read exactly 50 bytes off the stream
134
+ if (m.length !== 50)
135
+ throw new Error('ACT1_READ_FAILED');
136
+ // 2. parse th read message m into v,re, and c
137
+ const v = m.slice(0, 1)[0];
138
+ const re = m.slice(1, 34);
139
+ const c = m.slice(34);
140
+ this.repk = re;
141
+ // 3. assert version is known version
142
+ if (v !== 0)
143
+ throw new Error('ACT1_BAD_VERSION');
144
+ // 4. sha256(h || re.serializedCompressed');
145
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, re]));
146
+ // 5. ss = ECDH(re, ls.priv);
147
+ const ss = (0, crypto_1.ecdh)(re, this.ls);
148
+ // 6. ck, temp_k1 = HKDF(cd, ss)
149
+ const tempK1 = (0, crypto_1.hkdf)(ss, 64, this.ck);
150
+ this.ck = tempK1.slice(0, 32);
151
+ this.tempK1 = tempK1.slice(32);
152
+ // 7. p = decryptWithAD(temp_k1, 0, h, c)
153
+ (0, crypto_1.ccpDecrypt)(this.tempK1, Buffer.alloc(12), this.h, c);
154
+ // 8. h = sha256(h || c)
155
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, c]));
156
+ }
157
+ /**
158
+ * Receiver Act2 takes place only if Act1 was successful.
159
+ * This act sends responder's ephermeral key to the initiator.
160
+ */
161
+ recieveAct2() {
162
+ // 1. e = generateKey() => done in initialization
163
+ // 2. h = sha256(h || e.pub.compressed())
164
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, this.epk]));
165
+ // 3. ss = ecdh(re, e.priv)
166
+ const ss = (0, crypto_1.ecdh)(this.repk, this.es);
167
+ // 4. ck, temp_k2 = hkdf(ck, ss)
168
+ const tempK2 = (0, crypto_1.hkdf)(ss, 64, this.ck);
169
+ this.ck = tempK2.slice(0, 32);
170
+ this.tempK2 = tempK2.slice(32);
171
+ // 5. c = encryptWithAd(temp_k2, 0, h, zero)
172
+ const c = (0, crypto_1.ccpEncrypt)(this.tempK2, Buffer.alloc(12), this.h, Buffer.alloc(0));
173
+ // 6. h = sha256(h || c)
174
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, c]));
175
+ // 7. m = 0 || e.pub.compressed() Z|| c
176
+ const m = Buffer.concat([Buffer.alloc(1), this.epk, c]);
177
+ return m;
178
+ }
179
+ /**
180
+ * Receiver Act3 is the final phase in the authenticated key
181
+ * agreement. This act is executed only if act 2 was successful.
182
+ * The receiver extracts the public key of the initiator.
183
+ * @param m 66-byte message
184
+ */
185
+ receiveAct3(m) {
186
+ // 1. read exactly 66 bytes from the network buffer
187
+ if (m.length !== 66)
188
+ throw new Error('ACT3_READ_FAILED');
189
+ // 2. parse m into v, c, t
190
+ const v = m.slice(0, 1)[0];
191
+ const c = m.slice(1, 50);
192
+ const t = m.slice(50);
193
+ // 3. validate v is recognized
194
+ if (v !== 0)
195
+ throw new Error('ACT3_BAD_VERSION');
196
+ // 4. rs = decryptWithAD(temp_k2, 1, h, c)
197
+ const rs = (0, crypto_1.ccpDecrypt)(this.tempK2, Buffer.from('000000000100000000000000', 'hex'), this.h, c);
198
+ this.rpk = rs;
199
+ // 5. h = sha256(h || c)
200
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, c]));
201
+ // 6. ss = ECDH(rs, e.priv)
202
+ const ss = (0, crypto_1.ecdh)(this.rpk, this.es);
203
+ // 7. ck, temp_k3 = hkdf(cs, ss)
204
+ const tempK3 = (0, crypto_1.hkdf)(ss, 64, this.ck);
205
+ this.ck = tempK3.slice(0, 32);
206
+ this.tempK3 = tempK3.slice(32);
207
+ // 8. p = decryptWithAD(temp_k3, 0, h, t)
208
+ (0, crypto_1.ccpDecrypt)(this.tempK3, Buffer.alloc(12), this.h, t);
209
+ // 9. rk, sk = hkdf(ck, zero)
210
+ const sk = (0, crypto_1.hkdf)(Buffer.alloc(0), 64, this.ck);
211
+ this.rk = sk.slice(0, 32);
212
+ this.sk = sk.slice(32);
213
+ // 10. rn = 0, sn = 0
214
+ this.rn = Buffer.alloc(12);
215
+ this.sn = Buffer.alloc(12);
216
+ }
217
+ /**
218
+ * Sends an encrypted message using the shared sending key and nonce.
219
+ * The nonce is rotated once the message is sent. The sending key is
220
+ * rotated every 1000 messages.
221
+ * @param m
222
+ */
223
+ encryptMessage(m) {
224
+ // step 1/2. serialize m length into int16
225
+ const l = Buffer.alloc(2);
226
+ l.writeUInt16BE(m.length, 0);
227
+ // step 3. encrypt l, using chachapoly1305, sn, sk)
228
+ const lc = (0, crypto_1.ccpEncrypt)(this.sk, this.sn, Buffer.alloc(0), l);
229
+ // step 3a: increment sn
230
+ if (this._incrementSendingNonce() >= 1000)
231
+ this._rotateSendingKeys();
232
+ // step 4 encrypt m using chachapoly1305, sn, sk
233
+ const c = (0, crypto_1.ccpEncrypt)(this.sk, this.sn, Buffer.alloc(0), m);
234
+ // step 4a: increment sn
235
+ if (this._incrementSendingNonce() >= 1000)
236
+ this._rotateSendingKeys();
237
+ // step 5 return m to be sent
238
+ return Buffer.concat([lc, c]);
239
+ }
240
+ /**
241
+ * Decrypts the length of the message using the receiving key and nonce.
242
+ * The receiving key is rotated every 1000 messages.
243
+ */
244
+ decryptLength(lc) {
245
+ const l = (0, crypto_1.ccpDecrypt)(this.rk, this.rn, Buffer.alloc(0), lc);
246
+ if (this._incrementRecievingNonce() >= 1000)
247
+ this._rotateRecievingKeys();
248
+ return l.readUInt16BE(0);
249
+ }
250
+ /**
251
+ * Decrypts the message using the receiving key and nonce. The receiving
252
+ * key is rotated every 1000 messages.
253
+ */
254
+ decryptMessage(c) {
255
+ const m = (0, crypto_1.ccpDecrypt)(this.rk, this.rn, Buffer.alloc(0), c);
256
+ if (this._incrementRecievingNonce() >= 1000)
257
+ this._rotateRecievingKeys();
258
+ return m;
259
+ }
260
+ /////////////////////////////////////
261
+ /**
262
+ * Initializes the noise state prior to Act1.
263
+ */
264
+ _initialize(pubkey) {
265
+ if (this.logger)
266
+ this.logger.debug('initialize noise state');
267
+ // 1. h = SHA-256(protocolName)
268
+ this.h = (0, crypto_1.sha256)(Buffer.from(this.protocolName));
269
+ // 2. ck = h
270
+ this.ck = this.h;
271
+ // 3. h = SHA-256(h || prologue)
272
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, this.prologue]));
273
+ // 4. h = SHA-256(h || pubkey)
274
+ this.h = (0, crypto_1.sha256)(Buffer.concat([this.h, pubkey]));
275
+ }
276
+ _incrementSendingNonce() {
277
+ const newValue = this.sn.readUInt16LE(4) + 1;
278
+ this.sn.writeUInt16LE(newValue, 4);
279
+ return newValue;
280
+ }
281
+ _incrementRecievingNonce() {
282
+ const newValue = this.rn.readUInt16LE(4) + 1;
283
+ this.rn.writeUInt16LE(newValue, 4);
284
+ return newValue;
285
+ }
286
+ _rotateSendingKeys() {
287
+ if (this.logger)
288
+ this.logger.debug('rotating sending key');
289
+ const result = (0, crypto_1.hkdf)(this.sk, 64, this.ck);
290
+ this.sk = result.slice(32);
291
+ this.ck = result.slice(0, 32);
292
+ this.sn = Buffer.alloc(12);
293
+ }
294
+ _rotateRecievingKeys() {
295
+ if (this.logger)
296
+ this.logger.debug('rotating receiving key');
297
+ const result = (0, crypto_1.hkdf)(this.rk, 64, this.ck);
298
+ this.rk = result.slice(32);
299
+ this.ck = result.slice(0, 32);
300
+ this.rn = Buffer.alloc(12);
301
+ }
302
+ }
303
+ exports.NoiseState = NoiseState;
304
+ //# sourceMappingURL=noise-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noise-state.js","sourceRoot":"","sources":["../lib/noise-state.ts"],"names":[],"mappings":";;;AAAA,6CAA8E;AAC9E,6CAAgD;AAKhD,MAAa,UAAU;IA0GrB;;;OAGG;IACH,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAqB;QA3GjD;;;;WAIG;QACI,iBAAY,GAAG,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QAE1E;;WAEG;QACI,aAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW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AAE,CAAC,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAEO,oBAAoB;QAC1B,IAAI,IAAI,CAAC,MAAM;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,IAAA,aAAI,EAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;CACF;AA1dD,gCA0dC"}
@@ -0,0 +1,5 @@
1
+ export declare enum READ_STATE {
2
+ READY_FOR_LEN = 2,
3
+ READY_FOR_BODY = 3,
4
+ BLOCKED = 4
5
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.READ_STATE = void 0;
4
+ var READ_STATE;
5
+ (function (READ_STATE) {
6
+ READ_STATE[READ_STATE["READY_FOR_LEN"] = 2] = "READY_FOR_LEN";
7
+ READ_STATE[READ_STATE["READY_FOR_BODY"] = 3] = "READY_FOR_BODY";
8
+ READ_STATE[READ_STATE["BLOCKED"] = 4] = "BLOCKED";
9
+ })(READ_STATE = exports.READ_STATE || (exports.READ_STATE = {}));
10
+ //# sourceMappingURL=read-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-state.js","sourceRoot":"","sources":["../lib/read-state.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6DAAiB,CAAA;IACjB,+DAAkB,CAAA;IAClB,iDAAW,CAAA;AACb,CAAC,EAJW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAIrB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * States that the handshake process can be in. States depend on
3
+ * whether the socket is the connection Initiator or Responder.
4
+ *
5
+ * Initiator:
6
+ * 1. create and send Iniatitor act1 and transition to
7
+ * AWAITING_RESPONDER_REPLY
8
+ * 2. process the Responder's reply as act2
9
+ * 3. create Initiator act3 reply to complete the handshake
10
+ * and transitions to READY
11
+ *
12
+ * Responder:
13
+ * 1. begins in AWAITING_INITIATOR waiting to receive act1
14
+ * 2. processes act1 and creates a reply as act2 and transitions
15
+ * to AWAITING_INITIATOR_REPLY
16
+ * 3. processes the Initiator's reply to complete the handshake
17
+ * and transition to READY
18
+ */
19
+ export enum HANDSHAKE_STATE {
20
+ /**
21
+ * Initial state for the Initiator. Initiator will transition to
22
+ * AWAITING_RESPONDER_REPLY once act1 is completed and sent.
23
+ */
24
+ INITIATOR_INITIATING = 0,
25
+
26
+ /**
27
+ * Responders begin in this state and wait for the Intiator to begin
28
+ * the handshake. Sockets originating from the NoiseServer will
29
+ * begin in this state.
30
+ */
31
+ AWAITING_INITIATOR = 1,
32
+
33
+ /**
34
+ * Initiator has sent act1 and is awaiting the reply from the responder.
35
+ * Once received, the intiator will create the reply
36
+ */
37
+ AWAITING_RESPONDER_REPLY = 2,
38
+
39
+ /**
40
+ * Responder has sent a reply to the inititator, the Responder will be
41
+ * waiting for the final stage of the handshake sent by the Initiator.
42
+ */
43
+ AWAITING_INITIATOR_REPLY = 3,
44
+
45
+ /**
46
+ * Responder/Initiator have completed the handshake and we're ready to
47
+ * start sending and receiving over the socket.
48
+ */
49
+ READY = 100,
50
+ }
@@ -0,0 +1,88 @@
1
+ import * as crypto from '@node-dlc/crypto';
2
+ import { ILogger } from '@node-dlc/logger';
3
+ import { Socket } from 'net';
4
+
5
+ import { NoiseServer } from './noise-server';
6
+ import { NoiseServerOptions } from './noise-server-options';
7
+ import { NoiseSocket } from './noise-socket';
8
+ import { NoiseState } from './noise-state';
9
+
10
+ export { NoiseError } from './noise-error';
11
+ export { NoiseServer } from './noise-server';
12
+ export { NoiseServerListenOptions } from './noise-server-listen-options';
13
+ export { NoiseServerOptions } from './noise-server-options';
14
+ export { NoiseSocket } from './noise-socket';
15
+ export { NoiseSocketOptions } from './noise-socket-options';
16
+ export { NoiseState } from './noise-state';
17
+
18
+ export type NoiseConnectOptions = {
19
+ /**
20
+ * Local secret as a 32-byte secp256k1 private key
21
+ */
22
+ ls: Buffer;
23
+
24
+ /**
25
+ * Optional ephemeral 32-byte secp256k1 private key. If not provided, one is generated.
26
+ */
27
+ es?: Buffer;
28
+
29
+ /**
30
+ * remote compressed public key, 33-bytes.
31
+ */
32
+ rpk: Buffer;
33
+
34
+ /**
35
+ * Optional host. Defaults to localhost.
36
+ */
37
+ host?: string;
38
+
39
+ /**
40
+ * Optional port. Defaults to 9735.
41
+ */
42
+ port?: number;
43
+
44
+ /**
45
+ * Optional logger
46
+ */
47
+ logger?: ILogger;
48
+ };
49
+
50
+ /**
51
+ * Connect to a remote noise socket server.
52
+ */
53
+ export function connect({
54
+ ls,
55
+ es,
56
+ rpk,
57
+ host,
58
+ port = 9735,
59
+ logger,
60
+ }: NoiseConnectOptions): NoiseSocket {
61
+ if (!es) {
62
+ es = crypto.createPrivateKey();
63
+ }
64
+
65
+ const noiseLogger = logger
66
+ ? logger.sub('noise', rpk.slice(0, 8).toString('hex'))
67
+ : undefined;
68
+ const noiseState = new NoiseState({ ls, es, logger: noiseLogger });
69
+ const socket = new Socket();
70
+ const instance = new NoiseSocket({
71
+ socket,
72
+ noiseState,
73
+ rpk,
74
+ logger: noiseLogger,
75
+ });
76
+ socket.connect({ host, port });
77
+ return instance;
78
+ }
79
+
80
+ /**
81
+ * Factory function to create a new server
82
+ */
83
+ export function createServer(
84
+ { ls, esFactory }: NoiseServerOptions,
85
+ connListener: (socket: NoiseSocket) => void,
86
+ ): NoiseServer {
87
+ return new NoiseServer({ ls, esFactory }, connListener);
88
+ }
@@ -0,0 +1,3 @@
1
+ export class NoiseError extends Error {
2
+ public module = 'noise';
3
+ }
@@ -0,0 +1,25 @@
1
+ export type NoiseServerListenOptions = {
2
+ /**
3
+ * Optional port to listen on. If port is omitted or is 0,
4
+ * the operating system will assign an arbitrary unused port, which can be retrieved
5
+ * by using server.address().port after the 'listening' event has been emitted.
6
+ */
7
+ port?: number;
8
+
9
+ /**
10
+ * Optional host to listen on. If host is omitted, the server
11
+ * will accept connections on the unspecified IPv6 address (::) when IPv6 is available,
12
+ * or the unspecified IPv4 address (0.0.0.0) otherwise. In most operating systems,
13
+ * listening to the unspecified IPv6 address (::) may cause NoiseSocket to also
14
+ * listen on the unspecified IPv4 address (0.0.0.0).
15
+ */
16
+ host?: string;
17
+
18
+ /**
19
+ * Optional value to specify the maximum length of the
20
+ * queue of pending connections. The actual length will be determined by the OS through
21
+ * sysctl settings such as tcp_max_syn_backlog and somaxconn on Linux. The default value
22
+ * of this parameter is 511 (not 512).
23
+ */
24
+ backlog?: number;
25
+ };
@@ -0,0 +1,13 @@
1
+ export type NoiseServerOptions = {
2
+ /**
3
+ * Local private key as a 32-byte private key for elliptic curve
4
+ * secp256k1 used by the server
5
+ */
6
+ ls: Buffer;
7
+
8
+ /**
9
+ * Function for creating the ephemeral private key used by each
10
+ * connection
11
+ */
12
+ esFactory?: () => Buffer;
13
+ };
@@ -0,0 +1,135 @@
1
+ import * as crypto from '@node-dlc/crypto';
2
+ import assert from 'assert';
3
+ import { EventEmitter } from 'events';
4
+ import { AddressInfo, Server, Socket } from 'net';
5
+
6
+ import { NoiseError } from './noise-error';
7
+ import { NoiseServerListenOptions } from './noise-server-listen-options';
8
+ import { NoiseServerOptions } from './noise-server-options';
9
+ import { NoiseSocket } from './noise-socket';
10
+ import { NoiseState } from './noise-state';
11
+
12
+ export class NoiseServer extends EventEmitter {
13
+ /**
14
+ * Local private key as a 32-byte private key for elliptic curve
15
+ * secp256k1 used by the server
16
+ */
17
+ public ls: Buffer;
18
+
19
+ /**
20
+ * Function for creating the ephemeral private key used by each
21
+ * connection
22
+ */
23
+ public esFactory: () => Buffer;
24
+
25
+ /**
26
+ * Socket server that is created
27
+ */
28
+ private _server: Server;
29
+
30
+ /**
31
+ * NoiseServer is a TCP server that wraps socket instances
32
+ * with the NoiseSocket class. This class is an event emitter
33
+ * with the same interface as net.Server.
34
+ *
35
+ * The constructor take arguments that will be used by the
36
+ * NoiseState.
37
+ */
38
+ constructor(
39
+ opts: NoiseServerOptions,
40
+ connListener?: (socket: NoiseSocket) => void,
41
+ ) {
42
+ super();
43
+
44
+ // localSecret assertions
45
+ assert.ok(Buffer.isBuffer(opts.ls), new NoiseError('ls must be a buffer'));
46
+ assert.ok(
47
+ crypto.validPrivateKey(opts.ls),
48
+ new NoiseError('ls must be valid public key'),
49
+ );
50
+ this.ls = opts.ls;
51
+
52
+ // ephemeral secret factory
53
+ assert.ok(
54
+ !opts.esFactory || typeof opts.esFactory === 'function',
55
+ new NoiseError('esFactory must be a function'),
56
+ );
57
+ this.esFactory = opts.esFactory || crypto.createPrivateKey;
58
+
59
+ // construct and bind the server
60
+ this._server = new Server();
61
+ this._server.on('connection', this._onConnection.bind(this));
62
+ this._server.on('error', (err) => this.emit('error', err));
63
+ this._server.on('close', () => this.emit('close'));
64
+ this._server.on('listening', () => this.emit('listening'));
65
+
66
+ if (connListener) this.on('connection', connListener);
67
+ }
68
+
69
+ /**
70
+ * Called when the socket receives a new socket connection.
71
+ * Emits the `connection` event.
72
+ */
73
+ public _onConnection(socket: Socket): void {
74
+ const ls = this.ls;
75
+ const es = this.esFactory();
76
+ const noiseState = new NoiseState({ ls, es });
77
+ const noiseSocket = new NoiseSocket({ socket, noiseState });
78
+ this.emit('connection', noiseSocket);
79
+ }
80
+
81
+ /**
82
+ * Returns the address the server is listeening on. If the server is
83
+ * not listening, it will return undefined.
84
+ */
85
+ public address(): string | AddressInfo {
86
+ return this._server.address();
87
+ }
88
+
89
+ /**
90
+ * Stops the server from accepting new connections and keeps existing connections open.
91
+ * This function is asynchronous, the server is fully closed when all connections are
92
+ * ended and the server emits a `close` event. The optional `cb` event will be called
93
+ * once the `close` event occurs.
94
+ */
95
+ public close(cb?: (err?: Error) => void): void {
96
+ this._server.close(cb);
97
+ }
98
+
99
+ /**
100
+ * Asynchronously get the number of concurrent connections on the server. Works when sockets were sent to forks.
101
+ */
102
+ public getConnections(cb: (error: Error, count: number) => void): void {
103
+ this._server.getConnections(cb);
104
+ }
105
+
106
+ /**
107
+ * Start a server listening for connections. This method is asyncrhonous,
108
+ * once the server has started listening, the `listening` event will be
109
+ * emitted.
110
+ * @param callback Called when the server is listening. Automatically binds
111
+ * the function to the `listening` event.
112
+ */
113
+ public listen(opts: NoiseServerListenOptions, callback?: () => void): this {
114
+ this._server.listen(opts, callback);
115
+ return this;
116
+ }
117
+
118
+ /**
119
+ * Indicates whether or not the server is listening for connections.
120
+ */
121
+ public get listening(): boolean {
122
+ return this._server.listening;
123
+ }
124
+
125
+ /**
126
+ * Set this property to reject connections when the server's connection count gets high.
127
+ */
128
+ public get maxConnections(): number {
129
+ return this._server.maxConnections;
130
+ }
131
+
132
+ public set maxConnections(val: number) {
133
+ this._server.maxConnections = val;
134
+ }
135
+ }