waves_lib 0.1.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 (1222) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +22 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/LICENSE.txt +19 -0
  7. data/README.md +39 -0
  8. data/Rakefile +12 -0
  9. data/js/node_modules/@protobufjs/aspromise/LICENSE +26 -0
  10. data/js/node_modules/@protobufjs/aspromise/README.md +13 -0
  11. data/js/node_modules/@protobufjs/aspromise/index.d.ts +13 -0
  12. data/js/node_modules/@protobufjs/aspromise/index.js +52 -0
  13. data/js/node_modules/@protobufjs/aspromise/package.json +21 -0
  14. data/js/node_modules/@protobufjs/aspromise/tests/index.js +130 -0
  15. data/js/node_modules/@protobufjs/base64/LICENSE +26 -0
  16. data/js/node_modules/@protobufjs/base64/README.md +19 -0
  17. data/js/node_modules/@protobufjs/base64/index.d.ts +32 -0
  18. data/js/node_modules/@protobufjs/base64/index.js +139 -0
  19. data/js/node_modules/@protobufjs/base64/package.json +21 -0
  20. data/js/node_modules/@protobufjs/base64/tests/index.js +46 -0
  21. data/js/node_modules/@protobufjs/codegen/LICENSE +26 -0
  22. data/js/node_modules/@protobufjs/codegen/README.md +49 -0
  23. data/js/node_modules/@protobufjs/codegen/index.d.ts +31 -0
  24. data/js/node_modules/@protobufjs/codegen/index.js +99 -0
  25. data/js/node_modules/@protobufjs/codegen/package.json +13 -0
  26. data/js/node_modules/@protobufjs/codegen/tests/index.js +13 -0
  27. data/js/node_modules/@protobufjs/eventemitter/LICENSE +26 -0
  28. data/js/node_modules/@protobufjs/eventemitter/README.md +22 -0
  29. data/js/node_modules/@protobufjs/eventemitter/index.d.ts +43 -0
  30. data/js/node_modules/@protobufjs/eventemitter/index.js +76 -0
  31. data/js/node_modules/@protobufjs/eventemitter/package.json +21 -0
  32. data/js/node_modules/@protobufjs/eventemitter/tests/index.js +47 -0
  33. data/js/node_modules/@protobufjs/fetch/LICENSE +26 -0
  34. data/js/node_modules/@protobufjs/fetch/README.md +13 -0
  35. data/js/node_modules/@protobufjs/fetch/index.d.ts +56 -0
  36. data/js/node_modules/@protobufjs/fetch/index.js +115 -0
  37. data/js/node_modules/@protobufjs/fetch/package.json +25 -0
  38. data/js/node_modules/@protobufjs/fetch/tests/index.js +16 -0
  39. data/js/node_modules/@protobufjs/float/LICENSE +26 -0
  40. data/js/node_modules/@protobufjs/float/README.md +102 -0
  41. data/js/node_modules/@protobufjs/float/bench/index.js +87 -0
  42. data/js/node_modules/@protobufjs/float/bench/suite.js +46 -0
  43. data/js/node_modules/@protobufjs/float/index.d.ts +83 -0
  44. data/js/node_modules/@protobufjs/float/index.js +335 -0
  45. data/js/node_modules/@protobufjs/float/package.json +26 -0
  46. data/js/node_modules/@protobufjs/float/tests/index.js +100 -0
  47. data/js/node_modules/@protobufjs/inquire/LICENSE +26 -0
  48. data/js/node_modules/@protobufjs/inquire/README.md +13 -0
  49. data/js/node_modules/@protobufjs/inquire/index.d.ts +9 -0
  50. data/js/node_modules/@protobufjs/inquire/index.js +17 -0
  51. data/js/node_modules/@protobufjs/inquire/package.json +21 -0
  52. data/js/node_modules/@protobufjs/inquire/tests/data/array.js +1 -0
  53. data/js/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +1 -0
  54. data/js/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +1 -0
  55. data/js/node_modules/@protobufjs/inquire/tests/data/object.js +1 -0
  56. data/js/node_modules/@protobufjs/inquire/tests/index.js +20 -0
  57. data/js/node_modules/@protobufjs/path/LICENSE +26 -0
  58. data/js/node_modules/@protobufjs/path/README.md +19 -0
  59. data/js/node_modules/@protobufjs/path/index.d.ts +22 -0
  60. data/js/node_modules/@protobufjs/path/index.js +65 -0
  61. data/js/node_modules/@protobufjs/path/package.json +21 -0
  62. data/js/node_modules/@protobufjs/path/tests/index.js +60 -0
  63. data/js/node_modules/@protobufjs/pool/LICENSE +26 -0
  64. data/js/node_modules/@protobufjs/pool/README.md +13 -0
  65. data/js/node_modules/@protobufjs/pool/index.d.ts +32 -0
  66. data/js/node_modules/@protobufjs/pool/index.js +48 -0
  67. data/js/node_modules/@protobufjs/pool/package.json +21 -0
  68. data/js/node_modules/@protobufjs/pool/tests/index.js +33 -0
  69. data/js/node_modules/@protobufjs/utf8/LICENSE +26 -0
  70. data/js/node_modules/@protobufjs/utf8/README.md +20 -0
  71. data/js/node_modules/@protobufjs/utf8/index.d.ts +24 -0
  72. data/js/node_modules/@protobufjs/utf8/index.js +105 -0
  73. data/js/node_modules/@protobufjs/utf8/package.json +21 -0
  74. data/js/node_modules/@protobufjs/utf8/tests/data/utf8.txt +216 -0
  75. data/js/node_modules/@protobufjs/utf8/tests/index.js +57 -0
  76. data/js/node_modules/@types/base64-js/LICENSE +21 -0
  77. data/js/node_modules/@types/base64-js/README.md +16 -0
  78. data/js/node_modules/@types/base64-js/index.d.ts +23 -0
  79. data/js/node_modules/@types/base64-js/package.json +29 -0
  80. data/js/node_modules/@types/long/LICENSE +21 -0
  81. data/js/node_modules/@types/long/README.md +16 -0
  82. data/js/node_modules/@types/long/index.d.ts +389 -0
  83. data/js/node_modules/@types/long/package.json +25 -0
  84. data/js/node_modules/@types/node/LICENSE +21 -0
  85. data/js/node_modules/@types/node/README.md +16 -0
  86. data/js/node_modules/@types/node/assert/strict.d.ts +8 -0
  87. data/js/node_modules/@types/node/assert.d.ts +972 -0
  88. data/js/node_modules/@types/node/async_hooks.d.ts +530 -0
  89. data/js/node_modules/@types/node/buffer.d.ts +2354 -0
  90. data/js/node_modules/@types/node/child_process.d.ts +1395 -0
  91. data/js/node_modules/@types/node/cluster.d.ts +414 -0
  92. data/js/node_modules/@types/node/console.d.ts +412 -0
  93. data/js/node_modules/@types/node/constants.d.ts +18 -0
  94. data/js/node_modules/@types/node/crypto.d.ts +3978 -0
  95. data/js/node_modules/@types/node/dgram.d.ts +545 -0
  96. data/js/node_modules/@types/node/diagnostics_channel.d.ts +191 -0
  97. data/js/node_modules/@types/node/dns/promises.d.ts +414 -0
  98. data/js/node_modules/@types/node/dns.d.ts +668 -0
  99. data/js/node_modules/@types/node/dom-events.d.ts +126 -0
  100. data/js/node_modules/@types/node/domain.d.ts +170 -0
  101. data/js/node_modules/@types/node/events.d.ts +724 -0
  102. data/js/node_modules/@types/node/fs/promises.d.ts +1190 -0
  103. data/js/node_modules/@types/node/fs.d.ts +4044 -0
  104. data/js/node_modules/@types/node/globals.d.ts +303 -0
  105. data/js/node_modules/@types/node/globals.global.d.ts +1 -0
  106. data/js/node_modules/@types/node/http.d.ts +1724 -0
  107. data/js/node_modules/@types/node/http2.d.ts +2129 -0
  108. data/js/node_modules/@types/node/https.d.ts +441 -0
  109. data/js/node_modules/@types/node/index.d.ts +134 -0
  110. data/js/node_modules/@types/node/inspector.d.ts +2748 -0
  111. data/js/node_modules/@types/node/module.d.ts +129 -0
  112. data/js/node_modules/@types/node/net.d.ts +888 -0
  113. data/js/node_modules/@types/node/os.d.ts +477 -0
  114. data/js/node_modules/@types/node/package.json +237 -0
  115. data/js/node_modules/@types/node/path.d.ts +191 -0
  116. data/js/node_modules/@types/node/perf_hooks.d.ts +638 -0
  117. data/js/node_modules/@types/node/process.d.ts +1494 -0
  118. data/js/node_modules/@types/node/punycode.d.ts +117 -0
  119. data/js/node_modules/@types/node/querystring.d.ts +131 -0
  120. data/js/node_modules/@types/node/readline/promises.d.ts +145 -0
  121. data/js/node_modules/@types/node/readline.d.ts +526 -0
  122. data/js/node_modules/@types/node/repl.d.ts +424 -0
  123. data/js/node_modules/@types/node/stream/consumers.d.ts +12 -0
  124. data/js/node_modules/@types/node/stream/promises.d.ts +42 -0
  125. data/js/node_modules/@types/node/stream/web.d.ts +330 -0
  126. data/js/node_modules/@types/node/stream.d.ts +1421 -0
  127. data/js/node_modules/@types/node/string_decoder.d.ts +67 -0
  128. data/js/node_modules/@types/node/test.d.ts +1383 -0
  129. data/js/node_modules/@types/node/timers/promises.d.ts +93 -0
  130. data/js/node_modules/@types/node/timers.d.ts +215 -0
  131. data/js/node_modules/@types/node/tls.d.ts +1130 -0
  132. data/js/node_modules/@types/node/trace_events.d.ts +182 -0
  133. data/js/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  134. data/js/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
  135. data/js/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
  136. data/js/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
  137. data/js/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
  138. data/js/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
  139. data/js/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  140. data/js/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  141. data/js/node_modules/@types/node/ts4.8/crypto.d.ts +3977 -0
  142. data/js/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  143. data/js/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
  144. data/js/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
  145. data/js/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
  146. data/js/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  147. data/js/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  148. data/js/node_modules/@types/node/ts4.8/events.d.ts +724 -0
  149. data/js/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
  150. data/js/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
  151. data/js/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
  152. data/js/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  153. data/js/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
  154. data/js/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
  155. data/js/node_modules/@types/node/ts4.8/https.d.ts +441 -0
  156. data/js/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  157. data/js/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
  158. data/js/node_modules/@types/node/ts4.8/module.d.ts +129 -0
  159. data/js/node_modules/@types/node/ts4.8/net.d.ts +888 -0
  160. data/js/node_modules/@types/node/ts4.8/os.d.ts +477 -0
  161. data/js/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  162. data/js/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
  163. data/js/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
  164. data/js/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  165. data/js/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  166. data/js/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
  167. data/js/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
  168. data/js/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  169. data/js/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  170. data/js/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  171. data/js/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  172. data/js/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
  173. data/js/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  174. data/js/node_modules/@types/node/ts4.8/test.d.ts +1365 -0
  175. data/js/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
  176. data/js/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
  177. data/js/node_modules/@types/node/ts4.8/tls.d.ts +1130 -0
  178. data/js/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
  179. data/js/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
  180. data/js/node_modules/@types/node/ts4.8/url.d.ts +901 -0
  181. data/js/node_modules/@types/node/ts4.8/util.d.ts +2116 -0
  182. data/js/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
  183. data/js/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
  184. data/js/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
  185. data/js/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
  186. data/js/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  187. data/js/node_modules/@types/node/tty.d.ts +208 -0
  188. data/js/node_modules/@types/node/url.d.ts +901 -0
  189. data/js/node_modules/@types/node/util.d.ts +2116 -0
  190. data/js/node_modules/@types/node/v8.d.ts +635 -0
  191. data/js/node_modules/@types/node/vm.d.ts +894 -0
  192. data/js/node_modules/@types/node/wasi.d.ts +152 -0
  193. data/js/node_modules/@types/node/worker_threads.d.ts +693 -0
  194. data/js/node_modules/@types/node/zlib.d.ts +517 -0
  195. data/js/node_modules/@types/node-fetch/LICENSE +21 -0
  196. data/js/node_modules/@types/node-fetch/README.md +16 -0
  197. data/js/node_modules/@types/node-fetch/externals.d.ts +24 -0
  198. data/js/node_modules/@types/node-fetch/index.d.ts +224 -0
  199. data/js/node_modules/@types/node-fetch/package.json +83 -0
  200. data/js/node_modules/@waves/bignumber/dist/BigNumber.d.ts +74 -0
  201. data/js/node_modules/@waves/bignumber/dist/BigNumber.js +252 -0
  202. data/js/node_modules/@waves/bignumber/dist/BigNumber.js.map +1 -0
  203. data/js/node_modules/@waves/bignumber/dist/Config.d.ts +22 -0
  204. data/js/node_modules/@waves/bignumber/dist/Config.js +43 -0
  205. data/js/node_modules/@waves/bignumber/dist/Config.js.map +1 -0
  206. data/js/node_modules/@waves/bignumber/dist/bignumber.umd.js +3194 -0
  207. data/js/node_modules/@waves/bignumber/dist/bignumber.umd.min.js +1 -0
  208. data/js/node_modules/@waves/bignumber/dist/index.d.ts +3 -0
  209. data/js/node_modules/@waves/bignumber/dist/index.js +9 -0
  210. data/js/node_modules/@waves/bignumber/dist/index.js.map +1 -0
  211. data/js/node_modules/@waves/bignumber/package.json +64 -0
  212. data/js/node_modules/@waves/bignumber/readme.md +285 -0
  213. data/js/node_modules/@waves/marshall/LICENSE +9 -0
  214. data/js/node_modules/@waves/marshall/README.md +39 -0
  215. data/js/node_modules/@waves/marshall/dist/index.d.ts +26 -0
  216. data/js/node_modules/@waves/marshall/dist/index.js +45 -0
  217. data/js/node_modules/@waves/marshall/dist/index.js.map +1 -0
  218. data/js/node_modules/@waves/marshall/dist/jsonMethods.d.ts +36 -0
  219. data/js/node_modules/@waves/marshall/dist/jsonMethods.js +194 -0
  220. data/js/node_modules/@waves/marshall/dist/jsonMethods.js.map +1 -0
  221. data/js/node_modules/@waves/marshall/dist/libs/Utf8ArrayToStr.d.ts +1 -0
  222. data/js/node_modules/@waves/marshall/dist/libs/Utf8ArrayToStr.js +35 -0
  223. data/js/node_modules/@waves/marshall/dist/libs/Utf8ArrayToStr.js.map +1 -0
  224. data/js/node_modules/@waves/marshall/dist/libs/base58.d.ts +5 -0
  225. data/js/node_modules/@waves/marshall/dist/libs/base58.js +66 -0
  226. data/js/node_modules/@waves/marshall/dist/libs/base58.js.map +1 -0
  227. data/js/node_modules/@waves/marshall/dist/libs/utils.d.ts +2 -0
  228. data/js/node_modules/@waves/marshall/dist/libs/utils.js +6 -0
  229. data/js/node_modules/@waves/marshall/dist/libs/utils.js.map +1 -0
  230. data/js/node_modules/@waves/marshall/dist/min/waves-marshall.min.js +1 -0
  231. data/js/node_modules/@waves/marshall/dist/parse.d.ts +21 -0
  232. data/js/node_modules/@waves/marshall/dist/parse.js +142 -0
  233. data/js/node_modules/@waves/marshall/dist/parse.js.map +1 -0
  234. data/js/node_modules/@waves/marshall/dist/parsePrimitives.d.ts +57 -0
  235. data/js/node_modules/@waves/marshall/dist/parsePrimitives.js +96 -0
  236. data/js/node_modules/@waves/marshall/dist/parsePrimitives.js.map +1 -0
  237. data/js/node_modules/@waves/marshall/dist/schemaTypes.d.ts +62 -0
  238. data/js/node_modules/@waves/marshall/dist/schemaTypes.js +41 -0
  239. data/js/node_modules/@waves/marshall/dist/schemaTypes.js.map +1 -0
  240. data/js/node_modules/@waves/marshall/dist/schemas.d.ts +128 -0
  241. data/js/node_modules/@waves/marshall/dist/schemas.js +542 -0
  242. data/js/node_modules/@waves/marshall/dist/schemas.js.map +1 -0
  243. data/js/node_modules/@waves/marshall/dist/serialize.d.ts +11 -0
  244. data/js/node_modules/@waves/marshall/dist/serialize.js +102 -0
  245. data/js/node_modules/@waves/marshall/dist/serialize.js.map +1 -0
  246. data/js/node_modules/@waves/marshall/dist/serializePrimitives.d.ts +21 -0
  247. data/js/node_modules/@waves/marshall/dist/serializePrimitives.js +63 -0
  248. data/js/node_modules/@waves/marshall/dist/serializePrimitives.js.map +1 -0
  249. data/js/node_modules/@waves/marshall/package.json +45 -0
  250. data/js/node_modules/@waves/marshall/src/index.ts +51 -0
  251. data/js/node_modules/@waves/marshall/src/jsonMethods.ts +231 -0
  252. data/js/node_modules/@waves/marshall/src/libs/Utf8ArrayToStr.ts +35 -0
  253. data/js/node_modules/@waves/marshall/src/libs/base58.ts +88 -0
  254. data/js/node_modules/@waves/marshall/src/libs/utils.ts +6 -0
  255. data/js/node_modules/@waves/marshall/src/parse.ts +157 -0
  256. data/js/node_modules/@waves/marshall/src/parsePrimitives.ts +118 -0
  257. data/js/node_modules/@waves/marshall/src/schemaTypes.ts +91 -0
  258. data/js/node_modules/@waves/marshall/src/schemas.ts +630 -0
  259. data/js/node_modules/@waves/marshall/src/serialize.ts +110 -0
  260. data/js/node_modules/@waves/marshall/src/serializePrimitives.ts +80 -0
  261. data/js/node_modules/@waves/node-api-js/README.md +2 -0
  262. data/js/node_modules/@waves/node-api-js/cjs/api-node/activation/index.d.ts +21 -0
  263. data/js/node_modules/@waves/node-api-js/cjs/api-node/activation/index.js +20 -0
  264. data/js/node_modules/@waves/node-api-js/cjs/api-node/activation/index.js.map +1 -0
  265. data/js/node_modules/@waves/node-api-js/cjs/api-node/addresses/index.d.ts +81 -0
  266. data/js/node_modules/@waves/node-api-js/cjs/api-node/addresses/index.js +174 -0
  267. data/js/node_modules/@waves/node-api-js/cjs/api-node/addresses/index.js.map +1 -0
  268. data/js/node_modules/@waves/node-api-js/cjs/api-node/alias/index.d.ts +6 -0
  269. data/js/node_modules/@waves/node-api-js/cjs/api-node/alias/index.js +22 -0
  270. data/js/node_modules/@waves/node-api-js/cjs/api-node/alias/index.js.map +1 -0
  271. data/js/node_modules/@waves/node-api-js/cjs/api-node/assets/index.d.ts +79 -0
  272. data/js/node_modules/@waves/node-api-js/cjs/api-node/assets/index.js +172 -0
  273. data/js/node_modules/@waves/node-api-js/cjs/api-node/assets/index.js.map +1 -0
  274. data/js/node_modules/@waves/node-api-js/cjs/api-node/blocks/index.d.ts +131 -0
  275. data/js/node_modules/@waves/node-api-js/cjs/api-node/blocks/index.js +210 -0
  276. data/js/node_modules/@waves/node-api-js/cjs/api-node/blocks/index.js.map +1 -0
  277. data/js/node_modules/@waves/node-api-js/cjs/api-node/consensus/index.d.ts +39 -0
  278. data/js/node_modules/@waves/node-api-js/cjs/api-node/consensus/index.js +37 -0
  279. data/js/node_modules/@waves/node-api-js/cjs/api-node/consensus/index.js.map +1 -0
  280. data/js/node_modules/@waves/node-api-js/cjs/api-node/debug/index.d.ts +189 -0
  281. data/js/node_modules/@waves/node-api-js/cjs/api-node/debug/index.js +245 -0
  282. data/js/node_modules/@waves/node-api-js/cjs/api-node/debug/index.js.map +1 -0
  283. data/js/node_modules/@waves/node-api-js/cjs/api-node/eth/index.d.ts +3 -0
  284. data/js/node_modules/@waves/node-api-js/cjs/api-node/eth/index.js +15 -0
  285. data/js/node_modules/@waves/node-api-js/cjs/api-node/eth/index.js.map +1 -0
  286. data/js/node_modules/@waves/node-api-js/cjs/api-node/leasing/index.d.ts +22 -0
  287. data/js/node_modules/@waves/node-api-js/cjs/api-node/leasing/index.js +42 -0
  288. data/js/node_modules/@waves/node-api-js/cjs/api-node/leasing/index.js.map +1 -0
  289. data/js/node_modules/@waves/node-api-js/cjs/api-node/node/index.d.ts +11 -0
  290. data/js/node_modules/@waves/node-api-js/cjs/api-node/node/index.js +20 -0
  291. data/js/node_modules/@waves/node-api-js/cjs/api-node/node/index.js.map +1 -0
  292. data/js/node_modules/@waves/node-api-js/cjs/api-node/peers/index.d.ts +46 -0
  293. data/js/node_modules/@waves/node-api-js/cjs/api-node/peers/index.js +60 -0
  294. data/js/node_modules/@waves/node-api-js/cjs/api-node/peers/index.js.map +1 -0
  295. data/js/node_modules/@waves/node-api-js/cjs/api-node/rewards/index.d.ts +21 -0
  296. data/js/node_modules/@waves/node-api-js/cjs/api-node/rewards/index.js +21 -0
  297. data/js/node_modules/@waves/node-api-js/cjs/api-node/rewards/index.js.map +1 -0
  298. data/js/node_modules/@waves/node-api-js/cjs/api-node/transactions/index.d.ts +73 -0
  299. data/js/node_modules/@waves/node-api-js/cjs/api-node/transactions/index.js +193 -0
  300. data/js/node_modules/@waves/node-api-js/cjs/api-node/transactions/index.js.map +1 -0
  301. data/js/node_modules/@waves/node-api-js/cjs/api-node/utils/index.d.ts +110 -0
  302. data/js/node_modules/@waves/node-api-js/cjs/api-node/utils/index.js +211 -0
  303. data/js/node_modules/@waves/node-api-js/cjs/api-node/utils/index.js.map +1 -0
  304. data/js/node_modules/@waves/node-api-js/cjs/api-node/wallet/index.d.ts +5 -0
  305. data/js/node_modules/@waves/node-api-js/cjs/api-node/wallet/index.js +7 -0
  306. data/js/node_modules/@waves/node-api-js/cjs/api-node/wallet/index.js.map +1 -0
  307. data/js/node_modules/@waves/node-api-js/cjs/constants.d.ts +40 -0
  308. data/js/node_modules/@waves/node-api-js/cjs/constants.js +43 -0
  309. data/js/node_modules/@waves/node-api-js/cjs/constants.js.map +1 -0
  310. data/js/node_modules/@waves/node-api-js/cjs/create.d.ts +1240 -0
  311. data/js/node_modules/@waves/node-api-js/cjs/create.js +119 -0
  312. data/js/node_modules/@waves/node-api-js/cjs/create.js.map +1 -0
  313. data/js/node_modules/@waves/node-api-js/cjs/index.d.ts +9 -0
  314. data/js/node_modules/@waves/node-api-js/cjs/index.js +18 -0
  315. data/js/node_modules/@waves/node-api-js/cjs/index.js.map +1 -0
  316. data/js/node_modules/@waves/node-api-js/cjs/interface.d.ts +44 -0
  317. data/js/node_modules/@waves/node-api-js/cjs/interface.js +10 -0
  318. data/js/node_modules/@waves/node-api-js/cjs/interface.js.map +1 -0
  319. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/availableSponsoredBalances.d.ts +7 -0
  320. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/availableSponsoredBalances.js +30 -0
  321. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/availableSponsoredBalances.js.map +1 -0
  322. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/ethAddress2waves.d.ts +1 -0
  323. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/ethAddress2waves.js +47 -0
  324. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/ethAddress2waves.js.map +1 -0
  325. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getAssetIdListByTx.d.ts +2 -0
  326. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getAssetIdListByTx.js +48 -0
  327. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getAssetIdListByTx.js.map +1 -0
  328. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getAssetsByTransaction.d.ts +3 -0
  329. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getAssetsByTransaction.js +14 -0
  330. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getAssetsByTransaction.js.map +1 -0
  331. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getTransactionsWithAssets.d.ts +6 -0
  332. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getTransactionsWithAssets.js +13 -0
  333. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/getTransactionsWithAssets.js.map +1 -0
  334. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/watch.d.ts +24 -0
  335. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/watch.js +168 -0
  336. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/watch.js.map +1 -0
  337. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/wavesAddress2eth.d.ts +1 -0
  338. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/wavesAddress2eth.js +10 -0
  339. data/js/node_modules/@waves/node-api-js/cjs/tools/adresses/wavesAddress2eth.js.map +1 -0
  340. data/js/node_modules/@waves/node-api-js/cjs/tools/assets/wavesAsset2eth.d.ts +1 -0
  341. data/js/node_modules/@waves/node-api-js/cjs/tools/assets/wavesAsset2eth.js +10 -0
  342. data/js/node_modules/@waves/node-api-js/cjs/tools/assets/wavesAsset2eth.js.map +1 -0
  343. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/detectInterval.d.ts +1 -0
  344. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/detectInterval.js +12 -0
  345. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/detectInterval.js.map +1 -0
  346. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkByte.d.ts +1 -0
  347. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkByte.js +54 -0
  348. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkByte.js.map +1 -0
  349. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkCode.d.ts +1 -0
  350. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkCode.js +11 -0
  351. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/getNetworkCode.js.map +1 -0
  352. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/waitHeight.d.ts +3 -0
  353. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/waitHeight.js +65 -0
  354. data/js/node_modules/@waves/node-api-js/cjs/tools/blocks/waitHeight.js.map +1 -0
  355. data/js/node_modules/@waves/node-api-js/cjs/tools/parse.d.ts +1 -0
  356. data/js/node_modules/@waves/node-api-js/cjs/tools/parse.js +8 -0
  357. data/js/node_modules/@waves/node-api-js/cjs/tools/parse.js.map +1 -0
  358. data/js/node_modules/@waves/node-api-js/cjs/tools/query.d.ts +4 -0
  359. data/js/node_modules/@waves/node-api-js/cjs/tools/query.js +41 -0
  360. data/js/node_modules/@waves/node-api-js/cjs/tools/query.js.map +1 -0
  361. data/js/node_modules/@waves/node-api-js/cjs/tools/request.d.ts +64 -0
  362. data/js/node_modules/@waves/node-api-js/cjs/tools/request.js +42 -0
  363. data/js/node_modules/@waves/node-api-js/cjs/tools/request.js.map +1 -0
  364. data/js/node_modules/@waves/node-api-js/cjs/tools/resolve.d.ts +1 -0
  365. data/js/node_modules/@waves/node-api-js/cjs/tools/resolve.js +7 -0
  366. data/js/node_modules/@waves/node-api-js/cjs/tools/resolve.js.map +1 -0
  367. data/js/node_modules/@waves/node-api-js/cjs/tools/stringify.d.ts +1 -0
  368. data/js/node_modules/@waves/node-api-js/cjs/tools/stringify.js +21 -0
  369. data/js/node_modules/@waves/node-api-js/cjs/tools/stringify.js.map +1 -0
  370. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/broadcast.d.ts +14 -0
  371. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/broadcast.js +60 -0
  372. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/broadcast.js.map +1 -0
  373. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/ethTxId2waves.d.ts +1 -0
  374. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/ethTxId2waves.js +11 -0
  375. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/ethTxId2waves.js.map +1 -0
  376. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/transactions.d.ts +0 -0
  377. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/transactions.js +2 -0
  378. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/transactions.js.map +1 -0
  379. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/wait.d.ts +10 -0
  380. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/wait.js +42 -0
  381. data/js/node_modules/@waves/node-api-js/cjs/tools/transactions/wait.js.map +1 -0
  382. data/js/node_modules/@waves/node-api-js/cjs/tools/utils.d.ts +32 -0
  383. data/js/node_modules/@waves/node-api-js/cjs/tools/utils.js +118 -0
  384. data/js/node_modules/@waves/node-api-js/cjs/tools/utils.js.map +1 -0
  385. data/js/node_modules/@waves/node-api-js/dist/0.node-api.js +467 -0
  386. data/js/node_modules/@waves/node-api-js/dist/node-api.js +30544 -0
  387. data/js/node_modules/@waves/node-api-js/dist/node-api.min.js +26 -0
  388. data/js/node_modules/@waves/node-api-js/dist/node-api.min.js.LICENSE.txt +17 -0
  389. data/js/node_modules/@waves/node-api-js/dist/node_fs-node_path.node-api.js +23 -0
  390. data/js/node_modules/@waves/node-api-js/dist/vendors-node_modules_node-fetch_src_utils_multipart-parser_js.node-api.js +599 -0
  391. data/js/node_modules/@waves/node-api-js/es/api-node/activation/index.d.ts +21 -0
  392. data/js/node_modules/@waves/node-api-js/es/api-node/activation/index.js +13 -0
  393. data/js/node_modules/@waves/node-api-js/es/api-node/activation/index.js.map +1 -0
  394. data/js/node_modules/@waves/node-api-js/es/api-node/addresses/index.d.ts +81 -0
  395. data/js/node_modules/@waves/node-api-js/es/api-node/addresses/index.js +111 -0
  396. data/js/node_modules/@waves/node-api-js/es/api-node/addresses/index.js.map +1 -0
  397. data/js/node_modules/@waves/node-api-js/es/api-node/alias/index.d.ts +6 -0
  398. data/js/node_modules/@waves/node-api-js/es/api-node/alias/index.js +14 -0
  399. data/js/node_modules/@waves/node-api-js/es/api-node/alias/index.js.map +1 -0
  400. data/js/node_modules/@waves/node-api-js/es/api-node/assets/index.d.ts +79 -0
  401. data/js/node_modules/@waves/node-api-js/es/api-node/assets/index.js +103 -0
  402. data/js/node_modules/@waves/node-api-js/es/api-node/assets/index.js.map +1 -0
  403. data/js/node_modules/@waves/node-api-js/es/api-node/blocks/index.d.ts +131 -0
  404. data/js/node_modules/@waves/node-api-js/es/api-node/blocks/index.js +179 -0
  405. data/js/node_modules/@waves/node-api-js/es/api-node/blocks/index.js.map +1 -0
  406. data/js/node_modules/@waves/node-api-js/es/api-node/consensus/index.d.ts +39 -0
  407. data/js/node_modules/@waves/node-api-js/es/api-node/consensus/index.js +27 -0
  408. data/js/node_modules/@waves/node-api-js/es/api-node/consensus/index.js.map +1 -0
  409. data/js/node_modules/@waves/node-api-js/es/api-node/debug/index.d.ts +189 -0
  410. data/js/node_modules/@waves/node-api-js/es/api-node/debug/index.js +201 -0
  411. data/js/node_modules/@waves/node-api-js/es/api-node/debug/index.js.map +1 -0
  412. data/js/node_modules/@waves/node-api-js/es/api-node/eth/index.d.ts +3 -0
  413. data/js/node_modules/@waves/node-api-js/es/api-node/eth/index.js +8 -0
  414. data/js/node_modules/@waves/node-api-js/es/api-node/eth/index.js.map +1 -0
  415. data/js/node_modules/@waves/node-api-js/es/api-node/leasing/index.d.ts +22 -0
  416. data/js/node_modules/@waves/node-api-js/es/api-node/leasing/index.js +22 -0
  417. data/js/node_modules/@waves/node-api-js/es/api-node/leasing/index.js.map +1 -0
  418. data/js/node_modules/@waves/node-api-js/es/api-node/node/index.d.ts +11 -0
  419. data/js/node_modules/@waves/node-api-js/es/api-node/node/index.js +10 -0
  420. data/js/node_modules/@waves/node-api-js/es/api-node/node/index.js.map +1 -0
  421. data/js/node_modules/@waves/node-api-js/es/api-node/peers/index.d.ts +46 -0
  422. data/js/node_modules/@waves/node-api-js/es/api-node/peers/index.js +46 -0
  423. data/js/node_modules/@waves/node-api-js/es/api-node/peers/index.js.map +1 -0
  424. data/js/node_modules/@waves/node-api-js/es/api-node/rewards/index.d.ts +21 -0
  425. data/js/node_modules/@waves/node-api-js/es/api-node/rewards/index.js +13 -0
  426. data/js/node_modules/@waves/node-api-js/es/api-node/rewards/index.js.map +1 -0
  427. data/js/node_modules/@waves/node-api-js/es/api-node/transactions/index.d.ts +73 -0
  428. data/js/node_modules/@waves/node-api-js/es/api-node/transactions/index.js +137 -0
  429. data/js/node_modules/@waves/node-api-js/es/api-node/transactions/index.js.map +1 -0
  430. data/js/node_modules/@waves/node-api-js/es/api-node/utils/index.d.ts +110 -0
  431. data/js/node_modules/@waves/node-api-js/es/api-node/utils/index.js +193 -0
  432. data/js/node_modules/@waves/node-api-js/es/api-node/utils/index.js.map +1 -0
  433. data/js/node_modules/@waves/node-api-js/es/api-node/wallet/index.d.ts +5 -0
  434. data/js/node_modules/@waves/node-api-js/es/api-node/wallet/index.js +7 -0
  435. data/js/node_modules/@waves/node-api-js/es/api-node/wallet/index.js.map +1 -0
  436. data/js/node_modules/@waves/node-api-js/es/constants.d.ts +40 -0
  437. data/js/node_modules/@waves/node-api-js/es/constants.js +40 -0
  438. data/js/node_modules/@waves/node-api-js/es/constants.js.map +1 -0
  439. data/js/node_modules/@waves/node-api-js/es/create.d.ts +1240 -0
  440. data/js/node_modules/@waves/node-api-js/es/create.js +93 -0
  441. data/js/node_modules/@waves/node-api-js/es/create.js.map +1 -0
  442. data/js/node_modules/@waves/node-api-js/es/index.d.ts +9 -0
  443. data/js/node_modules/@waves/node-api-js/es/index.js +9 -0
  444. data/js/node_modules/@waves/node-api-js/es/index.js.map +1 -0
  445. data/js/node_modules/@waves/node-api-js/es/interface.d.ts +44 -0
  446. data/js/node_modules/@waves/node-api-js/es/interface.js +3 -0
  447. data/js/node_modules/@waves/node-api-js/es/interface.js.map +1 -0
  448. data/js/node_modules/@waves/node-api-js/es/tools/adresses/availableSponsoredBalances.d.ts +7 -0
  449. data/js/node_modules/@waves/node-api-js/es/tools/adresses/availableSponsoredBalances.js +27 -0
  450. data/js/node_modules/@waves/node-api-js/es/tools/adresses/availableSponsoredBalances.js.map +1 -0
  451. data/js/node_modules/@waves/node-api-js/es/tools/adresses/ethAddress2waves.d.ts +1 -0
  452. data/js/node_modules/@waves/node-api-js/es/tools/adresses/ethAddress2waves.js +31 -0
  453. data/js/node_modules/@waves/node-api-js/es/tools/adresses/ethAddress2waves.js.map +1 -0
  454. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetIdListByTx.d.ts +2 -0
  455. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetIdListByTx.js +24 -0
  456. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetIdListByTx.js.map +1 -0
  457. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetsByTransaction.d.ts +3 -0
  458. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetsByTransaction.js +8 -0
  459. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getAssetsByTransaction.js.map +1 -0
  460. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getTransactionsWithAssets.d.ts +6 -0
  461. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getTransactionsWithAssets.js +7 -0
  462. data/js/node_modules/@waves/node-api-js/es/tools/adresses/getTransactionsWithAssets.js.map +1 -0
  463. data/js/node_modules/@waves/node-api-js/es/tools/adresses/watch.d.ts +24 -0
  464. data/js/node_modules/@waves/node-api-js/es/tools/adresses/watch.js +134 -0
  465. data/js/node_modules/@waves/node-api-js/es/tools/adresses/watch.js.map +1 -0
  466. data/js/node_modules/@waves/node-api-js/es/tools/adresses/wavesAddress2eth.d.ts +1 -0
  467. data/js/node_modules/@waves/node-api-js/es/tools/adresses/wavesAddress2eth.js +7 -0
  468. data/js/node_modules/@waves/node-api-js/es/tools/adresses/wavesAddress2eth.js.map +1 -0
  469. data/js/node_modules/@waves/node-api-js/es/tools/assets/wavesAsset2eth.d.ts +1 -0
  470. data/js/node_modules/@waves/node-api-js/es/tools/assets/wavesAsset2eth.js +7 -0
  471. data/js/node_modules/@waves/node-api-js/es/tools/assets/wavesAsset2eth.js.map +1 -0
  472. data/js/node_modules/@waves/node-api-js/es/tools/blocks/detectInterval.d.ts +1 -0
  473. data/js/node_modules/@waves/node-api-js/es/tools/blocks/detectInterval.js +9 -0
  474. data/js/node_modules/@waves/node-api-js/es/tools/blocks/detectInterval.js.map +1 -0
  475. data/js/node_modules/@waves/node-api-js/es/tools/blocks/getNetworkByte.d.ts +1 -0
  476. data/js/node_modules/@waves/node-api-js/es/tools/blocks/getNetworkByte.js +51 -0
  477. data/js/node_modules/@waves/node-api-js/es/tools/blocks/getNetworkByte.js.map +1 -0
  478. data/js/node_modules/@waves/node-api-js/es/tools/blocks/getNetworkCode.d.ts +1 -0
  479. data/js/node_modules/@waves/node-api-js/es/tools/blocks/getNetworkCode.js +5 -0
  480. data/js/node_modules/@waves/node-api-js/es/tools/blocks/getNetworkCode.js.map +1 -0
  481. data/js/node_modules/@waves/node-api-js/es/tools/blocks/waitHeight.d.ts +3 -0
  482. data/js/node_modules/@waves/node-api-js/es/tools/blocks/waitHeight.js +36 -0
  483. data/js/node_modules/@waves/node-api-js/es/tools/blocks/waitHeight.js.map +1 -0
  484. data/js/node_modules/@waves/node-api-js/es/tools/parse.d.ts +1 -0
  485. data/js/node_modules/@waves/node-api-js/es/tools/parse.js +5 -0
  486. data/js/node_modules/@waves/node-api-js/es/tools/parse.js.map +1 -0
  487. data/js/node_modules/@waves/node-api-js/es/tools/query.d.ts +4 -0
  488. data/js/node_modules/@waves/node-api-js/es/tools/query.js +12 -0
  489. data/js/node_modules/@waves/node-api-js/es/tools/query.js.map +1 -0
  490. data/js/node_modules/@waves/node-api-js/es/tools/request.d.ts +64 -0
  491. data/js/node_modules/@waves/node-api-js/es/tools/request.js +22 -0
  492. data/js/node_modules/@waves/node-api-js/es/tools/request.js.map +1 -0
  493. data/js/node_modules/@waves/node-api-js/es/tools/resolve.d.ts +1 -0
  494. data/js/node_modules/@waves/node-api-js/es/tools/resolve.js +4 -0
  495. data/js/node_modules/@waves/node-api-js/es/tools/resolve.js.map +1 -0
  496. data/js/node_modules/@waves/node-api-js/es/tools/stringify.d.ts +1 -0
  497. data/js/node_modules/@waves/node-api-js/es/tools/stringify.js +18 -0
  498. data/js/node_modules/@waves/node-api-js/es/tools/stringify.js.map +1 -0
  499. data/js/node_modules/@waves/node-api-js/es/tools/transactions/broadcast.d.ts +14 -0
  500. data/js/node_modules/@waves/node-api-js/es/tools/transactions/broadcast.js +43 -0
  501. data/js/node_modules/@waves/node-api-js/es/tools/transactions/broadcast.js.map +1 -0
  502. data/js/node_modules/@waves/node-api-js/es/tools/transactions/ethTxId2waves.d.ts +1 -0
  503. data/js/node_modules/@waves/node-api-js/es/tools/transactions/ethTxId2waves.js +8 -0
  504. data/js/node_modules/@waves/node-api-js/es/tools/transactions/ethTxId2waves.js.map +1 -0
  505. data/js/node_modules/@waves/node-api-js/es/tools/transactions/transactions.d.ts +0 -0
  506. data/js/node_modules/@waves/node-api-js/es/tools/transactions/transactions.js +2 -0
  507. data/js/node_modules/@waves/node-api-js/es/tools/transactions/transactions.js.map +1 -0
  508. data/js/node_modules/@waves/node-api-js/es/tools/transactions/wait.d.ts +10 -0
  509. data/js/node_modules/@waves/node-api-js/es/tools/transactions/wait.js +39 -0
  510. data/js/node_modules/@waves/node-api-js/es/tools/transactions/wait.js.map +1 -0
  511. data/js/node_modules/@waves/node-api-js/es/tools/utils.d.ts +32 -0
  512. data/js/node_modules/@waves/node-api-js/es/tools/utils.js +73 -0
  513. data/js/node_modules/@waves/node-api-js/es/tools/utils.js.map +1 -0
  514. data/js/node_modules/@waves/node-api-js/package.json +66 -0
  515. data/js/node_modules/@waves/parse-json-bignumber/coverage/clover.xml +225 -0
  516. data/js/node_modules/@waves/parse-json-bignumber/coverage/coverage-final.json +2 -0
  517. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/base.css +212 -0
  518. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/index.html +93 -0
  519. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/parse-json-bignumber.ts.html +1598 -0
  520. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/prettify.css +1 -0
  521. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/prettify.js +1 -0
  522. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  523. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov-report/sorter.js +158 -0
  524. data/js/node_modules/@waves/parse-json-bignumber/coverage/lcov.info +415 -0
  525. data/js/node_modules/@waves/parse-json-bignumber/dist/parse-json-bignumber.d.ts +11 -0
  526. data/js/node_modules/@waves/parse-json-bignumber/dist/parse-json-bignumber.js +412 -0
  527. data/js/node_modules/@waves/parse-json-bignumber/dist/parse-json-bignumber.min.js +1 -0
  528. data/js/node_modules/@waves/parse-json-bignumber/package.json +40 -0
  529. data/js/node_modules/@waves/parse-json-bignumber/src/parse-json-bignumber.ts +511 -0
  530. data/js/node_modules/@waves/parse-json-bignumber/test/index.ts +130 -0
  531. data/js/node_modules/@waves/parse-json-bignumber/test/tsconfig.json +14 -0
  532. data/js/node_modules/@waves/parse-json-bignumber/tsconfig.json +15 -0
  533. data/js/node_modules/@waves/protobuf-serialization/README.MD +116 -0
  534. data/js/node_modules/@waves/protobuf-serialization/dist/index.d.ts +2005 -0
  535. data/js/node_modules/@waves/protobuf-serialization/dist/index.js +6636 -0
  536. data/js/node_modules/@waves/protobuf-serialization/package.json +30 -0
  537. data/js/node_modules/@waves/protobuf-serialization/proto/waves/amount.proto +10 -0
  538. data/js/node_modules/@waves/protobuf-serialization/proto/waves/block.proto +40 -0
  539. data/js/node_modules/@waves/protobuf-serialization/proto/waves/events/events.proto +213 -0
  540. data/js/node_modules/@waves/protobuf-serialization/proto/waves/events/grpc/blockchain_updates.proto +42 -0
  541. data/js/node_modules/@waves/protobuf-serialization/proto/waves/invoke_script_result.proto +98 -0
  542. data/js/node_modules/@waves/protobuf-serialization/proto/waves/lang/dapp_meta.proto +21 -0
  543. data/js/node_modules/@waves/protobuf-serialization/proto/waves/node/grpc/accounts_api.proto +68 -0
  544. data/js/node_modules/@waves/protobuf-serialization/proto/waves/node/grpc/assets_api.proto +41 -0
  545. data/js/node_modules/@waves/protobuf-serialization/proto/waves/node/grpc/blockchain_api.proto +54 -0
  546. data/js/node_modules/@waves/protobuf-serialization/proto/waves/node/grpc/blocks_api.proto +41 -0
  547. data/js/node_modules/@waves/protobuf-serialization/proto/waves/node/grpc/transactions_api.proto +73 -0
  548. data/js/node_modules/@waves/protobuf-serialization/proto/waves/order.proto +43 -0
  549. data/js/node_modules/@waves/protobuf-serialization/proto/waves/recipient.proto +13 -0
  550. data/js/node_modules/@waves/protobuf-serialization/proto/waves/transaction.proto +156 -0
  551. data/js/node_modules/@waves/ts-lib-crypto/README.md +492 -0
  552. data/js/node_modules/@waves/ts-lib-crypto/bytes.d.ts +10 -0
  553. data/js/node_modules/@waves/ts-lib-crypto/bytes.js +21 -0
  554. data/js/node_modules/@waves/ts-lib-crypto/bytes.js.map +1 -0
  555. data/js/node_modules/@waves/ts-lib-crypto/conversions/base-xx.d.ts +7 -0
  556. data/js/node_modules/@waves/ts-lib-crypto/conversions/base-xx.js +27 -0
  557. data/js/node_modules/@waves/ts-lib-crypto/conversions/base-xx.js.map +1 -0
  558. data/js/node_modules/@waves/ts-lib-crypto/conversions/param.d.ts +3 -0
  559. data/js/node_modules/@waves/ts-lib-crypto/conversions/param.js +24 -0
  560. data/js/node_modules/@waves/ts-lib-crypto/conversions/param.js.map +1 -0
  561. data/js/node_modules/@waves/ts-lib-crypto/conversions/string-bytes.d.ts +11 -0
  562. data/js/node_modules/@waves/ts-lib-crypto/conversions/string-bytes.js +65 -0
  563. data/js/node_modules/@waves/ts-lib-crypto/conversions/string-bytes.js.map +1 -0
  564. data/js/node_modules/@waves/ts-lib-crypto/crypto/address-keys-seed.d.ts +7 -0
  565. data/js/node_modules/@waves/ts-lib-crypto/crypto/address-keys-seed.js +58 -0
  566. data/js/node_modules/@waves/ts-lib-crypto/crypto/address-keys-seed.js.map +1 -0
  567. data/js/node_modules/@waves/ts-lib-crypto/crypto/concat-split.d.ts +3 -0
  568. data/js/node_modules/@waves/ts-lib-crypto/crypto/concat-split.js +39 -0
  569. data/js/node_modules/@waves/ts-lib-crypto/crypto/concat-split.js.map +1 -0
  570. data/js/node_modules/@waves/ts-lib-crypto/crypto/crypto.d.ts +13 -0
  571. data/js/node_modules/@waves/ts-lib-crypto/crypto/crypto.js +117 -0
  572. data/js/node_modules/@waves/ts-lib-crypto/crypto/crypto.js.map +1 -0
  573. data/js/node_modules/@waves/ts-lib-crypto/crypto/encryption.d.ts +6 -0
  574. data/js/node_modules/@waves/ts-lib-crypto/crypto/encryption.js +89 -0
  575. data/js/node_modules/@waves/ts-lib-crypto/crypto/encryption.js.map +1 -0
  576. data/js/node_modules/@waves/ts-lib-crypto/crypto/hashing.d.ts +7 -0
  577. data/js/node_modules/@waves/ts-lib-crypto/crypto/hashing.js +39 -0
  578. data/js/node_modules/@waves/ts-lib-crypto/crypto/hashing.js.map +1 -0
  579. data/js/node_modules/@waves/ts-lib-crypto/crypto/interface.d.ts +98 -0
  580. data/js/node_modules/@waves/ts-lib-crypto/crypto/interface.js +9 -0
  581. data/js/node_modules/@waves/ts-lib-crypto/crypto/interface.js.map +1 -0
  582. data/js/node_modules/@waves/ts-lib-crypto/crypto/merkle-verify.d.ts +7 -0
  583. data/js/node_modules/@waves/ts-lib-crypto/crypto/merkle-verify.js +51 -0
  584. data/js/node_modules/@waves/ts-lib-crypto/crypto/merkle-verify.js.map +1 -0
  585. data/js/node_modules/@waves/ts-lib-crypto/crypto/random.d.ts +4 -0
  586. data/js/node_modules/@waves/ts-lib-crypto/crypto/random.js +51 -0
  587. data/js/node_modules/@waves/ts-lib-crypto/crypto/random.js.map +1 -0
  588. data/js/node_modules/@waves/ts-lib-crypto/crypto/rsa.d.ts +7 -0
  589. data/js/node_modules/@waves/ts-lib-crypto/crypto/rsa.js +159 -0
  590. data/js/node_modules/@waves/ts-lib-crypto/crypto/rsa.js.map +1 -0
  591. data/js/node_modules/@waves/ts-lib-crypto/crypto/seed-ecryption.d.ts +9 -0
  592. data/js/node_modules/@waves/ts-lib-crypto/crypto/seed-ecryption.js +62 -0
  593. data/js/node_modules/@waves/ts-lib-crypto/crypto/seed-ecryption.js.map +1 -0
  594. data/js/node_modules/@waves/ts-lib-crypto/crypto/seed-words-list.d.ts +1 -0
  595. data/js/node_modules/@waves/ts-lib-crypto/crypto/seed-words-list.js +189 -0
  596. data/js/node_modules/@waves/ts-lib-crypto/crypto/seed-words-list.js.map +1 -0
  597. data/js/node_modules/@waves/ts-lib-crypto/crypto/sign.d.ts +2 -0
  598. data/js/node_modules/@waves/ts-lib-crypto/crypto/sign.js +16 -0
  599. data/js/node_modules/@waves/ts-lib-crypto/crypto/sign.js.map +1 -0
  600. data/js/node_modules/@waves/ts-lib-crypto/crypto/util.d.ts +3 -0
  601. data/js/node_modules/@waves/ts-lib-crypto/crypto/util.js +9 -0
  602. data/js/node_modules/@waves/ts-lib-crypto/crypto/util.js.map +1 -0
  603. data/js/node_modules/@waves/ts-lib-crypto/crypto/verification.d.ts +7 -0
  604. data/js/node_modules/@waves/ts-lib-crypto/crypto/verification.js +49 -0
  605. data/js/node_modules/@waves/ts-lib-crypto/crypto/verification.js.map +1 -0
  606. data/js/node_modules/@waves/ts-lib-crypto/extensions/chain-id.d.ts +5 -0
  607. data/js/node_modules/@waves/ts-lib-crypto/extensions/chain-id.js +16 -0
  608. data/js/node_modules/@waves/ts-lib-crypto/extensions/chain-id.js.map +1 -0
  609. data/js/node_modules/@waves/ts-lib-crypto/extensions/seed.d.ts +6 -0
  610. data/js/node_modules/@waves/ts-lib-crypto/extensions/seed.js +18 -0
  611. data/js/node_modules/@waves/ts-lib-crypto/extensions/seed.js.map +1 -0
  612. data/js/node_modules/@waves/ts-lib-crypto/index.d.ts +10 -0
  613. data/js/node_modules/@waves/ts-lib-crypto/index.js +21 -0
  614. data/js/node_modules/@waves/ts-lib-crypto/index.js.map +1 -0
  615. data/js/node_modules/@waves/ts-lib-crypto/libs/Utf8.d.ts +2 -0
  616. data/js/node_modules/@waves/ts-lib-crypto/libs/Utf8.js +61 -0
  617. data/js/node_modules/@waves/ts-lib-crypto/libs/Utf8.js.map +1 -0
  618. data/js/node_modules/@waves/ts-lib-crypto/libs/axlsign.js +1374 -0
  619. data/js/node_modules/@waves/ts-lib-crypto/libs/base58.d.ts +5 -0
  620. data/js/node_modules/@waves/ts-lib-crypto/libs/base58.js +66 -0
  621. data/js/node_modules/@waves/ts-lib-crypto/libs/base58.js.map +1 -0
  622. data/js/node_modules/@waves/ts-lib-crypto/libs/blake2b.js +308 -0
  623. data/js/node_modules/@waves/ts-lib-crypto/libs/sha3.js +441 -0
  624. data/js/node_modules/@waves/ts-lib-crypto/min/waves-lib-crypto.js +33 -0
  625. data/js/node_modules/@waves/ts-lib-crypto/package.json +31 -0
  626. data/js/node_modules/@waves/ts-types/dist/src/common.d.ts +59 -0
  627. data/js/node_modules/@waves/ts-types/dist/src/common.js +53 -0
  628. data/js/node_modules/@waves/ts-types/dist/src/exchange.d.ts +47 -0
  629. data/js/node_modules/@waves/ts-types/dist/src/exchange.js +2 -0
  630. data/js/node_modules/@waves/ts-types/dist/src/index.d.ts +52 -0
  631. data/js/node_modules/@waves/ts-types/dist/src/index.js +63 -0
  632. data/js/node_modules/@waves/ts-types/dist/src/invoke.d.ts +22 -0
  633. data/js/node_modules/@waves/ts-types/dist/src/invoke.js +2 -0
  634. data/js/node_modules/@waves/ts-types/dist/src/network.d.ts +6 -0
  635. data/js/node_modules/@waves/ts-types/dist/src/network.js +10 -0
  636. data/js/node_modules/@waves/ts-types/dist/src/parts.d.ts +159 -0
  637. data/js/node_modules/@waves/ts-types/dist/src/parts.js +2 -0
  638. data/js/node_modules/@waves/ts-types/dist/transactions/index.d.ts +363 -0
  639. data/js/node_modules/@waves/ts-types/dist/transactions/index.js +3 -0
  640. data/js/node_modules/@waves/ts-types/index.ts +1 -0
  641. data/js/node_modules/@waves/ts-types/package.json +41 -0
  642. data/js/node_modules/@waves/ts-types/src/index.ts +57 -0
  643. data/js/node_modules/@waves/ts-types/src/parts.ts +247 -0
  644. data/js/node_modules/@waves/ts-types/transactions/index.ts +789 -0
  645. data/js/node_modules/@waves/ts-types/tsconfig.json +16 -0
  646. data/js/node_modules/@waves/waves-transactions/README.md +432 -0
  647. data/js/node_modules/@waves/waves-transactions/dist/defaultVersions.d.ts +18 -0
  648. data/js/node_modules/@waves/waves-transactions/dist/defaultVersions.js +22 -0
  649. data/js/node_modules/@waves/waves-transactions/dist/defaultVersions.js.map +1 -0
  650. data/js/node_modules/@waves/waves-transactions/dist/general.d.ts +68 -0
  651. data/js/node_modules/@waves/waves-transactions/dist/general.js +135 -0
  652. data/js/node_modules/@waves/waves-transactions/dist/general.js.map +1 -0
  653. data/js/node_modules/@waves/waves-transactions/dist/generic.d.ts +28 -0
  654. data/js/node_modules/@waves/waves-transactions/dist/generic.js +88 -0
  655. data/js/node_modules/@waves/waves-transactions/dist/generic.js.map +1 -0
  656. data/js/node_modules/@waves/waves-transactions/dist/index.d.ts +37 -0
  657. data/js/node_modules/@waves/waves-transactions/dist/index.js +98 -0
  658. data/js/node_modules/@waves/waves-transactions/dist/index.js.map +1 -0
  659. data/js/node_modules/@waves/waves-transactions/dist/make-tx.d.ts +50 -0
  660. data/js/node_modules/@waves/waves-transactions/dist/make-tx.js +106 -0
  661. data/js/node_modules/@waves/waves-transactions/dist/make-tx.js.map +1 -0
  662. data/js/node_modules/@waves/waves-transactions/dist/min/waves-transactions.min.js +26 -0
  663. data/js/node_modules/@waves/waves-transactions/dist/nodeInteraction.d.ts +116 -0
  664. data/js/node_modules/@waves/waves-transactions/dist/nodeInteraction.js +277 -0
  665. data/js/node_modules/@waves/waves-transactions/dist/nodeInteraction.js.map +1 -0
  666. data/js/node_modules/@waves/waves-transactions/dist/proto-serialize.d.ts +62 -0
  667. data/js/node_modules/@waves/waves-transactions/dist/proto-serialize.js +514 -0
  668. data/js/node_modules/@waves/waves-transactions/dist/proto-serialize.js.map +1 -0
  669. data/js/node_modules/@waves/waves-transactions/dist/requests/auth.d.ts +7 -0
  670. data/js/node_modules/@waves/waves-transactions/dist/requests/auth.js +31 -0
  671. data/js/node_modules/@waves/waves-transactions/dist/requests/auth.js.map +1 -0
  672. data/js/node_modules/@waves/waves-transactions/dist/requests/cancel-order.d.ts +7 -0
  673. data/js/node_modules/@waves/waves-transactions/dist/requests/cancel-order.js +29 -0
  674. data/js/node_modules/@waves/waves-transactions/dist/requests/cancel-order.js.map +1 -0
  675. data/js/node_modules/@waves/waves-transactions/dist/requests/custom-data.d.ts +40 -0
  676. data/js/node_modules/@waves/waves-transactions/dist/requests/custom-data.js +37 -0
  677. data/js/node_modules/@waves/waves-transactions/dist/requests/custom-data.js.map +1 -0
  678. data/js/node_modules/@waves/waves-transactions/dist/requests/order.d.ts +50 -0
  679. data/js/node_modules/@waves/waves-transactions/dist/requests/order.js +62 -0
  680. data/js/node_modules/@waves/waves-transactions/dist/requests/order.js.map +1 -0
  681. data/js/node_modules/@waves/waves-transactions/dist/requests/wavesAuth.d.ts +7 -0
  682. data/js/node_modules/@waves/waves-transactions/dist/requests/wavesAuth.js +31 -0
  683. data/js/node_modules/@waves/waves-transactions/dist/requests/wavesAuth.js.map +1 -0
  684. data/js/node_modules/@waves/waves-transactions/dist/seedUtils/index.d.ts +21 -0
  685. data/js/node_modules/@waves/waves-transactions/dist/seedUtils/index.js +85 -0
  686. data/js/node_modules/@waves/waves-transactions/dist/seedUtils/index.js.map +1 -0
  687. data/js/node_modules/@waves/waves-transactions/dist/transactions/alias.d.ts +8 -0
  688. data/js/node_modules/@waves/waves-transactions/dist/transactions/alias.js +35 -0
  689. data/js/node_modules/@waves/waves-transactions/dist/transactions/alias.js.map +1 -0
  690. data/js/node_modules/@waves/waves-transactions/dist/transactions/burn.d.ts +8 -0
  691. data/js/node_modules/@waves/waves-transactions/dist/transactions/burn.js +35 -0
  692. data/js/node_modules/@waves/waves-transactions/dist/transactions/burn.js.map +1 -0
  693. data/js/node_modules/@waves/waves-transactions/dist/transactions/cancel-lease.d.ts +8 -0
  694. data/js/node_modules/@waves/waves-transactions/dist/transactions/cancel-lease.js +34 -0
  695. data/js/node_modules/@waves/waves-transactions/dist/transactions/cancel-lease.js.map +1 -0
  696. data/js/node_modules/@waves/waves-transactions/dist/transactions/data.d.ts +5 -0
  697. data/js/node_modules/@waves/waves-transactions/dist/transactions/data.js +112 -0
  698. data/js/node_modules/@waves/waves-transactions/dist/transactions/data.js.map +1 -0
  699. data/js/node_modules/@waves/waves-transactions/dist/transactions/exchange.d.ts +7 -0
  700. data/js/node_modules/@waves/waves-transactions/dist/transactions/exchange.js +39 -0
  701. data/js/node_modules/@waves/waves-transactions/dist/transactions/exchange.js.map +1 -0
  702. data/js/node_modules/@waves/waves-transactions/dist/transactions/invoke-expression.d.ts +0 -0
  703. data/js/node_modules/@waves/waves-transactions/dist/transactions/invoke-expression.js +52 -0
  704. data/js/node_modules/@waves/waves-transactions/dist/transactions/invoke-expression.js.map +1 -0
  705. data/js/node_modules/@waves/waves-transactions/dist/transactions/invoke-script.d.ts +8 -0
  706. data/js/node_modules/@waves/waves-transactions/dist/transactions/invoke-script.js +43 -0
  707. data/js/node_modules/@waves/waves-transactions/dist/transactions/invoke-script.js.map +1 -0
  708. data/js/node_modules/@waves/waves-transactions/dist/transactions/issue.d.ts +8 -0
  709. data/js/node_modules/@waves/waves-transactions/dist/transactions/issue.js +42 -0
  710. data/js/node_modules/@waves/waves-transactions/dist/transactions/issue.js.map +1 -0
  711. data/js/node_modules/@waves/waves-transactions/dist/transactions/lease.d.ts +8 -0
  712. data/js/node_modules/@waves/waves-transactions/dist/transactions/lease.js +35 -0
  713. data/js/node_modules/@waves/waves-transactions/dist/transactions/lease.js.map +1 -0
  714. data/js/node_modules/@waves/waves-transactions/dist/transactions/mass-transfer.d.ts +8 -0
  715. data/js/node_modules/@waves/waves-transactions/dist/transactions/mass-transfer.js +39 -0
  716. data/js/node_modules/@waves/waves-transactions/dist/transactions/mass-transfer.js.map +1 -0
  717. data/js/node_modules/@waves/waves-transactions/dist/transactions/reissue.d.ts +8 -0
  718. data/js/node_modules/@waves/waves-transactions/dist/transactions/reissue.js +36 -0
  719. data/js/node_modules/@waves/waves-transactions/dist/transactions/reissue.js.map +1 -0
  720. data/js/node_modules/@waves/waves-transactions/dist/transactions/set-asset-script.d.ts +8 -0
  721. data/js/node_modules/@waves/waves-transactions/dist/transactions/set-asset-script.js +37 -0
  722. data/js/node_modules/@waves/waves-transactions/dist/transactions/set-asset-script.js.map +1 -0
  723. data/js/node_modules/@waves/waves-transactions/dist/transactions/set-script.d.ts +8 -0
  724. data/js/node_modules/@waves/waves-transactions/dist/transactions/set-script.js +38 -0
  725. data/js/node_modules/@waves/waves-transactions/dist/transactions/set-script.js.map +1 -0
  726. data/js/node_modules/@waves/waves-transactions/dist/transactions/sponsorship.d.ts +8 -0
  727. data/js/node_modules/@waves/waves-transactions/dist/transactions/sponsorship.js +35 -0
  728. data/js/node_modules/@waves/waves-transactions/dist/transactions/sponsorship.js.map +1 -0
  729. data/js/node_modules/@waves/waves-transactions/dist/transactions/transfer.d.ts +8 -0
  730. data/js/node_modules/@waves/waves-transactions/dist/transactions/transfer.js +38 -0
  731. data/js/node_modules/@waves/waves-transactions/dist/transactions/transfer.js.map +1 -0
  732. data/js/node_modules/@waves/waves-transactions/dist/transactions/update-asset-info.d.ts +8 -0
  733. data/js/node_modules/@waves/waves-transactions/dist/transactions/update-asset-info.js +35 -0
  734. data/js/node_modules/@waves/waves-transactions/dist/transactions/update-asset-info.js.map +1 -0
  735. data/js/node_modules/@waves/waves-transactions/dist/transactions.d.ts +277 -0
  736. data/js/node_modules/@waves/waves-transactions/dist/transactions.js +3 -0
  737. data/js/node_modules/@waves/waves-transactions/dist/transactions.js.map +1 -0
  738. data/js/node_modules/@waves/waves-transactions/dist/types.d.ts +11 -0
  739. data/js/node_modules/@waves/waves-transactions/dist/types.js +6 -0
  740. data/js/node_modules/@waves/waves-transactions/dist/types.js.map +1 -0
  741. data/js/node_modules/@waves/waves-transactions/dist/validators/alias.d.ts +1 -0
  742. data/js/node_modules/@waves/waves-transactions/dist/validators/alias.js +17 -0
  743. data/js/node_modules/@waves/waves-transactions/dist/validators/alias.js.map +1 -0
  744. data/js/node_modules/@waves/waves-transactions/dist/validators/auth.d.ts +1 -0
  745. data/js/node_modules/@waves/waves-transactions/dist/validators/auth.js +10 -0
  746. data/js/node_modules/@waves/waves-transactions/dist/validators/auth.js.map +1 -0
  747. data/js/node_modules/@waves/waves-transactions/dist/validators/burn.d.ts +1 -0
  748. data/js/node_modules/@waves/waves-transactions/dist/validators/burn.js +18 -0
  749. data/js/node_modules/@waves/waves-transactions/dist/validators/burn.js.map +1 -0
  750. data/js/node_modules/@waves/waves-transactions/dist/validators/cancel-lease.d.ts +1 -0
  751. data/js/node_modules/@waves/waves-transactions/dist/validators/cancel-lease.js +17 -0
  752. data/js/node_modules/@waves/waves-transactions/dist/validators/cancel-lease.js.map +1 -0
  753. data/js/node_modules/@waves/waves-transactions/dist/validators/cancel-order.d.ts +1 -0
  754. data/js/node_modules/@waves/waves-transactions/dist/validators/cancel-order.js +12 -0
  755. data/js/node_modules/@waves/waves-transactions/dist/validators/cancel-order.js.map +1 -0
  756. data/js/node_modules/@waves/waves-transactions/dist/validators/custom-data.d.ts +1 -0
  757. data/js/node_modules/@waves/waves-transactions/dist/validators/custom-data.js +16 -0
  758. data/js/node_modules/@waves/waves-transactions/dist/validators/custom-data.js.map +1 -0
  759. data/js/node_modules/@waves/waves-transactions/dist/validators/data.d.ts +2 -0
  760. data/js/node_modules/@waves/waves-transactions/dist/validators/data.js +18 -0
  761. data/js/node_modules/@waves/waves-transactions/dist/validators/data.js.map +1 -0
  762. data/js/node_modules/@waves/waves-transactions/dist/validators/exchange.d.ts +1 -0
  763. data/js/node_modules/@waves/waves-transactions/dist/validators/exchange.js +22 -0
  764. data/js/node_modules/@waves/waves-transactions/dist/validators/exchange.js.map +1 -0
  765. data/js/node_modules/@waves/waves-transactions/dist/validators/index.d.ts +24 -0
  766. data/js/node_modules/@waves/waves-transactions/dist/validators/index.js +60 -0
  767. data/js/node_modules/@waves/waves-transactions/dist/validators/index.js.map +1 -0
  768. data/js/node_modules/@waves/waves-transactions/dist/validators/invoke-expression.d.ts +0 -0
  769. data/js/node_modules/@waves/waves-transactions/dist/validators/invoke-expression.js +33 -0
  770. data/js/node_modules/@waves/waves-transactions/dist/validators/invoke-expression.js.map +1 -0
  771. data/js/node_modules/@waves/waves-transactions/dist/validators/invoke-script.d.ts +1 -0
  772. data/js/node_modules/@waves/waves-transactions/dist/validators/invoke-script.js +20 -0
  773. data/js/node_modules/@waves/waves-transactions/dist/validators/invoke-script.js.map +1 -0
  774. data/js/node_modules/@waves/waves-transactions/dist/validators/issue.d.ts +1 -0
  775. data/js/node_modules/@waves/waves-transactions/dist/validators/issue.js +22 -0
  776. data/js/node_modules/@waves/waves-transactions/dist/validators/issue.js.map +1 -0
  777. data/js/node_modules/@waves/waves-transactions/dist/validators/lease.d.ts +1 -0
  778. data/js/node_modules/@waves/waves-transactions/dist/validators/lease.js +17 -0
  779. data/js/node_modules/@waves/waves-transactions/dist/validators/lease.js.map +1 -0
  780. data/js/node_modules/@waves/waves-transactions/dist/validators/mass-transfer.d.ts +1 -0
  781. data/js/node_modules/@waves/waves-transactions/dist/validators/mass-transfer.js +18 -0
  782. data/js/node_modules/@waves/waves-transactions/dist/validators/mass-transfer.js.map +1 -0
  783. data/js/node_modules/@waves/waves-transactions/dist/validators/order.d.ts +1 -0
  784. data/js/node_modules/@waves/waves-transactions/dist/validators/order.js +34 -0
  785. data/js/node_modules/@waves/waves-transactions/dist/validators/order.js.map +1 -0
  786. data/js/node_modules/@waves/waves-transactions/dist/validators/reissue.d.ts +1 -0
  787. data/js/node_modules/@waves/waves-transactions/dist/validators/reissue.js +19 -0
  788. data/js/node_modules/@waves/waves-transactions/dist/validators/reissue.js.map +1 -0
  789. data/js/node_modules/@waves/waves-transactions/dist/validators/set-asset-script.d.ts +1 -0
  790. data/js/node_modules/@waves/waves-transactions/dist/validators/set-asset-script.js +18 -0
  791. data/js/node_modules/@waves/waves-transactions/dist/validators/set-asset-script.js.map +1 -0
  792. data/js/node_modules/@waves/waves-transactions/dist/validators/set-script.d.ts +1 -0
  793. data/js/node_modules/@waves/waves-transactions/dist/validators/set-script.js +17 -0
  794. data/js/node_modules/@waves/waves-transactions/dist/validators/set-script.js.map +1 -0
  795. data/js/node_modules/@waves/waves-transactions/dist/validators/sponsorship.d.ts +1 -0
  796. data/js/node_modules/@waves/waves-transactions/dist/validators/sponsorship.js +17 -0
  797. data/js/node_modules/@waves/waves-transactions/dist/validators/sponsorship.js.map +1 -0
  798. data/js/node_modules/@waves/waves-transactions/dist/validators/transfer.d.ts +1 -0
  799. data/js/node_modules/@waves/waves-transactions/dist/validators/transfer.js +20 -0
  800. data/js/node_modules/@waves/waves-transactions/dist/validators/transfer.js.map +1 -0
  801. data/js/node_modules/@waves/waves-transactions/dist/validators/update-asset-info.d.ts +1 -0
  802. data/js/node_modules/@waves/waves-transactions/dist/validators/update-asset-info.js +18 -0
  803. data/js/node_modules/@waves/waves-transactions/dist/validators/update-asset-info.js.map +1 -0
  804. data/js/node_modules/@waves/waves-transactions/dist/validators/validators.d.ts +52 -0
  805. data/js/node_modules/@waves/waves-transactions/dist/validators/validators.js +160 -0
  806. data/js/node_modules/@waves/waves-transactions/dist/validators/validators.js.map +1 -0
  807. data/js/node_modules/@waves/waves-transactions/dist/validators/wavesAuth.d.ts +1 -0
  808. data/js/node_modules/@waves/waves-transactions/dist/validators/wavesAuth.js +10 -0
  809. data/js/node_modules/@waves/waves-transactions/dist/validators/wavesAuth.js.map +1 -0
  810. data/js/node_modules/@waves/waves-transactions/package.json +83 -0
  811. data/js/node_modules/@waves/waves-transactions/src/defaultVersions.ts +18 -0
  812. data/js/node_modules/@waves/waves-transactions/src/general.ts +165 -0
  813. data/js/node_modules/@waves/waves-transactions/src/generic.ts +88 -0
  814. data/js/node_modules/@waves/waves-transactions/src/index.ts +87 -0
  815. data/js/node_modules/@waves/waves-transactions/src/make-tx.ts +179 -0
  816. data/js/node_modules/@waves/waves-transactions/src/nodeInteraction.ts +297 -0
  817. data/js/node_modules/@waves/waves-transactions/src/proto-serialize.ts +571 -0
  818. data/js/node_modules/@waves/waves-transactions/src/requests/auth.ts +42 -0
  819. data/js/node_modules/@waves/waves-transactions/src/requests/cancel-order.ts +37 -0
  820. data/js/node_modules/@waves/waves-transactions/src/requests/custom-data.ts +73 -0
  821. data/js/node_modules/@waves/waves-transactions/src/requests/order.ts +121 -0
  822. data/js/node_modules/@waves/waves-transactions/src/requests/wavesAuth.ts +40 -0
  823. data/js/node_modules/@waves/waves-transactions/src/seedUtils/index.ts +124 -0
  824. data/js/node_modules/@waves/waves-transactions/src/transactions/alias.ts +46 -0
  825. data/js/node_modules/@waves/waves-transactions/src/transactions/burn.ts +45 -0
  826. data/js/node_modules/@waves/waves-transactions/src/transactions/cancel-lease.ts +44 -0
  827. data/js/node_modules/@waves/waves-transactions/src/transactions/data.ts +122 -0
  828. data/js/node_modules/@waves/waves-transactions/src/transactions/exchange.ts +47 -0
  829. data/js/node_modules/@waves/waves-transactions/src/transactions/invoke-expression.ts +50 -0
  830. data/js/node_modules/@waves/waves-transactions/src/transactions/invoke-script.ts +54 -0
  831. data/js/node_modules/@waves/waves-transactions/src/transactions/issue.ts +52 -0
  832. data/js/node_modules/@waves/waves-transactions/src/transactions/lease.ts +45 -0
  833. data/js/node_modules/@waves/waves-transactions/src/transactions/mass-transfer.ts +55 -0
  834. data/js/node_modules/@waves/waves-transactions/src/transactions/reissue.ts +46 -0
  835. data/js/node_modules/@waves/waves-transactions/src/transactions/set-asset-script.ts +57 -0
  836. data/js/node_modules/@waves/waves-transactions/src/transactions/set-script.ts +54 -0
  837. data/js/node_modules/@waves/waves-transactions/src/transactions/sponsorship.ts +45 -0
  838. data/js/node_modules/@waves/waves-transactions/src/transactions/transfer.ts +55 -0
  839. data/js/node_modules/@waves/waves-transactions/src/transactions/update-asset-info.ts +44 -0
  840. data/js/node_modules/@waves/waves-transactions/src/transactions.ts +352 -0
  841. data/js/node_modules/@waves/waves-transactions/src/types.ts +12 -0
  842. data/js/node_modules/@waves/waves-transactions/src/validators/alias.ts +28 -0
  843. data/js/node_modules/@waves/waves-transactions/src/validators/auth.ts +14 -0
  844. data/js/node_modules/@waves/waves-transactions/src/validators/burn.ts +29 -0
  845. data/js/node_modules/@waves/waves-transactions/src/validators/cancel-lease.ts +27 -0
  846. data/js/node_modules/@waves/waves-transactions/src/validators/cancel-order.ts +17 -0
  847. data/js/node_modules/@waves/waves-transactions/src/validators/custom-data.ts +40 -0
  848. data/js/node_modules/@waves/waves-transactions/src/validators/data.ts +33 -0
  849. data/js/node_modules/@waves/waves-transactions/src/validators/exchange.ts +36 -0
  850. data/js/node_modules/@waves/waves-transactions/src/validators/index.ts +50 -0
  851. data/js/node_modules/@waves/waves-transactions/src/validators/invoke-expression.ts +31 -0
  852. data/js/node_modules/@waves/waves-transactions/src/validators/invoke-script.ts +64 -0
  853. data/js/node_modules/@waves/waves-transactions/src/validators/issue.ts +41 -0
  854. data/js/node_modules/@waves/waves-transactions/src/validators/lease.ts +29 -0
  855. data/js/node_modules/@waves/waves-transactions/src/validators/mass-transfer.ts +47 -0
  856. data/js/node_modules/@waves/waves-transactions/src/validators/order.ts +68 -0
  857. data/js/node_modules/@waves/waves-transactions/src/validators/reissue.ts +31 -0
  858. data/js/node_modules/@waves/waves-transactions/src/validators/set-asset-script.ts +28 -0
  859. data/js/node_modules/@waves/waves-transactions/src/validators/set-script.ts +28 -0
  860. data/js/node_modules/@waves/waves-transactions/src/validators/sponsorship.ts +28 -0
  861. data/js/node_modules/@waves/waves-transactions/src/validators/transfer.ts +32 -0
  862. data/js/node_modules/@waves/waves-transactions/src/validators/update-asset-info.ts +32 -0
  863. data/js/node_modules/@waves/waves-transactions/src/validators/validators.ts +306 -0
  864. data/js/node_modules/@waves/waves-transactions/src/validators/wavesAuth.ts +15 -0
  865. data/js/node_modules/asynckit/LICENSE +21 -0
  866. data/js/node_modules/asynckit/README.md +233 -0
  867. data/js/node_modules/asynckit/bench.js +76 -0
  868. data/js/node_modules/asynckit/index.js +6 -0
  869. data/js/node_modules/asynckit/lib/abort.js +29 -0
  870. data/js/node_modules/asynckit/lib/async.js +34 -0
  871. data/js/node_modules/asynckit/lib/defer.js +26 -0
  872. data/js/node_modules/asynckit/lib/iterate.js +75 -0
  873. data/js/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  874. data/js/node_modules/asynckit/lib/readable_parallel.js +25 -0
  875. data/js/node_modules/asynckit/lib/readable_serial.js +25 -0
  876. data/js/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  877. data/js/node_modules/asynckit/lib/state.js +37 -0
  878. data/js/node_modules/asynckit/lib/streamify.js +141 -0
  879. data/js/node_modules/asynckit/lib/terminator.js +29 -0
  880. data/js/node_modules/asynckit/package.json +63 -0
  881. data/js/node_modules/asynckit/parallel.js +43 -0
  882. data/js/node_modules/asynckit/serial.js +17 -0
  883. data/js/node_modules/asynckit/serialOrdered.js +75 -0
  884. data/js/node_modules/asynckit/stream.js +21 -0
  885. data/js/node_modules/axios/CHANGELOG.md +413 -0
  886. data/js/node_modules/axios/LICENSE +19 -0
  887. data/js/node_modules/axios/README.md +709 -0
  888. data/js/node_modules/axios/UPGRADE_GUIDE.md +162 -0
  889. data/js/node_modules/axios/dist/axios.js +1715 -0
  890. data/js/node_modules/axios/dist/axios.map +1 -0
  891. data/js/node_modules/axios/dist/axios.min.js +3 -0
  892. data/js/node_modules/axios/dist/axios.min.map +1 -0
  893. data/js/node_modules/axios/index.d.ts +157 -0
  894. data/js/node_modules/axios/index.js +1 -0
  895. data/js/node_modules/axios/lib/adapters/README.md +37 -0
  896. data/js/node_modules/axios/lib/adapters/http.js +279 -0
  897. data/js/node_modules/axios/lib/adapters/xhr.js +180 -0
  898. data/js/node_modules/axios/lib/axios.js +53 -0
  899. data/js/node_modules/axios/lib/cancel/Cancel.js +19 -0
  900. data/js/node_modules/axios/lib/cancel/CancelToken.js +57 -0
  901. data/js/node_modules/axios/lib/cancel/isCancel.js +5 -0
  902. data/js/node_modules/axios/lib/core/Axios.js +94 -0
  903. data/js/node_modules/axios/lib/core/InterceptorManager.js +52 -0
  904. data/js/node_modules/axios/lib/core/README.md +7 -0
  905. data/js/node_modules/axios/lib/core/buildFullPath.js +20 -0
  906. data/js/node_modules/axios/lib/core/createError.js +18 -0
  907. data/js/node_modules/axios/lib/core/dispatchRequest.js +79 -0
  908. data/js/node_modules/axios/lib/core/enhanceError.js +42 -0
  909. data/js/node_modules/axios/lib/core/mergeConfig.js +73 -0
  910. data/js/node_modules/axios/lib/core/settle.js +25 -0
  911. data/js/node_modules/axios/lib/core/transformData.js +20 -0
  912. data/js/node_modules/axios/lib/defaults.js +97 -0
  913. data/js/node_modules/axios/lib/helpers/README.md +7 -0
  914. data/js/node_modules/axios/lib/helpers/bind.js +11 -0
  915. data/js/node_modules/axios/lib/helpers/buildURL.js +71 -0
  916. data/js/node_modules/axios/lib/helpers/combineURLs.js +14 -0
  917. data/js/node_modules/axios/lib/helpers/cookies.js +53 -0
  918. data/js/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
  919. data/js/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
  920. data/js/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
  921. data/js/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
  922. data/js/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
  923. data/js/node_modules/axios/lib/helpers/spread.js +27 -0
  924. data/js/node_modules/axios/lib/utils.js +344 -0
  925. data/js/node_modules/axios/package.json +84 -0
  926. data/js/node_modules/base64-js/LICENSE +21 -0
  927. data/js/node_modules/base64-js/README.md +34 -0
  928. data/js/node_modules/base64-js/base64js.min.js +1 -0
  929. data/js/node_modules/base64-js/index.d.ts +3 -0
  930. data/js/node_modules/base64-js/index.js +150 -0
  931. data/js/node_modules/base64-js/package.json +47 -0
  932. data/js/node_modules/bignumber.js/CHANGELOG.md +290 -0
  933. data/js/node_modules/bignumber.js/LICENCE.md +26 -0
  934. data/js/node_modules/bignumber.js/README.md +286 -0
  935. data/js/node_modules/bignumber.js/bignumber.d.ts +1831 -0
  936. data/js/node_modules/bignumber.js/bignumber.js +2926 -0
  937. data/js/node_modules/bignumber.js/bignumber.mjs +2889 -0
  938. data/js/node_modules/bignumber.js/doc/API.html +2249 -0
  939. data/js/node_modules/bignumber.js/package.json +50 -0
  940. data/js/node_modules/combined-stream/License +19 -0
  941. data/js/node_modules/combined-stream/Readme.md +138 -0
  942. data/js/node_modules/combined-stream/lib/combined_stream.js +208 -0
  943. data/js/node_modules/combined-stream/package.json +25 -0
  944. data/js/node_modules/combined-stream/yarn.lock +17 -0
  945. data/js/node_modules/debug/CHANGELOG.md +395 -0
  946. data/js/node_modules/debug/LICENSE +19 -0
  947. data/js/node_modules/debug/Makefile +58 -0
  948. data/js/node_modules/debug/README.md +368 -0
  949. data/js/node_modules/debug/karma.conf.js +70 -0
  950. data/js/node_modules/debug/node.js +1 -0
  951. data/js/node_modules/debug/package.json +43 -0
  952. data/js/node_modules/debug/src/browser.js +195 -0
  953. data/js/node_modules/debug/src/debug.js +225 -0
  954. data/js/node_modules/debug/src/index.js +10 -0
  955. data/js/node_modules/debug/src/node.js +186 -0
  956. data/js/node_modules/delayed-stream/License +19 -0
  957. data/js/node_modules/delayed-stream/Makefile +7 -0
  958. data/js/node_modules/delayed-stream/Readme.md +141 -0
  959. data/js/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  960. data/js/node_modules/delayed-stream/package.json +27 -0
  961. data/js/node_modules/follow-redirects/LICENSE +18 -0
  962. data/js/node_modules/follow-redirects/README.md +155 -0
  963. data/js/node_modules/follow-redirects/http.js +1 -0
  964. data/js/node_modules/follow-redirects/https.js +1 -0
  965. data/js/node_modules/follow-redirects/index.js +322 -0
  966. data/js/node_modules/follow-redirects/package.json +60 -0
  967. data/js/node_modules/form-data/License +19 -0
  968. data/js/node_modules/form-data/README.md.bak +356 -0
  969. data/js/node_modules/form-data/Readme.md +356 -0
  970. data/js/node_modules/form-data/index.d.ts +62 -0
  971. data/js/node_modules/form-data/lib/browser.js +2 -0
  972. data/js/node_modules/form-data/lib/form_data.js +498 -0
  973. data/js/node_modules/form-data/lib/populate.js +10 -0
  974. data/js/node_modules/form-data/package.json +68 -0
  975. data/js/node_modules/js-sha3/CHANGELOG.md +106 -0
  976. data/js/node_modules/js-sha3/LICENSE.txt +20 -0
  977. data/js/node_modules/js-sha3/README.md +241 -0
  978. data/js/node_modules/js-sha3/build/sha3.min.js +9 -0
  979. data/js/node_modules/js-sha3/index.d.ts +317 -0
  980. data/js/node_modules/js-sha3/package.json +45 -0
  981. data/js/node_modules/js-sha3/src/sha3.js +656 -0
  982. data/js/node_modules/long/LICENSE +202 -0
  983. data/js/node_modules/long/README.md +246 -0
  984. data/js/node_modules/long/dist/long.js +2 -0
  985. data/js/node_modules/long/dist/long.js.map +1 -0
  986. data/js/node_modules/long/index.js +1 -0
  987. data/js/node_modules/long/package.json +34 -0
  988. data/js/node_modules/long/src/long.js +1323 -0
  989. data/js/node_modules/mime-db/HISTORY.md +507 -0
  990. data/js/node_modules/mime-db/LICENSE +23 -0
  991. data/js/node_modules/mime-db/README.md +100 -0
  992. data/js/node_modules/mime-db/db.json +8519 -0
  993. data/js/node_modules/mime-db/index.js +12 -0
  994. data/js/node_modules/mime-db/package.json +60 -0
  995. data/js/node_modules/mime-types/HISTORY.md +397 -0
  996. data/js/node_modules/mime-types/LICENSE +23 -0
  997. data/js/node_modules/mime-types/README.md +113 -0
  998. data/js/node_modules/mime-types/index.js +188 -0
  999. data/js/node_modules/mime-types/package.json +44 -0
  1000. data/js/node_modules/ms/index.js +152 -0
  1001. data/js/node_modules/ms/license.md +21 -0
  1002. data/js/node_modules/ms/package.json +37 -0
  1003. data/js/node_modules/ms/readme.md +51 -0
  1004. data/js/node_modules/node-fetch/LICENSE.md +22 -0
  1005. data/js/node_modules/node-fetch/README.md +633 -0
  1006. data/js/node_modules/node-fetch/browser.js +25 -0
  1007. data/js/node_modules/node-fetch/lib/index.es.js +1781 -0
  1008. data/js/node_modules/node-fetch/lib/index.js +1790 -0
  1009. data/js/node_modules/node-fetch/lib/index.mjs +1779 -0
  1010. data/js/node_modules/node-fetch/package.json +89 -0
  1011. data/js/node_modules/node-forge/CHANGELOG.md +211 -0
  1012. data/js/node_modules/node-forge/LICENSE +331 -0
  1013. data/js/node_modules/node-forge/README.md +2097 -0
  1014. data/js/node_modules/node-forge/dist/forge.all.min.js +2 -0
  1015. data/js/node_modules/node-forge/dist/forge.all.min.js.map +1 -0
  1016. data/js/node_modules/node-forge/dist/forge.min.js +2 -0
  1017. data/js/node_modules/node-forge/dist/forge.min.js.map +1 -0
  1018. data/js/node_modules/node-forge/dist/prime.worker.min.js +2 -0
  1019. data/js/node_modules/node-forge/dist/prime.worker.min.js.map +1 -0
  1020. data/js/node_modules/node-forge/flash/README.md +48 -0
  1021. data/js/node_modules/node-forge/flash/package.json +28 -0
  1022. data/js/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
  1023. data/js/node_modules/node-forge/lib/aes.js +1091 -0
  1024. data/js/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
  1025. data/js/node_modules/node-forge/lib/asn1.js +1408 -0
  1026. data/js/node_modules/node-forge/lib/baseN.js +186 -0
  1027. data/js/node_modules/node-forge/lib/cipher.js +230 -0
  1028. data/js/node_modules/node-forge/lib/cipherModes.js +987 -0
  1029. data/js/node_modules/node-forge/lib/debug.js +78 -0
  1030. data/js/node_modules/node-forge/lib/des.js +496 -0
  1031. data/js/node_modules/node-forge/lib/ed25519.js +996 -0
  1032. data/js/node_modules/node-forge/lib/forge.js +13 -0
  1033. data/js/node_modules/node-forge/lib/form.js +149 -0
  1034. data/js/node_modules/node-forge/lib/hmac.js +146 -0
  1035. data/js/node_modules/node-forge/lib/http.js +1364 -0
  1036. data/js/node_modules/node-forge/lib/index.all.js +16 -0
  1037. data/js/node_modules/node-forge/lib/index.js +35 -0
  1038. data/js/node_modules/node-forge/lib/jsbn.js +1264 -0
  1039. data/js/node_modules/node-forge/lib/kem.js +168 -0
  1040. data/js/node_modules/node-forge/lib/log.js +317 -0
  1041. data/js/node_modules/node-forge/lib/md.all.js +13 -0
  1042. data/js/node_modules/node-forge/lib/md.js +11 -0
  1043. data/js/node_modules/node-forge/lib/md5.js +289 -0
  1044. data/js/node_modules/node-forge/lib/mgf.js +12 -0
  1045. data/js/node_modules/node-forge/lib/mgf1.js +57 -0
  1046. data/js/node_modules/node-forge/lib/oids.js +163 -0
  1047. data/js/node_modules/node-forge/lib/pbe.js +1023 -0
  1048. data/js/node_modules/node-forge/lib/pbkdf2.js +211 -0
  1049. data/js/node_modules/node-forge/lib/pem.js +230 -0
  1050. data/js/node_modules/node-forge/lib/pkcs1.js +276 -0
  1051. data/js/node_modules/node-forge/lib/pkcs12.js +1074 -0
  1052. data/js/node_modules/node-forge/lib/pkcs7.js +1257 -0
  1053. data/js/node_modules/node-forge/lib/pkcs7asn1.js +409 -0
  1054. data/js/node_modules/node-forge/lib/pki.js +102 -0
  1055. data/js/node_modules/node-forge/lib/prime.js +297 -0
  1056. data/js/node_modules/node-forge/lib/prime.worker.js +168 -0
  1057. data/js/node_modules/node-forge/lib/prng.js +419 -0
  1058. data/js/node_modules/node-forge/lib/pss.js +241 -0
  1059. data/js/node_modules/node-forge/lib/random.js +191 -0
  1060. data/js/node_modules/node-forge/lib/rc2.js +410 -0
  1061. data/js/node_modules/node-forge/lib/rsa.js +1858 -0
  1062. data/js/node_modules/node-forge/lib/sha1.js +319 -0
  1063. data/js/node_modules/node-forge/lib/sha256.js +327 -0
  1064. data/js/node_modules/node-forge/lib/sha512.js +561 -0
  1065. data/js/node_modules/node-forge/lib/socket.js +287 -0
  1066. data/js/node_modules/node-forge/lib/ssh.js +236 -0
  1067. data/js/node_modules/node-forge/lib/task.js +725 -0
  1068. data/js/node_modules/node-forge/lib/tls.js +4282 -0
  1069. data/js/node_modules/node-forge/lib/tlssocket.js +249 -0
  1070. data/js/node_modules/node-forge/lib/util.js +2993 -0
  1071. data/js/node_modules/node-forge/lib/x509.js +3333 -0
  1072. data/js/node_modules/node-forge/lib/xhr.js +736 -0
  1073. data/js/node_modules/node-forge/package.json +120 -0
  1074. data/js/node_modules/protobufjs/CHANGELOG.md +1027 -0
  1075. data/js/node_modules/protobufjs/LICENSE +39 -0
  1076. data/js/node_modules/protobufjs/README.md +905 -0
  1077. data/js/node_modules/protobufjs/bin/pbjs +6 -0
  1078. data/js/node_modules/protobufjs/bin/pbts +6 -0
  1079. data/js/node_modules/protobufjs/cli/LICENSE +33 -0
  1080. data/js/node_modules/protobufjs/cli/README.md +174 -0
  1081. data/js/node_modules/protobufjs/cli/bin/pbjs +6 -0
  1082. data/js/node_modules/protobufjs/cli/bin/pbts +6 -0
  1083. data/js/node_modules/protobufjs/cli/index.d.ts +3 -0
  1084. data/js/node_modules/protobufjs/cli/index.js +3 -0
  1085. data/js/node_modules/protobufjs/cli/lib/tsd-jsdoc/LICENSE +21 -0
  1086. data/js/node_modules/protobufjs/cli/lib/tsd-jsdoc/README.md +23 -0
  1087. data/js/node_modules/protobufjs/cli/lib/tsd-jsdoc/plugin.js +21 -0
  1088. data/js/node_modules/protobufjs/cli/lib/tsd-jsdoc/publish.js +705 -0
  1089. data/js/node_modules/protobufjs/cli/lib/tsd-jsdoc.json +18 -0
  1090. data/js/node_modules/protobufjs/cli/package.json +8 -0
  1091. data/js/node_modules/protobufjs/cli/package.standalone.json +32 -0
  1092. data/js/node_modules/protobufjs/cli/pbjs.d.ts +9 -0
  1093. data/js/node_modules/protobufjs/cli/pbjs.js +330 -0
  1094. data/js/node_modules/protobufjs/cli/pbts.d.ts +9 -0
  1095. data/js/node_modules/protobufjs/cli/pbts.js +197 -0
  1096. data/js/node_modules/protobufjs/cli/targets/json-module.js +38 -0
  1097. data/js/node_modules/protobufjs/cli/targets/json.js +8 -0
  1098. data/js/node_modules/protobufjs/cli/targets/proto.js +326 -0
  1099. data/js/node_modules/protobufjs/cli/targets/proto2.js +10 -0
  1100. data/js/node_modules/protobufjs/cli/targets/proto3.js +10 -0
  1101. data/js/node_modules/protobufjs/cli/targets/static-module.js +29 -0
  1102. data/js/node_modules/protobufjs/cli/targets/static.js +711 -0
  1103. data/js/node_modules/protobufjs/cli/util.js +183 -0
  1104. data/js/node_modules/protobufjs/cli/wrappers/amd.js +7 -0
  1105. data/js/node_modules/protobufjs/cli/wrappers/closure.js +7 -0
  1106. data/js/node_modules/protobufjs/cli/wrappers/commonjs.js +7 -0
  1107. data/js/node_modules/protobufjs/cli/wrappers/default.js +15 -0
  1108. data/js/node_modules/protobufjs/cli/wrappers/es6.js +5 -0
  1109. data/js/node_modules/protobufjs/dist/README.md +31 -0
  1110. data/js/node_modules/protobufjs/dist/light/README.md +31 -0
  1111. data/js/node_modules/protobufjs/dist/light/protobuf.js +7322 -0
  1112. data/js/node_modules/protobufjs/dist/light/protobuf.js.map +1 -0
  1113. data/js/node_modules/protobufjs/dist/light/protobuf.min.js +8 -0
  1114. data/js/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -0
  1115. data/js/node_modules/protobufjs/dist/minimal/README.md +31 -0
  1116. data/js/node_modules/protobufjs/dist/minimal/protobuf.js +2714 -0
  1117. data/js/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -0
  1118. data/js/node_modules/protobufjs/dist/minimal/protobuf.min.js +8 -0
  1119. data/js/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -0
  1120. data/js/node_modules/protobufjs/dist/protobuf.js +8964 -0
  1121. data/js/node_modules/protobufjs/dist/protobuf.js.map +1 -0
  1122. data/js/node_modules/protobufjs/dist/protobuf.min.js +8 -0
  1123. data/js/node_modules/protobufjs/dist/protobuf.min.js.map +1 -0
  1124. data/js/node_modules/protobufjs/ext/debug/README.md +4 -0
  1125. data/js/node_modules/protobufjs/ext/debug/index.js +71 -0
  1126. data/js/node_modules/protobufjs/ext/descriptor/README.md +72 -0
  1127. data/js/node_modules/protobufjs/ext/descriptor/index.d.ts +191 -0
  1128. data/js/node_modules/protobufjs/ext/descriptor/index.js +1052 -0
  1129. data/js/node_modules/protobufjs/ext/descriptor/test.js +54 -0
  1130. data/js/node_modules/protobufjs/google/LICENSE +27 -0
  1131. data/js/node_modules/protobufjs/google/README.md +1 -0
  1132. data/js/node_modules/protobufjs/google/api/annotations.json +83 -0
  1133. data/js/node_modules/protobufjs/google/api/annotations.proto +11 -0
  1134. data/js/node_modules/protobufjs/google/api/http.json +86 -0
  1135. data/js/node_modules/protobufjs/google/api/http.proto +31 -0
  1136. data/js/node_modules/protobufjs/google/protobuf/api.json +118 -0
  1137. data/js/node_modules/protobufjs/google/protobuf/api.proto +34 -0
  1138. data/js/node_modules/protobufjs/google/protobuf/descriptor.json +739 -0
  1139. data/js/node_modules/protobufjs/google/protobuf/descriptor.proto +286 -0
  1140. data/js/node_modules/protobufjs/google/protobuf/source_context.json +20 -0
  1141. data/js/node_modules/protobufjs/google/protobuf/source_context.proto +7 -0
  1142. data/js/node_modules/protobufjs/google/protobuf/type.json +202 -0
  1143. data/js/node_modules/protobufjs/google/protobuf/type.proto +89 -0
  1144. data/js/node_modules/protobufjs/index.d.ts +2739 -0
  1145. data/js/node_modules/protobufjs/index.js +4 -0
  1146. data/js/node_modules/protobufjs/light.d.ts +2 -0
  1147. data/js/node_modules/protobufjs/light.js +4 -0
  1148. data/js/node_modules/protobufjs/minimal.d.ts +2 -0
  1149. data/js/node_modules/protobufjs/minimal.js +4 -0
  1150. data/js/node_modules/protobufjs/package-lock.json +7870 -0
  1151. data/js/node_modules/protobufjs/package.json +122 -0
  1152. data/js/node_modules/protobufjs/scripts/changelog.js +150 -0
  1153. data/js/node_modules/protobufjs/scripts/postinstall.js +35 -0
  1154. data/js/node_modules/protobufjs/src/common.js +399 -0
  1155. data/js/node_modules/protobufjs/src/converter.js +293 -0
  1156. data/js/node_modules/protobufjs/src/decoder.js +128 -0
  1157. data/js/node_modules/protobufjs/src/encoder.js +100 -0
  1158. data/js/node_modules/protobufjs/src/enum.js +181 -0
  1159. data/js/node_modules/protobufjs/src/field.js +374 -0
  1160. data/js/node_modules/protobufjs/src/index-light.js +104 -0
  1161. data/js/node_modules/protobufjs/src/index-minimal.js +36 -0
  1162. data/js/node_modules/protobufjs/src/index.js +12 -0
  1163. data/js/node_modules/protobufjs/src/mapfield.js +126 -0
  1164. data/js/node_modules/protobufjs/src/message.js +139 -0
  1165. data/js/node_modules/protobufjs/src/method.js +160 -0
  1166. data/js/node_modules/protobufjs/src/namespace.js +434 -0
  1167. data/js/node_modules/protobufjs/src/object.js +243 -0
  1168. data/js/node_modules/protobufjs/src/oneof.js +203 -0
  1169. data/js/node_modules/protobufjs/src/parse.js +820 -0
  1170. data/js/node_modules/protobufjs/src/reader.js +411 -0
  1171. data/js/node_modules/protobufjs/src/reader_buffer.js +51 -0
  1172. data/js/node_modules/protobufjs/src/root.js +363 -0
  1173. data/js/node_modules/protobufjs/src/roots.js +18 -0
  1174. data/js/node_modules/protobufjs/src/rpc/service.js +142 -0
  1175. data/js/node_modules/protobufjs/src/rpc.js +36 -0
  1176. data/js/node_modules/protobufjs/src/service.js +167 -0
  1177. data/js/node_modules/protobufjs/src/tokenize.js +403 -0
  1178. data/js/node_modules/protobufjs/src/type.js +589 -0
  1179. data/js/node_modules/protobufjs/src/types.js +196 -0
  1180. data/js/node_modules/protobufjs/src/typescript.jsdoc +15 -0
  1181. data/js/node_modules/protobufjs/src/util/longbits.js +200 -0
  1182. data/js/node_modules/protobufjs/src/util/minimal.js +421 -0
  1183. data/js/node_modules/protobufjs/src/util.js +212 -0
  1184. data/js/node_modules/protobufjs/src/verifier.js +177 -0
  1185. data/js/node_modules/protobufjs/src/wrappers.js +102 -0
  1186. data/js/node_modules/protobufjs/src/writer.js +465 -0
  1187. data/js/node_modules/protobufjs/src/writer_buffer.js +85 -0
  1188. data/js/node_modules/protobufjs/tsconfig.json +7 -0
  1189. data/js/node_modules/tr46/index.js +193 -0
  1190. data/js/node_modules/tr46/lib/mappingTable.json +1 -0
  1191. data/js/node_modules/tr46/package.json +31 -0
  1192. data/js/node_modules/typed-ts-events/dist/EventEmitter.d.ts +23 -0
  1193. data/js/node_modules/typed-ts-events/dist/events.js +145 -0
  1194. data/js/node_modules/typed-ts-events/dist/events.js.map +1 -0
  1195. data/js/node_modules/typed-ts-events/dist/events.min.js +2 -0
  1196. data/js/node_modules/typed-ts-events/dist/events.min.js.map +1 -0
  1197. data/js/node_modules/typed-ts-events/dist/index.d.ts +3 -0
  1198. data/js/node_modules/typed-ts-events/package.json +64 -0
  1199. data/js/node_modules/typed-ts-events/readme.md +77 -0
  1200. data/js/node_modules/webidl-conversions/LICENSE.md +12 -0
  1201. data/js/node_modules/webidl-conversions/README.md +53 -0
  1202. data/js/node_modules/webidl-conversions/lib/index.js +189 -0
  1203. data/js/node_modules/webidl-conversions/package.json +23 -0
  1204. data/js/node_modules/whatwg-url/LICENSE.txt +21 -0
  1205. data/js/node_modules/whatwg-url/README.md +67 -0
  1206. data/js/node_modules/whatwg-url/lib/URL-impl.js +200 -0
  1207. data/js/node_modules/whatwg-url/lib/URL.js +196 -0
  1208. data/js/node_modules/whatwg-url/lib/public-api.js +11 -0
  1209. data/js/node_modules/whatwg-url/lib/url-state-machine.js +1297 -0
  1210. data/js/node_modules/whatwg-url/lib/utils.js +20 -0
  1211. data/js/node_modules/whatwg-url/package.json +32 -0
  1212. data/js/package-lock.json +706 -0
  1213. data/js/package.json +15 -0
  1214. data/js/worker.js +109 -0
  1215. data/js/yarn.lock +285 -0
  1216. data/lib/waves_lib/map.rb +211 -0
  1217. data/lib/waves_lib/root_wrapper.rb +85 -0
  1218. data/lib/waves_lib/version.rb +6 -0
  1219. data/lib/waves_lib/wrapped_buffer.rb +26 -0
  1220. data/lib/waves_lib/wrapper.rb +82 -0
  1221. data/lib/waves_lib.rb +10 -0
  1222. metadata +1264 -0
@@ -0,0 +1,3977 @@
1
+ /**
2
+ * The `node:crypto` module provides cryptographic functionality that includes a
3
+ * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify
4
+ * functions.
5
+ *
6
+ * ```js
7
+ * const { createHmac } = await import('node:crypto');
8
+ *
9
+ * const secret = 'abcdefg';
10
+ * const hash = createHmac('sha256', secret)
11
+ * .update('I love cupcakes')
12
+ * .digest('hex');
13
+ * console.log(hash);
14
+ * // Prints:
15
+ * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
16
+ * ```
17
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js)
18
+ */
19
+ declare module 'crypto' {
20
+ import * as stream from 'node:stream';
21
+ import { PeerCertificate } from 'node:tls';
22
+ /**
23
+ * SPKAC is a Certificate Signing Request mechanism originally implemented by
24
+ * Netscape and was specified formally as part of HTML5's `keygen` element.
25
+ *
26
+ * `<keygen>` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects
27
+ * should not use this element anymore.
28
+ *
29
+ * The `node:crypto` module provides the `Certificate` class for working with SPKAC
30
+ * data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
31
+ * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally.
32
+ * @since v0.11.8
33
+ */
34
+ class Certificate {
35
+ /**
36
+ * ```js
37
+ * const { Certificate } = await import('node:crypto');
38
+ * const spkac = getSpkacSomehow();
39
+ * const challenge = Certificate.exportChallenge(spkac);
40
+ * console.log(challenge.toString('utf8'));
41
+ * // Prints: the challenge as a UTF8 string
42
+ * ```
43
+ * @since v9.0.0
44
+ * @param encoding The `encoding` of the `spkac` string.
45
+ * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
46
+ */
47
+ static exportChallenge(spkac: BinaryLike): Buffer;
48
+ /**
49
+ * ```js
50
+ * const { Certificate } = await import('node:crypto');
51
+ * const spkac = getSpkacSomehow();
52
+ * const publicKey = Certificate.exportPublicKey(spkac);
53
+ * console.log(publicKey);
54
+ * // Prints: the public key as <Buffer ...>
55
+ * ```
56
+ * @since v9.0.0
57
+ * @param encoding The `encoding` of the `spkac` string.
58
+ * @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
59
+ */
60
+ static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
61
+ /**
62
+ * ```js
63
+ * import { Buffer } from 'node:buffer';
64
+ * const { Certificate } = await import('node:crypto');
65
+ *
66
+ * const spkac = getSpkacSomehow();
67
+ * console.log(Certificate.verifySpkac(Buffer.from(spkac)));
68
+ * // Prints: true or false
69
+ * ```
70
+ * @since v9.0.0
71
+ * @param encoding The `encoding` of the `spkac` string.
72
+ * @return `true` if the given `spkac` data structure is valid, `false` otherwise.
73
+ */
74
+ static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
75
+ /**
76
+ * @deprecated
77
+ * @param spkac
78
+ * @returns The challenge component of the `spkac` data structure,
79
+ * which includes a public key and a challenge.
80
+ */
81
+ exportChallenge(spkac: BinaryLike): Buffer;
82
+ /**
83
+ * @deprecated
84
+ * @param spkac
85
+ * @param encoding The encoding of the spkac string.
86
+ * @returns The public key component of the `spkac` data structure,
87
+ * which includes a public key and a challenge.
88
+ */
89
+ exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
90
+ /**
91
+ * @deprecated
92
+ * @param spkac
93
+ * @returns `true` if the given `spkac` data structure is valid,
94
+ * `false` otherwise.
95
+ */
96
+ verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
97
+ }
98
+ namespace constants {
99
+ // https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants
100
+ const OPENSSL_VERSION_NUMBER: number;
101
+ /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
102
+ const SSL_OP_ALL: number;
103
+ /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
104
+ const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
105
+ /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
106
+ const SSL_OP_CIPHER_SERVER_PREFERENCE: number;
107
+ /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */
108
+ const SSL_OP_CISCO_ANYCONNECT: number;
109
+ /** Instructs OpenSSL to turn on cookie exchange. */
110
+ const SSL_OP_COOKIE_EXCHANGE: number;
111
+ /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */
112
+ const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
113
+ /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */
114
+ const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
115
+ /** Allows initial connection to servers that do not support RI. */
116
+ const SSL_OP_LEGACY_SERVER_CONNECT: number;
117
+ /** Instructs OpenSSL to disable support for SSL/TLS compression. */
118
+ const SSL_OP_NO_COMPRESSION: number;
119
+ const SSL_OP_NO_QUERY_MTU: number;
120
+ /** Instructs OpenSSL to always start a new session when performing renegotiation. */
121
+ const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
122
+ const SSL_OP_NO_SSLv2: number;
123
+ const SSL_OP_NO_SSLv3: number;
124
+ const SSL_OP_NO_TICKET: number;
125
+ const SSL_OP_NO_TLSv1: number;
126
+ const SSL_OP_NO_TLSv1_1: number;
127
+ const SSL_OP_NO_TLSv1_2: number;
128
+ /** Instructs OpenSSL to disable version rollback attack detection. */
129
+ const SSL_OP_TLS_ROLLBACK_BUG: number;
130
+ const ENGINE_METHOD_RSA: number;
131
+ const ENGINE_METHOD_DSA: number;
132
+ const ENGINE_METHOD_DH: number;
133
+ const ENGINE_METHOD_RAND: number;
134
+ const ENGINE_METHOD_EC: number;
135
+ const ENGINE_METHOD_CIPHERS: number;
136
+ const ENGINE_METHOD_DIGESTS: number;
137
+ const ENGINE_METHOD_PKEY_METHS: number;
138
+ const ENGINE_METHOD_PKEY_ASN1_METHS: number;
139
+ const ENGINE_METHOD_ALL: number;
140
+ const ENGINE_METHOD_NONE: number;
141
+ const DH_CHECK_P_NOT_SAFE_PRIME: number;
142
+ const DH_CHECK_P_NOT_PRIME: number;
143
+ const DH_UNABLE_TO_CHECK_GENERATOR: number;
144
+ const DH_NOT_SUITABLE_GENERATOR: number;
145
+ const RSA_PKCS1_PADDING: number;
146
+ const RSA_SSLV23_PADDING: number;
147
+ const RSA_NO_PADDING: number;
148
+ const RSA_PKCS1_OAEP_PADDING: number;
149
+ const RSA_X931_PADDING: number;
150
+ const RSA_PKCS1_PSS_PADDING: number;
151
+ /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */
152
+ const RSA_PSS_SALTLEN_DIGEST: number;
153
+ /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */
154
+ const RSA_PSS_SALTLEN_MAX_SIGN: number;
155
+ /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */
156
+ const RSA_PSS_SALTLEN_AUTO: number;
157
+ const POINT_CONVERSION_COMPRESSED: number;
158
+ const POINT_CONVERSION_UNCOMPRESSED: number;
159
+ const POINT_CONVERSION_HYBRID: number;
160
+ /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */
161
+ const defaultCoreCipherList: string;
162
+ /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */
163
+ const defaultCipherList: string;
164
+ }
165
+ interface HashOptions extends stream.TransformOptions {
166
+ /**
167
+ * For XOF hash functions such as `shake256`, the
168
+ * outputLength option can be used to specify the desired output length in bytes.
169
+ */
170
+ outputLength?: number | undefined;
171
+ }
172
+ /** @deprecated since v10.0.0 */
173
+ const fips: boolean;
174
+ /**
175
+ * Creates and returns a `Hash` object that can be used to generate hash digests
176
+ * using the given `algorithm`. Optional `options` argument controls stream
177
+ * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option
178
+ * can be used to specify the desired output length in bytes.
179
+ *
180
+ * The `algorithm` is dependent on the available algorithms supported by the
181
+ * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
182
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms` will
183
+ * display the available digest algorithms.
184
+ *
185
+ * Example: generating the sha256 sum of a file
186
+ *
187
+ * ```js
188
+ * import {
189
+ * createReadStream,
190
+ * } from 'node:fs';
191
+ * import { argv } from 'node:process';
192
+ * const {
193
+ * createHash,
194
+ * } = await import('node:crypto');
195
+ *
196
+ * const filename = argv[2];
197
+ *
198
+ * const hash = createHash('sha256');
199
+ *
200
+ * const input = createReadStream(filename);
201
+ * input.on('readable', () => {
202
+ * // Only one element is going to be produced by the
203
+ * // hash stream.
204
+ * const data = input.read();
205
+ * if (data)
206
+ * hash.update(data);
207
+ * else {
208
+ * console.log(`${hash.digest('hex')} ${filename}`);
209
+ * }
210
+ * });
211
+ * ```
212
+ * @since v0.1.92
213
+ * @param options `stream.transform` options
214
+ */
215
+ function createHash(algorithm: string, options?: HashOptions): Hash;
216
+ /**
217
+ * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`.
218
+ * Optional `options` argument controls stream behavior.
219
+ *
220
+ * The `algorithm` is dependent on the available algorithms supported by the
221
+ * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
222
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms` will
223
+ * display the available digest algorithms.
224
+ *
225
+ * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
226
+ * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was
227
+ * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not
228
+ * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256).
229
+ *
230
+ * Example: generating the sha256 HMAC of a file
231
+ *
232
+ * ```js
233
+ * import {
234
+ * createReadStream,
235
+ * } from 'node:fs';
236
+ * import { argv } from 'node:process';
237
+ * const {
238
+ * createHmac,
239
+ * } = await import('node:crypto');
240
+ *
241
+ * const filename = argv[2];
242
+ *
243
+ * const hmac = createHmac('sha256', 'a secret');
244
+ *
245
+ * const input = createReadStream(filename);
246
+ * input.on('readable', () => {
247
+ * // Only one element is going to be produced by the
248
+ * // hash stream.
249
+ * const data = input.read();
250
+ * if (data)
251
+ * hmac.update(data);
252
+ * else {
253
+ * console.log(`${hmac.digest('hex')} ${filename}`);
254
+ * }
255
+ * });
256
+ * ```
257
+ * @since v0.1.94
258
+ * @param options `stream.transform` options
259
+ */
260
+ function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
261
+ // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
262
+ type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary';
263
+ type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
264
+ type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
265
+ type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
266
+ type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
267
+ /**
268
+ * The `Hash` class is a utility for creating hash digests of data. It can be
269
+ * used in one of two ways:
270
+ *
271
+ * * As a `stream` that is both readable and writable, where data is written
272
+ * to produce a computed hash digest on the readable side, or
273
+ * * Using the `hash.update()` and `hash.digest()` methods to produce the
274
+ * computed hash.
275
+ *
276
+ * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword.
277
+ *
278
+ * Example: Using `Hash` objects as streams:
279
+ *
280
+ * ```js
281
+ * const {
282
+ * createHash,
283
+ * } = await import('node:crypto');
284
+ *
285
+ * const hash = createHash('sha256');
286
+ *
287
+ * hash.on('readable', () => {
288
+ * // Only one element is going to be produced by the
289
+ * // hash stream.
290
+ * const data = hash.read();
291
+ * if (data) {
292
+ * console.log(data.toString('hex'));
293
+ * // Prints:
294
+ * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
295
+ * }
296
+ * });
297
+ *
298
+ * hash.write('some data to hash');
299
+ * hash.end();
300
+ * ```
301
+ *
302
+ * Example: Using `Hash` and piped streams:
303
+ *
304
+ * ```js
305
+ * import { createReadStream } from 'node:fs';
306
+ * import { stdout } from 'node:process';
307
+ * const { createHash } = await import('node:crypto');
308
+ *
309
+ * const hash = createHash('sha256');
310
+ *
311
+ * const input = createReadStream('test.js');
312
+ * input.pipe(hash).setEncoding('hex').pipe(stdout);
313
+ * ```
314
+ *
315
+ * Example: Using the `hash.update()` and `hash.digest()` methods:
316
+ *
317
+ * ```js
318
+ * const {
319
+ * createHash,
320
+ * } = await import('node:crypto');
321
+ *
322
+ * const hash = createHash('sha256');
323
+ *
324
+ * hash.update('some data to hash');
325
+ * console.log(hash.digest('hex'));
326
+ * // Prints:
327
+ * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
328
+ * ```
329
+ * @since v0.1.92
330
+ */
331
+ class Hash extends stream.Transform {
332
+ private constructor();
333
+ /**
334
+ * Creates a new `Hash` object that contains a deep copy of the internal state
335
+ * of the current `Hash` object.
336
+ *
337
+ * The optional `options` argument controls stream behavior. For XOF hash
338
+ * functions such as `'shake256'`, the `outputLength` option can be used to
339
+ * specify the desired output length in bytes.
340
+ *
341
+ * An error is thrown when an attempt is made to copy the `Hash` object after
342
+ * its `hash.digest()` method has been called.
343
+ *
344
+ * ```js
345
+ * // Calculate a rolling hash.
346
+ * const {
347
+ * createHash,
348
+ * } = await import('node:crypto');
349
+ *
350
+ * const hash = createHash('sha256');
351
+ *
352
+ * hash.update('one');
353
+ * console.log(hash.copy().digest('hex'));
354
+ *
355
+ * hash.update('two');
356
+ * console.log(hash.copy().digest('hex'));
357
+ *
358
+ * hash.update('three');
359
+ * console.log(hash.copy().digest('hex'));
360
+ *
361
+ * // Etc.
362
+ * ```
363
+ * @since v13.1.0
364
+ * @param options `stream.transform` options
365
+ */
366
+ copy(options?: stream.TransformOptions): Hash;
367
+ /**
368
+ * Updates the hash content with the given `data`, the encoding of which
369
+ * is given in `inputEncoding`.
370
+ * If `encoding` is not provided, and the `data` is a string, an
371
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
372
+ *
373
+ * This can be called many times with new data as it is streamed.
374
+ * @since v0.1.92
375
+ * @param inputEncoding The `encoding` of the `data` string.
376
+ */
377
+ update(data: BinaryLike): Hash;
378
+ update(data: string, inputEncoding: Encoding): Hash;
379
+ /**
380
+ * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method).
381
+ * If `encoding` is provided a string will be returned; otherwise
382
+ * a `Buffer` is returned.
383
+ *
384
+ * The `Hash` object can not be used again after `hash.digest()` method has been
385
+ * called. Multiple calls will cause an error to be thrown.
386
+ * @since v0.1.92
387
+ * @param encoding The `encoding` of the return value.
388
+ */
389
+ digest(): Buffer;
390
+ digest(encoding: BinaryToTextEncoding): string;
391
+ }
392
+ /**
393
+ * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can
394
+ * be used in one of two ways:
395
+ *
396
+ * * As a `stream` that is both readable and writable, where data is written
397
+ * to produce a computed HMAC digest on the readable side, or
398
+ * * Using the `hmac.update()` and `hmac.digest()` methods to produce the
399
+ * computed HMAC digest.
400
+ *
401
+ * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword.
402
+ *
403
+ * Example: Using `Hmac` objects as streams:
404
+ *
405
+ * ```js
406
+ * const {
407
+ * createHmac,
408
+ * } = await import('node:crypto');
409
+ *
410
+ * const hmac = createHmac('sha256', 'a secret');
411
+ *
412
+ * hmac.on('readable', () => {
413
+ * // Only one element is going to be produced by the
414
+ * // hash stream.
415
+ * const data = hmac.read();
416
+ * if (data) {
417
+ * console.log(data.toString('hex'));
418
+ * // Prints:
419
+ * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
420
+ * }
421
+ * });
422
+ *
423
+ * hmac.write('some data to hash');
424
+ * hmac.end();
425
+ * ```
426
+ *
427
+ * Example: Using `Hmac` and piped streams:
428
+ *
429
+ * ```js
430
+ * import { createReadStream } from 'node:fs';
431
+ * import { stdout } from 'node:process';
432
+ * const {
433
+ * createHmac,
434
+ * } = await import('node:crypto');
435
+ *
436
+ * const hmac = createHmac('sha256', 'a secret');
437
+ *
438
+ * const input = createReadStream('test.js');
439
+ * input.pipe(hmac).pipe(stdout);
440
+ * ```
441
+ *
442
+ * Example: Using the `hmac.update()` and `hmac.digest()` methods:
443
+ *
444
+ * ```js
445
+ * const {
446
+ * createHmac,
447
+ * } = await import('node:crypto');
448
+ *
449
+ * const hmac = createHmac('sha256', 'a secret');
450
+ *
451
+ * hmac.update('some data to hash');
452
+ * console.log(hmac.digest('hex'));
453
+ * // Prints:
454
+ * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
455
+ * ```
456
+ * @since v0.1.94
457
+ */
458
+ class Hmac extends stream.Transform {
459
+ private constructor();
460
+ /**
461
+ * Updates the `Hmac` content with the given `data`, the encoding of which
462
+ * is given in `inputEncoding`.
463
+ * If `encoding` is not provided, and the `data` is a string, an
464
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
465
+ *
466
+ * This can be called many times with new data as it is streamed.
467
+ * @since v0.1.94
468
+ * @param inputEncoding The `encoding` of the `data` string.
469
+ */
470
+ update(data: BinaryLike): Hmac;
471
+ update(data: string, inputEncoding: Encoding): Hmac;
472
+ /**
473
+ * Calculates the HMAC digest of all of the data passed using `hmac.update()`.
474
+ * If `encoding` is
475
+ * provided a string is returned; otherwise a `Buffer` is returned;
476
+ *
477
+ * The `Hmac` object can not be used again after `hmac.digest()` has been
478
+ * called. Multiple calls to `hmac.digest()` will result in an error being thrown.
479
+ * @since v0.1.94
480
+ * @param encoding The `encoding` of the return value.
481
+ */
482
+ digest(): Buffer;
483
+ digest(encoding: BinaryToTextEncoding): string;
484
+ }
485
+ type KeyObjectType = 'secret' | 'public' | 'private';
486
+ interface KeyExportOptions<T extends KeyFormat> {
487
+ type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
488
+ format: T;
489
+ cipher?: string | undefined;
490
+ passphrase?: string | Buffer | undefined;
491
+ }
492
+ interface JwkKeyExportOptions {
493
+ format: 'jwk';
494
+ }
495
+ interface JsonWebKey {
496
+ crv?: string | undefined;
497
+ d?: string | undefined;
498
+ dp?: string | undefined;
499
+ dq?: string | undefined;
500
+ e?: string | undefined;
501
+ k?: string | undefined;
502
+ kty?: string | undefined;
503
+ n?: string | undefined;
504
+ p?: string | undefined;
505
+ q?: string | undefined;
506
+ qi?: string | undefined;
507
+ x?: string | undefined;
508
+ y?: string | undefined;
509
+ [key: string]: unknown;
510
+ }
511
+ interface AsymmetricKeyDetails {
512
+ /**
513
+ * Key size in bits (RSA, DSA).
514
+ */
515
+ modulusLength?: number | undefined;
516
+ /**
517
+ * Public exponent (RSA).
518
+ */
519
+ publicExponent?: bigint | undefined;
520
+ /**
521
+ * Name of the message digest (RSA-PSS).
522
+ */
523
+ hashAlgorithm?: string | undefined;
524
+ /**
525
+ * Name of the message digest used by MGF1 (RSA-PSS).
526
+ */
527
+ mgf1HashAlgorithm?: string | undefined;
528
+ /**
529
+ * Minimal salt length in bytes (RSA-PSS).
530
+ */
531
+ saltLength?: number | undefined;
532
+ /**
533
+ * Size of q in bits (DSA).
534
+ */
535
+ divisorLength?: number | undefined;
536
+ /**
537
+ * Name of the curve (EC).
538
+ */
539
+ namedCurve?: string | undefined;
540
+ }
541
+ /**
542
+ * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
543
+ * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject`
544
+ * objects are not to be created directly using the `new`keyword.
545
+ *
546
+ * Most applications should consider using the new `KeyObject` API instead of
547
+ * passing keys as strings or `Buffer`s due to improved security features.
548
+ *
549
+ * `KeyObject` instances can be passed to other threads via `postMessage()`.
550
+ * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to
551
+ * be listed in the `transferList` argument.
552
+ * @since v11.6.0
553
+ */
554
+ class KeyObject {
555
+ private constructor();
556
+ /**
557
+ * Example: Converting a `CryptoKey` instance to a `KeyObject`:
558
+ *
559
+ * ```js
560
+ * const { KeyObject } = await import('node:crypto');
561
+ * const { subtle } = globalThis.crypto;
562
+ *
563
+ * const key = await subtle.generateKey({
564
+ * name: 'HMAC',
565
+ * hash: 'SHA-256',
566
+ * length: 256,
567
+ * }, true, ['sign', 'verify']);
568
+ *
569
+ * const keyObject = KeyObject.from(key);
570
+ * console.log(keyObject.symmetricKeySize);
571
+ * // Prints: 32 (symmetric key size in bytes)
572
+ * ```
573
+ * @since v15.0.0
574
+ */
575
+ static from(key: webcrypto.CryptoKey): KeyObject;
576
+ /**
577
+ * For asymmetric keys, this property represents the type of the key. Supported key
578
+ * types are:
579
+ *
580
+ * * `'rsa'` (OID 1.2.840.113549.1.1.1)
581
+ * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10)
582
+ * * `'dsa'` (OID 1.2.840.10040.4.1)
583
+ * * `'ec'` (OID 1.2.840.10045.2.1)
584
+ * * `'x25519'` (OID 1.3.101.110)
585
+ * * `'x448'` (OID 1.3.101.111)
586
+ * * `'ed25519'` (OID 1.3.101.112)
587
+ * * `'ed448'` (OID 1.3.101.113)
588
+ * * `'dh'` (OID 1.2.840.113549.1.3.1)
589
+ *
590
+ * This property is `undefined` for unrecognized `KeyObject` types and symmetric
591
+ * keys.
592
+ * @since v11.6.0
593
+ */
594
+ asymmetricKeyType?: KeyType | undefined;
595
+ /**
596
+ * For asymmetric keys, this property represents the size of the embedded key in
597
+ * bytes. This property is `undefined` for symmetric keys.
598
+ */
599
+ asymmetricKeySize?: number | undefined;
600
+ /**
601
+ * This property exists only on asymmetric keys. Depending on the type of the key,
602
+ * this object contains information about the key. None of the information obtained
603
+ * through this property can be used to uniquely identify a key or to compromise
604
+ * the security of the key.
605
+ *
606
+ * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence,
607
+ * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be
608
+ * set.
609
+ *
610
+ * Other key details might be exposed via this API using additional attributes.
611
+ * @since v15.7.0
612
+ */
613
+ asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
614
+ /**
615
+ * For symmetric keys, the following encoding options can be used:
616
+ *
617
+ * For public keys, the following encoding options can be used:
618
+ *
619
+ * For private keys, the following encoding options can be used:
620
+ *
621
+ * The result type depends on the selected encoding format, when PEM the
622
+ * result is a string, when DER it will be a buffer containing the data
623
+ * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object.
624
+ *
625
+ * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are
626
+ * ignored.
627
+ *
628
+ * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of
629
+ * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be
630
+ * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for
631
+ * encrypted private keys. Since PKCS#8 defines its own
632
+ * encryption mechanism, PEM-level encryption is not supported when encrypting
633
+ * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for
634
+ * PKCS#1 and SEC1 encryption.
635
+ * @since v11.6.0
636
+ */
637
+ export(options: KeyExportOptions<'pem'>): string | Buffer;
638
+ export(options?: KeyExportOptions<'der'>): Buffer;
639
+ export(options?: JwkKeyExportOptions): JsonWebKey;
640
+ /**
641
+ * For secret keys, this property represents the size of the key in bytes. This
642
+ * property is `undefined` for asymmetric keys.
643
+ * @since v11.6.0
644
+ */
645
+ symmetricKeySize?: number | undefined;
646
+ /**
647
+ * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys
648
+ * or `'private'` for private (asymmetric) keys.
649
+ * @since v11.6.0
650
+ */
651
+ type: KeyObjectType;
652
+ }
653
+ type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305';
654
+ type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
655
+ type CipherOCBTypes = 'aes-128-ocb' | 'aes-192-ocb' | 'aes-256-ocb';
656
+ type BinaryLike = string | NodeJS.ArrayBufferView;
657
+ type CipherKey = BinaryLike | KeyObject;
658
+ interface CipherCCMOptions extends stream.TransformOptions {
659
+ authTagLength: number;
660
+ }
661
+ interface CipherGCMOptions extends stream.TransformOptions {
662
+ authTagLength?: number | undefined;
663
+ }
664
+ interface CipherOCBOptions extends stream.TransformOptions {
665
+ authTagLength: number;
666
+ }
667
+ /**
668
+ * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
669
+ *
670
+ * The `options` argument controls stream behavior and is optional except when a
671
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
672
+ * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
673
+ * tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
674
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
675
+ *
676
+ * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
677
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
678
+ * display the available cipher algorithms.
679
+ *
680
+ * The `password` is used to derive the cipher key and initialization vector (IV).
681
+ * The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`.
682
+ *
683
+ * **This function is semantically insecure for all**
684
+ * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,**
685
+ * **GCM, or CCM).**
686
+ *
687
+ * The implementation of `crypto.createCipher()` derives keys using the OpenSSL
688
+ * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
689
+ * iteration, and no salt. The lack of salt allows dictionary attacks as the same
690
+ * password always creates the same key. The low iteration count and
691
+ * non-cryptographically secure hash algorithm allow passwords to be tested very
692
+ * rapidly.
693
+ *
694
+ * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that
695
+ * developers derive a key and IV on
696
+ * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode
697
+ * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when
698
+ * they are used in order to avoid the risk of IV reuse that causes
699
+ * vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details.
700
+ * @since v0.1.94
701
+ * @deprecated Since v10.0.0 - Use {@link createCipheriv} instead.
702
+ * @param options `stream.transform` options
703
+ */
704
+ function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM;
705
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
706
+ function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM;
707
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
708
+ function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher;
709
+ /**
710
+ * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
711
+ * initialization vector (`iv`).
712
+ *
713
+ * The `options` argument controls stream behavior and is optional except when a
714
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
715
+ * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
716
+ * tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
717
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
718
+ *
719
+ * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
720
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
721
+ * display the available cipher algorithms.
722
+ *
723
+ * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
724
+ * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be
725
+ * a `KeyObject` of type `secret`. If the cipher does not need
726
+ * an initialization vector, `iv` may be `null`.
727
+ *
728
+ * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`.
729
+ *
730
+ * Initialization vectors should be unpredictable and unique; ideally, they will be
731
+ * cryptographically random. They do not have to be secret: IVs are typically just
732
+ * added to ciphertext messages unencrypted. It may sound contradictory that
733
+ * something has to be unpredictable and unique, but does not have to be secret;
734
+ * remember that an attacker must not be able to predict ahead of time what a
735
+ * given IV will be.
736
+ * @since v0.1.94
737
+ * @param options `stream.transform` options
738
+ */
739
+ function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM;
740
+ function createCipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB;
741
+ function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM;
742
+ function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher;
743
+ /**
744
+ * Instances of the `Cipher` class are used to encrypt data. The class can be
745
+ * used in one of two ways:
746
+ *
747
+ * * As a `stream` that is both readable and writable, where plain unencrypted
748
+ * data is written to produce encrypted data on the readable side, or
749
+ * * Using the `cipher.update()` and `cipher.final()` methods to produce
750
+ * the encrypted data.
751
+ *
752
+ * The {@link createCipher} or {@link createCipheriv} methods are
753
+ * used to create `Cipher` instances. `Cipher` objects are not to be created
754
+ * directly using the `new` keyword.
755
+ *
756
+ * Example: Using `Cipher` objects as streams:
757
+ *
758
+ * ```js
759
+ * const {
760
+ * scrypt,
761
+ * randomFill,
762
+ * createCipheriv,
763
+ * } = await import('node:crypto');
764
+ *
765
+ * const algorithm = 'aes-192-cbc';
766
+ * const password = 'Password used to generate key';
767
+ *
768
+ * // First, we'll generate the key. The key length is dependent on the algorithm.
769
+ * // In this case for aes192, it is 24 bytes (192 bits).
770
+ * scrypt(password, 'salt', 24, (err, key) => {
771
+ * if (err) throw err;
772
+ * // Then, we'll generate a random initialization vector
773
+ * randomFill(new Uint8Array(16), (err, iv) => {
774
+ * if (err) throw err;
775
+ *
776
+ * // Once we have the key and iv, we can create and use the cipher...
777
+ * const cipher = createCipheriv(algorithm, key, iv);
778
+ *
779
+ * let encrypted = '';
780
+ * cipher.setEncoding('hex');
781
+ *
782
+ * cipher.on('data', (chunk) => encrypted += chunk);
783
+ * cipher.on('end', () => console.log(encrypted));
784
+ *
785
+ * cipher.write('some clear text data');
786
+ * cipher.end();
787
+ * });
788
+ * });
789
+ * ```
790
+ *
791
+ * Example: Using `Cipher` and piped streams:
792
+ *
793
+ * ```js
794
+ * import {
795
+ * createReadStream,
796
+ * createWriteStream,
797
+ * } from 'node:fs';
798
+ *
799
+ * import {
800
+ * pipeline,
801
+ * } from 'node:stream';
802
+ *
803
+ * const {
804
+ * scrypt,
805
+ * randomFill,
806
+ * createCipheriv,
807
+ * } = await import('node:crypto');
808
+ *
809
+ * const algorithm = 'aes-192-cbc';
810
+ * const password = 'Password used to generate key';
811
+ *
812
+ * // First, we'll generate the key. The key length is dependent on the algorithm.
813
+ * // In this case for aes192, it is 24 bytes (192 bits).
814
+ * scrypt(password, 'salt', 24, (err, key) => {
815
+ * if (err) throw err;
816
+ * // Then, we'll generate a random initialization vector
817
+ * randomFill(new Uint8Array(16), (err, iv) => {
818
+ * if (err) throw err;
819
+ *
820
+ * const cipher = createCipheriv(algorithm, key, iv);
821
+ *
822
+ * const input = createReadStream('test.js');
823
+ * const output = createWriteStream('test.enc');
824
+ *
825
+ * pipeline(input, cipher, output, (err) => {
826
+ * if (err) throw err;
827
+ * });
828
+ * });
829
+ * });
830
+ * ```
831
+ *
832
+ * Example: Using the `cipher.update()` and `cipher.final()` methods:
833
+ *
834
+ * ```js
835
+ * const {
836
+ * scrypt,
837
+ * randomFill,
838
+ * createCipheriv,
839
+ * } = await import('node:crypto');
840
+ *
841
+ * const algorithm = 'aes-192-cbc';
842
+ * const password = 'Password used to generate key';
843
+ *
844
+ * // First, we'll generate the key. The key length is dependent on the algorithm.
845
+ * // In this case for aes192, it is 24 bytes (192 bits).
846
+ * scrypt(password, 'salt', 24, (err, key) => {
847
+ * if (err) throw err;
848
+ * // Then, we'll generate a random initialization vector
849
+ * randomFill(new Uint8Array(16), (err, iv) => {
850
+ * if (err) throw err;
851
+ *
852
+ * const cipher = createCipheriv(algorithm, key, iv);
853
+ *
854
+ * let encrypted = cipher.update('some clear text data', 'utf8', 'hex');
855
+ * encrypted += cipher.final('hex');
856
+ * console.log(encrypted);
857
+ * });
858
+ * });
859
+ * ```
860
+ * @since v0.1.94
861
+ */
862
+ class Cipher extends stream.Transform {
863
+ private constructor();
864
+ /**
865
+ * Updates the cipher with `data`. If the `inputEncoding` argument is given,
866
+ * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or`DataView`. If `data` is a `Buffer`,
867
+ * `TypedArray`, or `DataView`, then`inputEncoding` is ignored.
868
+ *
869
+ * The `outputEncoding` specifies the output format of the enciphered
870
+ * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned.
871
+ *
872
+ * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being
873
+ * thrown.
874
+ * @since v0.1.94
875
+ * @param inputEncoding The `encoding` of the data.
876
+ * @param outputEncoding The `encoding` of the return value.
877
+ */
878
+ update(data: BinaryLike): Buffer;
879
+ update(data: string, inputEncoding: Encoding): Buffer;
880
+ update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
881
+ update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
882
+ /**
883
+ * Once the `cipher.final()` method has been called, the `Cipher` object can no
884
+ * longer be used to encrypt data. Attempts to call `cipher.final()` more than
885
+ * once will result in an error being thrown.
886
+ * @since v0.1.94
887
+ * @param outputEncoding The `encoding` of the return value.
888
+ * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
889
+ */
890
+ final(): Buffer;
891
+ final(outputEncoding: BufferEncoding): string;
892
+ /**
893
+ * When using block encryption algorithms, the `Cipher` class will automatically
894
+ * add padding to the input data to the appropriate block size. To disable the
895
+ * default padding call `cipher.setAutoPadding(false)`.
896
+ *
897
+ * When `autoPadding` is `false`, the length of the entire input data must be a
898
+ * multiple of the cipher's block size or `cipher.final()` will throw an error.
899
+ * Disabling automatic padding is useful for non-standard padding, for instance
900
+ * using `0x0` instead of PKCS padding.
901
+ *
902
+ * The `cipher.setAutoPadding()` method must be called before `cipher.final()`.
903
+ * @since v0.7.1
904
+ * @param [autoPadding=true]
905
+ * @return for method chaining.
906
+ */
907
+ setAutoPadding(autoPadding?: boolean): this;
908
+ }
909
+ interface CipherCCM extends Cipher {
910
+ setAAD(
911
+ buffer: NodeJS.ArrayBufferView,
912
+ options: {
913
+ plaintextLength: number;
914
+ }
915
+ ): this;
916
+ getAuthTag(): Buffer;
917
+ }
918
+ interface CipherGCM extends Cipher {
919
+ setAAD(
920
+ buffer: NodeJS.ArrayBufferView,
921
+ options?: {
922
+ plaintextLength: number;
923
+ }
924
+ ): this;
925
+ getAuthTag(): Buffer;
926
+ }
927
+ interface CipherOCB extends Cipher {
928
+ setAAD(
929
+ buffer: NodeJS.ArrayBufferView,
930
+ options?: {
931
+ plaintextLength: number;
932
+ }
933
+ ): this;
934
+ getAuthTag(): Buffer;
935
+ }
936
+ /**
937
+ * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
938
+ *
939
+ * The `options` argument controls stream behavior and is optional except when a
940
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
941
+ * authentication tag in bytes, see `CCM mode`.
942
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
943
+ *
944
+ * **This function is semantically insecure for all**
945
+ * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,**
946
+ * **GCM, or CCM).**
947
+ *
948
+ * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
949
+ * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
950
+ * iteration, and no salt. The lack of salt allows dictionary attacks as the same
951
+ * password always creates the same key. The low iteration count and
952
+ * non-cryptographically secure hash algorithm allow passwords to be tested very
953
+ * rapidly.
954
+ *
955
+ * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that
956
+ * developers derive a key and IV on
957
+ * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object.
958
+ * @since v0.1.94
959
+ * @deprecated Since v10.0.0 - Use {@link createDecipheriv} instead.
960
+ * @param options `stream.transform` options
961
+ */
962
+ function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM;
963
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
964
+ function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
965
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
966
+ function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher;
967
+ /**
968
+ * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
969
+ *
970
+ * The `options` argument controls stream behavior and is optional except when a
971
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
972
+ * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags
973
+ * to those with the specified length.
974
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
975
+ *
976
+ * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
977
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
978
+ * display the available cipher algorithms.
979
+ *
980
+ * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
981
+ * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be
982
+ * a `KeyObject` of type `secret`. If the cipher does not need
983
+ * an initialization vector, `iv` may be `null`.
984
+ *
985
+ * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`.
986
+ *
987
+ * Initialization vectors should be unpredictable and unique; ideally, they will be
988
+ * cryptographically random. They do not have to be secret: IVs are typically just
989
+ * added to ciphertext messages unencrypted. It may sound contradictory that
990
+ * something has to be unpredictable and unique, but does not have to be secret;
991
+ * remember that an attacker must not be able to predict ahead of time what a given
992
+ * IV will be.
993
+ * @since v0.1.94
994
+ * @param options `stream.transform` options
995
+ */
996
+ function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM;
997
+ function createDecipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB;
998
+ function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
999
+ function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
1000
+ /**
1001
+ * Instances of the `Decipher` class are used to decrypt data. The class can be
1002
+ * used in one of two ways:
1003
+ *
1004
+ * * As a `stream` that is both readable and writable, where plain encrypted
1005
+ * data is written to produce unencrypted data on the readable side, or
1006
+ * * Using the `decipher.update()` and `decipher.final()` methods to
1007
+ * produce the unencrypted data.
1008
+ *
1009
+ * The {@link createDecipher} or {@link createDecipheriv} methods are
1010
+ * used to create `Decipher` instances. `Decipher` objects are not to be created
1011
+ * directly using the `new` keyword.
1012
+ *
1013
+ * Example: Using `Decipher` objects as streams:
1014
+ *
1015
+ * ```js
1016
+ * import { Buffer } from 'node:buffer';
1017
+ * const {
1018
+ * scryptSync,
1019
+ * createDecipheriv,
1020
+ * } = await import('node:crypto');
1021
+ *
1022
+ * const algorithm = 'aes-192-cbc';
1023
+ * const password = 'Password used to generate key';
1024
+ * // Key length is dependent on the algorithm. In this case for aes192, it is
1025
+ * // 24 bytes (192 bits).
1026
+ * // Use the async `crypto.scrypt()` instead.
1027
+ * const key = scryptSync(password, 'salt', 24);
1028
+ * // The IV is usually passed along with the ciphertext.
1029
+ * const iv = Buffer.alloc(16, 0); // Initialization vector.
1030
+ *
1031
+ * const decipher = createDecipheriv(algorithm, key, iv);
1032
+ *
1033
+ * let decrypted = '';
1034
+ * decipher.on('readable', () => {
1035
+ * let chunk;
1036
+ * while (null !== (chunk = decipher.read())) {
1037
+ * decrypted += chunk.toString('utf8');
1038
+ * }
1039
+ * });
1040
+ * decipher.on('end', () => {
1041
+ * console.log(decrypted);
1042
+ * // Prints: some clear text data
1043
+ * });
1044
+ *
1045
+ * // Encrypted with same algorithm, key and iv.
1046
+ * const encrypted =
1047
+ * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa';
1048
+ * decipher.write(encrypted, 'hex');
1049
+ * decipher.end();
1050
+ * ```
1051
+ *
1052
+ * Example: Using `Decipher` and piped streams:
1053
+ *
1054
+ * ```js
1055
+ * import {
1056
+ * createReadStream,
1057
+ * createWriteStream,
1058
+ * } from 'node:fs';
1059
+ * import { Buffer } from 'node:buffer';
1060
+ * const {
1061
+ * scryptSync,
1062
+ * createDecipheriv,
1063
+ * } = await import('node:crypto');
1064
+ *
1065
+ * const algorithm = 'aes-192-cbc';
1066
+ * const password = 'Password used to generate key';
1067
+ * // Use the async `crypto.scrypt()` instead.
1068
+ * const key = scryptSync(password, 'salt', 24);
1069
+ * // The IV is usually passed along with the ciphertext.
1070
+ * const iv = Buffer.alloc(16, 0); // Initialization vector.
1071
+ *
1072
+ * const decipher = createDecipheriv(algorithm, key, iv);
1073
+ *
1074
+ * const input = createReadStream('test.enc');
1075
+ * const output = createWriteStream('test.js');
1076
+ *
1077
+ * input.pipe(decipher).pipe(output);
1078
+ * ```
1079
+ *
1080
+ * Example: Using the `decipher.update()` and `decipher.final()` methods:
1081
+ *
1082
+ * ```js
1083
+ * import { Buffer } from 'node:buffer';
1084
+ * const {
1085
+ * scryptSync,
1086
+ * createDecipheriv,
1087
+ * } = await import('node:crypto');
1088
+ *
1089
+ * const algorithm = 'aes-192-cbc';
1090
+ * const password = 'Password used to generate key';
1091
+ * // Use the async `crypto.scrypt()` instead.
1092
+ * const key = scryptSync(password, 'salt', 24);
1093
+ * // The IV is usually passed along with the ciphertext.
1094
+ * const iv = Buffer.alloc(16, 0); // Initialization vector.
1095
+ *
1096
+ * const decipher = createDecipheriv(algorithm, key, iv);
1097
+ *
1098
+ * // Encrypted using same algorithm, key and iv.
1099
+ * const encrypted =
1100
+ * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa';
1101
+ * let decrypted = decipher.update(encrypted, 'hex', 'utf8');
1102
+ * decrypted += decipher.final('utf8');
1103
+ * console.log(decrypted);
1104
+ * // Prints: some clear text data
1105
+ * ```
1106
+ * @since v0.1.94
1107
+ */
1108
+ class Decipher extends stream.Transform {
1109
+ private constructor();
1110
+ /**
1111
+ * Updates the decipher with `data`. If the `inputEncoding` argument is given,
1112
+ * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is
1113
+ * ignored.
1114
+ *
1115
+ * The `outputEncoding` specifies the output format of the enciphered
1116
+ * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned.
1117
+ *
1118
+ * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error
1119
+ * being thrown.
1120
+ * @since v0.1.94
1121
+ * @param inputEncoding The `encoding` of the `data` string.
1122
+ * @param outputEncoding The `encoding` of the return value.
1123
+ */
1124
+ update(data: NodeJS.ArrayBufferView): Buffer;
1125
+ update(data: string, inputEncoding: Encoding): Buffer;
1126
+ update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
1127
+ update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
1128
+ /**
1129
+ * Once the `decipher.final()` method has been called, the `Decipher` object can
1130
+ * no longer be used to decrypt data. Attempts to call `decipher.final()` more
1131
+ * than once will result in an error being thrown.
1132
+ * @since v0.1.94
1133
+ * @param outputEncoding The `encoding` of the return value.
1134
+ * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
1135
+ */
1136
+ final(): Buffer;
1137
+ final(outputEncoding: BufferEncoding): string;
1138
+ /**
1139
+ * When data has been encrypted without standard block padding, calling`decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and
1140
+ * removing padding.
1141
+ *
1142
+ * Turning auto padding off will only work if the input data's length is a
1143
+ * multiple of the ciphers block size.
1144
+ *
1145
+ * The `decipher.setAutoPadding()` method must be called before `decipher.final()`.
1146
+ * @since v0.7.1
1147
+ * @param [autoPadding=true]
1148
+ * @return for method chaining.
1149
+ */
1150
+ setAutoPadding(auto_padding?: boolean): this;
1151
+ }
1152
+ interface DecipherCCM extends Decipher {
1153
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1154
+ setAAD(
1155
+ buffer: NodeJS.ArrayBufferView,
1156
+ options: {
1157
+ plaintextLength: number;
1158
+ }
1159
+ ): this;
1160
+ }
1161
+ interface DecipherGCM extends Decipher {
1162
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1163
+ setAAD(
1164
+ buffer: NodeJS.ArrayBufferView,
1165
+ options?: {
1166
+ plaintextLength: number;
1167
+ }
1168
+ ): this;
1169
+ }
1170
+ interface DecipherOCB extends Decipher {
1171
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1172
+ setAAD(
1173
+ buffer: NodeJS.ArrayBufferView,
1174
+ options?: {
1175
+ plaintextLength: number;
1176
+ }
1177
+ ): this;
1178
+ }
1179
+ interface PrivateKeyInput {
1180
+ key: string | Buffer;
1181
+ format?: KeyFormat | undefined;
1182
+ type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
1183
+ passphrase?: string | Buffer | undefined;
1184
+ encoding?: string | undefined;
1185
+ }
1186
+ interface PublicKeyInput {
1187
+ key: string | Buffer;
1188
+ format?: KeyFormat | undefined;
1189
+ type?: 'pkcs1' | 'spki' | undefined;
1190
+ encoding?: string | undefined;
1191
+ }
1192
+ /**
1193
+ * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
1194
+ *
1195
+ * ```js
1196
+ * const {
1197
+ * generateKey,
1198
+ * } = await import('node:crypto');
1199
+ *
1200
+ * generateKey('hmac', { length: 512 }, (err, key) => {
1201
+ * if (err) throw err;
1202
+ * console.log(key.export().toString('hex')); // 46e..........620
1203
+ * });
1204
+ * ```
1205
+ *
1206
+ * The size of a generated HMAC key should not exceed the block size of the
1207
+ * underlying hash function. See {@link createHmac} for more information.
1208
+ * @since v15.0.0
1209
+ * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1210
+ */
1211
+ function generateKey(
1212
+ type: 'hmac' | 'aes',
1213
+ options: {
1214
+ length: number;
1215
+ },
1216
+ callback: (err: Error | null, key: KeyObject) => void
1217
+ ): void;
1218
+ /**
1219
+ * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
1220
+ *
1221
+ * ```js
1222
+ * const {
1223
+ * generateKeySync,
1224
+ * } = await import('node:crypto');
1225
+ *
1226
+ * const key = generateKeySync('hmac', { length: 512 });
1227
+ * console.log(key.export().toString('hex')); // e89..........41e
1228
+ * ```
1229
+ *
1230
+ * The size of a generated HMAC key should not exceed the block size of the
1231
+ * underlying hash function. See {@link createHmac} for more information.
1232
+ * @since v15.0.0
1233
+ * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1234
+ */
1235
+ function generateKeySync(
1236
+ type: 'hmac' | 'aes',
1237
+ options: {
1238
+ length: number;
1239
+ }
1240
+ ): KeyObject;
1241
+ interface JsonWebKeyInput {
1242
+ key: JsonWebKey;
1243
+ format: 'jwk';
1244
+ }
1245
+ /**
1246
+ * Creates and returns a new key object containing a private key. If `key` is a
1247
+ * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above.
1248
+ *
1249
+ * If the private key is encrypted, a `passphrase` must be specified. The length
1250
+ * of the passphrase is limited to 1024 bytes.
1251
+ * @since v11.6.0
1252
+ */
1253
+ function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject;
1254
+ /**
1255
+ * Creates and returns a new key object containing a public key. If `key` is a
1256
+ * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject`with type `'private'`, the public key is derived from the given private key;
1257
+ * otherwise, `key` must be an object with the properties described above.
1258
+ *
1259
+ * If the format is `'pem'`, the `'key'` may also be an X.509 certificate.
1260
+ *
1261
+ * Because public keys can be derived from private keys, a private key may be
1262
+ * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the
1263
+ * returned `KeyObject` will be `'public'` and that the private key cannot be
1264
+ * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned
1265
+ * and it will be impossible to extract the private key from the returned object.
1266
+ * @since v11.6.0
1267
+ */
1268
+ function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject;
1269
+ /**
1270
+ * Creates and returns a new key object containing a secret key for symmetric
1271
+ * encryption or `Hmac`.
1272
+ * @since v11.6.0
1273
+ * @param encoding The string encoding when `key` is a string.
1274
+ */
1275
+ function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
1276
+ function createSecretKey(key: string, encoding: BufferEncoding): KeyObject;
1277
+ /**
1278
+ * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms.
1279
+ * Optional `options` argument controls the `stream.Writable` behavior.
1280
+ *
1281
+ * In some cases, a `Sign` instance can be created using the name of a signature
1282
+ * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use
1283
+ * the corresponding digest algorithm. This does not work for all signature
1284
+ * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest
1285
+ * algorithm names.
1286
+ * @since v0.1.92
1287
+ * @param options `stream.Writable` options
1288
+ */
1289
+ function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
1290
+ type DSAEncoding = 'der' | 'ieee-p1363';
1291
+ interface SigningOptions {
1292
+ /**
1293
+ * @see crypto.constants.RSA_PKCS1_PADDING
1294
+ */
1295
+ padding?: number | undefined;
1296
+ saltLength?: number | undefined;
1297
+ dsaEncoding?: DSAEncoding | undefined;
1298
+ }
1299
+ interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
1300
+ interface SignKeyObjectInput extends SigningOptions {
1301
+ key: KeyObject;
1302
+ }
1303
+ interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {}
1304
+ interface VerifyKeyObjectInput extends SigningOptions {
1305
+ key: KeyObject;
1306
+ }
1307
+ interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
1308
+ type KeyLike = string | Buffer | KeyObject;
1309
+ /**
1310
+ * The `Sign` class is a utility for generating signatures. It can be used in one
1311
+ * of two ways:
1312
+ *
1313
+ * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or
1314
+ * * Using the `sign.update()` and `sign.sign()` methods to produce the
1315
+ * signature.
1316
+ *
1317
+ * The {@link createSign} method is used to create `Sign` instances. The
1318
+ * argument is the string name of the hash function to use. `Sign` objects are not
1319
+ * to be created directly using the `new` keyword.
1320
+ *
1321
+ * Example: Using `Sign` and `Verify` objects as streams:
1322
+ *
1323
+ * ```js
1324
+ * const {
1325
+ * generateKeyPairSync,
1326
+ * createSign,
1327
+ * createVerify,
1328
+ * } = await import('node:crypto');
1329
+ *
1330
+ * const { privateKey, publicKey } = generateKeyPairSync('ec', {
1331
+ * namedCurve: 'sect239k1',
1332
+ * });
1333
+ *
1334
+ * const sign = createSign('SHA256');
1335
+ * sign.write('some data to sign');
1336
+ * sign.end();
1337
+ * const signature = sign.sign(privateKey, 'hex');
1338
+ *
1339
+ * const verify = createVerify('SHA256');
1340
+ * verify.write('some data to sign');
1341
+ * verify.end();
1342
+ * console.log(verify.verify(publicKey, signature, 'hex'));
1343
+ * // Prints: true
1344
+ * ```
1345
+ *
1346
+ * Example: Using the `sign.update()` and `verify.update()` methods:
1347
+ *
1348
+ * ```js
1349
+ * const {
1350
+ * generateKeyPairSync,
1351
+ * createSign,
1352
+ * createVerify,
1353
+ * } = await import('node:crypto');
1354
+ *
1355
+ * const { privateKey, publicKey } = generateKeyPairSync('rsa', {
1356
+ * modulusLength: 2048,
1357
+ * });
1358
+ *
1359
+ * const sign = createSign('SHA256');
1360
+ * sign.update('some data to sign');
1361
+ * sign.end();
1362
+ * const signature = sign.sign(privateKey);
1363
+ *
1364
+ * const verify = createVerify('SHA256');
1365
+ * verify.update('some data to sign');
1366
+ * verify.end();
1367
+ * console.log(verify.verify(publicKey, signature));
1368
+ * // Prints: true
1369
+ * ```
1370
+ * @since v0.1.92
1371
+ */
1372
+ class Sign extends stream.Writable {
1373
+ private constructor();
1374
+ /**
1375
+ * Updates the `Sign` content with the given `data`, the encoding of which
1376
+ * is given in `inputEncoding`.
1377
+ * If `encoding` is not provided, and the `data` is a string, an
1378
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
1379
+ *
1380
+ * This can be called many times with new data as it is streamed.
1381
+ * @since v0.1.92
1382
+ * @param inputEncoding The `encoding` of the `data` string.
1383
+ */
1384
+ update(data: BinaryLike): this;
1385
+ update(data: string, inputEncoding: Encoding): this;
1386
+ /**
1387
+ * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`.
1388
+ *
1389
+ * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
1390
+ * object, the following additional properties can be passed:
1391
+ *
1392
+ * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned.
1393
+ *
1394
+ * The `Sign` object can not be again used after `sign.sign()` method has been
1395
+ * called. Multiple calls to `sign.sign()` will result in an error being thrown.
1396
+ * @since v0.1.92
1397
+ */
1398
+ sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
1399
+ sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string;
1400
+ }
1401
+ /**
1402
+ * Creates and returns a `Verify` object that uses the given algorithm.
1403
+ * Use {@link getHashes} to obtain an array of names of the available
1404
+ * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior.
1405
+ *
1406
+ * In some cases, a `Verify` instance can be created using the name of a signature
1407
+ * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use
1408
+ * the corresponding digest algorithm. This does not work for all signature
1409
+ * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest
1410
+ * algorithm names.
1411
+ * @since v0.1.92
1412
+ * @param options `stream.Writable` options
1413
+ */
1414
+ function createVerify(algorithm: string, options?: stream.WritableOptions): Verify;
1415
+ /**
1416
+ * The `Verify` class is a utility for verifying signatures. It can be used in one
1417
+ * of two ways:
1418
+ *
1419
+ * * As a writable `stream` where written data is used to validate against the
1420
+ * supplied signature, or
1421
+ * * Using the `verify.update()` and `verify.verify()` methods to verify
1422
+ * the signature.
1423
+ *
1424
+ * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword.
1425
+ *
1426
+ * See `Sign` for examples.
1427
+ * @since v0.1.92
1428
+ */
1429
+ class Verify extends stream.Writable {
1430
+ private constructor();
1431
+ /**
1432
+ * Updates the `Verify` content with the given `data`, the encoding of which
1433
+ * is given in `inputEncoding`.
1434
+ * If `inputEncoding` is not provided, and the `data` is a string, an
1435
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
1436
+ *
1437
+ * This can be called many times with new data as it is streamed.
1438
+ * @since v0.1.92
1439
+ * @param inputEncoding The `encoding` of the `data` string.
1440
+ */
1441
+ update(data: BinaryLike): Verify;
1442
+ update(data: string, inputEncoding: Encoding): Verify;
1443
+ /**
1444
+ * Verifies the provided data using the given `object` and `signature`.
1445
+ *
1446
+ * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an
1447
+ * object, the following additional properties can be passed:
1448
+ *
1449
+ * The `signature` argument is the previously calculated signature for the data, in
1450
+ * the `signatureEncoding`.
1451
+ * If a `signatureEncoding` is specified, the `signature` is expected to be a
1452
+ * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
1453
+ *
1454
+ * The `verify` object can not be used again after `verify.verify()` has been
1455
+ * called. Multiple calls to `verify.verify()` will result in an error being
1456
+ * thrown.
1457
+ *
1458
+ * Because public keys can be derived from private keys, a private key may
1459
+ * be passed instead of a public key.
1460
+ * @since v0.1.92
1461
+ */
1462
+ verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
1463
+ verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
1464
+ }
1465
+ /**
1466
+ * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
1467
+ * optional specific `generator`.
1468
+ *
1469
+ * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used.
1470
+ *
1471
+ * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise
1472
+ * a `Buffer`, `TypedArray`, or `DataView` is expected.
1473
+ *
1474
+ * If `generatorEncoding` is specified, `generator` is expected to be a string;
1475
+ * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected.
1476
+ * @since v0.11.12
1477
+ * @param primeEncoding The `encoding` of the `prime` string.
1478
+ * @param [generator=2]
1479
+ * @param generatorEncoding The `encoding` of the `generator` string.
1480
+ */
1481
+ function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
1482
+ function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
1483
+ function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
1484
+ function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
1485
+ function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
1486
+ /**
1487
+ * The `DiffieHellman` class is a utility for creating Diffie-Hellman key
1488
+ * exchanges.
1489
+ *
1490
+ * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function.
1491
+ *
1492
+ * ```js
1493
+ * import assert from 'node:assert';
1494
+ *
1495
+ * const {
1496
+ * createDiffieHellman,
1497
+ * } = await import('node:crypto');
1498
+ *
1499
+ * // Generate Alice's keys...
1500
+ * const alice = createDiffieHellman(2048);
1501
+ * const aliceKey = alice.generateKeys();
1502
+ *
1503
+ * // Generate Bob's keys...
1504
+ * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator());
1505
+ * const bobKey = bob.generateKeys();
1506
+ *
1507
+ * // Exchange and generate the secret...
1508
+ * const aliceSecret = alice.computeSecret(bobKey);
1509
+ * const bobSecret = bob.computeSecret(aliceKey);
1510
+ *
1511
+ * // OK
1512
+ * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
1513
+ * ```
1514
+ * @since v0.5.0
1515
+ */
1516
+ class DiffieHellman {
1517
+ private constructor();
1518
+ /**
1519
+ * Generates private and public Diffie-Hellman key values unless they have been
1520
+ * generated or computed already, and returns
1521
+ * the public key in the specified `encoding`. This key should be
1522
+ * transferred to the other party.
1523
+ * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
1524
+ *
1525
+ * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular,
1526
+ * once a private key has been generated or set, calling this function only updates
1527
+ * the public key but does not generate a new private key.
1528
+ * @since v0.5.0
1529
+ * @param encoding The `encoding` of the return value.
1530
+ */
1531
+ generateKeys(): Buffer;
1532
+ generateKeys(encoding: BinaryToTextEncoding): string;
1533
+ /**
1534
+ * Computes the shared secret using `otherPublicKey` as the other
1535
+ * party's public key and returns the computed shared secret. The supplied
1536
+ * key is interpreted using the specified `inputEncoding`, and secret is
1537
+ * encoded using specified `outputEncoding`.
1538
+ * If the `inputEncoding` is not
1539
+ * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
1540
+ *
1541
+ * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned.
1542
+ * @since v0.5.0
1543
+ * @param inputEncoding The `encoding` of an `otherPublicKey` string.
1544
+ * @param outputEncoding The `encoding` of the return value.
1545
+ */
1546
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
1547
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
1548
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
1549
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
1550
+ /**
1551
+ * Returns the Diffie-Hellman prime in the specified `encoding`.
1552
+ * If `encoding` is provided a string is
1553
+ * returned; otherwise a `Buffer` is returned.
1554
+ * @since v0.5.0
1555
+ * @param encoding The `encoding` of the return value.
1556
+ */
1557
+ getPrime(): Buffer;
1558
+ getPrime(encoding: BinaryToTextEncoding): string;
1559
+ /**
1560
+ * Returns the Diffie-Hellman generator in the specified `encoding`.
1561
+ * If `encoding` is provided a string is
1562
+ * returned; otherwise a `Buffer` is returned.
1563
+ * @since v0.5.0
1564
+ * @param encoding The `encoding` of the return value.
1565
+ */
1566
+ getGenerator(): Buffer;
1567
+ getGenerator(encoding: BinaryToTextEncoding): string;
1568
+ /**
1569
+ * Returns the Diffie-Hellman public key in the specified `encoding`.
1570
+ * If `encoding` is provided a
1571
+ * string is returned; otherwise a `Buffer` is returned.
1572
+ * @since v0.5.0
1573
+ * @param encoding The `encoding` of the return value.
1574
+ */
1575
+ getPublicKey(): Buffer;
1576
+ getPublicKey(encoding: BinaryToTextEncoding): string;
1577
+ /**
1578
+ * Returns the Diffie-Hellman private key in the specified `encoding`.
1579
+ * If `encoding` is provided a
1580
+ * string is returned; otherwise a `Buffer` is returned.
1581
+ * @since v0.5.0
1582
+ * @param encoding The `encoding` of the return value.
1583
+ */
1584
+ getPrivateKey(): Buffer;
1585
+ getPrivateKey(encoding: BinaryToTextEncoding): string;
1586
+ /**
1587
+ * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected
1588
+ * to be a string. If no `encoding` is provided, `publicKey` is expected
1589
+ * to be a `Buffer`, `TypedArray`, or `DataView`.
1590
+ * @since v0.5.0
1591
+ * @param encoding The `encoding` of the `publicKey` string.
1592
+ */
1593
+ setPublicKey(publicKey: NodeJS.ArrayBufferView): void;
1594
+ setPublicKey(publicKey: string, encoding: BufferEncoding): void;
1595
+ /**
1596
+ * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected
1597
+ * to be a string. If no `encoding` is provided, `privateKey` is expected
1598
+ * to be a `Buffer`, `TypedArray`, or `DataView`.
1599
+ *
1600
+ * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be
1601
+ * used to manually provide the public key or to automatically derive it.
1602
+ * @since v0.5.0
1603
+ * @param encoding The `encoding` of the `privateKey` string.
1604
+ */
1605
+ setPrivateKey(privateKey: NodeJS.ArrayBufferView): void;
1606
+ setPrivateKey(privateKey: string, encoding: BufferEncoding): void;
1607
+ /**
1608
+ * A bit field containing any warnings and/or errors resulting from a check
1609
+ * performed during initialization of the `DiffieHellman` object.
1610
+ *
1611
+ * The following values are valid for this property (as defined in `node:constants` module):
1612
+ *
1613
+ * * `DH_CHECK_P_NOT_SAFE_PRIME`
1614
+ * * `DH_CHECK_P_NOT_PRIME`
1615
+ * * `DH_UNABLE_TO_CHECK_GENERATOR`
1616
+ * * `DH_NOT_SUITABLE_GENERATOR`
1617
+ * @since v0.11.12
1618
+ */
1619
+ verifyError: number;
1620
+ }
1621
+ /**
1622
+ * The `DiffieHellmanGroup` class takes a well-known modp group as its argument.
1623
+ * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation.
1624
+ * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods.
1625
+ *
1626
+ * ```js
1627
+ * const { createDiffieHellmanGroup } = await import('node:crypto');
1628
+ * const dh = createDiffieHellmanGroup('modp1');
1629
+ * ```
1630
+ * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt):
1631
+ * ```bash
1632
+ * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
1633
+ * modp1 # 768 bits
1634
+ * modp2 # 1024 bits
1635
+ * modp5 # 1536 bits
1636
+ * modp14 # 2048 bits
1637
+ * modp15 # etc.
1638
+ * modp16
1639
+ * modp17
1640
+ * modp18
1641
+ * ```
1642
+ * @since v0.7.5
1643
+ */
1644
+ const DiffieHellmanGroup: DiffieHellmanGroupConstructor;
1645
+ interface DiffieHellmanGroupConstructor {
1646
+ new (name: string): DiffieHellmanGroup;
1647
+ (name: string): DiffieHellmanGroup;
1648
+ readonly prototype: DiffieHellmanGroup;
1649
+ }
1650
+ type DiffieHellmanGroup = Omit<DiffieHellman, 'setPublicKey' | 'setPrivateKey'>;
1651
+ /**
1652
+ * Creates a predefined `DiffieHellmanGroup` key exchange object. The
1653
+ * supported groups are listed in the documentation for `DiffieHellmanGroup`.
1654
+ *
1655
+ * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
1656
+ * the keys (with `diffieHellman.setPublicKey()`, for example). The
1657
+ * advantage of using this method is that the parties do not have to
1658
+ * generate nor exchange a group modulus beforehand, saving both processor
1659
+ * and communication time.
1660
+ *
1661
+ * Example (obtaining a shared secret):
1662
+ *
1663
+ * ```js
1664
+ * const {
1665
+ * getDiffieHellman,
1666
+ * } = await import('node:crypto');
1667
+ * const alice = getDiffieHellman('modp14');
1668
+ * const bob = getDiffieHellman('modp14');
1669
+ *
1670
+ * alice.generateKeys();
1671
+ * bob.generateKeys();
1672
+ *
1673
+ * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex');
1674
+ * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex');
1675
+ *
1676
+ * // aliceSecret and bobSecret should be the same
1677
+ * console.log(aliceSecret === bobSecret);
1678
+ * ```
1679
+ * @since v0.7.5
1680
+ */
1681
+ function getDiffieHellman(groupName: string): DiffieHellmanGroup;
1682
+ /**
1683
+ * An alias for {@link getDiffieHellman}
1684
+ * @since v0.9.3
1685
+ */
1686
+ function createDiffieHellmanGroup(name: string): DiffieHellmanGroup;
1687
+ /**
1688
+ * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
1689
+ * implementation. A selected HMAC digest algorithm specified by `digest` is
1690
+ * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`.
1691
+ *
1692
+ * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set;
1693
+ * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be
1694
+ * thrown if any of the input arguments specify invalid values or types.
1695
+ *
1696
+ * The `iterations` argument must be a number set as high as possible. The
1697
+ * higher the number of iterations, the more secure the derived key will be,
1698
+ * but will take a longer amount of time to complete.
1699
+ *
1700
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1701
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1702
+ *
1703
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1704
+ *
1705
+ * ```js
1706
+ * const {
1707
+ * pbkdf2,
1708
+ * } = await import('node:crypto');
1709
+ *
1710
+ * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => {
1711
+ * if (err) throw err;
1712
+ * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae'
1713
+ * });
1714
+ * ```
1715
+ *
1716
+ * An array of supported digest functions can be retrieved using {@link getHashes}.
1717
+ *
1718
+ * This API uses libuv's threadpool, which can have surprising and
1719
+ * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1720
+ * @since v0.5.5
1721
+ */
1722
+ function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void;
1723
+ /**
1724
+ * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
1725
+ * implementation. A selected HMAC digest algorithm specified by `digest` is
1726
+ * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`.
1727
+ *
1728
+ * If an error occurs an `Error` will be thrown, otherwise the derived key will be
1729
+ * returned as a `Buffer`.
1730
+ *
1731
+ * The `iterations` argument must be a number set as high as possible. The
1732
+ * higher the number of iterations, the more secure the derived key will be,
1733
+ * but will take a longer amount of time to complete.
1734
+ *
1735
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1736
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1737
+ *
1738
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1739
+ *
1740
+ * ```js
1741
+ * const {
1742
+ * pbkdf2Sync,
1743
+ * } = await import('node:crypto');
1744
+ *
1745
+ * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512');
1746
+ * console.log(key.toString('hex')); // '3745e48...08d59ae'
1747
+ * ```
1748
+ *
1749
+ * An array of supported digest functions can be retrieved using {@link getHashes}.
1750
+ * @since v0.9.3
1751
+ */
1752
+ function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
1753
+ /**
1754
+ * Generates cryptographically strong pseudorandom data. The `size` argument
1755
+ * is a number indicating the number of bytes to generate.
1756
+ *
1757
+ * If a `callback` function is provided, the bytes are generated asynchronously
1758
+ * and the `callback` function is invoked with two arguments: `err` and `buf`.
1759
+ * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes.
1760
+ *
1761
+ * ```js
1762
+ * // Asynchronous
1763
+ * const {
1764
+ * randomBytes,
1765
+ * } = await import('node:crypto');
1766
+ *
1767
+ * randomBytes(256, (err, buf) => {
1768
+ * if (err) throw err;
1769
+ * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`);
1770
+ * });
1771
+ * ```
1772
+ *
1773
+ * If the `callback` function is not provided, the random bytes are generated
1774
+ * synchronously and returned as a `Buffer`. An error will be thrown if
1775
+ * there is a problem generating the bytes.
1776
+ *
1777
+ * ```js
1778
+ * // Synchronous
1779
+ * const {
1780
+ * randomBytes,
1781
+ * } = await import('node:crypto');
1782
+ *
1783
+ * const buf = randomBytes(256);
1784
+ * console.log(
1785
+ * `${buf.length} bytes of random data: ${buf.toString('hex')}`);
1786
+ * ```
1787
+ *
1788
+ * The `crypto.randomBytes()` method will not complete until there is
1789
+ * sufficient entropy available.
1790
+ * This should normally never take longer than a few milliseconds. The only time
1791
+ * when generating the random bytes may conceivably block for a longer period of
1792
+ * time is right after boot, when the whole system is still low on entropy.
1793
+ *
1794
+ * This API uses libuv's threadpool, which can have surprising and
1795
+ * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1796
+ *
1797
+ * The asynchronous version of `crypto.randomBytes()` is carried out in a single
1798
+ * threadpool request. To minimize threadpool task length variation, partition
1799
+ * large `randomBytes` requests when doing so as part of fulfilling a client
1800
+ * request.
1801
+ * @since v0.5.8
1802
+ * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`.
1803
+ * @return if the `callback` function is not provided.
1804
+ */
1805
+ function randomBytes(size: number): Buffer;
1806
+ function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
1807
+ function pseudoRandomBytes(size: number): Buffer;
1808
+ function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
1809
+ /**
1810
+ * Return a random integer `n` such that `min <= n < max`. This
1811
+ * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
1812
+ *
1813
+ * The range (`max - min`) must be less than 248. `min` and `max` must
1814
+ * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
1815
+ *
1816
+ * If the `callback` function is not provided, the random integer is
1817
+ * generated synchronously.
1818
+ *
1819
+ * ```js
1820
+ * // Asynchronous
1821
+ * const {
1822
+ * randomInt,
1823
+ * } = await import('node:crypto');
1824
+ *
1825
+ * randomInt(3, (err, n) => {
1826
+ * if (err) throw err;
1827
+ * console.log(`Random number chosen from (0, 1, 2): ${n}`);
1828
+ * });
1829
+ * ```
1830
+ *
1831
+ * ```js
1832
+ * // Synchronous
1833
+ * const {
1834
+ * randomInt,
1835
+ * } = await import('node:crypto');
1836
+ *
1837
+ * const n = randomInt(3);
1838
+ * console.log(`Random number chosen from (0, 1, 2): ${n}`);
1839
+ * ```
1840
+ *
1841
+ * ```js
1842
+ * // With `min` argument
1843
+ * const {
1844
+ * randomInt,
1845
+ * } = await import('node:crypto');
1846
+ *
1847
+ * const n = randomInt(1, 7);
1848
+ * console.log(`The dice rolled: ${n}`);
1849
+ * ```
1850
+ * @since v14.10.0, v12.19.0
1851
+ * @param [min=0] Start of random range (inclusive).
1852
+ * @param max End of random range (exclusive).
1853
+ * @param callback `function(err, n) {}`.
1854
+ */
1855
+ function randomInt(max: number): number;
1856
+ function randomInt(min: number, max: number): number;
1857
+ function randomInt(max: number, callback: (err: Error | null, value: number) => void): void;
1858
+ function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void;
1859
+ /**
1860
+ * Synchronous version of {@link randomFill}.
1861
+ *
1862
+ * ```js
1863
+ * import { Buffer } from 'node:buffer';
1864
+ * const { randomFillSync } = await import('node:crypto');
1865
+ *
1866
+ * const buf = Buffer.alloc(10);
1867
+ * console.log(randomFillSync(buf).toString('hex'));
1868
+ *
1869
+ * randomFillSync(buf, 5);
1870
+ * console.log(buf.toString('hex'));
1871
+ *
1872
+ * // The above is equivalent to the following:
1873
+ * randomFillSync(buf, 5, 5);
1874
+ * console.log(buf.toString('hex'));
1875
+ * ```
1876
+ *
1877
+ * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`.
1878
+ *
1879
+ * ```js
1880
+ * import { Buffer } from 'node:buffer';
1881
+ * const { randomFillSync } = await import('node:crypto');
1882
+ *
1883
+ * const a = new Uint32Array(10);
1884
+ * console.log(Buffer.from(randomFillSync(a).buffer,
1885
+ * a.byteOffset, a.byteLength).toString('hex'));
1886
+ *
1887
+ * const b = new DataView(new ArrayBuffer(10));
1888
+ * console.log(Buffer.from(randomFillSync(b).buffer,
1889
+ * b.byteOffset, b.byteLength).toString('hex'));
1890
+ *
1891
+ * const c = new ArrayBuffer(10);
1892
+ * console.log(Buffer.from(randomFillSync(c)).toString('hex'));
1893
+ * ```
1894
+ * @since v7.10.0, v6.13.0
1895
+ * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`.
1896
+ * @param [offset=0]
1897
+ * @param [size=buffer.length - offset]
1898
+ * @return The object passed as `buffer` argument.
1899
+ */
1900
+ function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
1901
+ /**
1902
+ * This function is similar to {@link randomBytes} but requires the first
1903
+ * argument to be a `Buffer` that will be filled. It also
1904
+ * requires that a callback is passed in.
1905
+ *
1906
+ * If the `callback` function is not provided, an error will be thrown.
1907
+ *
1908
+ * ```js
1909
+ * import { Buffer } from 'node:buffer';
1910
+ * const { randomFill } = await import('node:crypto');
1911
+ *
1912
+ * const buf = Buffer.alloc(10);
1913
+ * randomFill(buf, (err, buf) => {
1914
+ * if (err) throw err;
1915
+ * console.log(buf.toString('hex'));
1916
+ * });
1917
+ *
1918
+ * randomFill(buf, 5, (err, buf) => {
1919
+ * if (err) throw err;
1920
+ * console.log(buf.toString('hex'));
1921
+ * });
1922
+ *
1923
+ * // The above is equivalent to the following:
1924
+ * randomFill(buf, 5, 5, (err, buf) => {
1925
+ * if (err) throw err;
1926
+ * console.log(buf.toString('hex'));
1927
+ * });
1928
+ * ```
1929
+ *
1930
+ * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`.
1931
+ *
1932
+ * While this includes instances of `Float32Array` and `Float64Array`, this
1933
+ * function should not be used to generate random floating-point numbers. The
1934
+ * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array
1935
+ * contains finite numbers only, they are not drawn from a uniform random
1936
+ * distribution and have no meaningful lower or upper bounds.
1937
+ *
1938
+ * ```js
1939
+ * import { Buffer } from 'node:buffer';
1940
+ * const { randomFill } = await import('node:crypto');
1941
+ *
1942
+ * const a = new Uint32Array(10);
1943
+ * randomFill(a, (err, buf) => {
1944
+ * if (err) throw err;
1945
+ * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
1946
+ * .toString('hex'));
1947
+ * });
1948
+ *
1949
+ * const b = new DataView(new ArrayBuffer(10));
1950
+ * randomFill(b, (err, buf) => {
1951
+ * if (err) throw err;
1952
+ * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
1953
+ * .toString('hex'));
1954
+ * });
1955
+ *
1956
+ * const c = new ArrayBuffer(10);
1957
+ * randomFill(c, (err, buf) => {
1958
+ * if (err) throw err;
1959
+ * console.log(Buffer.from(buf).toString('hex'));
1960
+ * });
1961
+ * ```
1962
+ *
1963
+ * This API uses libuv's threadpool, which can have surprising and
1964
+ * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1965
+ *
1966
+ * The asynchronous version of `crypto.randomFill()` is carried out in a single
1967
+ * threadpool request. To minimize threadpool task length variation, partition
1968
+ * large `randomFill` requests when doing so as part of fulfilling a client
1969
+ * request.
1970
+ * @since v7.10.0, v6.13.0
1971
+ * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`.
1972
+ * @param [offset=0]
1973
+ * @param [size=buffer.length - offset]
1974
+ * @param callback `function(err, buf) {}`.
1975
+ */
1976
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
1977
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
1978
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
1979
+ interface ScryptOptions {
1980
+ cost?: number | undefined;
1981
+ blockSize?: number | undefined;
1982
+ parallelization?: number | undefined;
1983
+ N?: number | undefined;
1984
+ r?: number | undefined;
1985
+ p?: number | undefined;
1986
+ maxmem?: number | undefined;
1987
+ }
1988
+ /**
1989
+ * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
1990
+ * key derivation function that is designed to be expensive computationally and
1991
+ * memory-wise in order to make brute-force attacks unrewarding.
1992
+ *
1993
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1994
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1995
+ *
1996
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1997
+ *
1998
+ * The `callback` function is called with two arguments: `err` and `derivedKey`.`err` is an exception object when key derivation fails, otherwise `err` is`null`. `derivedKey` is passed to the
1999
+ * callback as a `Buffer`.
2000
+ *
2001
+ * An exception is thrown when any of the input arguments specify invalid values
2002
+ * or types.
2003
+ *
2004
+ * ```js
2005
+ * const {
2006
+ * scrypt,
2007
+ * } = await import('node:crypto');
2008
+ *
2009
+ * // Using the factory defaults.
2010
+ * scrypt('password', 'salt', 64, (err, derivedKey) => {
2011
+ * if (err) throw err;
2012
+ * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae'
2013
+ * });
2014
+ * // Using a custom N parameter. Must be a power of two.
2015
+ * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => {
2016
+ * if (err) throw err;
2017
+ * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34'
2018
+ * });
2019
+ * ```
2020
+ * @since v10.5.0
2021
+ */
2022
+ function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void;
2023
+ function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void;
2024
+ /**
2025
+ * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
2026
+ * key derivation function that is designed to be expensive computationally and
2027
+ * memory-wise in order to make brute-force attacks unrewarding.
2028
+ *
2029
+ * The `salt` should be as unique as possible. It is recommended that a salt is
2030
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
2031
+ *
2032
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
2033
+ *
2034
+ * An exception is thrown when key derivation fails, otherwise the derived key is
2035
+ * returned as a `Buffer`.
2036
+ *
2037
+ * An exception is thrown when any of the input arguments specify invalid values
2038
+ * or types.
2039
+ *
2040
+ * ```js
2041
+ * const {
2042
+ * scryptSync,
2043
+ * } = await import('node:crypto');
2044
+ * // Using the factory defaults.
2045
+ *
2046
+ * const key1 = scryptSync('password', 'salt', 64);
2047
+ * console.log(key1.toString('hex')); // '3745e48...08d59ae'
2048
+ * // Using a custom N parameter. Must be a power of two.
2049
+ * const key2 = scryptSync('password', 'salt', 64, { N: 1024 });
2050
+ * console.log(key2.toString('hex')); // '3745e48...aa39b34'
2051
+ * ```
2052
+ * @since v10.5.0
2053
+ */
2054
+ function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer;
2055
+ interface RsaPublicKey {
2056
+ key: KeyLike;
2057
+ padding?: number | undefined;
2058
+ }
2059
+ interface RsaPrivateKey {
2060
+ key: KeyLike;
2061
+ passphrase?: string | undefined;
2062
+ /**
2063
+ * @default 'sha1'
2064
+ */
2065
+ oaepHash?: string | undefined;
2066
+ oaepLabel?: NodeJS.TypedArray | undefined;
2067
+ padding?: number | undefined;
2068
+ }
2069
+ /**
2070
+ * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using
2071
+ * the corresponding private key, for example using {@link privateDecrypt}.
2072
+ *
2073
+ * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an
2074
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`.
2075
+ *
2076
+ * Because RSA public keys can be derived from private keys, a private key may
2077
+ * be passed instead of a public key.
2078
+ * @since v0.11.14
2079
+ */
2080
+ function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
2081
+ /**
2082
+ * Decrypts `buffer` with `key`.`buffer` was previously encrypted using
2083
+ * the corresponding private key, for example using {@link privateEncrypt}.
2084
+ *
2085
+ * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an
2086
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`.
2087
+ *
2088
+ * Because RSA public keys can be derived from private keys, a private key may
2089
+ * be passed instead of a public key.
2090
+ * @since v1.1.0
2091
+ */
2092
+ function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
2093
+ /**
2094
+ * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
2095
+ * the corresponding public key, for example using {@link publicEncrypt}.
2096
+ *
2097
+ * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
2098
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`.
2099
+ * @since v0.11.14
2100
+ */
2101
+ function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
2102
+ /**
2103
+ * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
2104
+ * the corresponding public key, for example using {@link publicDecrypt}.
2105
+ *
2106
+ * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
2107
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`.
2108
+ * @since v1.1.0
2109
+ */
2110
+ function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
2111
+ /**
2112
+ * ```js
2113
+ * const {
2114
+ * getCiphers,
2115
+ * } = await import('node:crypto');
2116
+ *
2117
+ * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...]
2118
+ * ```
2119
+ * @since v0.9.3
2120
+ * @return An array with the names of the supported cipher algorithms.
2121
+ */
2122
+ function getCiphers(): string[];
2123
+ /**
2124
+ * ```js
2125
+ * const {
2126
+ * getCurves,
2127
+ * } = await import('node:crypto');
2128
+ *
2129
+ * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
2130
+ * ```
2131
+ * @since v2.3.0
2132
+ * @return An array with the names of the supported elliptic curves.
2133
+ */
2134
+ function getCurves(): string[];
2135
+ /**
2136
+ * @since v10.0.0
2137
+ * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}.
2138
+ */
2139
+ function getFips(): 1 | 0;
2140
+ /**
2141
+ * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build.
2142
+ * Throws an error if FIPS mode is not available.
2143
+ * @since v10.0.0
2144
+ * @param bool `true` to enable FIPS mode.
2145
+ */
2146
+ function setFips(bool: boolean): void;
2147
+ /**
2148
+ * ```js
2149
+ * const {
2150
+ * getHashes,
2151
+ * } = await import('node:crypto');
2152
+ *
2153
+ * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
2154
+ * ```
2155
+ * @since v0.9.3
2156
+ * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms.
2157
+ */
2158
+ function getHashes(): string[];
2159
+ /**
2160
+ * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH)
2161
+ * key exchanges.
2162
+ *
2163
+ * Instances of the `ECDH` class can be created using the {@link createECDH} function.
2164
+ *
2165
+ * ```js
2166
+ * import assert from 'node:assert';
2167
+ *
2168
+ * const {
2169
+ * createECDH,
2170
+ * } = await import('node:crypto');
2171
+ *
2172
+ * // Generate Alice's keys...
2173
+ * const alice = createECDH('secp521r1');
2174
+ * const aliceKey = alice.generateKeys();
2175
+ *
2176
+ * // Generate Bob's keys...
2177
+ * const bob = createECDH('secp521r1');
2178
+ * const bobKey = bob.generateKeys();
2179
+ *
2180
+ * // Exchange and generate the secret...
2181
+ * const aliceSecret = alice.computeSecret(bobKey);
2182
+ * const bobSecret = bob.computeSecret(aliceKey);
2183
+ *
2184
+ * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
2185
+ * // OK
2186
+ * ```
2187
+ * @since v0.11.14
2188
+ */
2189
+ class ECDH {
2190
+ private constructor();
2191
+ /**
2192
+ * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the
2193
+ * format specified by `format`. The `format` argument specifies point encoding
2194
+ * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is
2195
+ * interpreted using the specified `inputEncoding`, and the returned key is encoded
2196
+ * using the specified `outputEncoding`.
2197
+ *
2198
+ * Use {@link getCurves} to obtain a list of available curve names.
2199
+ * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display
2200
+ * the name and description of each available elliptic curve.
2201
+ *
2202
+ * If `format` is not specified the point will be returned in `'uncompressed'`format.
2203
+ *
2204
+ * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
2205
+ *
2206
+ * Example (uncompressing a key):
2207
+ *
2208
+ * ```js
2209
+ * const {
2210
+ * createECDH,
2211
+ * ECDH,
2212
+ * } = await import('node:crypto');
2213
+ *
2214
+ * const ecdh = createECDH('secp256k1');
2215
+ * ecdh.generateKeys();
2216
+ *
2217
+ * const compressedKey = ecdh.getPublicKey('hex', 'compressed');
2218
+ *
2219
+ * const uncompressedKey = ECDH.convertKey(compressedKey,
2220
+ * 'secp256k1',
2221
+ * 'hex',
2222
+ * 'hex',
2223
+ * 'uncompressed');
2224
+ *
2225
+ * // The converted key and the uncompressed public key should be the same
2226
+ * console.log(uncompressedKey === ecdh.getPublicKey('hex'));
2227
+ * ```
2228
+ * @since v10.0.0
2229
+ * @param inputEncoding The `encoding` of the `key` string.
2230
+ * @param outputEncoding The `encoding` of the return value.
2231
+ * @param [format='uncompressed']
2232
+ */
2233
+ static convertKey(
2234
+ key: BinaryLike,
2235
+ curve: string,
2236
+ inputEncoding?: BinaryToTextEncoding,
2237
+ outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url',
2238
+ format?: 'uncompressed' | 'compressed' | 'hybrid'
2239
+ ): Buffer | string;
2240
+ /**
2241
+ * Generates private and public EC Diffie-Hellman key values, and returns
2242
+ * the public key in the specified `format` and `encoding`. This key should be
2243
+ * transferred to the other party.
2244
+ *
2245
+ * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format.
2246
+ *
2247
+ * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
2248
+ * @since v0.11.14
2249
+ * @param encoding The `encoding` of the return value.
2250
+ * @param [format='uncompressed']
2251
+ */
2252
+ generateKeys(): Buffer;
2253
+ generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
2254
+ /**
2255
+ * Computes the shared secret using `otherPublicKey` as the other
2256
+ * party's public key and returns the computed shared secret. The supplied
2257
+ * key is interpreted using specified `inputEncoding`, and the returned secret
2258
+ * is encoded using the specified `outputEncoding`.
2259
+ * If the `inputEncoding` is not
2260
+ * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`.
2261
+ *
2262
+ * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned.
2263
+ *
2264
+ * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is
2265
+ * usually supplied from a remote user over an insecure network,
2266
+ * be sure to handle this exception accordingly.
2267
+ * @since v0.11.14
2268
+ * @param inputEncoding The `encoding` of the `otherPublicKey` string.
2269
+ * @param outputEncoding The `encoding` of the return value.
2270
+ */
2271
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
2272
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
2273
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
2274
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
2275
+ /**
2276
+ * If `encoding` is specified, a string is returned; otherwise a `Buffer` is
2277
+ * returned.
2278
+ * @since v0.11.14
2279
+ * @param encoding The `encoding` of the return value.
2280
+ * @return The EC Diffie-Hellman in the specified `encoding`.
2281
+ */
2282
+ getPrivateKey(): Buffer;
2283
+ getPrivateKey(encoding: BinaryToTextEncoding): string;
2284
+ /**
2285
+ * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format.
2286
+ *
2287
+ * If `encoding` is specified, a string is returned; otherwise a `Buffer` is
2288
+ * returned.
2289
+ * @since v0.11.14
2290
+ * @param encoding The `encoding` of the return value.
2291
+ * @param [format='uncompressed']
2292
+ * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
2293
+ */
2294
+ getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer;
2295
+ getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
2296
+ /**
2297
+ * Sets the EC Diffie-Hellman private key.
2298
+ * If `encoding` is provided, `privateKey` is expected
2299
+ * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
2300
+ *
2301
+ * If `privateKey` is not valid for the curve specified when the `ECDH` object was
2302
+ * created, an error is thrown. Upon setting the private key, the associated
2303
+ * public point (key) is also generated and set in the `ECDH` object.
2304
+ * @since v0.11.14
2305
+ * @param encoding The `encoding` of the `privateKey` string.
2306
+ */
2307
+ setPrivateKey(privateKey: NodeJS.ArrayBufferView): void;
2308
+ setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void;
2309
+ }
2310
+ /**
2311
+ * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a
2312
+ * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent
2313
+ * OpenSSL releases, `openssl ecparam -list_curves` will also display the name
2314
+ * and description of each available elliptic curve.
2315
+ * @since v0.11.14
2316
+ */
2317
+ function createECDH(curveName: string): ECDH;
2318
+ /**
2319
+ * This function compares the underlying bytes that represent the given`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time
2320
+ * algorithm.
2321
+ *
2322
+ * This function does not leak timing information that
2323
+ * would allow an attacker to guess one of the values. This is suitable for
2324
+ * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
2325
+ *
2326
+ * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
2327
+ * must have the same byte length. An error is thrown if `a` and `b` have
2328
+ * different byte lengths.
2329
+ *
2330
+ * If at least one of `a` and `b` is a `TypedArray` with more than one byte per
2331
+ * entry, such as `Uint16Array`, the result will be computed using the platform
2332
+ * byte order.
2333
+ *
2334
+ * **When both of the inputs are `Float32Array`s or`Float64Array`s, this function might return unexpected results due to IEEE 754**
2335
+ * **encoding of floating-point numbers. In particular, neither `x === y` nor`Object.is(x, y)` implies that the byte representations of two floating-point**
2336
+ * **numbers `x` and `y` are equal.**
2337
+ *
2338
+ * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code
2339
+ * is timing-safe. Care should be taken to ensure that the surrounding code does
2340
+ * not introduce timing vulnerabilities.
2341
+ * @since v6.6.0
2342
+ */
2343
+ function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
2344
+ type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
2345
+ type KeyFormat = 'pem' | 'der' | 'jwk';
2346
+ interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2347
+ format: T;
2348
+ cipher?: string | undefined;
2349
+ passphrase?: string | undefined;
2350
+ }
2351
+ interface KeyPairKeyObjectResult {
2352
+ publicKey: KeyObject;
2353
+ privateKey: KeyObject;
2354
+ }
2355
+ interface ED25519KeyPairKeyObjectOptions {}
2356
+ interface ED448KeyPairKeyObjectOptions {}
2357
+ interface X25519KeyPairKeyObjectOptions {}
2358
+ interface X448KeyPairKeyObjectOptions {}
2359
+ interface ECKeyPairKeyObjectOptions {
2360
+ /**
2361
+ * Name of the curve to use
2362
+ */
2363
+ namedCurve: string;
2364
+ }
2365
+ interface RSAKeyPairKeyObjectOptions {
2366
+ /**
2367
+ * Key size in bits
2368
+ */
2369
+ modulusLength: number;
2370
+ /**
2371
+ * Public exponent
2372
+ * @default 0x10001
2373
+ */
2374
+ publicExponent?: number | undefined;
2375
+ }
2376
+ interface RSAPSSKeyPairKeyObjectOptions {
2377
+ /**
2378
+ * Key size in bits
2379
+ */
2380
+ modulusLength: number;
2381
+ /**
2382
+ * Public exponent
2383
+ * @default 0x10001
2384
+ */
2385
+ publicExponent?: number | undefined;
2386
+ /**
2387
+ * Name of the message digest
2388
+ */
2389
+ hashAlgorithm?: string;
2390
+ /**
2391
+ * Name of the message digest used by MGF1
2392
+ */
2393
+ mgf1HashAlgorithm?: string;
2394
+ /**
2395
+ * Minimal salt length in bytes
2396
+ */
2397
+ saltLength?: string;
2398
+ }
2399
+ interface DSAKeyPairKeyObjectOptions {
2400
+ /**
2401
+ * Key size in bits
2402
+ */
2403
+ modulusLength: number;
2404
+ /**
2405
+ * Size of q in bits
2406
+ */
2407
+ divisorLength: number;
2408
+ }
2409
+ interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2410
+ /**
2411
+ * Key size in bits
2412
+ */
2413
+ modulusLength: number;
2414
+ /**
2415
+ * Public exponent
2416
+ * @default 0x10001
2417
+ */
2418
+ publicExponent?: number | undefined;
2419
+ publicKeyEncoding: {
2420
+ type: 'pkcs1' | 'spki';
2421
+ format: PubF;
2422
+ };
2423
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2424
+ type: 'pkcs1' | 'pkcs8';
2425
+ };
2426
+ }
2427
+ interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2428
+ /**
2429
+ * Key size in bits
2430
+ */
2431
+ modulusLength: number;
2432
+ /**
2433
+ * Public exponent
2434
+ * @default 0x10001
2435
+ */
2436
+ publicExponent?: number | undefined;
2437
+ /**
2438
+ * Name of the message digest
2439
+ */
2440
+ hashAlgorithm?: string;
2441
+ /**
2442
+ * Name of the message digest used by MGF1
2443
+ */
2444
+ mgf1HashAlgorithm?: string;
2445
+ /**
2446
+ * Minimal salt length in bytes
2447
+ */
2448
+ saltLength?: string;
2449
+ publicKeyEncoding: {
2450
+ type: 'spki';
2451
+ format: PubF;
2452
+ };
2453
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2454
+ type: 'pkcs8';
2455
+ };
2456
+ }
2457
+ interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2458
+ /**
2459
+ * Key size in bits
2460
+ */
2461
+ modulusLength: number;
2462
+ /**
2463
+ * Size of q in bits
2464
+ */
2465
+ divisorLength: number;
2466
+ publicKeyEncoding: {
2467
+ type: 'spki';
2468
+ format: PubF;
2469
+ };
2470
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2471
+ type: 'pkcs8';
2472
+ };
2473
+ }
2474
+ interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2475
+ /**
2476
+ * Name of the curve to use.
2477
+ */
2478
+ namedCurve: string;
2479
+ publicKeyEncoding: {
2480
+ type: 'pkcs1' | 'spki';
2481
+ format: PubF;
2482
+ };
2483
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2484
+ type: 'sec1' | 'pkcs8';
2485
+ };
2486
+ }
2487
+ interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2488
+ publicKeyEncoding: {
2489
+ type: 'spki';
2490
+ format: PubF;
2491
+ };
2492
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2493
+ type: 'pkcs8';
2494
+ };
2495
+ }
2496
+ interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2497
+ publicKeyEncoding: {
2498
+ type: 'spki';
2499
+ format: PubF;
2500
+ };
2501
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2502
+ type: 'pkcs8';
2503
+ };
2504
+ }
2505
+ interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2506
+ publicKeyEncoding: {
2507
+ type: 'spki';
2508
+ format: PubF;
2509
+ };
2510
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2511
+ type: 'pkcs8';
2512
+ };
2513
+ }
2514
+ interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2515
+ publicKeyEncoding: {
2516
+ type: 'spki';
2517
+ format: PubF;
2518
+ };
2519
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2520
+ type: 'pkcs8';
2521
+ };
2522
+ }
2523
+ interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
2524
+ publicKey: T1;
2525
+ privateKey: T2;
2526
+ }
2527
+ /**
2528
+ * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2529
+ * Ed25519, Ed448, X25519, X448, and DH are currently supported.
2530
+ *
2531
+ * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2532
+ * behaves as if `keyObject.export()` had been called on its result. Otherwise,
2533
+ * the respective part of the key is returned as a `KeyObject`.
2534
+ *
2535
+ * When encoding public keys, it is recommended to use `'spki'`. When encoding
2536
+ * private keys, it is recommended to use `'pkcs8'` with a strong passphrase,
2537
+ * and to keep the passphrase confidential.
2538
+ *
2539
+ * ```js
2540
+ * const {
2541
+ * generateKeyPairSync,
2542
+ * } = await import('node:crypto');
2543
+ *
2544
+ * const {
2545
+ * publicKey,
2546
+ * privateKey,
2547
+ * } = generateKeyPairSync('rsa', {
2548
+ * modulusLength: 4096,
2549
+ * publicKeyEncoding: {
2550
+ * type: 'spki',
2551
+ * format: 'pem',
2552
+ * },
2553
+ * privateKeyEncoding: {
2554
+ * type: 'pkcs8',
2555
+ * format: 'pem',
2556
+ * cipher: 'aes-256-cbc',
2557
+ * passphrase: 'top secret',
2558
+ * },
2559
+ * });
2560
+ * ```
2561
+ *
2562
+ * The return value `{ publicKey, privateKey }` represents the generated key pair.
2563
+ * When PEM encoding was selected, the respective key will be a string, otherwise
2564
+ * it will be a buffer containing the data encoded as DER.
2565
+ * @since v10.12.0
2566
+ * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2567
+ */
2568
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2569
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2570
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2571
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2572
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2573
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2574
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2575
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2576
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2577
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2578
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2579
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2580
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2581
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2582
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2583
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2584
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2585
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2586
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2587
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2588
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2589
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2590
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2591
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2592
+ function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2593
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2594
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2595
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2596
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2597
+ function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2598
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2599
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2600
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2601
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2602
+ function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2603
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2604
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2605
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2606
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2607
+ function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2608
+ /**
2609
+ * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
2610
+ * Ed25519, Ed448, X25519, X448, and DH are currently supported.
2611
+ *
2612
+ * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2613
+ * behaves as if `keyObject.export()` had been called on its result. Otherwise,
2614
+ * the respective part of the key is returned as a `KeyObject`.
2615
+ *
2616
+ * It is recommended to encode public keys as `'spki'` and private keys as`'pkcs8'` with encryption for long-term storage:
2617
+ *
2618
+ * ```js
2619
+ * const {
2620
+ * generateKeyPair,
2621
+ * } = await import('node:crypto');
2622
+ *
2623
+ * generateKeyPair('rsa', {
2624
+ * modulusLength: 4096,
2625
+ * publicKeyEncoding: {
2626
+ * type: 'spki',
2627
+ * format: 'pem',
2628
+ * },
2629
+ * privateKeyEncoding: {
2630
+ * type: 'pkcs8',
2631
+ * format: 'pem',
2632
+ * cipher: 'aes-256-cbc',
2633
+ * passphrase: 'top secret',
2634
+ * },
2635
+ * }, (err, publicKey, privateKey) => {
2636
+ * // Handle errors and use the generated key pair.
2637
+ * });
2638
+ * ```
2639
+ *
2640
+ * On completion, `callback` will be called with `err` set to `undefined` and`publicKey` / `privateKey` representing the generated key pair.
2641
+ *
2642
+ * If this method is invoked as its `util.promisify()` ed version, it returns
2643
+ * a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
2644
+ * @since v10.12.0
2645
+ * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2646
+ */
2647
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2648
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2649
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2650
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2651
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2652
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2653
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2654
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2655
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2656
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2657
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2658
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2659
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2660
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2661
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2662
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2663
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2664
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2665
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2666
+ function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2667
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2668
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2669
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2670
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2671
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2672
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2673
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2674
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2675
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2676
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2677
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2678
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2679
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2680
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2681
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2682
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2683
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2684
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2685
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2686
+ function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2687
+ namespace generateKeyPair {
2688
+ function __promisify__(
2689
+ type: 'rsa',
2690
+ options: RSAKeyPairOptions<'pem', 'pem'>
2691
+ ): Promise<{
2692
+ publicKey: string;
2693
+ privateKey: string;
2694
+ }>;
2695
+ function __promisify__(
2696
+ type: 'rsa',
2697
+ options: RSAKeyPairOptions<'pem', 'der'>
2698
+ ): Promise<{
2699
+ publicKey: string;
2700
+ privateKey: Buffer;
2701
+ }>;
2702
+ function __promisify__(
2703
+ type: 'rsa',
2704
+ options: RSAKeyPairOptions<'der', 'pem'>
2705
+ ): Promise<{
2706
+ publicKey: Buffer;
2707
+ privateKey: string;
2708
+ }>;
2709
+ function __promisify__(
2710
+ type: 'rsa',
2711
+ options: RSAKeyPairOptions<'der', 'der'>
2712
+ ): Promise<{
2713
+ publicKey: Buffer;
2714
+ privateKey: Buffer;
2715
+ }>;
2716
+ function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2717
+ function __promisify__(
2718
+ type: 'rsa-pss',
2719
+ options: RSAPSSKeyPairOptions<'pem', 'pem'>
2720
+ ): Promise<{
2721
+ publicKey: string;
2722
+ privateKey: string;
2723
+ }>;
2724
+ function __promisify__(
2725
+ type: 'rsa-pss',
2726
+ options: RSAPSSKeyPairOptions<'pem', 'der'>
2727
+ ): Promise<{
2728
+ publicKey: string;
2729
+ privateKey: Buffer;
2730
+ }>;
2731
+ function __promisify__(
2732
+ type: 'rsa-pss',
2733
+ options: RSAPSSKeyPairOptions<'der', 'pem'>
2734
+ ): Promise<{
2735
+ publicKey: Buffer;
2736
+ privateKey: string;
2737
+ }>;
2738
+ function __promisify__(
2739
+ type: 'rsa-pss',
2740
+ options: RSAPSSKeyPairOptions<'der', 'der'>
2741
+ ): Promise<{
2742
+ publicKey: Buffer;
2743
+ privateKey: Buffer;
2744
+ }>;
2745
+ function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2746
+ function __promisify__(
2747
+ type: 'dsa',
2748
+ options: DSAKeyPairOptions<'pem', 'pem'>
2749
+ ): Promise<{
2750
+ publicKey: string;
2751
+ privateKey: string;
2752
+ }>;
2753
+ function __promisify__(
2754
+ type: 'dsa',
2755
+ options: DSAKeyPairOptions<'pem', 'der'>
2756
+ ): Promise<{
2757
+ publicKey: string;
2758
+ privateKey: Buffer;
2759
+ }>;
2760
+ function __promisify__(
2761
+ type: 'dsa',
2762
+ options: DSAKeyPairOptions<'der', 'pem'>
2763
+ ): Promise<{
2764
+ publicKey: Buffer;
2765
+ privateKey: string;
2766
+ }>;
2767
+ function __promisify__(
2768
+ type: 'dsa',
2769
+ options: DSAKeyPairOptions<'der', 'der'>
2770
+ ): Promise<{
2771
+ publicKey: Buffer;
2772
+ privateKey: Buffer;
2773
+ }>;
2774
+ function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2775
+ function __promisify__(
2776
+ type: 'ec',
2777
+ options: ECKeyPairOptions<'pem', 'pem'>
2778
+ ): Promise<{
2779
+ publicKey: string;
2780
+ privateKey: string;
2781
+ }>;
2782
+ function __promisify__(
2783
+ type: 'ec',
2784
+ options: ECKeyPairOptions<'pem', 'der'>
2785
+ ): Promise<{
2786
+ publicKey: string;
2787
+ privateKey: Buffer;
2788
+ }>;
2789
+ function __promisify__(
2790
+ type: 'ec',
2791
+ options: ECKeyPairOptions<'der', 'pem'>
2792
+ ): Promise<{
2793
+ publicKey: Buffer;
2794
+ privateKey: string;
2795
+ }>;
2796
+ function __promisify__(
2797
+ type: 'ec',
2798
+ options: ECKeyPairOptions<'der', 'der'>
2799
+ ): Promise<{
2800
+ publicKey: Buffer;
2801
+ privateKey: Buffer;
2802
+ }>;
2803
+ function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2804
+ function __promisify__(
2805
+ type: 'ed25519',
2806
+ options: ED25519KeyPairOptions<'pem', 'pem'>
2807
+ ): Promise<{
2808
+ publicKey: string;
2809
+ privateKey: string;
2810
+ }>;
2811
+ function __promisify__(
2812
+ type: 'ed25519',
2813
+ options: ED25519KeyPairOptions<'pem', 'der'>
2814
+ ): Promise<{
2815
+ publicKey: string;
2816
+ privateKey: Buffer;
2817
+ }>;
2818
+ function __promisify__(
2819
+ type: 'ed25519',
2820
+ options: ED25519KeyPairOptions<'der', 'pem'>
2821
+ ): Promise<{
2822
+ publicKey: Buffer;
2823
+ privateKey: string;
2824
+ }>;
2825
+ function __promisify__(
2826
+ type: 'ed25519',
2827
+ options: ED25519KeyPairOptions<'der', 'der'>
2828
+ ): Promise<{
2829
+ publicKey: Buffer;
2830
+ privateKey: Buffer;
2831
+ }>;
2832
+ function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2833
+ function __promisify__(
2834
+ type: 'ed448',
2835
+ options: ED448KeyPairOptions<'pem', 'pem'>
2836
+ ): Promise<{
2837
+ publicKey: string;
2838
+ privateKey: string;
2839
+ }>;
2840
+ function __promisify__(
2841
+ type: 'ed448',
2842
+ options: ED448KeyPairOptions<'pem', 'der'>
2843
+ ): Promise<{
2844
+ publicKey: string;
2845
+ privateKey: Buffer;
2846
+ }>;
2847
+ function __promisify__(
2848
+ type: 'ed448',
2849
+ options: ED448KeyPairOptions<'der', 'pem'>
2850
+ ): Promise<{
2851
+ publicKey: Buffer;
2852
+ privateKey: string;
2853
+ }>;
2854
+ function __promisify__(
2855
+ type: 'ed448',
2856
+ options: ED448KeyPairOptions<'der', 'der'>
2857
+ ): Promise<{
2858
+ publicKey: Buffer;
2859
+ privateKey: Buffer;
2860
+ }>;
2861
+ function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2862
+ function __promisify__(
2863
+ type: 'x25519',
2864
+ options: X25519KeyPairOptions<'pem', 'pem'>
2865
+ ): Promise<{
2866
+ publicKey: string;
2867
+ privateKey: string;
2868
+ }>;
2869
+ function __promisify__(
2870
+ type: 'x25519',
2871
+ options: X25519KeyPairOptions<'pem', 'der'>
2872
+ ): Promise<{
2873
+ publicKey: string;
2874
+ privateKey: Buffer;
2875
+ }>;
2876
+ function __promisify__(
2877
+ type: 'x25519',
2878
+ options: X25519KeyPairOptions<'der', 'pem'>
2879
+ ): Promise<{
2880
+ publicKey: Buffer;
2881
+ privateKey: string;
2882
+ }>;
2883
+ function __promisify__(
2884
+ type: 'x25519',
2885
+ options: X25519KeyPairOptions<'der', 'der'>
2886
+ ): Promise<{
2887
+ publicKey: Buffer;
2888
+ privateKey: Buffer;
2889
+ }>;
2890
+ function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2891
+ function __promisify__(
2892
+ type: 'x448',
2893
+ options: X448KeyPairOptions<'pem', 'pem'>
2894
+ ): Promise<{
2895
+ publicKey: string;
2896
+ privateKey: string;
2897
+ }>;
2898
+ function __promisify__(
2899
+ type: 'x448',
2900
+ options: X448KeyPairOptions<'pem', 'der'>
2901
+ ): Promise<{
2902
+ publicKey: string;
2903
+ privateKey: Buffer;
2904
+ }>;
2905
+ function __promisify__(
2906
+ type: 'x448',
2907
+ options: X448KeyPairOptions<'der', 'pem'>
2908
+ ): Promise<{
2909
+ publicKey: Buffer;
2910
+ privateKey: string;
2911
+ }>;
2912
+ function __promisify__(
2913
+ type: 'x448',
2914
+ options: X448KeyPairOptions<'der', 'der'>
2915
+ ): Promise<{
2916
+ publicKey: Buffer;
2917
+ privateKey: Buffer;
2918
+ }>;
2919
+ function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2920
+ }
2921
+ /**
2922
+ * Calculates and returns the signature for `data` using the given private key and
2923
+ * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
2924
+ * dependent upon the key type (especially Ed25519 and Ed448).
2925
+ *
2926
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been
2927
+ * passed to {@link createPrivateKey}. If it is an object, the following
2928
+ * additional properties can be passed:
2929
+ *
2930
+ * If the `callback` function is provided this function uses libuv's threadpool.
2931
+ * @since v12.0.0
2932
+ */
2933
+ function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
2934
+ function sign(
2935
+ algorithm: string | null | undefined,
2936
+ data: NodeJS.ArrayBufferView,
2937
+ key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
2938
+ callback: (error: Error | null, data: Buffer) => void
2939
+ ): void;
2940
+ /**
2941
+ * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
2942
+ * key type (especially Ed25519 and Ed448).
2943
+ *
2944
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been
2945
+ * passed to {@link createPublicKey}. If it is an object, the following
2946
+ * additional properties can be passed:
2947
+ *
2948
+ * The `signature` argument is the previously calculated signature for the `data`.
2949
+ *
2950
+ * Because public keys can be derived from private keys, a private key or a public
2951
+ * key may be passed for `key`.
2952
+ *
2953
+ * If the `callback` function is provided this function uses libuv's threadpool.
2954
+ * @since v12.0.0
2955
+ */
2956
+ function verify(
2957
+ algorithm: string | null | undefined,
2958
+ data: NodeJS.ArrayBufferView,
2959
+ key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2960
+ signature: NodeJS.ArrayBufferView
2961
+ ): boolean;
2962
+ function verify(
2963
+ algorithm: string | null | undefined,
2964
+ data: NodeJS.ArrayBufferView,
2965
+ key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
2966
+ signature: NodeJS.ArrayBufferView,
2967
+ callback: (error: Error | null, result: boolean) => void
2968
+ ): void;
2969
+ /**
2970
+ * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
2971
+ * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'`(for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES).
2972
+ * @since v13.9.0, v12.17.0
2973
+ */
2974
+ function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
2975
+ type CipherMode = 'cbc' | 'ccm' | 'cfb' | 'ctr' | 'ecb' | 'gcm' | 'ocb' | 'ofb' | 'stream' | 'wrap' | 'xts';
2976
+ interface CipherInfoOptions {
2977
+ /**
2978
+ * A test key length.
2979
+ */
2980
+ keyLength?: number | undefined;
2981
+ /**
2982
+ * A test IV length.
2983
+ */
2984
+ ivLength?: number | undefined;
2985
+ }
2986
+ interface CipherInfo {
2987
+ /**
2988
+ * The name of the cipher.
2989
+ */
2990
+ name: string;
2991
+ /**
2992
+ * The nid of the cipher.
2993
+ */
2994
+ nid: number;
2995
+ /**
2996
+ * The block size of the cipher in bytes.
2997
+ * This property is omitted when mode is 'stream'.
2998
+ */
2999
+ blockSize?: number | undefined;
3000
+ /**
3001
+ * The expected or default initialization vector length in bytes.
3002
+ * This property is omitted if the cipher does not use an initialization vector.
3003
+ */
3004
+ ivLength?: number | undefined;
3005
+ /**
3006
+ * The expected or default key length in bytes.
3007
+ */
3008
+ keyLength: number;
3009
+ /**
3010
+ * The cipher mode.
3011
+ */
3012
+ mode: CipherMode;
3013
+ }
3014
+ /**
3015
+ * Returns information about a given cipher.
3016
+ *
3017
+ * Some ciphers accept variable length keys and initialization vectors. By default,
3018
+ * the `crypto.getCipherInfo()` method will return the default values for these
3019
+ * ciphers. To test if a given key length or iv length is acceptable for given
3020
+ * cipher, use the `keyLength` and `ivLength` options. If the given values are
3021
+ * unacceptable, `undefined` will be returned.
3022
+ * @since v15.0.0
3023
+ * @param nameOrNid The name or nid of the cipher to query.
3024
+ */
3025
+ function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined;
3026
+ /**
3027
+ * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`,`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes.
3028
+ *
3029
+ * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set;
3030
+ * otherwise `err` will be `null`. The successfully generated `derivedKey` will
3031
+ * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any
3032
+ * of the input arguments specify invalid values or types.
3033
+ *
3034
+ * ```js
3035
+ * import { Buffer } from 'node:buffer';
3036
+ * const {
3037
+ * hkdf,
3038
+ * } = await import('node:crypto');
3039
+ *
3040
+ * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => {
3041
+ * if (err) throw err;
3042
+ * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
3043
+ * });
3044
+ * ```
3045
+ * @since v15.0.0
3046
+ * @param digest The digest algorithm to use.
3047
+ * @param ikm The input keying material. Must be provided but can be zero-length.
3048
+ * @param salt The salt value. Must be provided but can be zero-length.
3049
+ * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
3050
+ * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
3051
+ * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
3052
+ */
3053
+ function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void;
3054
+ /**
3055
+ * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
3056
+ * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
3057
+ *
3058
+ * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).
3059
+ *
3060
+ * An error will be thrown if any of the input arguments specify invalid values or
3061
+ * types, or if the derived key cannot be generated.
3062
+ *
3063
+ * ```js
3064
+ * import { Buffer } from 'node:buffer';
3065
+ * const {
3066
+ * hkdfSync,
3067
+ * } = await import('node:crypto');
3068
+ *
3069
+ * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64);
3070
+ * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
3071
+ * ```
3072
+ * @since v15.0.0
3073
+ * @param digest The digest algorithm to use.
3074
+ * @param ikm The input keying material. Must be provided but can be zero-length.
3075
+ * @param salt The salt value. Must be provided but can be zero-length.
3076
+ * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
3077
+ * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
3078
+ * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
3079
+ */
3080
+ function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer;
3081
+ interface SecureHeapUsage {
3082
+ /**
3083
+ * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
3084
+ */
3085
+ total: number;
3086
+ /**
3087
+ * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag.
3088
+ */
3089
+ min: number;
3090
+ /**
3091
+ * The total number of bytes currently allocated from the secure heap.
3092
+ */
3093
+ used: number;
3094
+ /**
3095
+ * The calculated ratio of `used` to `total` allocated bytes.
3096
+ */
3097
+ utilization: number;
3098
+ }
3099
+ /**
3100
+ * @since v15.6.0
3101
+ */
3102
+ function secureHeapUsed(): SecureHeapUsage;
3103
+ interface RandomUUIDOptions {
3104
+ /**
3105
+ * By default, to improve performance,
3106
+ * Node.js will pre-emptively generate and persistently cache enough
3107
+ * random data to generate up to 128 random UUIDs. To generate a UUID
3108
+ * without using the cache, set `disableEntropyCache` to `true`.
3109
+ *
3110
+ * @default `false`
3111
+ */
3112
+ disableEntropyCache?: boolean | undefined;
3113
+ }
3114
+ /**
3115
+ * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
3116
+ * cryptographic pseudorandom number generator.
3117
+ * @since v15.6.0, v14.17.0
3118
+ */
3119
+ function randomUUID(options?: RandomUUIDOptions): string;
3120
+ interface X509CheckOptions {
3121
+ /**
3122
+ * @default 'always'
3123
+ */
3124
+ subject?: 'always' | 'default' | 'never';
3125
+ /**
3126
+ * @default true
3127
+ */
3128
+ wildcards?: boolean;
3129
+ /**
3130
+ * @default true
3131
+ */
3132
+ partialWildcards?: boolean;
3133
+ /**
3134
+ * @default false
3135
+ */
3136
+ multiLabelWildcards?: boolean;
3137
+ /**
3138
+ * @default false
3139
+ */
3140
+ singleLabelSubdomains?: boolean;
3141
+ }
3142
+ /**
3143
+ * Encapsulates an X509 certificate and provides read-only access to
3144
+ * its information.
3145
+ *
3146
+ * ```js
3147
+ * const { X509Certificate } = await import('node:crypto');
3148
+ *
3149
+ * const x509 = new X509Certificate('{... pem encoded cert ...}');
3150
+ *
3151
+ * console.log(x509.subject);
3152
+ * ```
3153
+ * @since v15.6.0
3154
+ */
3155
+ class X509Certificate {
3156
+ /**
3157
+ * Will be \`true\` if this is a Certificate Authority (CA) certificate.
3158
+ * @since v15.6.0
3159
+ */
3160
+ readonly ca: boolean;
3161
+ /**
3162
+ * The SHA-1 fingerprint of this certificate.
3163
+ *
3164
+ * Because SHA-1 is cryptographically broken and because the security of SHA-1 is
3165
+ * significantly worse than that of algorithms that are commonly used to sign
3166
+ * certificates, consider using `x509.fingerprint256` instead.
3167
+ * @since v15.6.0
3168
+ */
3169
+ readonly fingerprint: string;
3170
+ /**
3171
+ * The SHA-256 fingerprint of this certificate.
3172
+ * @since v15.6.0
3173
+ */
3174
+ readonly fingerprint256: string;
3175
+ /**
3176
+ * The SHA-512 fingerprint of this certificate.
3177
+ *
3178
+ * Because computing the SHA-256 fingerprint is usually faster and because it is
3179
+ * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be
3180
+ * a better choice. While SHA-512 presumably provides a higher level of security in
3181
+ * general, the security of SHA-256 matches that of most algorithms that are
3182
+ * commonly used to sign certificates.
3183
+ * @since v17.2.0, v16.14.0
3184
+ */
3185
+ readonly fingerprint512: string;
3186
+ /**
3187
+ * The complete subject of this certificate.
3188
+ * @since v15.6.0
3189
+ */
3190
+ readonly subject: string;
3191
+ /**
3192
+ * The subject alternative name specified for this certificate.
3193
+ *
3194
+ * This is a comma-separated list of subject alternative names. Each entry begins
3195
+ * with a string identifying the kind of the subject alternative name followed by
3196
+ * a colon and the value associated with the entry.
3197
+ *
3198
+ * Earlier versions of Node.js incorrectly assumed that it is safe to split this
3199
+ * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However,
3200
+ * both malicious and legitimate certificates can contain subject alternative names
3201
+ * that include this sequence when represented as a string.
3202
+ *
3203
+ * After the prefix denoting the type of the entry, the remainder of each entry
3204
+ * might be enclosed in quotes to indicate that the value is a JSON string literal.
3205
+ * For backward compatibility, Node.js only uses JSON string literals within this
3206
+ * property when necessary to avoid ambiguity. Third-party code should be prepared
3207
+ * to handle both possible entry formats.
3208
+ * @since v15.6.0
3209
+ */
3210
+ readonly subjectAltName: string | undefined;
3211
+ /**
3212
+ * A textual representation of the certificate's authority information access
3213
+ * extension.
3214
+ *
3215
+ * This is a line feed separated list of access descriptions. Each line begins with
3216
+ * the access method and the kind of the access location, followed by a colon and
3217
+ * the value associated with the access location.
3218
+ *
3219
+ * After the prefix denoting the access method and the kind of the access location,
3220
+ * the remainder of each line might be enclosed in quotes to indicate that the
3221
+ * value is a JSON string literal. For backward compatibility, Node.js only uses
3222
+ * JSON string literals within this property when necessary to avoid ambiguity.
3223
+ * Third-party code should be prepared to handle both possible entry formats.
3224
+ * @since v15.6.0
3225
+ */
3226
+ readonly infoAccess: string | undefined;
3227
+ /**
3228
+ * An array detailing the key usages for this certificate.
3229
+ * @since v15.6.0
3230
+ */
3231
+ readonly keyUsage: string[];
3232
+ /**
3233
+ * The issuer identification included in this certificate.
3234
+ * @since v15.6.0
3235
+ */
3236
+ readonly issuer: string;
3237
+ /**
3238
+ * The issuer certificate or `undefined` if the issuer certificate is not
3239
+ * available.
3240
+ * @since v15.9.0
3241
+ */
3242
+ readonly issuerCertificate?: X509Certificate | undefined;
3243
+ /**
3244
+ * The public key `KeyObject` for this certificate.
3245
+ * @since v15.6.0
3246
+ */
3247
+ readonly publicKey: KeyObject;
3248
+ /**
3249
+ * A `Buffer` containing the DER encoding of this certificate.
3250
+ * @since v15.6.0
3251
+ */
3252
+ readonly raw: Buffer;
3253
+ /**
3254
+ * The serial number of this certificate.
3255
+ *
3256
+ * Serial numbers are assigned by certificate authorities and do not uniquely
3257
+ * identify certificates. Consider using `x509.fingerprint256` as a unique
3258
+ * identifier instead.
3259
+ * @since v15.6.0
3260
+ */
3261
+ readonly serialNumber: string;
3262
+ /**
3263
+ * The date/time from which this certificate is considered valid.
3264
+ * @since v15.6.0
3265
+ */
3266
+ readonly validFrom: string;
3267
+ /**
3268
+ * The date/time until which this certificate is considered valid.
3269
+ * @since v15.6.0
3270
+ */
3271
+ readonly validTo: string;
3272
+ constructor(buffer: BinaryLike);
3273
+ /**
3274
+ * Checks whether the certificate matches the given email address.
3275
+ *
3276
+ * If the `'subject'` option is undefined or set to `'default'`, the certificate
3277
+ * subject is only considered if the subject alternative name extension either does
3278
+ * not exist or does not contain any email addresses.
3279
+ *
3280
+ * If the `'subject'` option is set to `'always'` and if the subject alternative
3281
+ * name extension either does not exist or does not contain a matching email
3282
+ * address, the certificate subject is considered.
3283
+ *
3284
+ * If the `'subject'` option is set to `'never'`, the certificate subject is never
3285
+ * considered, even if the certificate contains no subject alternative names.
3286
+ * @since v15.6.0
3287
+ * @return Returns `email` if the certificate matches, `undefined` if it does not.
3288
+ */
3289
+ checkEmail(email: string, options?: Pick<X509CheckOptions, 'subject'>): string | undefined;
3290
+ /**
3291
+ * Checks whether the certificate matches the given host name.
3292
+ *
3293
+ * If the certificate matches the given host name, the matching subject name is
3294
+ * returned. The returned name might be an exact match (e.g., `foo.example.com`)
3295
+ * or it might contain wildcards (e.g., `*.example.com`). Because host name
3296
+ * comparisons are case-insensitive, the returned subject name might also differ
3297
+ * from the given `name` in capitalization.
3298
+ *
3299
+ * If the `'subject'` option is undefined or set to `'default'`, the certificate
3300
+ * subject is only considered if the subject alternative name extension either does
3301
+ * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS").
3302
+ *
3303
+ * If the `'subject'` option is set to `'always'` and if the subject alternative
3304
+ * name extension either does not exist or does not contain a matching DNS name,
3305
+ * the certificate subject is considered.
3306
+ *
3307
+ * If the `'subject'` option is set to `'never'`, the certificate subject is never
3308
+ * considered, even if the certificate contains no subject alternative names.
3309
+ * @since v15.6.0
3310
+ * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`.
3311
+ */
3312
+ checkHost(name: string, options?: X509CheckOptions): string | undefined;
3313
+ /**
3314
+ * Checks whether the certificate matches the given IP address (IPv4 or IPv6).
3315
+ *
3316
+ * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they
3317
+ * must match the given `ip` address exactly. Other subject alternative names as
3318
+ * well as the subject field of the certificate are ignored.
3319
+ * @since v15.6.0
3320
+ * @return Returns `ip` if the certificate matches, `undefined` if it does not.
3321
+ */
3322
+ checkIP(ip: string): string | undefined;
3323
+ /**
3324
+ * Checks whether this certificate was issued by the given `otherCert`.
3325
+ * @since v15.6.0
3326
+ */
3327
+ checkIssued(otherCert: X509Certificate): boolean;
3328
+ /**
3329
+ * Checks whether the public key for this certificate is consistent with
3330
+ * the given private key.
3331
+ * @since v15.6.0
3332
+ * @param privateKey A private key.
3333
+ */
3334
+ checkPrivateKey(privateKey: KeyObject): boolean;
3335
+ /**
3336
+ * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded
3337
+ * certificate.
3338
+ * @since v15.6.0
3339
+ */
3340
+ toJSON(): string;
3341
+ /**
3342
+ * Returns information about this certificate using the legacy `certificate object` encoding.
3343
+ * @since v15.6.0
3344
+ */
3345
+ toLegacyObject(): PeerCertificate;
3346
+ /**
3347
+ * Returns the PEM-encoded certificate.
3348
+ * @since v15.6.0
3349
+ */
3350
+ toString(): string;
3351
+ /**
3352
+ * Verifies that this certificate was signed by the given public key.
3353
+ * Does not perform any other validation checks on the certificate.
3354
+ * @since v15.6.0
3355
+ * @param publicKey A public key.
3356
+ */
3357
+ verify(publicKey: KeyObject): boolean;
3358
+ }
3359
+ type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint;
3360
+ interface GeneratePrimeOptions {
3361
+ add?: LargeNumberLike | undefined;
3362
+ rem?: LargeNumberLike | undefined;
3363
+ /**
3364
+ * @default false
3365
+ */
3366
+ safe?: boolean | undefined;
3367
+ bigint?: boolean | undefined;
3368
+ }
3369
+ interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions {
3370
+ bigint: true;
3371
+ }
3372
+ interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions {
3373
+ bigint?: false | undefined;
3374
+ }
3375
+ /**
3376
+ * Generates a pseudorandom prime of `size` bits.
3377
+ *
3378
+ * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime.
3379
+ *
3380
+ * The `options.add` and `options.rem` parameters can be used to enforce additional
3381
+ * requirements, e.g., for Diffie-Hellman:
3382
+ *
3383
+ * * If `options.add` and `options.rem` are both set, the prime will satisfy the
3384
+ * condition that `prime % add = rem`.
3385
+ * * If only `options.add` is set and `options.safe` is not `true`, the prime will
3386
+ * satisfy the condition that `prime % add = 1`.
3387
+ * * If only `options.add` is set and `options.safe` is set to `true`, the prime
3388
+ * will instead satisfy the condition that `prime % add = 3`. This is necessary
3389
+ * because `prime % add = 1` for `options.add > 2` would contradict the condition
3390
+ * enforced by `options.safe`.
3391
+ * * `options.rem` is ignored if `options.add` is not given.
3392
+ *
3393
+ * Both `options.add` and `options.rem` must be encoded as big-endian sequences
3394
+ * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`.
3395
+ *
3396
+ * By default, the prime is encoded as a big-endian sequence of octets
3397
+ * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
3398
+ * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided.
3399
+ * @since v15.8.0
3400
+ * @param size The size (in bits) of the prime to generate.
3401
+ */
3402
+ function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3403
+ function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void;
3404
+ function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3405
+ function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void;
3406
+ /**
3407
+ * Generates a pseudorandom prime of `size` bits.
3408
+ *
3409
+ * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime.
3410
+ *
3411
+ * The `options.add` and `options.rem` parameters can be used to enforce additional
3412
+ * requirements, e.g., for Diffie-Hellman:
3413
+ *
3414
+ * * If `options.add` and `options.rem` are both set, the prime will satisfy the
3415
+ * condition that `prime % add = rem`.
3416
+ * * If only `options.add` is set and `options.safe` is not `true`, the prime will
3417
+ * satisfy the condition that `prime % add = 1`.
3418
+ * * If only `options.add` is set and `options.safe` is set to `true`, the prime
3419
+ * will instead satisfy the condition that `prime % add = 3`. This is necessary
3420
+ * because `prime % add = 1` for `options.add > 2` would contradict the condition
3421
+ * enforced by `options.safe`.
3422
+ * * `options.rem` is ignored if `options.add` is not given.
3423
+ *
3424
+ * Both `options.add` and `options.rem` must be encoded as big-endian sequences
3425
+ * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`.
3426
+ *
3427
+ * By default, the prime is encoded as a big-endian sequence of octets
3428
+ * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
3429
+ * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided.
3430
+ * @since v15.8.0
3431
+ * @param size The size (in bits) of the prime to generate.
3432
+ */
3433
+ function generatePrimeSync(size: number): ArrayBuffer;
3434
+ function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint;
3435
+ function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer;
3436
+ function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint;
3437
+ interface CheckPrimeOptions {
3438
+ /**
3439
+ * The number of Miller-Rabin probabilistic primality iterations to perform.
3440
+ * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input.
3441
+ * Care must be used when selecting a number of checks.
3442
+ * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details.
3443
+ *
3444
+ * @default 0
3445
+ */
3446
+ checks?: number | undefined;
3447
+ }
3448
+ /**
3449
+ * Checks the primality of the `candidate`.
3450
+ * @since v15.8.0
3451
+ * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
3452
+ */
3453
+ function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
3454
+ function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void;
3455
+ /**
3456
+ * Checks the primality of the `candidate`.
3457
+ * @since v15.8.0
3458
+ * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
3459
+ * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`.
3460
+ */
3461
+ function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean;
3462
+ /**
3463
+ * Load and set the `engine` for some or all OpenSSL functions (selected by flags).
3464
+ *
3465
+ * `engine` could be either an id or a path to the engine's shared library.
3466
+ *
3467
+ * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags`is a bit field taking one of or a mix of the following flags (defined in`crypto.constants`):
3468
+ *
3469
+ * * `crypto.constants.ENGINE_METHOD_RSA`
3470
+ * * `crypto.constants.ENGINE_METHOD_DSA`
3471
+ * * `crypto.constants.ENGINE_METHOD_DH`
3472
+ * * `crypto.constants.ENGINE_METHOD_RAND`
3473
+ * * `crypto.constants.ENGINE_METHOD_EC`
3474
+ * * `crypto.constants.ENGINE_METHOD_CIPHERS`
3475
+ * * `crypto.constants.ENGINE_METHOD_DIGESTS`
3476
+ * * `crypto.constants.ENGINE_METHOD_PKEY_METHS`
3477
+ * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS`
3478
+ * * `crypto.constants.ENGINE_METHOD_ALL`
3479
+ * * `crypto.constants.ENGINE_METHOD_NONE`
3480
+ * @since v0.11.11
3481
+ * @param flags
3482
+ */
3483
+ function setEngine(engine: string, flags?: number): void;
3484
+ /**
3485
+ * A convenient alias for {@link webcrypto.getRandomValues}. This
3486
+ * implementation is not compliant with the Web Crypto spec, to write
3487
+ * web-compatible code use {@link webcrypto.getRandomValues} instead.
3488
+ * @since v17.4.0
3489
+ * @return Returns `typedArray`.
3490
+ */
3491
+ function getRandomValues<T extends webcrypto.BufferSource>(typedArray: T): T;
3492
+ /**
3493
+ * A convenient alias for `crypto.webcrypto.subtle`.
3494
+ * @since v17.4.0
3495
+ */
3496
+ const subtle: webcrypto.SubtleCrypto;
3497
+ /**
3498
+ * An implementation of the Web Crypto API standard.
3499
+ *
3500
+ * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details.
3501
+ * @since v15.0.0
3502
+ */
3503
+ const webcrypto: webcrypto.Crypto;
3504
+ namespace webcrypto {
3505
+ type BufferSource = ArrayBufferView | ArrayBuffer;
3506
+ type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki';
3507
+ type KeyType = 'private' | 'public' | 'secret';
3508
+ type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey';
3509
+ type AlgorithmIdentifier = Algorithm | string;
3510
+ type HashAlgorithmIdentifier = AlgorithmIdentifier;
3511
+ type NamedCurve = string;
3512
+ type BigInteger = Uint8Array;
3513
+ interface AesCbcParams extends Algorithm {
3514
+ iv: BufferSource;
3515
+ }
3516
+ interface AesCtrParams extends Algorithm {
3517
+ counter: BufferSource;
3518
+ length: number;
3519
+ }
3520
+ interface AesDerivedKeyParams extends Algorithm {
3521
+ length: number;
3522
+ }
3523
+ interface AesGcmParams extends Algorithm {
3524
+ additionalData?: BufferSource;
3525
+ iv: BufferSource;
3526
+ tagLength?: number;
3527
+ }
3528
+ interface AesKeyAlgorithm extends KeyAlgorithm {
3529
+ length: number;
3530
+ }
3531
+ interface AesKeyGenParams extends Algorithm {
3532
+ length: number;
3533
+ }
3534
+ interface Algorithm {
3535
+ name: string;
3536
+ }
3537
+ interface EcKeyAlgorithm extends KeyAlgorithm {
3538
+ namedCurve: NamedCurve;
3539
+ }
3540
+ interface EcKeyGenParams extends Algorithm {
3541
+ namedCurve: NamedCurve;
3542
+ }
3543
+ interface EcKeyImportParams extends Algorithm {
3544
+ namedCurve: NamedCurve;
3545
+ }
3546
+ interface EcdhKeyDeriveParams extends Algorithm {
3547
+ public: CryptoKey;
3548
+ }
3549
+ interface EcdsaParams extends Algorithm {
3550
+ hash: HashAlgorithmIdentifier;
3551
+ }
3552
+ interface Ed448Params extends Algorithm {
3553
+ context?: BufferSource;
3554
+ }
3555
+ interface HkdfParams extends Algorithm {
3556
+ hash: HashAlgorithmIdentifier;
3557
+ info: BufferSource;
3558
+ salt: BufferSource;
3559
+ }
3560
+ interface HmacImportParams extends Algorithm {
3561
+ hash: HashAlgorithmIdentifier;
3562
+ length?: number;
3563
+ }
3564
+ interface HmacKeyAlgorithm extends KeyAlgorithm {
3565
+ hash: KeyAlgorithm;
3566
+ length: number;
3567
+ }
3568
+ interface HmacKeyGenParams extends Algorithm {
3569
+ hash: HashAlgorithmIdentifier;
3570
+ length?: number;
3571
+ }
3572
+ interface JsonWebKey {
3573
+ alg?: string;
3574
+ crv?: string;
3575
+ d?: string;
3576
+ dp?: string;
3577
+ dq?: string;
3578
+ e?: string;
3579
+ ext?: boolean;
3580
+ k?: string;
3581
+ key_ops?: string[];
3582
+ kty?: string;
3583
+ n?: string;
3584
+ oth?: RsaOtherPrimesInfo[];
3585
+ p?: string;
3586
+ q?: string;
3587
+ qi?: string;
3588
+ use?: string;
3589
+ x?: string;
3590
+ y?: string;
3591
+ }
3592
+ interface KeyAlgorithm {
3593
+ name: string;
3594
+ }
3595
+ interface Pbkdf2Params extends Algorithm {
3596
+ hash: HashAlgorithmIdentifier;
3597
+ iterations: number;
3598
+ salt: BufferSource;
3599
+ }
3600
+ interface RsaHashedImportParams extends Algorithm {
3601
+ hash: HashAlgorithmIdentifier;
3602
+ }
3603
+ interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
3604
+ hash: KeyAlgorithm;
3605
+ }
3606
+ interface RsaHashedKeyGenParams extends RsaKeyGenParams {
3607
+ hash: HashAlgorithmIdentifier;
3608
+ }
3609
+ interface RsaKeyAlgorithm extends KeyAlgorithm {
3610
+ modulusLength: number;
3611
+ publicExponent: BigInteger;
3612
+ }
3613
+ interface RsaKeyGenParams extends Algorithm {
3614
+ modulusLength: number;
3615
+ publicExponent: BigInteger;
3616
+ }
3617
+ interface RsaOaepParams extends Algorithm {
3618
+ label?: BufferSource;
3619
+ }
3620
+ interface RsaOtherPrimesInfo {
3621
+ d?: string;
3622
+ r?: string;
3623
+ t?: string;
3624
+ }
3625
+ interface RsaPssParams extends Algorithm {
3626
+ saltLength: number;
3627
+ }
3628
+ /**
3629
+ * Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class.
3630
+ * `Crypto` is a singleton that provides access to the remainder of the crypto API.
3631
+ * @since v15.0.0
3632
+ */
3633
+ interface Crypto {
3634
+ /**
3635
+ * Provides access to the `SubtleCrypto` API.
3636
+ * @since v15.0.0
3637
+ */
3638
+ readonly subtle: SubtleCrypto;
3639
+ /**
3640
+ * Generates cryptographically strong random values.
3641
+ * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned.
3642
+ *
3643
+ * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted.
3644
+ *
3645
+ * An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
3646
+ * @since v15.0.0
3647
+ */
3648
+ getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(typedArray: T): T;
3649
+ /**
3650
+ * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
3651
+ * The UUID is generated using a cryptographic pseudorandom number generator.
3652
+ * @since v16.7.0
3653
+ */
3654
+ randomUUID(): string;
3655
+ CryptoKey: CryptoKeyConstructor;
3656
+ }
3657
+ // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
3658
+ interface CryptoKeyConstructor {
3659
+ /** Illegal constructor */
3660
+ (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
3661
+ readonly length: 0;
3662
+ readonly name: 'CryptoKey';
3663
+ readonly prototype: CryptoKey;
3664
+ }
3665
+ /**
3666
+ * @since v15.0.0
3667
+ */
3668
+ interface CryptoKey {
3669
+ /**
3670
+ * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters.
3671
+ * @since v15.0.0
3672
+ */
3673
+ readonly algorithm: KeyAlgorithm;
3674
+ /**
3675
+ * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`.
3676
+ * @since v15.0.0
3677
+ */
3678
+ readonly extractable: boolean;
3679
+ /**
3680
+ * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key.
3681
+ * @since v15.0.0
3682
+ */
3683
+ readonly type: KeyType;
3684
+ /**
3685
+ * An array of strings identifying the operations for which the key may be used.
3686
+ *
3687
+ * The possible usages are:
3688
+ * - `'encrypt'` - The key may be used to encrypt data.
3689
+ * - `'decrypt'` - The key may be used to decrypt data.
3690
+ * - `'sign'` - The key may be used to generate digital signatures.
3691
+ * - `'verify'` - The key may be used to verify digital signatures.
3692
+ * - `'deriveKey'` - The key may be used to derive a new key.
3693
+ * - `'deriveBits'` - The key may be used to derive bits.
3694
+ * - `'wrapKey'` - The key may be used to wrap another key.
3695
+ * - `'unwrapKey'` - The key may be used to unwrap another key.
3696
+ *
3697
+ * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`).
3698
+ * @since v15.0.0
3699
+ */
3700
+ readonly usages: KeyUsage[];
3701
+ }
3702
+ /**
3703
+ * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair.
3704
+ * @since v15.0.0
3705
+ */
3706
+ interface CryptoKeyPair {
3707
+ /**
3708
+ * A {@link CryptoKey} whose type will be `'private'`.
3709
+ * @since v15.0.0
3710
+ */
3711
+ privateKey: CryptoKey;
3712
+ /**
3713
+ * A {@link CryptoKey} whose type will be `'public'`.
3714
+ * @since v15.0.0
3715
+ */
3716
+ publicKey: CryptoKey;
3717
+ }
3718
+ /**
3719
+ * @since v15.0.0
3720
+ */
3721
+ interface SubtleCrypto {
3722
+ /**
3723
+ * Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
3724
+ * `subtle.decrypt()` attempts to decipher the provided `data`. If successful,
3725
+ * the returned promise will be resolved with an `<ArrayBuffer>` containing the plaintext result.
3726
+ *
3727
+ * The algorithms currently supported include:
3728
+ *
3729
+ * - `'RSA-OAEP'`
3730
+ * - `'AES-CTR'`
3731
+ * - `'AES-CBC'`
3732
+ * - `'AES-GCM'`
3733
+ * @since v15.0.0
3734
+ */
3735
+ decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
3736
+ /**
3737
+ * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
3738
+ * `subtle.deriveBits()` attempts to generate `length` bits.
3739
+ * The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
3740
+ * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
3741
+ * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
3742
+ * If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
3743
+ *
3744
+ * The algorithms currently supported include:
3745
+ *
3746
+ * - `'ECDH'`
3747
+ * - `'X25519'`
3748
+ * - `'X448'`
3749
+ * - `'HKDF'`
3750
+ * - `'PBKDF2'`
3751
+ * @since v15.0.0
3752
+ */
3753
+ deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
3754
+ deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
3755
+ /**
3756
+ * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
3757
+ * `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
3758
+ *
3759
+ * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
3760
+ * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
3761
+ *
3762
+ * The algorithms currently supported include:
3763
+ *
3764
+ * - `'ECDH'`
3765
+ * - `'X25519'`
3766
+ * - `'X448'`
3767
+ * - `'HKDF'`
3768
+ * - `'PBKDF2'`
3769
+ * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
3770
+ * @since v15.0.0
3771
+ */
3772
+ deriveKey(
3773
+ algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
3774
+ baseKey: CryptoKey,
3775
+ derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params,
3776
+ extractable: boolean,
3777
+ keyUsages: ReadonlyArray<KeyUsage>
3778
+ ): Promise<CryptoKey>;
3779
+ /**
3780
+ * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
3781
+ * If successful, the returned promise is resolved with an `<ArrayBuffer>` containing the computed digest.
3782
+ *
3783
+ * If `algorithm` is provided as a `<string>`, it must be one of:
3784
+ *
3785
+ * - `'SHA-1'`
3786
+ * - `'SHA-256'`
3787
+ * - `'SHA-384'`
3788
+ * - `'SHA-512'`
3789
+ *
3790
+ * If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
3791
+ * @since v15.0.0
3792
+ */
3793
+ digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
3794
+ /**
3795
+ * Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
3796
+ * `subtle.encrypt()` attempts to encipher `data`. If successful,
3797
+ * the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
3798
+ *
3799
+ * The algorithms currently supported include:
3800
+ *
3801
+ * - `'RSA-OAEP'`
3802
+ * - `'AES-CTR'`
3803
+ * - `'AES-CBC'`
3804
+ * - `'AES-GCM'`
3805
+ * @since v15.0.0
3806
+ */
3807
+ encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
3808
+ /**
3809
+ * Exports the given key into the specified format, if supported.
3810
+ *
3811
+ * If the `<CryptoKey>` is not extractable, the returned promise will reject.
3812
+ *
3813
+ * When `format` is either `'pkcs8'` or `'spki'` and the export is successful,
3814
+ * the returned promise will be resolved with an `<ArrayBuffer>` containing the exported key data.
3815
+ *
3816
+ * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
3817
+ * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
3818
+ * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
3819
+ * @returns `<Promise>` containing `<ArrayBuffer>`.
3820
+ * @since v15.0.0
3821
+ */
3822
+ exportKey(format: 'jwk', key: CryptoKey): Promise<JsonWebKey>;
3823
+ exportKey(format: Exclude<KeyFormat, 'jwk'>, key: CryptoKey): Promise<ArrayBuffer>;
3824
+ /**
3825
+ * Using the method and parameters provided in `algorithm`,
3826
+ * `subtle.generateKey()` attempts to generate new keying material.
3827
+ * Depending the method used, the method may generate either a single `<CryptoKey>` or a `<CryptoKeyPair>`.
3828
+ *
3829
+ * The `<CryptoKeyPair>` (public and private key) generating algorithms supported include:
3830
+ *
3831
+ * - `'RSASSA-PKCS1-v1_5'`
3832
+ * - `'RSA-PSS'`
3833
+ * - `'RSA-OAEP'`
3834
+ * - `'ECDSA'`
3835
+ * - `'Ed25519'`
3836
+ * - `'Ed448'`
3837
+ * - `'ECDH'`
3838
+ * - `'X25519'`
3839
+ * - `'X448'`
3840
+ * The `<CryptoKey>` (secret key) generating algorithms supported include:
3841
+ *
3842
+ * - `'HMAC'`
3843
+ * - `'AES-CTR'`
3844
+ * - `'AES-CBC'`
3845
+ * - `'AES-GCM'`
3846
+ * - `'AES-KW'`
3847
+ * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
3848
+ * @since v15.0.0
3849
+ */
3850
+ generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
3851
+ generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
3852
+ generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
3853
+ /**
3854
+ * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
3855
+ * to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
3856
+ * If the import is successful, the returned promise will be resolved with the created `<CryptoKey>`.
3857
+ *
3858
+ * If importing a `'PBKDF2'` key, `extractable` must be `false`.
3859
+ * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
3860
+ * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
3861
+ * @since v15.0.0
3862
+ */
3863
+ importKey(
3864
+ format: 'jwk',
3865
+ keyData: JsonWebKey,
3866
+ algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
3867
+ extractable: boolean,
3868
+ keyUsages: ReadonlyArray<KeyUsage>
3869
+ ): Promise<CryptoKey>;
3870
+ importKey(
3871
+ format: Exclude<KeyFormat, 'jwk'>,
3872
+ keyData: BufferSource,
3873
+ algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
3874
+ extractable: boolean,
3875
+ keyUsages: KeyUsage[]
3876
+ ): Promise<CryptoKey>;
3877
+ /**
3878
+ * Using the method and parameters given by `algorithm` and the keying material provided by `key`,
3879
+ * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful,
3880
+ * the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
3881
+ *
3882
+ * The algorithms currently supported include:
3883
+ *
3884
+ * - `'RSASSA-PKCS1-v1_5'`
3885
+ * - `'RSA-PSS'`
3886
+ * - `'ECDSA'`
3887
+ * - `'Ed25519'`
3888
+ * - `'Ed448'`
3889
+ * - `'HMAC'`
3890
+ * @since v15.0.0
3891
+ */
3892
+ sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
3893
+ /**
3894
+ * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
3895
+ * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
3896
+ * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
3897
+ * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
3898
+ * If successful, the returned promise is resolved with a `<CryptoKey>` object.
3899
+ *
3900
+ * The wrapping algorithms currently supported include:
3901
+ *
3902
+ * - `'RSA-OAEP'`
3903
+ * - `'AES-CTR'`
3904
+ * - `'AES-CBC'`
3905
+ * - `'AES-GCM'`
3906
+ * - `'AES-KW'`
3907
+ *
3908
+ * The unwrapped key algorithms supported include:
3909
+ *
3910
+ * - `'RSASSA-PKCS1-v1_5'`
3911
+ * - `'RSA-PSS'`
3912
+ * - `'RSA-OAEP'`
3913
+ * - `'ECDSA'`
3914
+ * - `'Ed25519'`
3915
+ * - `'Ed448'`
3916
+ * - `'ECDH'`
3917
+ * - `'X25519'`
3918
+ * - `'X448'`
3919
+ * - `'HMAC'`
3920
+ * - `'AES-CTR'`
3921
+ * - `'AES-CBC'`
3922
+ * - `'AES-GCM'`
3923
+ * - `'AES-KW'`
3924
+ * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
3925
+ * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
3926
+ * @since v15.0.0
3927
+ */
3928
+ unwrapKey(
3929
+ format: KeyFormat,
3930
+ wrappedKey: BufferSource,
3931
+ unwrappingKey: CryptoKey,
3932
+ unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
3933
+ unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
3934
+ extractable: boolean,
3935
+ keyUsages: KeyUsage[]
3936
+ ): Promise<CryptoKey>;
3937
+ /**
3938
+ * Using the method and parameters given in `algorithm` and the keying material provided by `key`,
3939
+ * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`.
3940
+ * The returned promise is resolved with either `true` or `false`.
3941
+ *
3942
+ * The algorithms currently supported include:
3943
+ *
3944
+ * - `'RSASSA-PKCS1-v1_5'`
3945
+ * - `'RSA-PSS'`
3946
+ * - `'ECDSA'`
3947
+ * - `'Ed25519'`
3948
+ * - `'Ed448'`
3949
+ * - `'HMAC'`
3950
+ * @since v15.0.0
3951
+ */
3952
+ verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
3953
+ /**
3954
+ * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
3955
+ * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
3956
+ * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
3957
+ * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
3958
+ * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
3959
+ * If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the encrypted key data.
3960
+ *
3961
+ * The wrapping algorithms currently supported include:
3962
+ *
3963
+ * - `'RSA-OAEP'`
3964
+ * - `'AES-CTR'`
3965
+ * - `'AES-CBC'`
3966
+ * - `'AES-GCM'`
3967
+ * - `'AES-KW'`
3968
+ * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
3969
+ * @since v15.0.0
3970
+ */
3971
+ wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
3972
+ }
3973
+ }
3974
+ }
3975
+ declare module 'node:crypto' {
3976
+ export * from 'crypto';
3977
+ }