isomorfeus-puppetmaster 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (932) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isomorfeus/puppetmaster/driver/puppeteer.rb +21 -18
  3. data/lib/isomorfeus/puppetmaster/driver_registration.rb +4 -4
  4. data/lib/isomorfeus/puppetmaster/server_registration.rb +0 -52
  5. data/lib/isomorfeus/puppetmaster/version.rb +1 -1
  6. data/lib/isomorfeus/puppetmaster.rb +6 -3
  7. data/lib/isomorfeus-puppetmaster.rb +2 -1
  8. data/node_modules/.bin/extract-zip +12 -0
  9. data/node_modules/.bin/extract-zip.cmd +17 -0
  10. data/node_modules/.bin/extract-zip.ps1 +28 -0
  11. data/node_modules/.bin/mkdirp +12 -0
  12. data/node_modules/.bin/mkdirp.cmd +17 -0
  13. data/node_modules/.bin/mkdirp.ps1 +28 -0
  14. data/node_modules/.bin/rimraf +12 -0
  15. data/node_modules/.bin/rimraf.cmd +17 -0
  16. data/node_modules/.bin/rimraf.ps1 +28 -0
  17. data/node_modules/.package-lock.json +574 -0
  18. data/node_modules/@types/node/LICENSE +21 -0
  19. data/node_modules/@types/node/README.md +16 -0
  20. data/node_modules/@types/node/assert/strict.d.ts +8 -0
  21. data/node_modules/@types/node/assert.d.ts +912 -0
  22. data/node_modules/@types/node/async_hooks.d.ts +497 -0
  23. data/node_modules/@types/node/buffer.d.ts +2142 -0
  24. data/node_modules/@types/node/child_process.d.ts +1355 -0
  25. data/node_modules/@types/node/cluster.d.ts +414 -0
  26. data/node_modules/@types/node/console.d.ts +407 -0
  27. data/node_modules/@types/node/constants.d.ts +18 -0
  28. data/node_modules/@types/node/crypto.d.ts +3224 -0
  29. data/node_modules/@types/node/dgram.d.ts +545 -0
  30. data/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  31. data/node_modules/@types/node/dns/promises.d.ts +357 -0
  32. data/node_modules/@types/node/dns.d.ts +643 -0
  33. data/node_modules/@types/node/domain.d.ts +169 -0
  34. data/node_modules/@types/node/events.d.ts +623 -0
  35. data/node_modules/@types/node/fs/promises.d.ts +997 -0
  36. data/node_modules/@types/node/fs.d.ts +3723 -0
  37. data/node_modules/@types/node/globals.d.ts +285 -0
  38. data/node_modules/@types/node/globals.global.d.ts +1 -0
  39. data/node_modules/@types/node/http.d.ts +1358 -0
  40. data/node_modules/@types/node/http2.d.ts +2100 -0
  41. data/node_modules/@types/node/https.d.ts +391 -0
  42. data/node_modules/@types/node/index.d.ts +131 -0
  43. data/node_modules/@types/node/inspector.d.ts +2738 -0
  44. data/node_modules/@types/node/module.d.ts +114 -0
  45. data/node_modules/@types/node/net.d.ts +783 -0
  46. data/node_modules/@types/node/os.d.ts +455 -0
  47. data/node_modules/@types/node/package.json +230 -0
  48. data/node_modules/@types/node/path.d.ts +172 -0
  49. data/node_modules/@types/node/perf_hooks.d.ts +555 -0
  50. data/node_modules/@types/node/process.d.ts +1477 -0
  51. data/node_modules/@types/node/punycode.d.ts +117 -0
  52. data/node_modules/@types/node/querystring.d.ts +131 -0
  53. data/node_modules/@types/node/readline.d.ts +542 -0
  54. data/node_modules/@types/node/repl.d.ts +424 -0
  55. data/node_modules/@types/node/stream/consumers.d.ts +24 -0
  56. data/node_modules/@types/node/stream/promises.d.ts +42 -0
  57. data/node_modules/@types/node/stream/web.d.ts +6 -0
  58. data/node_modules/@types/node/stream.d.ts +1181 -0
  59. data/node_modules/@types/node/string_decoder.d.ts +67 -0
  60. data/node_modules/@types/node/timers/promises.d.ts +68 -0
  61. data/node_modules/@types/node/timers.d.ts +94 -0
  62. data/node_modules/@types/node/tls.d.ts +1019 -0
  63. data/node_modules/@types/node/trace_events.d.ts +161 -0
  64. data/node_modules/@types/node/tty.d.ts +206 -0
  65. data/node_modules/@types/node/url.d.ts +798 -0
  66. data/node_modules/@types/node/util.d.ts +1556 -0
  67. data/node_modules/@types/node/v8.d.ts +378 -0
  68. data/node_modules/@types/node/vm.d.ts +504 -0
  69. data/node_modules/@types/node/wasi.d.ts +153 -0
  70. data/node_modules/@types/node/worker_threads.d.ts +649 -0
  71. data/node_modules/@types/node/zlib.d.ts +517 -0
  72. data/node_modules/@types/yauzl/LICENSE +21 -0
  73. data/node_modules/@types/yauzl/README.md +16 -0
  74. data/node_modules/@types/yauzl/index.d.ts +98 -0
  75. data/node_modules/@types/yauzl/package.json +27 -0
  76. data/node_modules/agent-base/README.md +145 -0
  77. data/node_modules/agent-base/dist/src/index.d.ts +78 -0
  78. data/node_modules/agent-base/dist/src/index.js +203 -0
  79. data/node_modules/agent-base/dist/src/index.js.map +1 -0
  80. data/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  81. data/node_modules/agent-base/dist/src/promisify.js +18 -0
  82. data/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  83. data/node_modules/agent-base/package.json +64 -0
  84. data/node_modules/agent-base/src/index.ts +345 -0
  85. data/node_modules/agent-base/src/promisify.ts +33 -0
  86. data/node_modules/balanced-match/.github/FUNDING.yml +2 -0
  87. data/node_modules/balanced-match/LICENSE.md +21 -0
  88. data/node_modules/balanced-match/README.md +97 -0
  89. data/node_modules/balanced-match/index.js +62 -0
  90. data/node_modules/balanced-match/package.json +48 -0
  91. data/node_modules/base64-js/LICENSE +21 -0
  92. data/node_modules/base64-js/README.md +34 -0
  93. data/node_modules/base64-js/base64js.min.js +1 -0
  94. data/node_modules/base64-js/index.d.ts +3 -0
  95. data/node_modules/base64-js/index.js +150 -0
  96. data/node_modules/base64-js/package.json +47 -0
  97. data/node_modules/bl/.travis.yml +17 -0
  98. data/node_modules/bl/BufferList.js +396 -0
  99. data/node_modules/bl/LICENSE.md +13 -0
  100. data/node_modules/bl/README.md +247 -0
  101. data/node_modules/bl/bl.js +84 -0
  102. data/node_modules/bl/package.json +37 -0
  103. data/node_modules/bl/test/convert.js +21 -0
  104. data/node_modules/bl/test/indexOf.js +492 -0
  105. data/node_modules/bl/test/isBufferList.js +32 -0
  106. data/node_modules/bl/test/test.js +869 -0
  107. data/node_modules/brace-expansion/LICENSE +21 -0
  108. data/node_modules/brace-expansion/README.md +129 -0
  109. data/node_modules/brace-expansion/index.js +201 -0
  110. data/node_modules/brace-expansion/package.json +47 -0
  111. data/node_modules/buffer/AUTHORS.md +70 -0
  112. data/node_modules/buffer/LICENSE +21 -0
  113. data/node_modules/buffer/README.md +410 -0
  114. data/node_modules/buffer/index.d.ts +186 -0
  115. data/node_modules/buffer/index.js +1817 -0
  116. data/node_modules/buffer/package.json +96 -0
  117. data/node_modules/buffer-crc32/LICENSE +19 -0
  118. data/node_modules/buffer-crc32/README.md +47 -0
  119. data/node_modules/buffer-crc32/index.js +111 -0
  120. data/node_modules/buffer-crc32/package.json +39 -0
  121. data/node_modules/chownr/LICENSE +15 -0
  122. data/node_modules/chownr/README.md +3 -0
  123. data/node_modules/chownr/chownr.js +167 -0
  124. data/node_modules/chownr/package.json +29 -0
  125. data/node_modules/concat-map/.travis.yml +4 -0
  126. data/node_modules/concat-map/LICENSE +18 -0
  127. data/node_modules/concat-map/README.markdown +62 -0
  128. data/node_modules/concat-map/example/map.js +6 -0
  129. data/node_modules/concat-map/index.js +13 -0
  130. data/node_modules/concat-map/package.json +43 -0
  131. data/node_modules/concat-map/test/map.js +39 -0
  132. data/node_modules/debug/LICENSE +19 -0
  133. data/node_modules/debug/README.md +455 -0
  134. data/node_modules/debug/package.json +59 -0
  135. data/node_modules/debug/src/browser.js +269 -0
  136. data/node_modules/debug/src/common.js +261 -0
  137. data/node_modules/debug/src/index.js +10 -0
  138. data/node_modules/debug/src/node.js +263 -0
  139. data/node_modules/devtools-protocol/LICENSE +27 -0
  140. data/node_modules/devtools-protocol/README.md +12 -0
  141. data/node_modules/devtools-protocol/changelog.md +10491 -0
  142. data/node_modules/devtools-protocol/externs/protocol_externs.js +9734 -0
  143. data/node_modules/devtools-protocol/json/browser_protocol.json +20641 -0
  144. data/node_modules/devtools-protocol/json/js_protocol.json +3581 -0
  145. data/node_modules/devtools-protocol/package.json +18 -0
  146. data/node_modules/devtools-protocol/pdl/browser_protocol.pdl +9637 -0
  147. data/node_modules/devtools-protocol/pdl/js_protocol.pdl +1678 -0
  148. data/node_modules/devtools-protocol/types/protocol-mapping.d.ts +4321 -0
  149. data/node_modules/devtools-protocol/types/protocol-proxy-api.d.ts +3683 -0
  150. data/node_modules/devtools-protocol/types/protocol.d.ts +15538 -0
  151. data/node_modules/end-of-stream/LICENSE +21 -0
  152. data/node_modules/end-of-stream/README.md +54 -0
  153. data/node_modules/end-of-stream/index.js +94 -0
  154. data/node_modules/end-of-stream/package.json +37 -0
  155. data/node_modules/extract-zip/LICENSE +23 -0
  156. data/node_modules/extract-zip/cli.js +19 -0
  157. data/node_modules/extract-zip/index.d.ts +21 -0
  158. data/node_modules/extract-zip/index.js +173 -0
  159. data/node_modules/extract-zip/package.json +80 -0
  160. data/node_modules/extract-zip/readme.md +57 -0
  161. data/node_modules/fd-slicer/.npmignore +2 -0
  162. data/node_modules/fd-slicer/.travis.yml +7 -0
  163. data/node_modules/fd-slicer/CHANGELOG.md +49 -0
  164. data/node_modules/fd-slicer/LICENSE +21 -0
  165. data/node_modules/fd-slicer/README.md +199 -0
  166. data/node_modules/fd-slicer/index.js +296 -0
  167. data/node_modules/fd-slicer/package.json +36 -0
  168. data/node_modules/fd-slicer/test/test.js +350 -0
  169. data/node_modules/find-up/index.d.ts +137 -0
  170. data/node_modules/find-up/index.js +89 -0
  171. data/node_modules/find-up/license +9 -0
  172. data/node_modules/find-up/package.json +53 -0
  173. data/node_modules/find-up/readme.md +156 -0
  174. data/node_modules/fs-constants/LICENSE +21 -0
  175. data/node_modules/fs-constants/README.md +26 -0
  176. data/node_modules/fs-constants/browser.js +1 -0
  177. data/node_modules/fs-constants/index.js +1 -0
  178. data/node_modules/fs-constants/package.json +19 -0
  179. data/node_modules/fs.realpath/LICENSE +43 -0
  180. data/node_modules/fs.realpath/README.md +33 -0
  181. data/node_modules/fs.realpath/index.js +66 -0
  182. data/node_modules/fs.realpath/old.js +303 -0
  183. data/node_modules/fs.realpath/package.json +26 -0
  184. data/node_modules/get-stream/buffer-stream.js +52 -0
  185. data/node_modules/get-stream/index.d.ts +108 -0
  186. data/node_modules/get-stream/index.js +60 -0
  187. data/node_modules/get-stream/license +9 -0
  188. data/node_modules/get-stream/package.json +50 -0
  189. data/node_modules/get-stream/readme.md +124 -0
  190. data/node_modules/glob/LICENSE +21 -0
  191. data/node_modules/glob/README.md +375 -0
  192. data/node_modules/glob/changelog.md +67 -0
  193. data/node_modules/glob/common.js +234 -0
  194. data/node_modules/glob/glob.js +788 -0
  195. data/node_modules/glob/package.json +51 -0
  196. data/node_modules/glob/sync.js +484 -0
  197. data/node_modules/https-proxy-agent/README.md +137 -0
  198. data/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  199. data/node_modules/https-proxy-agent/dist/agent.js +180 -0
  200. data/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  201. data/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  202. data/node_modules/https-proxy-agent/dist/index.js +14 -0
  203. data/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  204. data/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  205. data/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  206. data/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  207. data/node_modules/https-proxy-agent/package.json +56 -0
  208. data/node_modules/ieee754/LICENSE +11 -0
  209. data/node_modules/ieee754/README.md +51 -0
  210. data/node_modules/ieee754/index.d.ts +10 -0
  211. data/node_modules/ieee754/index.js +85 -0
  212. data/node_modules/ieee754/package.json +52 -0
  213. data/node_modules/inflight/LICENSE +15 -0
  214. data/node_modules/inflight/README.md +37 -0
  215. data/node_modules/inflight/inflight.js +54 -0
  216. data/node_modules/inflight/package.json +29 -0
  217. data/node_modules/inherits/LICENSE +16 -0
  218. data/node_modules/inherits/README.md +42 -0
  219. data/node_modules/inherits/inherits.js +9 -0
  220. data/node_modules/inherits/inherits_browser.js +27 -0
  221. data/node_modules/inherits/package.json +29 -0
  222. data/node_modules/locate-path/index.d.ts +83 -0
  223. data/node_modules/locate-path/index.js +65 -0
  224. data/node_modules/locate-path/license +9 -0
  225. data/node_modules/locate-path/package.json +45 -0
  226. data/node_modules/locate-path/readme.md +122 -0
  227. data/node_modules/minimatch/LICENSE +15 -0
  228. data/node_modules/minimatch/README.md +209 -0
  229. data/node_modules/minimatch/minimatch.js +923 -0
  230. data/node_modules/minimatch/package.json +30 -0
  231. data/node_modules/minimist/.travis.yml +8 -0
  232. data/node_modules/minimist/LICENSE +18 -0
  233. data/node_modules/minimist/example/parse.js +2 -0
  234. data/node_modules/minimist/index.js +245 -0
  235. data/node_modules/minimist/package.json +45 -0
  236. data/node_modules/minimist/readme.markdown +95 -0
  237. data/node_modules/minimist/test/all_bool.js +32 -0
  238. data/node_modules/minimist/test/bool.js +178 -0
  239. data/node_modules/minimist/test/dash.js +31 -0
  240. data/node_modules/minimist/test/default_bool.js +35 -0
  241. data/node_modules/minimist/test/dotted.js +22 -0
  242. data/node_modules/minimist/test/kv_short.js +16 -0
  243. data/node_modules/minimist/test/long.js +31 -0
  244. data/node_modules/minimist/test/num.js +36 -0
  245. data/node_modules/minimist/test/parse.js +197 -0
  246. data/node_modules/minimist/test/parse_modified.js +9 -0
  247. data/node_modules/minimist/test/proto.js +44 -0
  248. data/node_modules/minimist/test/short.js +67 -0
  249. data/node_modules/minimist/test/stop_early.js +15 -0
  250. data/node_modules/minimist/test/unknown.js +102 -0
  251. data/node_modules/minimist/test/whitespace.js +8 -0
  252. data/node_modules/mkdirp/LICENSE +21 -0
  253. data/node_modules/mkdirp/bin/cmd.js +33 -0
  254. data/node_modules/mkdirp/bin/usage.txt +12 -0
  255. data/node_modules/mkdirp/index.js +99 -0
  256. data/node_modules/mkdirp/package.json +34 -0
  257. data/node_modules/mkdirp/readme.markdown +100 -0
  258. data/node_modules/ms/index.js +162 -0
  259. data/node_modules/ms/license.md +21 -0
  260. data/node_modules/ms/package.json +37 -0
  261. data/node_modules/ms/readme.md +60 -0
  262. data/node_modules/node-fetch/CHANGELOG.md +272 -0
  263. data/node_modules/node-fetch/LICENSE.md +22 -0
  264. data/node_modules/node-fetch/README.md +590 -0
  265. data/node_modules/node-fetch/browser.js +25 -0
  266. data/node_modules/node-fetch/lib/index.es.js +1640 -0
  267. data/node_modules/node-fetch/lib/index.js +1649 -0
  268. data/node_modules/node-fetch/lib/index.mjs +1638 -0
  269. data/node_modules/node-fetch/package.json +66 -0
  270. data/node_modules/once/LICENSE +15 -0
  271. data/node_modules/once/README.md +79 -0
  272. data/node_modules/once/once.js +42 -0
  273. data/node_modules/once/package.json +33 -0
  274. data/node_modules/p-limit/index.d.ts +38 -0
  275. data/node_modules/p-limit/index.js +57 -0
  276. data/node_modules/p-limit/license +9 -0
  277. data/node_modules/p-limit/package.json +52 -0
  278. data/node_modules/p-limit/readme.md +101 -0
  279. data/node_modules/p-locate/index.d.ts +64 -0
  280. data/node_modules/p-locate/index.js +52 -0
  281. data/node_modules/p-locate/license +9 -0
  282. data/node_modules/p-locate/package.json +53 -0
  283. data/node_modules/p-locate/readme.md +90 -0
  284. data/node_modules/p-try/index.d.ts +39 -0
  285. data/node_modules/p-try/index.js +9 -0
  286. data/node_modules/p-try/license +9 -0
  287. data/node_modules/p-try/package.json +42 -0
  288. data/node_modules/p-try/readme.md +58 -0
  289. data/node_modules/path-exists/index.d.ts +28 -0
  290. data/node_modules/path-exists/index.js +23 -0
  291. data/node_modules/path-exists/license +9 -0
  292. data/node_modules/path-exists/package.json +39 -0
  293. data/node_modules/path-exists/readme.md +52 -0
  294. data/node_modules/path-is-absolute/index.js +20 -0
  295. data/node_modules/path-is-absolute/license +21 -0
  296. data/node_modules/path-is-absolute/package.json +43 -0
  297. data/node_modules/path-is-absolute/readme.md +59 -0
  298. data/node_modules/pend/LICENSE +23 -0
  299. data/node_modules/pend/README.md +41 -0
  300. data/node_modules/pend/index.js +55 -0
  301. data/node_modules/pend/package.json +18 -0
  302. data/node_modules/pend/test.js +137 -0
  303. data/node_modules/pkg-dir/index.d.ts +44 -0
  304. data/node_modules/pkg-dir/index.js +17 -0
  305. data/node_modules/pkg-dir/license +9 -0
  306. data/node_modules/pkg-dir/package.json +56 -0
  307. data/node_modules/pkg-dir/readme.md +66 -0
  308. data/node_modules/progress/CHANGELOG.md +115 -0
  309. data/node_modules/progress/LICENSE +22 -0
  310. data/node_modules/progress/Makefile +8 -0
  311. data/node_modules/progress/Readme.md +146 -0
  312. data/node_modules/progress/index.js +1 -0
  313. data/node_modules/progress/lib/node-progress.js +235 -0
  314. data/node_modules/progress/package.json +26 -0
  315. data/node_modules/proxy-from-env/.eslintrc +29 -0
  316. data/node_modules/proxy-from-env/.travis.yml +10 -0
  317. data/node_modules/proxy-from-env/LICENSE +20 -0
  318. data/node_modules/proxy-from-env/README.md +131 -0
  319. data/node_modules/proxy-from-env/index.js +108 -0
  320. data/node_modules/proxy-from-env/package.json +34 -0
  321. data/node_modules/proxy-from-env/test.js +483 -0
  322. data/node_modules/pump/.travis.yml +5 -0
  323. data/node_modules/pump/LICENSE +21 -0
  324. data/node_modules/pump/README.md +65 -0
  325. data/node_modules/pump/index.js +82 -0
  326. data/node_modules/pump/package.json +24 -0
  327. data/node_modules/pump/test-browser.js +66 -0
  328. data/node_modules/pump/test-node.js +53 -0
  329. data/node_modules/puppeteer-core/CHANGELOG.md +226 -0
  330. data/node_modules/puppeteer-core/LICENSE +202 -0
  331. data/node_modules/puppeteer-core/README.md +483 -0
  332. data/node_modules/puppeteer-core/cjs-entry-core.js +29 -0
  333. data/node_modules/puppeteer-core/cjs-entry.js +29 -0
  334. data/node_modules/puppeteer-core/install.js +89 -0
  335. data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts +111 -0
  336. data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts.map +1 -0
  337. data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js +81 -0
  338. data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js.map +1 -0
  339. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts +176 -0
  340. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts.map +1 -0
  341. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js +361 -0
  342. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js.map +1 -0
  343. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts +21 -0
  344. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts.map +1 -0
  345. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js +85 -0
  346. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -0
  347. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts +438 -0
  348. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts.map +1 -0
  349. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js +528 -0
  350. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js.map +1 -0
  351. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts +54 -0
  352. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +1 -0
  353. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js +98 -0
  354. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -0
  355. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts +26 -0
  356. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -0
  357. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js +35 -0
  358. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js.map +1 -0
  359. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts +130 -0
  360. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts.map +1 -0
  361. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js +281 -0
  362. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js.map +1 -0
  363. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts +25 -0
  364. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map +1 -0
  365. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js +18 -0
  366. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js.map +1 -0
  367. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +73 -0
  368. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -0
  369. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js +65 -0
  370. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -0
  371. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts +189 -0
  372. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts.map +1 -0
  373. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js +329 -0
  374. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js.map +1 -0
  375. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts +173 -0
  376. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -0
  377. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js +655 -0
  378. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -0
  379. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts +53 -0
  380. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts.map +1 -0
  381. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js +82 -0
  382. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js.map +1 -0
  383. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +41 -0
  384. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +1 -0
  385. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js +951 -0
  386. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js.map +1 -0
  387. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts +75 -0
  388. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts.map +1 -0
  389. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js +98 -0
  390. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js.map +1 -0
  391. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts +25 -0
  392. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts.map +1 -0
  393. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js +38 -0
  394. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js.map +1 -0
  395. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts +42 -0
  396. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -0
  397. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js +49 -0
  398. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js.map +1 -0
  399. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts +61 -0
  400. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +1 -0
  401. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js +18 -0
  402. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js.map +1 -0
  403. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts +93 -0
  404. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -0
  405. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js +117 -0
  406. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js.map +1 -0
  407. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts +82 -0
  408. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts.map +1 -0
  409. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js +87 -0
  410. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js.map +1 -0
  411. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts +194 -0
  412. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +1 -0
  413. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js +322 -0
  414. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js.map +1 -0
  415. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts +59 -0
  416. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts.map +1 -0
  417. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js +72 -0
  418. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js.map +1 -0
  419. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts +733 -0
  420. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -0
  421. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js +965 -0
  422. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js.map +1 -0
  423. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts +341 -0
  424. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -0
  425. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js +547 -0
  426. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -0
  427. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts +126 -0
  428. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -0
  429. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js +155 -0
  430. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -0
  431. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts +360 -0
  432. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts.map +1 -0
  433. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js +545 -0
  434. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js.map +1 -0
  435. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts +469 -0
  436. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -0
  437. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js +803 -0
  438. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js.map +1 -0
  439. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +66 -0
  440. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -0
  441. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js +149 -0
  442. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -0
  443. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts +27 -0
  444. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts.map +1 -0
  445. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js +34 -0
  446. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js.map +1 -0
  447. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts +97 -0
  448. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -0
  449. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js +341 -0
  450. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -0
  451. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts +157 -0
  452. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts.map +1 -0
  453. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js +35 -0
  454. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js.map +1 -0
  455. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts +2011 -0
  456. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts.map +1 -0
  457. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js +2427 -0
  458. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js.map +1 -0
  459. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts +21 -0
  460. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts.map +1 -0
  461. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js +18 -0
  462. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js.map +1 -0
  463. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts +160 -0
  464. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts.map +1 -0
  465. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js +162 -0
  466. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js.map +1 -0
  467. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts +52 -0
  468. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts.map +1 -0
  469. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js +3 -0
  470. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js.map +1 -0
  471. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts +65 -0
  472. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts.map +1 -0
  473. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js +166 -0
  474. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js.map +1 -0
  475. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts +61 -0
  476. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map +1 -0
  477. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js +77 -0
  478. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js.map +1 -0
  479. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts +99 -0
  480. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts.map +1 -0
  481. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js +145 -0
  482. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js.map +1 -0
  483. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts +28 -0
  484. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map +1 -0
  485. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js +48 -0
  486. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js.map +1 -0
  487. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts +47 -0
  488. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts.map +1 -0
  489. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js +104 -0
  490. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js.map +1 -0
  491. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts +40 -0
  492. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map +1 -0
  493. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js +407 -0
  494. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js.map +1 -0
  495. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts +99 -0
  496. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts.map +1 -0
  497. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js +113 -0
  498. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js.map +1 -0
  499. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts +22 -0
  500. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts.map +1 -0
  501. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js +29 -0
  502. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js.map +1 -0
  503. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts +17 -0
  504. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts.map +1 -0
  505. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js +44 -0
  506. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js.map +1 -0
  507. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts +85 -0
  508. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts.map +1 -0
  509. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js +328 -0
  510. data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js.map +1 -0
  511. data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts +17 -0
  512. data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts.map +1 -0
  513. data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js +20 -0
  514. data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js.map +1 -0
  515. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts +18 -0
  516. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts.map +1 -0
  517. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js +45 -0
  518. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js.map +1 -0
  519. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts +18 -0
  520. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts.map +1 -0
  521. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js +27 -0
  522. data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js.map +1 -0
  523. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +134 -0
  524. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map +1 -0
  525. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js +502 -0
  526. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js.map +1 -0
  527. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts +40 -0
  528. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -0
  529. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js +225 -0
  530. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -0
  531. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts +131 -0
  532. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -0
  533. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js +18 -0
  534. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js.map +1 -0
  535. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts +17 -0
  536. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -0
  537. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js +574 -0
  538. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js.map +1 -0
  539. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +27 -0
  540. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -0
  541. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +42 -0
  542. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -0
  543. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts +30 -0
  544. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts.map +1 -0
  545. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js +65 -0
  546. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js.map +1 -0
  547. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts +154 -0
  548. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts.map +1 -0
  549. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js +189 -0
  550. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js.map +1 -0
  551. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts +18 -0
  552. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts.map +1 -0
  553. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js +160 -0
  554. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js.map +1 -0
  555. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts +18 -0
  556. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts.map +1 -0
  557. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js +25 -0
  558. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js.map +1 -0
  559. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts +18 -0
  560. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts.map +1 -0
  561. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js +24 -0
  562. data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js.map +1 -0
  563. data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts +22 -0
  564. data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts.map +1 -0
  565. data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js +23 -0
  566. data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js.map +1 -0
  567. data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts +18 -0
  568. data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts.map +1 -0
  569. data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js +24 -0
  570. data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js.map +1 -0
  571. data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts +28 -0
  572. data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts.map +1 -0
  573. data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js +57 -0
  574. data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js.map +1 -0
  575. data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts +111 -0
  576. data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts.map +1 -0
  577. data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js +81 -0
  578. data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js.map +1 -0
  579. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts +176 -0
  580. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts.map +1 -0
  581. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js +357 -0
  582. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js.map +1 -0
  583. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts +21 -0
  584. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map +1 -0
  585. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js +82 -0
  586. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -0
  587. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts +438 -0
  588. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts.map +1 -0
  589. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js +523 -0
  590. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js.map +1 -0
  591. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts +54 -0
  592. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -0
  593. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js +75 -0
  594. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -0
  595. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts +26 -0
  596. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -0
  597. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js +31 -0
  598. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js.map +1 -0
  599. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts +130 -0
  600. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts.map +1 -0
  601. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js +276 -0
  602. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js.map +1 -0
  603. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts +25 -0
  604. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map +1 -0
  605. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js +17 -0
  606. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js.map +1 -0
  607. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts +73 -0
  608. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -0
  609. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js +61 -0
  610. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -0
  611. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts +189 -0
  612. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts.map +1 -0
  613. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js +323 -0
  614. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js.map +1 -0
  615. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts +173 -0
  616. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -0
  617. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js +650 -0
  618. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js.map +1 -0
  619. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts +53 -0
  620. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts.map +1 -0
  621. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js +78 -0
  622. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js.map +1 -0
  623. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts +41 -0
  624. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +1 -0
  625. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js +948 -0
  626. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js.map +1 -0
  627. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts +75 -0
  628. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts.map +1 -0
  629. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js +94 -0
  630. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js.map +1 -0
  631. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts +25 -0
  632. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts.map +1 -0
  633. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js +34 -0
  634. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js.map +1 -0
  635. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts +42 -0
  636. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts.map +1 -0
  637. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js +44 -0
  638. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js.map +1 -0
  639. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts +61 -0
  640. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts.map +1 -0
  641. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js +17 -0
  642. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js.map +1 -0
  643. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts +93 -0
  644. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -0
  645. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js +110 -0
  646. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js.map +1 -0
  647. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts +82 -0
  648. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts.map +1 -0
  649. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js +84 -0
  650. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js.map +1 -0
  651. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts +194 -0
  652. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts.map +1 -0
  653. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js +318 -0
  654. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js.map +1 -0
  655. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts +59 -0
  656. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts.map +1 -0
  657. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js +68 -0
  658. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js.map +1 -0
  659. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts +733 -0
  660. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -0
  661. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js +960 -0
  662. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js.map +1 -0
  663. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts +341 -0
  664. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -0
  665. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js +543 -0
  666. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -0
  667. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts +126 -0
  668. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -0
  669. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js +151 -0
  670. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -0
  671. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts +360 -0
  672. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts.map +1 -0
  673. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js +539 -0
  674. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js.map +1 -0
  675. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts +469 -0
  676. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -0
  677. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js +778 -0
  678. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js.map +1 -0
  679. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +66 -0
  680. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -0
  681. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js +145 -0
  682. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -0
  683. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts +27 -0
  684. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts.map +1 -0
  685. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js +31 -0
  686. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js.map +1 -0
  687. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts +97 -0
  688. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -0
  689. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js +337 -0
  690. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js.map +1 -0
  691. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts +157 -0
  692. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts.map +1 -0
  693. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js +32 -0
  694. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js.map +1 -0
  695. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts +2011 -0
  696. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts.map +1 -0
  697. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js +2423 -0
  698. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js.map +1 -0
  699. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts +21 -0
  700. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts.map +1 -0
  701. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js +17 -0
  702. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js.map +1 -0
  703. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts +160 -0
  704. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts.map +1 -0
  705. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js +158 -0
  706. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js.map +1 -0
  707. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts +52 -0
  708. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts.map +1 -0
  709. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js +2 -0
  710. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js.map +1 -0
  711. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts +65 -0
  712. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts.map +1 -0
  713. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js +158 -0
  714. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js.map +1 -0
  715. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts +61 -0
  716. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts.map +1 -0
  717. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js +73 -0
  718. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js.map +1 -0
  719. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts +99 -0
  720. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts.map +1 -0
  721. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js +141 -0
  722. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js.map +1 -0
  723. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts +28 -0
  724. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map +1 -0
  725. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js +44 -0
  726. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js.map +1 -0
  727. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts +47 -0
  728. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts.map +1 -0
  729. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js +100 -0
  730. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js.map +1 -0
  731. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts +40 -0
  732. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map +1 -0
  733. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js +404 -0
  734. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js.map +1 -0
  735. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts +99 -0
  736. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts.map +1 -0
  737. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js +109 -0
  738. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js.map +1 -0
  739. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts +22 -0
  740. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts.map +1 -0
  741. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js +25 -0
  742. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js.map +1 -0
  743. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts +17 -0
  744. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts.map +1 -0
  745. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js +21 -0
  746. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js.map +1 -0
  747. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts +85 -0
  748. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts.map +1 -0
  749. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js +306 -0
  750. data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js.map +1 -0
  751. data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts +17 -0
  752. data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts.map +1 -0
  753. data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js +17 -0
  754. data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js.map +1 -0
  755. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts +18 -0
  756. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts.map +1 -0
  757. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js +38 -0
  758. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js.map +1 -0
  759. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts +18 -0
  760. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts.map +1 -0
  761. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js +23 -0
  762. data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js.map +1 -0
  763. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts +134 -0
  764. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +1 -0
  765. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js +476 -0
  766. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js.map +1 -0
  767. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts +40 -0
  768. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -0
  769. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js +199 -0
  770. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -0
  771. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts +131 -0
  772. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -0
  773. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js +17 -0
  774. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js.map +1 -0
  775. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts +17 -0
  776. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -0
  777. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js +552 -0
  778. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js.map +1 -0
  779. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +27 -0
  780. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -0
  781. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js +35 -0
  782. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -0
  783. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts +30 -0
  784. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts.map +1 -0
  785. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js +61 -0
  786. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js.map +1 -0
  787. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts +154 -0
  788. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts.map +1 -0
  789. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js +182 -0
  790. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js.map +1 -0
  791. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts +18 -0
  792. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts.map +1 -0
  793. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js +152 -0
  794. data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js.map +1 -0
  795. data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts +18 -0
  796. data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts.map +1 -0
  797. data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js +23 -0
  798. data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js.map +1 -0
  799. data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts +18 -0
  800. data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts.map +1 -0
  801. data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js +22 -0
  802. data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js.map +1 -0
  803. data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts +22 -0
  804. data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts.map +1 -0
  805. data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js +20 -0
  806. data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js.map +1 -0
  807. data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts +18 -0
  808. data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts.map +1 -0
  809. data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js +22 -0
  810. data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js.map +1 -0
  811. data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts +28 -0
  812. data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts.map +1 -0
  813. data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js +54 -0
  814. data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js.map +1 -0
  815. data/node_modules/puppeteer-core/lib/types.d.ts +6911 -0
  816. data/node_modules/puppeteer-core/package.json +122 -0
  817. data/node_modules/puppeteer-core/typescript-if-required.js +61 -0
  818. data/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  819. data/node_modules/readable-stream/GOVERNANCE.md +136 -0
  820. data/node_modules/readable-stream/LICENSE +47 -0
  821. data/node_modules/readable-stream/README.md +106 -0
  822. data/node_modules/readable-stream/errors-browser.js +127 -0
  823. data/node_modules/readable-stream/errors.js +116 -0
  824. data/node_modules/readable-stream/experimentalWarning.js +17 -0
  825. data/node_modules/readable-stream/lib/_stream_duplex.js +139 -0
  826. data/node_modules/readable-stream/lib/_stream_passthrough.js +39 -0
  827. data/node_modules/readable-stream/lib/_stream_readable.js +1124 -0
  828. data/node_modules/readable-stream/lib/_stream_transform.js +201 -0
  829. data/node_modules/readable-stream/lib/_stream_writable.js +697 -0
  830. data/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
  831. data/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
  832. data/node_modules/readable-stream/lib/internal/streams/destroy.js +105 -0
  833. data/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
  834. data/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  835. data/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
  836. data/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
  837. data/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
  838. data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  839. data/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  840. data/node_modules/readable-stream/package.json +68 -0
  841. data/node_modules/readable-stream/readable-browser.js +9 -0
  842. data/node_modules/readable-stream/readable.js +16 -0
  843. data/node_modules/rimraf/CHANGELOG.md +65 -0
  844. data/node_modules/rimraf/LICENSE +15 -0
  845. data/node_modules/rimraf/README.md +101 -0
  846. data/node_modules/rimraf/bin.js +68 -0
  847. data/node_modules/rimraf/package.json +32 -0
  848. data/node_modules/rimraf/rimraf.js +360 -0
  849. data/node_modules/safe-buffer/LICENSE +21 -0
  850. data/node_modules/safe-buffer/README.md +584 -0
  851. data/node_modules/safe-buffer/index.d.ts +187 -0
  852. data/node_modules/safe-buffer/index.js +65 -0
  853. data/node_modules/safe-buffer/package.json +51 -0
  854. data/node_modules/string_decoder/LICENSE +48 -0
  855. data/node_modules/string_decoder/README.md +47 -0
  856. data/node_modules/string_decoder/lib/string_decoder.js +296 -0
  857. data/node_modules/string_decoder/package.json +34 -0
  858. data/node_modules/tar-fs/.travis.yml +5 -0
  859. data/node_modules/tar-fs/LICENSE +21 -0
  860. data/node_modules/tar-fs/README.md +163 -0
  861. data/node_modules/tar-fs/index.js +348 -0
  862. data/node_modules/tar-fs/package.json +41 -0
  863. data/node_modules/tar-fs/test/fixtures/a/hello.txt +1 -0
  864. data/node_modules/tar-fs/test/fixtures/b/a/test.txt +1 -0
  865. data/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
  866. data/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
  867. data/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
  868. data/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
  869. data/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
  870. data/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
  871. data/node_modules/tar-fs/test/fixtures/e/file +0 -0
  872. data/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
  873. data/node_modules/tar-fs/test/index.js +346 -0
  874. data/node_modules/tar-stream/LICENSE +21 -0
  875. data/node_modules/tar-stream/README.md +168 -0
  876. data/node_modules/tar-stream/extract.js +257 -0
  877. data/node_modules/tar-stream/headers.js +295 -0
  878. data/node_modules/tar-stream/index.js +2 -0
  879. data/node_modules/tar-stream/pack.js +255 -0
  880. data/node_modules/tar-stream/package.json +58 -0
  881. data/node_modules/tar-stream/sandbox.js +11 -0
  882. data/node_modules/through/.travis.yml +5 -0
  883. data/node_modules/through/LICENSE.APACHE2 +15 -0
  884. data/node_modules/through/LICENSE.MIT +24 -0
  885. data/node_modules/through/index.js +108 -0
  886. data/node_modules/through/package.json +36 -0
  887. data/node_modules/through/readme.markdown +64 -0
  888. data/node_modules/through/test/async.js +28 -0
  889. data/node_modules/through/test/auto-destroy.js +30 -0
  890. data/node_modules/through/test/buffering.js +71 -0
  891. data/node_modules/through/test/end.js +45 -0
  892. data/node_modules/through/test/index.js +133 -0
  893. data/node_modules/unbzip2-stream/LICENSE +24 -0
  894. data/node_modules/unbzip2-stream/README.md +59 -0
  895. data/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js +1 -0
  896. data/node_modules/unbzip2-stream/index.js +92 -0
  897. data/node_modules/unbzip2-stream/lib/bit_iterator.js +39 -0
  898. data/node_modules/unbzip2-stream/lib/bzip2.js +367 -0
  899. data/node_modules/unbzip2-stream/package.json +51 -0
  900. data/node_modules/util-deprecate/History.md +16 -0
  901. data/node_modules/util-deprecate/LICENSE +24 -0
  902. data/node_modules/util-deprecate/README.md +53 -0
  903. data/node_modules/util-deprecate/browser.js +67 -0
  904. data/node_modules/util-deprecate/node.js +6 -0
  905. data/node_modules/util-deprecate/package.json +27 -0
  906. data/node_modules/wrappy/LICENSE +15 -0
  907. data/node_modules/wrappy/README.md +36 -0
  908. data/node_modules/wrappy/package.json +29 -0
  909. data/node_modules/wrappy/wrappy.js +33 -0
  910. data/node_modules/ws/LICENSE +21 -0
  911. data/node_modules/ws/README.md +496 -0
  912. data/node_modules/ws/browser.js +8 -0
  913. data/node_modules/ws/index.js +10 -0
  914. data/node_modules/ws/lib/buffer-util.js +129 -0
  915. data/node_modules/ws/lib/constants.js +10 -0
  916. data/node_modules/ws/lib/event-target.js +184 -0
  917. data/node_modules/ws/lib/extension.js +223 -0
  918. data/node_modules/ws/lib/limiter.js +55 -0
  919. data/node_modules/ws/lib/permessage-deflate.js +517 -0
  920. data/node_modules/ws/lib/receiver.js +507 -0
  921. data/node_modules/ws/lib/sender.js +405 -0
  922. data/node_modules/ws/lib/stream.js +165 -0
  923. data/node_modules/ws/lib/validation.js +104 -0
  924. data/node_modules/ws/lib/websocket-server.js +418 -0
  925. data/node_modules/ws/lib/websocket.js +942 -0
  926. data/node_modules/ws/package.json +56 -0
  927. data/node_modules/yauzl/LICENSE +21 -0
  928. data/node_modules/yauzl/README.md +658 -0
  929. data/node_modules/yauzl/index.js +796 -0
  930. data/node_modules/yauzl/package.json +40 -0
  931. data/package.json +6 -0
  932. metadata +940 -58
@@ -0,0 +1,18 @@
1
+ /** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
2
+ declare module 'constants' {
3
+ import { constants as osConstants, SignalConstants } from 'node:os';
4
+ import { constants as cryptoConstants } from 'node:crypto';
5
+ import { constants as fsConstants } from 'node:fs';
6
+
7
+ const exp: typeof osConstants.errno &
8
+ typeof osConstants.priority &
9
+ SignalConstants &
10
+ typeof cryptoConstants &
11
+ typeof fsConstants;
12
+ export = exp;
13
+ }
14
+
15
+ declare module 'node:constants' {
16
+ import constants = require('constants');
17
+ export = constants;
18
+ }
@@ -0,0 +1,3224 @@
1
+ /**
2
+ * The `crypto` module provides cryptographic functionality that includes a set of
3
+ * wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.
4
+ *
5
+ * ```js
6
+ * const { createHmac } = await import('crypto');
7
+ *
8
+ * const secret = 'abcdefg';
9
+ * const hash = createHmac('sha256', secret)
10
+ * .update('I love cupcakes')
11
+ * .digest('hex');
12
+ * console.log(hash);
13
+ * // Prints:
14
+ * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
15
+ * ```
16
+ * @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/crypto.js)
17
+ */
18
+ declare module 'crypto' {
19
+ import * as stream from 'node:stream';
20
+ import { PeerCertificate } from 'node:tls';
21
+ interface Certificate {
22
+ /**
23
+ * @deprecated
24
+ * @param spkac
25
+ * @returns The challenge component of the `spkac` data structure,
26
+ * which includes a public key and a challenge.
27
+ */
28
+ exportChallenge(spkac: BinaryLike): Buffer;
29
+ /**
30
+ * @deprecated
31
+ * @param spkac
32
+ * @param encoding The encoding of the spkac string.
33
+ * @returns The public key component of the `spkac` data structure,
34
+ * which includes a public key and a challenge.
35
+ */
36
+ exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
37
+ /**
38
+ * @deprecated
39
+ * @param spkac
40
+ * @returns `true` if the given `spkac` data structure is valid,
41
+ * `false` otherwise.
42
+ */
43
+ verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
44
+ }
45
+ const Certificate: Certificate & {
46
+ /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
47
+ new (): Certificate;
48
+ /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
49
+ (): Certificate;
50
+ /**
51
+ * @param spkac
52
+ * @returns The challenge component of the `spkac` data structure,
53
+ * which includes a public key and a challenge.
54
+ */
55
+ exportChallenge(spkac: BinaryLike): Buffer;
56
+ /**
57
+ * @param spkac
58
+ * @param encoding The encoding of the spkac string.
59
+ * @returns The public key component of the `spkac` data structure,
60
+ * which includes a public key and a challenge.
61
+ */
62
+ exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
63
+ /**
64
+ * @param spkac
65
+ * @returns `true` if the given `spkac` data structure is valid,
66
+ * `false` otherwise.
67
+ */
68
+ verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
69
+ };
70
+ namespace constants {
71
+ // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
72
+ const OPENSSL_VERSION_NUMBER: number;
73
+ /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
74
+ const SSL_OP_ALL: number;
75
+ /** 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. */
76
+ const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
77
+ /** 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. */
78
+ const SSL_OP_CIPHER_SERVER_PREFERENCE: number;
79
+ /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */
80
+ const SSL_OP_CISCO_ANYCONNECT: number;
81
+ /** Instructs OpenSSL to turn on cookie exchange. */
82
+ const SSL_OP_COOKIE_EXCHANGE: number;
83
+ /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */
84
+ const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
85
+ /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */
86
+ const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
87
+ /** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */
88
+ const SSL_OP_EPHEMERAL_RSA: number;
89
+ /** Allows initial connection to servers that do not support RI. */
90
+ const SSL_OP_LEGACY_SERVER_CONNECT: number;
91
+ const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
92
+ const SSL_OP_MICROSOFT_SESS_ID_BUG: number;
93
+ /** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */
94
+ const SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
95
+ const SSL_OP_NETSCAPE_CA_DN_BUG: number;
96
+ const SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
97
+ const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
98
+ const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
99
+ /** Instructs OpenSSL to disable support for SSL/TLS compression. */
100
+ const SSL_OP_NO_COMPRESSION: number;
101
+ const SSL_OP_NO_QUERY_MTU: number;
102
+ /** Instructs OpenSSL to always start a new session when performing renegotiation. */
103
+ const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
104
+ const SSL_OP_NO_SSLv2: number;
105
+ const SSL_OP_NO_SSLv3: number;
106
+ const SSL_OP_NO_TICKET: number;
107
+ const SSL_OP_NO_TLSv1: number;
108
+ const SSL_OP_NO_TLSv1_1: number;
109
+ const SSL_OP_NO_TLSv1_2: number;
110
+ const SSL_OP_PKCS1_CHECK_1: number;
111
+ const SSL_OP_PKCS1_CHECK_2: number;
112
+ /** Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. */
113
+ const SSL_OP_SINGLE_DH_USE: number;
114
+ /** Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. */
115
+ const SSL_OP_SINGLE_ECDH_USE: number;
116
+ const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
117
+ const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
118
+ const SSL_OP_TLS_BLOCK_PADDING_BUG: number;
119
+ const SSL_OP_TLS_D5_BUG: number;
120
+ /** Instructs OpenSSL to disable version rollback attack detection. */
121
+ const SSL_OP_TLS_ROLLBACK_BUG: number;
122
+ const ENGINE_METHOD_RSA: number;
123
+ const ENGINE_METHOD_DSA: number;
124
+ const ENGINE_METHOD_DH: number;
125
+ const ENGINE_METHOD_RAND: number;
126
+ const ENGINE_METHOD_EC: number;
127
+ const ENGINE_METHOD_CIPHERS: number;
128
+ const ENGINE_METHOD_DIGESTS: number;
129
+ const ENGINE_METHOD_PKEY_METHS: number;
130
+ const ENGINE_METHOD_PKEY_ASN1_METHS: number;
131
+ const ENGINE_METHOD_ALL: number;
132
+ const ENGINE_METHOD_NONE: number;
133
+ const DH_CHECK_P_NOT_SAFE_PRIME: number;
134
+ const DH_CHECK_P_NOT_PRIME: number;
135
+ const DH_UNABLE_TO_CHECK_GENERATOR: number;
136
+ const DH_NOT_SUITABLE_GENERATOR: number;
137
+ const ALPN_ENABLED: number;
138
+ const RSA_PKCS1_PADDING: number;
139
+ const RSA_SSLV23_PADDING: number;
140
+ const RSA_NO_PADDING: number;
141
+ const RSA_PKCS1_OAEP_PADDING: number;
142
+ const RSA_X931_PADDING: number;
143
+ const RSA_PKCS1_PSS_PADDING: number;
144
+ /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */
145
+ const RSA_PSS_SALTLEN_DIGEST: number;
146
+ /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */
147
+ const RSA_PSS_SALTLEN_MAX_SIGN: number;
148
+ /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */
149
+ const RSA_PSS_SALTLEN_AUTO: number;
150
+ const POINT_CONVERSION_COMPRESSED: number;
151
+ const POINT_CONVERSION_UNCOMPRESSED: number;
152
+ const POINT_CONVERSION_HYBRID: number;
153
+ /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */
154
+ const defaultCoreCipherList: string;
155
+ /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */
156
+ const defaultCipherList: string;
157
+ }
158
+ interface HashOptions extends stream.TransformOptions {
159
+ /**
160
+ * For XOF hash functions such as `shake256`, the
161
+ * outputLength option can be used to specify the desired output length in bytes.
162
+ */
163
+ outputLength?: number | undefined;
164
+ }
165
+ /** @deprecated since v10.0.0 */
166
+ const fips: boolean;
167
+ /**
168
+ * Creates and returns a `Hash` object that can be used to generate hash digests
169
+ * using the given `algorithm`. Optional `options` argument controls stream
170
+ * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option
171
+ * can be used to specify the desired output length in bytes.
172
+ *
173
+ * The `algorithm` is dependent on the available algorithms supported by the
174
+ * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
175
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
176
+ * display the available digest algorithms.
177
+ *
178
+ * Example: generating the sha256 sum of a file
179
+ *
180
+ * ```js
181
+ * import {
182
+ * createReadStream
183
+ * } from 'fs';
184
+ * import { argv } from 'process';
185
+ * const {
186
+ * createHash
187
+ * } = await import('crypto');
188
+ *
189
+ * const filename = argv[2];
190
+ *
191
+ * const hash = createHash('sha256');
192
+ *
193
+ * const input = createReadStream(filename);
194
+ * input.on('readable', () => {
195
+ * // Only one element is going to be produced by the
196
+ * // hash stream.
197
+ * const data = input.read();
198
+ * if (data)
199
+ * hash.update(data);
200
+ * else {
201
+ * console.log(`${hash.digest('hex')} ${filename}`);
202
+ * }
203
+ * });
204
+ * ```
205
+ * @since v0.1.92
206
+ * @param options `stream.transform` options
207
+ */
208
+ function createHash(algorithm: string, options?: HashOptions): Hash;
209
+ /**
210
+ * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`.
211
+ * Optional `options` argument controls stream behavior.
212
+ *
213
+ * The `algorithm` is dependent on the available algorithms supported by the
214
+ * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
215
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
216
+ * display the available digest algorithms.
217
+ *
218
+ * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
219
+ * a `KeyObject`, its type must be `secret`.
220
+ *
221
+ * Example: generating the sha256 HMAC of a file
222
+ *
223
+ * ```js
224
+ * import {
225
+ * createReadStream
226
+ * } from 'fs';
227
+ * import { argv } from 'process';
228
+ * const {
229
+ * createHmac
230
+ * } = await import('crypto');
231
+ *
232
+ * const filename = argv[2];
233
+ *
234
+ * const hmac = createHmac('sha256', 'a secret');
235
+ *
236
+ * const input = createReadStream(filename);
237
+ * input.on('readable', () => {
238
+ * // Only one element is going to be produced by the
239
+ * // hash stream.
240
+ * const data = input.read();
241
+ * if (data)
242
+ * hmac.update(data);
243
+ * else {
244
+ * console.log(`${hmac.digest('hex')} ${filename}`);
245
+ * }
246
+ * });
247
+ * ```
248
+ * @since v0.1.94
249
+ * @param options `stream.transform` options
250
+ */
251
+ function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
252
+ // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
253
+ type BinaryToTextEncoding = 'base64' | 'hex';
254
+ type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
255
+ type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
256
+ type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
257
+ type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
258
+ /**
259
+ * The `Hash` class is a utility for creating hash digests of data. It can be
260
+ * used in one of two ways:
261
+ *
262
+ * * As a `stream` that is both readable and writable, where data is written
263
+ * to produce a computed hash digest on the readable side, or
264
+ * * Using the `hash.update()` and `hash.digest()` methods to produce the
265
+ * computed hash.
266
+ *
267
+ * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword.
268
+ *
269
+ * Example: Using `Hash` objects as streams:
270
+ *
271
+ * ```js
272
+ * const {
273
+ * createHash
274
+ * } = await import('crypto');
275
+ *
276
+ * const hash = createHash('sha256');
277
+ *
278
+ * hash.on('readable', () => {
279
+ * // Only one element is going to be produced by the
280
+ * // hash stream.
281
+ * const data = hash.read();
282
+ * if (data) {
283
+ * console.log(data.toString('hex'));
284
+ * // Prints:
285
+ * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
286
+ * }
287
+ * });
288
+ *
289
+ * hash.write('some data to hash');
290
+ * hash.end();
291
+ * ```
292
+ *
293
+ * Example: Using `Hash` and piped streams:
294
+ *
295
+ * ```js
296
+ * import { createReadStream } from 'fs';
297
+ * import { stdout } from 'process';
298
+ * const { createHash } = await import('crypto');
299
+ *
300
+ * const hash = createHash('sha256');
301
+ *
302
+ * const input = createReadStream('test.js');
303
+ * input.pipe(hash).setEncoding('hex').pipe(stdout);
304
+ * ```
305
+ *
306
+ * Example: Using the `hash.update()` and `hash.digest()` methods:
307
+ *
308
+ * ```js
309
+ * const {
310
+ * createHash
311
+ * } = await import('crypto');
312
+ *
313
+ * const hash = createHash('sha256');
314
+ *
315
+ * hash.update('some data to hash');
316
+ * console.log(hash.digest('hex'));
317
+ * // Prints:
318
+ * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
319
+ * ```
320
+ * @since v0.1.92
321
+ */
322
+ class Hash extends stream.Transform {
323
+ private constructor();
324
+ /**
325
+ * Creates a new `Hash` object that contains a deep copy of the internal state
326
+ * of the current `Hash` object.
327
+ *
328
+ * The optional `options` argument controls stream behavior. For XOF hash
329
+ * functions such as `'shake256'`, the `outputLength` option can be used to
330
+ * specify the desired output length in bytes.
331
+ *
332
+ * An error is thrown when an attempt is made to copy the `Hash` object after
333
+ * its `hash.digest()` method has been called.
334
+ *
335
+ * ```js
336
+ * // Calculate a rolling hash.
337
+ * const {
338
+ * createHash
339
+ * } = await import('crypto');
340
+ *
341
+ * const hash = createHash('sha256');
342
+ *
343
+ * hash.update('one');
344
+ * console.log(hash.copy().digest('hex'));
345
+ *
346
+ * hash.update('two');
347
+ * console.log(hash.copy().digest('hex'));
348
+ *
349
+ * hash.update('three');
350
+ * console.log(hash.copy().digest('hex'));
351
+ *
352
+ * // Etc.
353
+ * ```
354
+ * @since v13.1.0
355
+ * @param options `stream.transform` options
356
+ */
357
+ copy(options?: stream.TransformOptions): Hash;
358
+ /**
359
+ * Updates the hash content with the given `data`, the encoding of which
360
+ * is given in `inputEncoding`.
361
+ * If `encoding` is not provided, and the `data` is a string, an
362
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
363
+ *
364
+ * This can be called many times with new data as it is streamed.
365
+ * @since v0.1.92
366
+ * @param inputEncoding The `encoding` of the `data` string.
367
+ */
368
+ update(data: BinaryLike): Hash;
369
+ update(data: string, inputEncoding: Encoding): Hash;
370
+ /**
371
+ * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method).
372
+ * If `encoding` is provided a string will be returned; otherwise
373
+ * a `Buffer` is returned.
374
+ *
375
+ * The `Hash` object can not be used again after `hash.digest()` method has been
376
+ * called. Multiple calls will cause an error to be thrown.
377
+ * @since v0.1.92
378
+ * @param encoding The `encoding` of the return value.
379
+ */
380
+ digest(): Buffer;
381
+ digest(encoding: BinaryToTextEncoding): string;
382
+ }
383
+ /**
384
+ * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can
385
+ * be used in one of two ways:
386
+ *
387
+ * * As a `stream` that is both readable and writable, where data is written
388
+ * to produce a computed HMAC digest on the readable side, or
389
+ * * Using the `hmac.update()` and `hmac.digest()` methods to produce the
390
+ * computed HMAC digest.
391
+ *
392
+ * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword.
393
+ *
394
+ * Example: Using `Hmac` objects as streams:
395
+ *
396
+ * ```js
397
+ * const {
398
+ * createHmac
399
+ * } = await import('crypto');
400
+ *
401
+ * const hmac = createHmac('sha256', 'a secret');
402
+ *
403
+ * hmac.on('readable', () => {
404
+ * // Only one element is going to be produced by the
405
+ * // hash stream.
406
+ * const data = hmac.read();
407
+ * if (data) {
408
+ * console.log(data.toString('hex'));
409
+ * // Prints:
410
+ * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
411
+ * }
412
+ * });
413
+ *
414
+ * hmac.write('some data to hash');
415
+ * hmac.end();
416
+ * ```
417
+ *
418
+ * Example: Using `Hmac` and piped streams:
419
+ *
420
+ * ```js
421
+ * import { createReadStream } from 'fs';
422
+ * import { stdout } from 'process';
423
+ * const {
424
+ * createHmac
425
+ * } = await import('crypto');
426
+ *
427
+ * const hmac = createHmac('sha256', 'a secret');
428
+ *
429
+ * const input = createReadStream('test.js');
430
+ * input.pipe(hmac).pipe(stdout);
431
+ * ```
432
+ *
433
+ * Example: Using the `hmac.update()` and `hmac.digest()` methods:
434
+ *
435
+ * ```js
436
+ * const {
437
+ * createHmac
438
+ * } = await import('crypto');
439
+ *
440
+ * const hmac = createHmac('sha256', 'a secret');
441
+ *
442
+ * hmac.update('some data to hash');
443
+ * console.log(hmac.digest('hex'));
444
+ * // Prints:
445
+ * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
446
+ * ```
447
+ * @since v0.1.94
448
+ */
449
+ class Hmac extends stream.Transform {
450
+ private constructor();
451
+ /**
452
+ * Updates the `Hmac` content with the given `data`, the encoding of which
453
+ * is given in `inputEncoding`.
454
+ * If `encoding` is not provided, and the `data` is a string, an
455
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
456
+ *
457
+ * This can be called many times with new data as it is streamed.
458
+ * @since v0.1.94
459
+ * @param inputEncoding The `encoding` of the `data` string.
460
+ */
461
+ update(data: BinaryLike): Hmac;
462
+ update(data: string, inputEncoding: Encoding): Hmac;
463
+ /**
464
+ * Calculates the HMAC digest of all of the data passed using `hmac.update()`.
465
+ * If `encoding` is
466
+ * provided a string is returned; otherwise a `Buffer` is returned;
467
+ *
468
+ * The `Hmac` object can not be used again after `hmac.digest()` has been
469
+ * called. Multiple calls to `hmac.digest()` will result in an error being thrown.
470
+ * @since v0.1.94
471
+ * @param encoding The `encoding` of the return value.
472
+ */
473
+ digest(): Buffer;
474
+ digest(encoding: BinaryToTextEncoding): string;
475
+ }
476
+ type KeyObjectType = 'secret' | 'public' | 'private';
477
+ interface KeyExportOptions<T extends KeyFormat> {
478
+ type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
479
+ format: T;
480
+ cipher?: string | undefined;
481
+ passphrase?: string | Buffer | undefined;
482
+ }
483
+ interface JwkKeyExportOptions {
484
+ format: 'jwk';
485
+ }
486
+ interface JsonWebKey {
487
+ crv?: string | undefined;
488
+ d?: string | undefined;
489
+ dp?: string | undefined;
490
+ dq?: string | undefined;
491
+ e?: string | undefined;
492
+ k?: string | undefined;
493
+ kty?: string | undefined;
494
+ n?: string | undefined;
495
+ p?: string | undefined;
496
+ q?: string | undefined;
497
+ qi?: string | undefined;
498
+ x?: string | undefined;
499
+ y?: string | undefined;
500
+ [key: string]: unknown;
501
+ }
502
+ interface AsymmetricKeyDetails {
503
+ /**
504
+ * Key size in bits (RSA, DSA).
505
+ */
506
+ modulusLength?: number | undefined;
507
+ /**
508
+ * Public exponent (RSA).
509
+ */
510
+ publicExponent?: bigint | undefined;
511
+ /**
512
+ * Size of q in bits (DSA).
513
+ */
514
+ divisorLength?: number | undefined;
515
+ /**
516
+ * Name of the curve (EC).
517
+ */
518
+ namedCurve?: string | undefined;
519
+ }
520
+ interface JwkKeyExportOptions {
521
+ format: 'jwk';
522
+ }
523
+ /**
524
+ * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
525
+ * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject`
526
+ * objects are not to be created directly using the `new`keyword.
527
+ *
528
+ * Most applications should consider using the new `KeyObject` API instead of
529
+ * passing keys as strings or `Buffer`s due to improved security features.
530
+ *
531
+ * `KeyObject` instances can be passed to other threads via `postMessage()`.
532
+ * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to
533
+ * be listed in the `transferList` argument.
534
+ * @since v11.6.0
535
+ */
536
+ class KeyObject {
537
+ private constructor();
538
+ /**
539
+ * For asymmetric keys, this property represents the type of the key. Supported key
540
+ * types are:
541
+ *
542
+ * * `'rsa'` (OID 1.2.840.113549.1.1.1)
543
+ * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10)
544
+ * * `'dsa'` (OID 1.2.840.10040.4.1)
545
+ * * `'ec'` (OID 1.2.840.10045.2.1)
546
+ * * `'x25519'` (OID 1.3.101.110)
547
+ * * `'x448'` (OID 1.3.101.111)
548
+ * * `'ed25519'` (OID 1.3.101.112)
549
+ * * `'ed448'` (OID 1.3.101.113)
550
+ * * `'dh'` (OID 1.2.840.113549.1.3.1)
551
+ *
552
+ * This property is `undefined` for unrecognized `KeyObject` types and symmetric
553
+ * keys.
554
+ * @since v11.6.0
555
+ */
556
+ asymmetricKeyType?: KeyType | undefined;
557
+ /**
558
+ * For asymmetric keys, this property represents the size of the embedded key in
559
+ * bytes. This property is `undefined` for symmetric keys.
560
+ */
561
+ asymmetricKeySize?: number | undefined;
562
+ /**
563
+ * This property exists only on asymmetric keys. Depending on the type of the key,
564
+ * this object contains information about the key. None of the information obtained
565
+ * through this property can be used to uniquely identify a key or to compromise
566
+ * the security of the key.
567
+ *
568
+ * RSA-PSS parameters, DH, or any future key type details might be exposed via this
569
+ * API using additional attributes.
570
+ * @since v15.7.0
571
+ */
572
+ asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
573
+ /**
574
+ * For symmetric keys, the following encoding options can be used:
575
+ *
576
+ * For public keys, the following encoding options can be used:
577
+ *
578
+ * For private keys, the following encoding options can be used:
579
+ *
580
+ * The result type depends on the selected encoding format, when PEM the
581
+ * result is a string, when DER it will be a buffer containing the data
582
+ * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object.
583
+ *
584
+ * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are
585
+ * ignored.
586
+ *
587
+ * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of
588
+ * 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
589
+ * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for
590
+ * encrypted private keys. Since PKCS#8 defines its own
591
+ * encryption mechanism, PEM-level encryption is not supported when encrypting
592
+ * 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
593
+ * PKCS#1 and SEC1 encryption.
594
+ * @since v11.6.0
595
+ */
596
+ export(options: KeyExportOptions<'pem'>): string | Buffer;
597
+ export(options?: KeyExportOptions<'der'>): Buffer;
598
+ export(options?: JwkKeyExportOptions): JsonWebKey;
599
+ /**
600
+ * For secret keys, this property represents the size of the key in bytes. This
601
+ * property is `undefined` for asymmetric keys.
602
+ * @since v11.6.0
603
+ */
604
+ symmetricKeySize?: number | undefined;
605
+ /**
606
+ * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys
607
+ * or `'private'` for private (asymmetric) keys.
608
+ * @since v11.6.0
609
+ */
610
+ type: KeyObjectType;
611
+ }
612
+ type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305';
613
+ type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
614
+ type BinaryLike = string | NodeJS.ArrayBufferView;
615
+ type CipherKey = BinaryLike | KeyObject;
616
+ interface CipherCCMOptions extends stream.TransformOptions {
617
+ authTagLength: number;
618
+ }
619
+ interface CipherGCMOptions extends stream.TransformOptions {
620
+ authTagLength?: number | undefined;
621
+ }
622
+ /**
623
+ * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
624
+ *
625
+ * The `options` argument controls stream behavior and is optional except when a
626
+ * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
627
+ * 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
628
+ * tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
629
+ *
630
+ * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
631
+ * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
632
+ * display the available cipher algorithms.
633
+ *
634
+ * The `password` is used to derive the cipher key and initialization vector (IV).
635
+ * The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`.
636
+ *
637
+ * The implementation of `crypto.createCipher()` derives keys using the OpenSSL
638
+ * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
639
+ * iteration, and no salt. The lack of salt allows dictionary attacks as the same
640
+ * password always creates the same key. The low iteration count and
641
+ * non-cryptographically secure hash algorithm allow passwords to be tested very
642
+ * rapidly.
643
+ *
644
+ * In line with OpenSSL's recommendation to use a more modern algorithm instead of[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
645
+ * developers derive a key and IV on
646
+ * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode
647
+ * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when
648
+ * they are used in order to avoid the risk of IV reuse that causes
649
+ * vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details.
650
+ * @since v0.1.94
651
+ * @deprecated Since v10.0.0 - Use {@link createCipheriv} instead.
652
+ * @param options `stream.transform` options
653
+ */
654
+ function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM;
655
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
656
+ function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM;
657
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
658
+ function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher;
659
+ /**
660
+ * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
661
+ * initialization vector (`iv`).
662
+ *
663
+ * The `options` argument controls stream behavior and is optional except when a
664
+ * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
665
+ * 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
666
+ * tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
667
+ *
668
+ * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
669
+ * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
670
+ * display the available cipher algorithms.
671
+ *
672
+ * 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
673
+ * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be
674
+ * a `KeyObject` of type `secret`. If the cipher does not need
675
+ * an initialization vector, `iv` may be `null`.
676
+ *
677
+ * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`.
678
+ *
679
+ * Initialization vectors should be unpredictable and unique; ideally, they will be
680
+ * cryptographically random. They do not have to be secret: IVs are typically just
681
+ * added to ciphertext messages unencrypted. It may sound contradictory that
682
+ * something has to be unpredictable and unique, but does not have to be secret;
683
+ * remember that an attacker must not be able to predict ahead of time what a
684
+ * given IV will be.
685
+ * @since v0.1.94
686
+ * @param options `stream.transform` options
687
+ */
688
+ function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike | null, options: CipherCCMOptions): CipherCCM;
689
+ function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike | null, options?: CipherGCMOptions): CipherGCM;
690
+ function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher;
691
+ /**
692
+ * Instances of the `Cipher` class are used to encrypt data. The class can be
693
+ * used in one of two ways:
694
+ *
695
+ * * As a `stream` that is both readable and writable, where plain unencrypted
696
+ * data is written to produce encrypted data on the readable side, or
697
+ * * Using the `cipher.update()` and `cipher.final()` methods to produce
698
+ * the encrypted data.
699
+ *
700
+ * The {@link createCipher} or {@link createCipheriv} methods are
701
+ * used to create `Cipher` instances. `Cipher` objects are not to be created
702
+ * directly using the `new` keyword.
703
+ *
704
+ * Example: Using `Cipher` objects as streams:
705
+ *
706
+ * ```js
707
+ * const {
708
+ * scrypt,
709
+ * randomFill,
710
+ * createCipheriv
711
+ * } = await import('crypto');
712
+ *
713
+ * const algorithm = 'aes-192-cbc';
714
+ * const password = 'Password used to generate key';
715
+ *
716
+ * // First, we'll generate the key. The key length is dependent on the algorithm.
717
+ * // In this case for aes192, it is 24 bytes (192 bits).
718
+ * scrypt(password, 'salt', 24, (err, key) => {
719
+ * if (err) throw err;
720
+ * // Then, we'll generate a random initialization vector
721
+ * randomFill(new Uint8Array(16), (err, iv) => {
722
+ * if (err) throw err;
723
+ *
724
+ * // Once we have the key and iv, we can create and use the cipher...
725
+ * const cipher = createCipheriv(algorithm, key, iv);
726
+ *
727
+ * let encrypted = '';
728
+ * cipher.setEncoding('hex');
729
+ *
730
+ * cipher.on('data', (chunk) => encrypted += chunk);
731
+ * cipher.on('end', () => console.log(encrypted));
732
+ *
733
+ * cipher.write('some clear text data');
734
+ * cipher.end();
735
+ * });
736
+ * });
737
+ * ```
738
+ *
739
+ * Example: Using `Cipher` and piped streams:
740
+ *
741
+ * ```js
742
+ * import {
743
+ * createReadStream,
744
+ * createWriteStream,
745
+ * } from 'fs';
746
+ *
747
+ * import {
748
+ * pipeline
749
+ * } from 'stream';
750
+ *
751
+ * const {
752
+ * scrypt,
753
+ * randomFill,
754
+ * createCipheriv
755
+ * } = await import('crypto');
756
+ *
757
+ * const algorithm = 'aes-192-cbc';
758
+ * const password = 'Password used to generate key';
759
+ *
760
+ * // First, we'll generate the key. The key length is dependent on the algorithm.
761
+ * // In this case for aes192, it is 24 bytes (192 bits).
762
+ * scrypt(password, 'salt', 24, (err, key) => {
763
+ * if (err) throw err;
764
+ * // Then, we'll generate a random initialization vector
765
+ * randomFill(new Uint8Array(16), (err, iv) => {
766
+ * if (err) throw err;
767
+ *
768
+ * const cipher = createCipheriv(algorithm, key, iv);
769
+ *
770
+ * const input = createReadStream('test.js');
771
+ * const output = createWriteStream('test.enc');
772
+ *
773
+ * pipeline(input, cipher, output, (err) => {
774
+ * if (err) throw err;
775
+ * });
776
+ * });
777
+ * });
778
+ * ```
779
+ *
780
+ * Example: Using the `cipher.update()` and `cipher.final()` methods:
781
+ *
782
+ * ```js
783
+ * const {
784
+ * scrypt,
785
+ * randomFill,
786
+ * createCipheriv
787
+ * } = await import('crypto');
788
+ *
789
+ * const algorithm = 'aes-192-cbc';
790
+ * const password = 'Password used to generate key';
791
+ *
792
+ * // First, we'll generate the key. The key length is dependent on the algorithm.
793
+ * // In this case for aes192, it is 24 bytes (192 bits).
794
+ * scrypt(password, 'salt', 24, (err, key) => {
795
+ * if (err) throw err;
796
+ * // Then, we'll generate a random initialization vector
797
+ * randomFill(new Uint8Array(16), (err, iv) => {
798
+ * if (err) throw err;
799
+ *
800
+ * const cipher = createCipheriv(algorithm, key, iv);
801
+ *
802
+ * let encrypted = cipher.update('some clear text data', 'utf8', 'hex');
803
+ * encrypted += cipher.final('hex');
804
+ * console.log(encrypted);
805
+ * });
806
+ * });
807
+ * ```
808
+ * @since v0.1.94
809
+ */
810
+ class Cipher extends stream.Transform {
811
+ private constructor();
812
+ /**
813
+ * Updates the cipher with `data`. If the `inputEncoding` argument is given,
814
+ * 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`,
815
+ * `TypedArray`, or `DataView`, then`inputEncoding` is ignored.
816
+ *
817
+ * The `outputEncoding` specifies the output format of the enciphered
818
+ * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned.
819
+ *
820
+ * 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
821
+ * thrown.
822
+ * @since v0.1.94
823
+ * @param inputEncoding The `encoding` of the data.
824
+ * @param outputEncoding The `encoding` of the return value.
825
+ */
826
+ update(data: BinaryLike): Buffer;
827
+ update(data: string, inputEncoding: Encoding): Buffer;
828
+ update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
829
+ update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
830
+ /**
831
+ * Once the `cipher.final()` method has been called, the `Cipher` object can no
832
+ * longer be used to encrypt data. Attempts to call `cipher.final()` more than
833
+ * once will result in an error being thrown.
834
+ * @since v0.1.94
835
+ * @param outputEncoding The `encoding` of the return value.
836
+ * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
837
+ */
838
+ final(): Buffer;
839
+ final(outputEncoding: BufferEncoding): string;
840
+ /**
841
+ * When using block encryption algorithms, the `Cipher` class will automatically
842
+ * add padding to the input data to the appropriate block size. To disable the
843
+ * default padding call `cipher.setAutoPadding(false)`.
844
+ *
845
+ * When `autoPadding` is `false`, the length of the entire input data must be a
846
+ * multiple of the cipher's block size or `cipher.final()` will throw an error.
847
+ * Disabling automatic padding is useful for non-standard padding, for instance
848
+ * using `0x0` instead of PKCS padding.
849
+ *
850
+ * The `cipher.setAutoPadding()` method must be called before `cipher.final()`.
851
+ * @since v0.7.1
852
+ * @param [autoPadding=true]
853
+ * @return for method chaining.
854
+ */
855
+ setAutoPadding(autoPadding?: boolean): this;
856
+ }
857
+ interface CipherCCM extends Cipher {
858
+ setAAD(
859
+ buffer: NodeJS.ArrayBufferView,
860
+ options: {
861
+ plaintextLength: number;
862
+ }
863
+ ): this;
864
+ getAuthTag(): Buffer;
865
+ }
866
+ interface CipherGCM extends Cipher {
867
+ setAAD(
868
+ buffer: NodeJS.ArrayBufferView,
869
+ options?: {
870
+ plaintextLength: number;
871
+ }
872
+ ): this;
873
+ getAuthTag(): Buffer;
874
+ }
875
+ /**
876
+ * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
877
+ *
878
+ * The `options` argument controls stream behavior and is optional except when a
879
+ * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
880
+ * authentication tag in bytes, see `CCM mode`.
881
+ *
882
+ * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
883
+ * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
884
+ * iteration, and no salt. The lack of salt allows dictionary attacks as the same
885
+ * password always creates the same key. The low iteration count and
886
+ * non-cryptographically secure hash algorithm allow passwords to be tested very
887
+ * rapidly.
888
+ *
889
+ * In line with OpenSSL's recommendation to use a more modern algorithm instead of[`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
890
+ * developers derive a key and IV on
891
+ * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object.
892
+ * @since v0.1.94
893
+ * @deprecated Since v10.0.0 - Use {@link createDecipheriv} instead.
894
+ * @param options `stream.transform` options
895
+ */
896
+ function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM;
897
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
898
+ function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
899
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
900
+ function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher;
901
+ /**
902
+ * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
903
+ *
904
+ * The `options` argument controls stream behavior and is optional except when a
905
+ * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
906
+ * 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
907
+ * to those with the specified length.
908
+ *
909
+ * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
910
+ * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
911
+ * display the available cipher algorithms.
912
+ *
913
+ * 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
914
+ * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be
915
+ * a `KeyObject` of type `secret`. If the cipher does not need
916
+ * an initialization vector, `iv` may be `null`.
917
+ *
918
+ * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`.
919
+ *
920
+ * Initialization vectors should be unpredictable and unique; ideally, they will be
921
+ * cryptographically random. They do not have to be secret: IVs are typically just
922
+ * added to ciphertext messages unencrypted. It may sound contradictory that
923
+ * something has to be unpredictable and unique, but does not have to be secret;
924
+ * remember that an attacker must not be able to predict ahead of time what a given
925
+ * IV will be.
926
+ * @since v0.1.94
927
+ * @param options `stream.transform` options
928
+ */
929
+ function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike | null, options: CipherCCMOptions): DecipherCCM;
930
+ function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike | null, options?: CipherGCMOptions): DecipherGCM;
931
+ function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
932
+ /**
933
+ * Instances of the `Decipher` class are used to decrypt data. The class can be
934
+ * used in one of two ways:
935
+ *
936
+ * * As a `stream` that is both readable and writable, where plain encrypted
937
+ * data is written to produce unencrypted data on the readable side, or
938
+ * * Using the `decipher.update()` and `decipher.final()` methods to
939
+ * produce the unencrypted data.
940
+ *
941
+ * The {@link createDecipher} or {@link createDecipheriv} methods are
942
+ * used to create `Decipher` instances. `Decipher` objects are not to be created
943
+ * directly using the `new` keyword.
944
+ *
945
+ * Example: Using `Decipher` objects as streams:
946
+ *
947
+ * ```js
948
+ * import { Buffer } from 'buffer';
949
+ * const {
950
+ * scryptSync,
951
+ * createDecipheriv
952
+ * } = await import('crypto');
953
+ *
954
+ * const algorithm = 'aes-192-cbc';
955
+ * const password = 'Password used to generate key';
956
+ * // Key length is dependent on the algorithm. In this case for aes192, it is
957
+ * // 24 bytes (192 bits).
958
+ * // Use the async `crypto.scrypt()` instead.
959
+ * const key = scryptSync(password, 'salt', 24);
960
+ * // The IV is usually passed along with the ciphertext.
961
+ * const iv = Buffer.alloc(16, 0); // Initialization vector.
962
+ *
963
+ * const decipher = createDecipheriv(algorithm, key, iv);
964
+ *
965
+ * let decrypted = '';
966
+ * decipher.on('readable', () => {
967
+ * while (null !== (chunk = decipher.read())) {
968
+ * decrypted += chunk.toString('utf8');
969
+ * }
970
+ * });
971
+ * decipher.on('end', () => {
972
+ * console.log(decrypted);
973
+ * // Prints: some clear text data
974
+ * });
975
+ *
976
+ * // Encrypted with same algorithm, key and iv.
977
+ * const encrypted =
978
+ * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa';
979
+ * decipher.write(encrypted, 'hex');
980
+ * decipher.end();
981
+ * ```
982
+ *
983
+ * Example: Using `Decipher` and piped streams:
984
+ *
985
+ * ```js
986
+ * import {
987
+ * createReadStream,
988
+ * createWriteStream,
989
+ * } from 'fs';
990
+ * import { Buffer } from 'buffer';
991
+ * const {
992
+ * scryptSync,
993
+ * createDecipheriv
994
+ * } = await import('crypto');
995
+ *
996
+ * const algorithm = 'aes-192-cbc';
997
+ * const password = 'Password used to generate key';
998
+ * // Use the async `crypto.scrypt()` instead.
999
+ * const key = scryptSync(password, 'salt', 24);
1000
+ * // The IV is usually passed along with the ciphertext.
1001
+ * const iv = Buffer.alloc(16, 0); // Initialization vector.
1002
+ *
1003
+ * const decipher = createDecipheriv(algorithm, key, iv);
1004
+ *
1005
+ * const input = createReadStream('test.enc');
1006
+ * const output = createWriteStream('test.js');
1007
+ *
1008
+ * input.pipe(decipher).pipe(output);
1009
+ * ```
1010
+ *
1011
+ * Example: Using the `decipher.update()` and `decipher.final()` methods:
1012
+ *
1013
+ * ```js
1014
+ * import { Buffer } from 'buffer';
1015
+ * const {
1016
+ * scryptSync,
1017
+ * createDecipheriv
1018
+ * } = await import('crypto');
1019
+ *
1020
+ * const algorithm = 'aes-192-cbc';
1021
+ * const password = 'Password used to generate key';
1022
+ * // Use the async `crypto.scrypt()` instead.
1023
+ * const key = scryptSync(password, 'salt', 24);
1024
+ * // The IV is usually passed along with the ciphertext.
1025
+ * const iv = Buffer.alloc(16, 0); // Initialization vector.
1026
+ *
1027
+ * const decipher = createDecipheriv(algorithm, key, iv);
1028
+ *
1029
+ * // Encrypted using same algorithm, key and iv.
1030
+ * const encrypted =
1031
+ * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa';
1032
+ * let decrypted = decipher.update(encrypted, 'hex', 'utf8');
1033
+ * decrypted += decipher.final('utf8');
1034
+ * console.log(decrypted);
1035
+ * // Prints: some clear text data
1036
+ * ```
1037
+ * @since v0.1.94
1038
+ */
1039
+ class Decipher extends stream.Transform {
1040
+ private constructor();
1041
+ /**
1042
+ * Updates the decipher with `data`. If the `inputEncoding` argument is given,
1043
+ * 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
1044
+ * ignored.
1045
+ *
1046
+ * The `outputEncoding` specifies the output format of the enciphered
1047
+ * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned.
1048
+ *
1049
+ * 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
1050
+ * being thrown.
1051
+ * @since v0.1.94
1052
+ * @param inputEncoding The `encoding` of the `data` string.
1053
+ * @param outputEncoding The `encoding` of the return value.
1054
+ */
1055
+ update(data: NodeJS.ArrayBufferView): Buffer;
1056
+ update(data: string, inputEncoding: Encoding): Buffer;
1057
+ update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
1058
+ update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
1059
+ /**
1060
+ * Once the `decipher.final()` method has been called, the `Decipher` object can
1061
+ * no longer be used to decrypt data. Attempts to call `decipher.final()` more
1062
+ * than once will result in an error being thrown.
1063
+ * @since v0.1.94
1064
+ * @param outputEncoding The `encoding` of the return value.
1065
+ * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
1066
+ */
1067
+ final(): Buffer;
1068
+ final(outputEncoding: BufferEncoding): string;
1069
+ /**
1070
+ * 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
1071
+ * removing padding.
1072
+ *
1073
+ * Turning auto padding off will only work if the input data's length is a
1074
+ * multiple of the ciphers block size.
1075
+ *
1076
+ * The `decipher.setAutoPadding()` method must be called before `decipher.final()`.
1077
+ * @since v0.7.1
1078
+ * @param [autoPadding=true]
1079
+ * @return for method chaining.
1080
+ */
1081
+ setAutoPadding(auto_padding?: boolean): this;
1082
+ }
1083
+ interface DecipherCCM extends Decipher {
1084
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1085
+ setAAD(
1086
+ buffer: NodeJS.ArrayBufferView,
1087
+ options: {
1088
+ plaintextLength: number;
1089
+ }
1090
+ ): this;
1091
+ }
1092
+ interface DecipherGCM extends Decipher {
1093
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1094
+ setAAD(
1095
+ buffer: NodeJS.ArrayBufferView,
1096
+ options?: {
1097
+ plaintextLength: number;
1098
+ }
1099
+ ): this;
1100
+ }
1101
+ interface PrivateKeyInput {
1102
+ key: string | Buffer;
1103
+ format?: KeyFormat | undefined;
1104
+ type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
1105
+ passphrase?: string | Buffer | undefined;
1106
+ }
1107
+ interface PublicKeyInput {
1108
+ key: string | Buffer;
1109
+ format?: KeyFormat | undefined;
1110
+ type?: 'pkcs1' | 'spki' | undefined;
1111
+ }
1112
+ /**
1113
+ * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
1114
+ *
1115
+ * ```js
1116
+ * const {
1117
+ * generateKey
1118
+ * } = await import('crypto');
1119
+ *
1120
+ * generateKey('hmac', { length: 64 }, (err, key) => {
1121
+ * if (err) throw err;
1122
+ * console.log(key.export().toString('hex')); // 46e..........620
1123
+ * });
1124
+ * ```
1125
+ * @since v15.0.0
1126
+ * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
1127
+ */
1128
+ function generateKey(
1129
+ type: 'hmac' | 'aes',
1130
+ options: {
1131
+ length: number;
1132
+ },
1133
+ callback: (err: Error | null, key: KeyObject) => void
1134
+ ): void;
1135
+ interface JsonWebKeyInput {
1136
+ key: JsonWebKey;
1137
+ format: 'jwk';
1138
+ }
1139
+ /**
1140
+ * Creates and returns a new key object containing a private key. If `key` is a
1141
+ * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above.
1142
+ *
1143
+ * If the private key is encrypted, a `passphrase` must be specified. The length
1144
+ * of the passphrase is limited to 1024 bytes.
1145
+ * @since v11.6.0
1146
+ */
1147
+ function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject;
1148
+ /**
1149
+ * Creates and returns a new key object containing a public key. If `key` is a
1150
+ * 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;
1151
+ * otherwise, `key` must be an object with the properties described above.
1152
+ *
1153
+ * If the format is `'pem'`, the `'key'` may also be an X.509 certificate.
1154
+ *
1155
+ * Because public keys can be derived from private keys, a private key may be
1156
+ * 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
1157
+ * returned `KeyObject` will be `'public'` and that the private key cannot be
1158
+ * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned
1159
+ * and it will be impossible to extract the private key from the returned object.
1160
+ * @since v11.6.0
1161
+ */
1162
+ function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject;
1163
+ /**
1164
+ * Creates and returns a new key object containing a secret key for symmetric
1165
+ * encryption or `Hmac`.
1166
+ * @since v11.6.0
1167
+ * @param encoding The string encoding when `key` is a string.
1168
+ */
1169
+ function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
1170
+ function createSecretKey(key: string, encoding: BufferEncoding): KeyObject;
1171
+ /**
1172
+ * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms.
1173
+ * Optional `options` argument controls the `stream.Writable` behavior.
1174
+ *
1175
+ * In some cases, a `Sign` instance can be created using the name of a signature
1176
+ * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use
1177
+ * the corresponding digest algorithm. This does not work for all signature
1178
+ * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest
1179
+ * algorithm names.
1180
+ * @since v0.1.92
1181
+ * @param options `stream.Writable` options
1182
+ */
1183
+ function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
1184
+ type DSAEncoding = 'der' | 'ieee-p1363';
1185
+ interface SigningOptions {
1186
+ /**
1187
+ * @See crypto.constants.RSA_PKCS1_PADDING
1188
+ */
1189
+ padding?: number | undefined;
1190
+ saltLength?: number | undefined;
1191
+ dsaEncoding?: DSAEncoding | undefined;
1192
+ }
1193
+ interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
1194
+ interface SignKeyObjectInput extends SigningOptions {
1195
+ key: KeyObject;
1196
+ }
1197
+ interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {}
1198
+ interface VerifyKeyObjectInput extends SigningOptions {
1199
+ key: KeyObject;
1200
+ }
1201
+ type KeyLike = string | Buffer | KeyObject;
1202
+ /**
1203
+ * The `Sign` class is a utility for generating signatures. It can be used in one
1204
+ * of two ways:
1205
+ *
1206
+ * * 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
1207
+ * * Using the `sign.update()` and `sign.sign()` methods to produce the
1208
+ * signature.
1209
+ *
1210
+ * The {@link createSign} method is used to create `Sign` instances. The
1211
+ * argument is the string name of the hash function to use. `Sign` objects are not
1212
+ * to be created directly using the `new` keyword.
1213
+ *
1214
+ * Example: Using `Sign` and `Verify` objects as streams:
1215
+ *
1216
+ * ```js
1217
+ * const {
1218
+ * generateKeyPairSync,
1219
+ * createSign,
1220
+ * createVerify
1221
+ * } = await import('crypto');
1222
+ *
1223
+ * const { privateKey, publicKey } = generateKeyPairSync('ec', {
1224
+ * namedCurve: 'sect239k1'
1225
+ * });
1226
+ *
1227
+ * const sign = createSign('SHA256');
1228
+ * sign.write('some data to sign');
1229
+ * sign.end();
1230
+ * const signature = sign.sign(privateKey, 'hex');
1231
+ *
1232
+ * const verify = createVerify('SHA256');
1233
+ * verify.write('some data to sign');
1234
+ * verify.end();
1235
+ * console.log(verify.verify(publicKey, signature, 'hex'));
1236
+ * // Prints: true
1237
+ * ```
1238
+ *
1239
+ * Example: Using the `sign.update()` and `verify.update()` methods:
1240
+ *
1241
+ * ```js
1242
+ * const {
1243
+ * generateKeyPairSync,
1244
+ * createSign,
1245
+ * createVerify
1246
+ * } = await import('crypto');
1247
+ *
1248
+ * const { privateKey, publicKey } = generateKeyPairSync('rsa', {
1249
+ * modulusLength: 2048,
1250
+ * });
1251
+ *
1252
+ * const sign = createSign('SHA256');
1253
+ * sign.update('some data to sign');
1254
+ * sign.end();
1255
+ * const signature = sign.sign(privateKey);
1256
+ *
1257
+ * const verify = createVerify('SHA256');
1258
+ * verify.update('some data to sign');
1259
+ * verify.end();
1260
+ * console.log(verify.verify(publicKey, signature));
1261
+ * // Prints: true
1262
+ * ```
1263
+ * @since v0.1.92
1264
+ */
1265
+ class Sign extends stream.Writable {
1266
+ private constructor();
1267
+ /**
1268
+ * Updates the `Sign` content with the given `data`, the encoding of which
1269
+ * is given in `inputEncoding`.
1270
+ * If `encoding` is not provided, and the `data` is a string, an
1271
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
1272
+ *
1273
+ * This can be called many times with new data as it is streamed.
1274
+ * @since v0.1.92
1275
+ * @param inputEncoding The `encoding` of the `data` string.
1276
+ */
1277
+ update(data: BinaryLike): this;
1278
+ update(data: string, inputEncoding: Encoding): this;
1279
+ /**
1280
+ * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`.
1281
+ *
1282
+ * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
1283
+ * object, the following additional properties can be passed:
1284
+ *
1285
+ * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned.
1286
+ *
1287
+ * The `Sign` object can not be again used after `sign.sign()` method has been
1288
+ * called. Multiple calls to `sign.sign()` will result in an error being thrown.
1289
+ * @since v0.1.92
1290
+ */
1291
+ sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
1292
+ sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string;
1293
+ }
1294
+ /**
1295
+ * Creates and returns a `Verify` object that uses the given algorithm.
1296
+ * Use {@link getHashes} to obtain an array of names of the available
1297
+ * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior.
1298
+ *
1299
+ * In some cases, a `Verify` instance can be created using the name of a signature
1300
+ * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use
1301
+ * the corresponding digest algorithm. This does not work for all signature
1302
+ * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest
1303
+ * algorithm names.
1304
+ * @since v0.1.92
1305
+ * @param options `stream.Writable` options
1306
+ */
1307
+ function createVerify(algorithm: string, options?: stream.WritableOptions): Verify;
1308
+ /**
1309
+ * The `Verify` class is a utility for verifying signatures. It can be used in one
1310
+ * of two ways:
1311
+ *
1312
+ * * As a writable `stream` where written data is used to validate against the
1313
+ * supplied signature, or
1314
+ * * Using the `verify.update()` and `verify.verify()` methods to verify
1315
+ * the signature.
1316
+ *
1317
+ * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword.
1318
+ *
1319
+ * See `Sign` for examples.
1320
+ * @since v0.1.92
1321
+ */
1322
+ class Verify extends stream.Writable {
1323
+ private constructor();
1324
+ /**
1325
+ * Updates the `Verify` content with the given `data`, the encoding of which
1326
+ * is given in `inputEncoding`.
1327
+ * If `inputEncoding` is not provided, and the `data` is a string, an
1328
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
1329
+ *
1330
+ * This can be called many times with new data as it is streamed.
1331
+ * @since v0.1.92
1332
+ * @param inputEncoding The `encoding` of the `data` string.
1333
+ */
1334
+ update(data: BinaryLike): Verify;
1335
+ update(data: string, inputEncoding: Encoding): Verify;
1336
+ /**
1337
+ * Verifies the provided data using the given `object` and `signature`.
1338
+ *
1339
+ * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an
1340
+ * object, the following additional properties can be passed:
1341
+ *
1342
+ * The `signature` argument is the previously calculated signature for the data, in
1343
+ * the `signatureEncoding`.
1344
+ * If a `signatureEncoding` is specified, the `signature` is expected to be a
1345
+ * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
1346
+ *
1347
+ * The `verify` object can not be used again after `verify.verify()` has been
1348
+ * called. Multiple calls to `verify.verify()` will result in an error being
1349
+ * thrown.
1350
+ *
1351
+ * Because public keys can be derived from private keys, a private key may
1352
+ * be passed instead of a public key.
1353
+ * @since v0.1.92
1354
+ */
1355
+ verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
1356
+ verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
1357
+ }
1358
+ /**
1359
+ * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
1360
+ * optional specific `generator`.
1361
+ *
1362
+ * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used.
1363
+ *
1364
+ * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise
1365
+ * a `Buffer`, `TypedArray`, or `DataView` is expected.
1366
+ *
1367
+ * If `generatorEncoding` is specified, `generator` is expected to be a string;
1368
+ * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected.
1369
+ * @since v0.11.12
1370
+ * @param primeEncoding The `encoding` of the `prime` string.
1371
+ * @param [generator=2]
1372
+ * @param generatorEncoding The `encoding` of the `generator` string.
1373
+ */
1374
+ function createDiffieHellman(primeLength: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman;
1375
+ function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
1376
+ function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding): DiffieHellman;
1377
+ function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman;
1378
+ function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
1379
+ /**
1380
+ * The `DiffieHellman` class is a utility for creating Diffie-Hellman key
1381
+ * exchanges.
1382
+ *
1383
+ * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function.
1384
+ *
1385
+ * ```js
1386
+ * import assert from 'assert';
1387
+ *
1388
+ * const {
1389
+ * createDiffieHellman
1390
+ * } = await import('crypto');
1391
+ *
1392
+ * // Generate Alice's keys...
1393
+ * const alice = createDiffieHellman(2048);
1394
+ * const aliceKey = alice.generateKeys();
1395
+ *
1396
+ * // Generate Bob's keys...
1397
+ * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator());
1398
+ * const bobKey = bob.generateKeys();
1399
+ *
1400
+ * // Exchange and generate the secret...
1401
+ * const aliceSecret = alice.computeSecret(bobKey);
1402
+ * const bobSecret = bob.computeSecret(aliceKey);
1403
+ *
1404
+ * // OK
1405
+ * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
1406
+ * ```
1407
+ * @since v0.5.0
1408
+ */
1409
+ class DiffieHellman {
1410
+ private constructor();
1411
+ /**
1412
+ * Generates private and public Diffie-Hellman key values, and returns
1413
+ * the public key in the specified `encoding`. This key should be
1414
+ * transferred to the other party.
1415
+ * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
1416
+ * @since v0.5.0
1417
+ * @param encoding The `encoding` of the return value.
1418
+ */
1419
+ generateKeys(): Buffer;
1420
+ generateKeys(encoding: BinaryToTextEncoding): string;
1421
+ /**
1422
+ * Computes the shared secret using `otherPublicKey` as the other
1423
+ * party's public key and returns the computed shared secret. The supplied
1424
+ * key is interpreted using the specified `inputEncoding`, and secret is
1425
+ * encoded using specified `outputEncoding`.
1426
+ * If the `inputEncoding` is not
1427
+ * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
1428
+ *
1429
+ * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned.
1430
+ * @since v0.5.0
1431
+ * @param inputEncoding The `encoding` of an `otherPublicKey` string.
1432
+ * @param outputEncoding The `encoding` of the return value.
1433
+ */
1434
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
1435
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
1436
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
1437
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
1438
+ /**
1439
+ * Returns the Diffie-Hellman prime in the specified `encoding`.
1440
+ * If `encoding` is provided a string is
1441
+ * returned; otherwise a `Buffer` is returned.
1442
+ * @since v0.5.0
1443
+ * @param encoding The `encoding` of the return value.
1444
+ */
1445
+ getPrime(): Buffer;
1446
+ getPrime(encoding: BinaryToTextEncoding): string;
1447
+ /**
1448
+ * Returns the Diffie-Hellman generator in the specified `encoding`.
1449
+ * If `encoding` is provided a string is
1450
+ * returned; otherwise a `Buffer` is returned.
1451
+ * @since v0.5.0
1452
+ * @param encoding The `encoding` of the return value.
1453
+ */
1454
+ getGenerator(): Buffer;
1455
+ getGenerator(encoding: BinaryToTextEncoding): string;
1456
+ /**
1457
+ * Returns the Diffie-Hellman public key in the specified `encoding`.
1458
+ * If `encoding` is provided a
1459
+ * string is returned; otherwise a `Buffer` is returned.
1460
+ * @since v0.5.0
1461
+ * @param encoding The `encoding` of the return value.
1462
+ */
1463
+ getPublicKey(): Buffer;
1464
+ getPublicKey(encoding: BinaryToTextEncoding): string;
1465
+ /**
1466
+ * Returns the Diffie-Hellman private key in the specified `encoding`.
1467
+ * If `encoding` is provided a
1468
+ * string is returned; otherwise a `Buffer` is returned.
1469
+ * @since v0.5.0
1470
+ * @param encoding The `encoding` of the return value.
1471
+ */
1472
+ getPrivateKey(): Buffer;
1473
+ getPrivateKey(encoding: BinaryToTextEncoding): string;
1474
+ /**
1475
+ * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected
1476
+ * to be a string. If no `encoding` is provided, `publicKey` is expected
1477
+ * to be a `Buffer`, `TypedArray`, or `DataView`.
1478
+ * @since v0.5.0
1479
+ * @param encoding The `encoding` of the `publicKey` string.
1480
+ */
1481
+ setPublicKey(publicKey: NodeJS.ArrayBufferView): void;
1482
+ setPublicKey(publicKey: string, encoding: BufferEncoding): void;
1483
+ /**
1484
+ * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected
1485
+ * to be a string. If no `encoding` is provided, `privateKey` is expected
1486
+ * to be a `Buffer`, `TypedArray`, or `DataView`.
1487
+ * @since v0.5.0
1488
+ * @param encoding The `encoding` of the `privateKey` string.
1489
+ */
1490
+ setPrivateKey(privateKey: NodeJS.ArrayBufferView): void;
1491
+ setPrivateKey(privateKey: string, encoding: BufferEncoding): void;
1492
+ /**
1493
+ * A bit field containing any warnings and/or errors resulting from a check
1494
+ * performed during initialization of the `DiffieHellman` object.
1495
+ *
1496
+ * The following values are valid for this property (as defined in `constants`module):
1497
+ *
1498
+ * * `DH_CHECK_P_NOT_SAFE_PRIME`
1499
+ * * `DH_CHECK_P_NOT_PRIME`
1500
+ * * `DH_UNABLE_TO_CHECK_GENERATOR`
1501
+ * * `DH_NOT_SUITABLE_GENERATOR`
1502
+ * @since v0.11.12
1503
+ */
1504
+ verifyError: number;
1505
+ }
1506
+ /**
1507
+ * Creates a predefined `DiffieHellmanGroup` key exchange object. The
1508
+ * supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in[RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
1509
+ * `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The
1510
+ * returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
1511
+ * the keys (with `diffieHellman.setPublicKey()`, for example). The
1512
+ * advantage of using this method is that the parties do not have to
1513
+ * generate nor exchange a group modulus beforehand, saving both processor
1514
+ * and communication time.
1515
+ *
1516
+ * Example (obtaining a shared secret):
1517
+ *
1518
+ * ```js
1519
+ * const {
1520
+ * getDiffieHellman
1521
+ * } = await import('crypto');
1522
+ * const alice = getDiffieHellman('modp14');
1523
+ * const bob = getDiffieHellman('modp14');
1524
+ *
1525
+ * alice.generateKeys();
1526
+ * bob.generateKeys();
1527
+ *
1528
+ * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex');
1529
+ * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex');
1530
+ *
1531
+ * // aliceSecret and bobSecret should be the same
1532
+ * console.log(aliceSecret === bobSecret);
1533
+ * ```
1534
+ * @since v0.7.5
1535
+ */
1536
+ function getDiffieHellman(groupName: string): DiffieHellman;
1537
+ /**
1538
+ * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
1539
+ * implementation. A selected HMAC digest algorithm specified by `digest` is
1540
+ * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`.
1541
+ *
1542
+ * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set;
1543
+ * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be
1544
+ * thrown if any of the input arguments specify invalid values or types.
1545
+ *
1546
+ * If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated,
1547
+ * please specify a `digest` explicitly.
1548
+ *
1549
+ * The `iterations` argument must be a number set as high as possible. The
1550
+ * higher the number of iterations, the more secure the derived key will be,
1551
+ * but will take a longer amount of time to complete.
1552
+ *
1553
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1554
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1555
+ *
1556
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1557
+ *
1558
+ * ```js
1559
+ * const {
1560
+ * pbkdf2
1561
+ * } = await import('crypto');
1562
+ *
1563
+ * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => {
1564
+ * if (err) throw err;
1565
+ * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae'
1566
+ * });
1567
+ * ```
1568
+ *
1569
+ * The `crypto.DEFAULT_ENCODING` property can be used to change the way the`derivedKey` is passed to the callback. This property, however, has been
1570
+ * deprecated and use should be avoided.
1571
+ *
1572
+ * ```js
1573
+ * import crypto from 'crypto';
1574
+ * crypto.DEFAULT_ENCODING = 'hex';
1575
+ * crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => {
1576
+ * if (err) throw err;
1577
+ * console.log(derivedKey); // '3745e48...aa39b34'
1578
+ * });
1579
+ * ```
1580
+ *
1581
+ * An array of supported digest functions can be retrieved using {@link getHashes}.
1582
+ *
1583
+ * This API uses libuv's threadpool, which can have surprising and
1584
+ * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1585
+ * @since v0.5.5
1586
+ */
1587
+ function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void;
1588
+ /**
1589
+ * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
1590
+ * implementation. A selected HMAC digest algorithm specified by `digest` is
1591
+ * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`.
1592
+ *
1593
+ * If an error occurs an `Error` will be thrown, otherwise the derived key will be
1594
+ * returned as a `Buffer`.
1595
+ *
1596
+ * If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated,
1597
+ * please specify a `digest` explicitly.
1598
+ *
1599
+ * The `iterations` argument must be a number set as high as possible. The
1600
+ * higher the number of iterations, the more secure the derived key will be,
1601
+ * but will take a longer amount of time to complete.
1602
+ *
1603
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1604
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1605
+ *
1606
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1607
+ *
1608
+ * ```js
1609
+ * const {
1610
+ * pbkdf2Sync
1611
+ * } = await import('crypto');
1612
+ *
1613
+ * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512');
1614
+ * console.log(key.toString('hex')); // '3745e48...08d59ae'
1615
+ * ```
1616
+ *
1617
+ * The `crypto.DEFAULT_ENCODING` property may be used to change the way the`derivedKey` is returned. This property, however, is deprecated and use
1618
+ * should be avoided.
1619
+ *
1620
+ * ```js
1621
+ * import crypto from 'crypto';
1622
+ * crypto.DEFAULT_ENCODING = 'hex';
1623
+ * const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512');
1624
+ * console.log(key); // '3745e48...aa39b34'
1625
+ * ```
1626
+ *
1627
+ * An array of supported digest functions can be retrieved using {@link getHashes}.
1628
+ * @since v0.9.3
1629
+ */
1630
+ function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
1631
+ /**
1632
+ * Generates cryptographically strong pseudorandom data. The `size` argument
1633
+ * is a number indicating the number of bytes to generate.
1634
+ *
1635
+ * If a `callback` function is provided, the bytes are generated asynchronously
1636
+ * and the `callback` function is invoked with two arguments: `err` and `buf`.
1637
+ * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes.
1638
+ *
1639
+ * ```js
1640
+ * // Asynchronous
1641
+ * const {
1642
+ * randomBytes
1643
+ * } = await import('crypto');
1644
+ *
1645
+ * randomBytes(256, (err, buf) => {
1646
+ * if (err) throw err;
1647
+ * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`);
1648
+ * });
1649
+ * ```
1650
+ *
1651
+ * If the `callback` function is not provided, the random bytes are generated
1652
+ * synchronously and returned as a `Buffer`. An error will be thrown if
1653
+ * there is a problem generating the bytes.
1654
+ *
1655
+ * ```js
1656
+ * // Synchronous
1657
+ * const {
1658
+ * randomBytes
1659
+ * } = await import('crypto');
1660
+ *
1661
+ * const buf = randomBytes(256);
1662
+ * console.log(
1663
+ * `${buf.length} bytes of random data: ${buf.toString('hex')}`);
1664
+ * ```
1665
+ *
1666
+ * The `crypto.randomBytes()` method will not complete until there is
1667
+ * sufficient entropy available.
1668
+ * This should normally never take longer than a few milliseconds. The only time
1669
+ * when generating the random bytes may conceivably block for a longer period of
1670
+ * time is right after boot, when the whole system is still low on entropy.
1671
+ *
1672
+ * This API uses libuv's threadpool, which can have surprising and
1673
+ * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1674
+ *
1675
+ * The asynchronous version of `crypto.randomBytes()` is carried out in a single
1676
+ * threadpool request. To minimize threadpool task length variation, partition
1677
+ * large `randomBytes` requests when doing so as part of fulfilling a client
1678
+ * request.
1679
+ * @since v0.5.8
1680
+ * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`.
1681
+ * @return if the `callback` function is not provided.
1682
+ */
1683
+ function randomBytes(size: number): Buffer;
1684
+ function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
1685
+ function pseudoRandomBytes(size: number): Buffer;
1686
+ function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
1687
+ /**
1688
+ * Return a random integer `n` such that `min <= n < max`. This
1689
+ * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
1690
+ *
1691
+ * The range (`max - min`) must be less than 248. `min` and `max` must
1692
+ * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
1693
+ *
1694
+ * If the `callback` function is not provided, the random integer is
1695
+ * generated synchronously.
1696
+ *
1697
+ * ```js
1698
+ * // Asynchronous
1699
+ * const {
1700
+ * randomInt
1701
+ * } = await import('crypto');
1702
+ *
1703
+ * randomInt(3, (err, n) => {
1704
+ * if (err) throw err;
1705
+ * console.log(`Random number chosen from (0, 1, 2): ${n}`);
1706
+ * });
1707
+ * ```
1708
+ *
1709
+ * ```js
1710
+ * // Synchronous
1711
+ * const {
1712
+ * randomInt
1713
+ * } = await import('crypto');
1714
+ *
1715
+ * const n = randomInt(3);
1716
+ * console.log(`Random number chosen from (0, 1, 2): ${n}`);
1717
+ * ```
1718
+ *
1719
+ * ```js
1720
+ * // With `min` argument
1721
+ * const {
1722
+ * randomInt
1723
+ * } = await import('crypto');
1724
+ *
1725
+ * const n = randomInt(1, 7);
1726
+ * console.log(`The dice rolled: ${n}`);
1727
+ * ```
1728
+ * @since v14.10.0, v12.19.0
1729
+ * @param [min=0] Start of random range (inclusive).
1730
+ * @param max End of random range (exclusive).
1731
+ * @param callback `function(err, n) {}`.
1732
+ */
1733
+ function randomInt(max: number): number;
1734
+ function randomInt(min: number, max: number): number;
1735
+ function randomInt(max: number, callback: (err: Error | null, value: number) => void): void;
1736
+ function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void;
1737
+ /**
1738
+ * Synchronous version of {@link randomFill}.
1739
+ *
1740
+ * ```js
1741
+ * import { Buffer } from 'buffer';
1742
+ * const { randomFillSync } = await import('crypto');
1743
+ *
1744
+ * const buf = Buffer.alloc(10);
1745
+ * console.log(randomFillSync(buf).toString('hex'));
1746
+ *
1747
+ * randomFillSync(buf, 5);
1748
+ * console.log(buf.toString('hex'));
1749
+ *
1750
+ * // The above is equivalent to the following:
1751
+ * randomFillSync(buf, 5, 5);
1752
+ * console.log(buf.toString('hex'));
1753
+ * ```
1754
+ *
1755
+ * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`.
1756
+ *
1757
+ * ```js
1758
+ * import { Buffer } from 'buffer';
1759
+ * const { randomFillSync } = await import('crypto');
1760
+ *
1761
+ * const a = new Uint32Array(10);
1762
+ * console.log(Buffer.from(randomFillSync(a).buffer,
1763
+ * a.byteOffset, a.byteLength).toString('hex'));
1764
+ *
1765
+ * const b = new DataView(new ArrayBuffer(10));
1766
+ * console.log(Buffer.from(randomFillSync(b).buffer,
1767
+ * b.byteOffset, b.byteLength).toString('hex'));
1768
+ *
1769
+ * const c = new ArrayBuffer(10);
1770
+ * console.log(Buffer.from(randomFillSync(c)).toString('hex'));
1771
+ * ```
1772
+ * @since v7.10.0, v6.13.0
1773
+ * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`.
1774
+ * @param [offset=0]
1775
+ * @param [size=buffer.length - offset]
1776
+ * @return The object passed as `buffer` argument.
1777
+ */
1778
+ function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
1779
+ /**
1780
+ * This function is similar to {@link randomBytes} but requires the first
1781
+ * argument to be a `Buffer` that will be filled. It also
1782
+ * requires that a callback is passed in.
1783
+ *
1784
+ * If the `callback` function is not provided, an error will be thrown.
1785
+ *
1786
+ * ```js
1787
+ * import { Buffer } from 'buffer';
1788
+ * const { randomFill } = await import('crypto');
1789
+ *
1790
+ * const buf = Buffer.alloc(10);
1791
+ * randomFill(buf, (err, buf) => {
1792
+ * if (err) throw err;
1793
+ * console.log(buf.toString('hex'));
1794
+ * });
1795
+ *
1796
+ * randomFill(buf, 5, (err, buf) => {
1797
+ * if (err) throw err;
1798
+ * console.log(buf.toString('hex'));
1799
+ * });
1800
+ *
1801
+ * // The above is equivalent to the following:
1802
+ * randomFill(buf, 5, 5, (err, buf) => {
1803
+ * if (err) throw err;
1804
+ * console.log(buf.toString('hex'));
1805
+ * });
1806
+ * ```
1807
+ *
1808
+ * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`.
1809
+ *
1810
+ * While this includes instances of `Float32Array` and `Float64Array`, this
1811
+ * function should not be used to generate random floating-point numbers. The
1812
+ * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array
1813
+ * contains finite numbers only, they are not drawn from a uniform random
1814
+ * distribution and have no meaningful lower or upper bounds.
1815
+ *
1816
+ * ```js
1817
+ * import { Buffer } from 'buffer';
1818
+ * const { randomFill } = await import('crypto');
1819
+ *
1820
+ * const a = new Uint32Array(10);
1821
+ * randomFill(a, (err, buf) => {
1822
+ * if (err) throw err;
1823
+ * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
1824
+ * .toString('hex'));
1825
+ * });
1826
+ *
1827
+ * const b = new DataView(new ArrayBuffer(10));
1828
+ * randomFill(b, (err, buf) => {
1829
+ * if (err) throw err;
1830
+ * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength)
1831
+ * .toString('hex'));
1832
+ * });
1833
+ *
1834
+ * const c = new ArrayBuffer(10);
1835
+ * randomFill(c, (err, buf) => {
1836
+ * if (err) throw err;
1837
+ * console.log(Buffer.from(buf).toString('hex'));
1838
+ * });
1839
+ * ```
1840
+ *
1841
+ * This API uses libuv's threadpool, which can have surprising and
1842
+ * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
1843
+ *
1844
+ * The asynchronous version of `crypto.randomFill()` is carried out in a single
1845
+ * threadpool request. To minimize threadpool task length variation, partition
1846
+ * large `randomFill` requests when doing so as part of fulfilling a client
1847
+ * request.
1848
+ * @since v7.10.0, v6.13.0
1849
+ * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`.
1850
+ * @param [offset=0]
1851
+ * @param [size=buffer.length - offset]
1852
+ * @param callback `function(err, buf) {}`.
1853
+ */
1854
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
1855
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
1856
+ function randomFill<T extends NodeJS.ArrayBufferView>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
1857
+ interface ScryptOptions {
1858
+ cost?: number | undefined;
1859
+ blockSize?: number | undefined;
1860
+ parallelization?: number | undefined;
1861
+ N?: number | undefined;
1862
+ r?: number | undefined;
1863
+ p?: number | undefined;
1864
+ maxmem?: number | undefined;
1865
+ }
1866
+ /**
1867
+ * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
1868
+ * key derivation function that is designed to be expensive computationally and
1869
+ * memory-wise in order to make brute-force attacks unrewarding.
1870
+ *
1871
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1872
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1873
+ *
1874
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1875
+ *
1876
+ * 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
1877
+ * callback as a `Buffer`.
1878
+ *
1879
+ * An exception is thrown when any of the input arguments specify invalid values
1880
+ * or types.
1881
+ *
1882
+ * ```js
1883
+ * const {
1884
+ * scrypt
1885
+ * } = await import('crypto');
1886
+ *
1887
+ * // Using the factory defaults.
1888
+ * scrypt('password', 'salt', 64, (err, derivedKey) => {
1889
+ * if (err) throw err;
1890
+ * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae'
1891
+ * });
1892
+ * // Using a custom N parameter. Must be a power of two.
1893
+ * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => {
1894
+ * if (err) throw err;
1895
+ * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34'
1896
+ * });
1897
+ * ```
1898
+ * @since v10.5.0
1899
+ */
1900
+ function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void;
1901
+ function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void;
1902
+ /**
1903
+ * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
1904
+ * key derivation function that is designed to be expensive computationally and
1905
+ * memory-wise in order to make brute-force attacks unrewarding.
1906
+ *
1907
+ * The `salt` should be as unique as possible. It is recommended that a salt is
1908
+ * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
1909
+ *
1910
+ * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
1911
+ *
1912
+ * An exception is thrown when key derivation fails, otherwise the derived key is
1913
+ * returned as a `Buffer`.
1914
+ *
1915
+ * An exception is thrown when any of the input arguments specify invalid values
1916
+ * or types.
1917
+ *
1918
+ * ```js
1919
+ * const {
1920
+ * scryptSync
1921
+ * } = await import('crypto');
1922
+ * // Using the factory defaults.
1923
+ *
1924
+ * const key1 = scryptSync('password', 'salt', 64);
1925
+ * console.log(key1.toString('hex')); // '3745e48...08d59ae'
1926
+ * // Using a custom N parameter. Must be a power of two.
1927
+ * const key2 = scryptSync('password', 'salt', 64, { N: 1024 });
1928
+ * console.log(key2.toString('hex')); // '3745e48...aa39b34'
1929
+ * ```
1930
+ * @since v10.5.0
1931
+ */
1932
+ function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer;
1933
+ interface RsaPublicKey {
1934
+ key: KeyLike;
1935
+ padding?: number | undefined;
1936
+ }
1937
+ interface RsaPrivateKey {
1938
+ key: KeyLike;
1939
+ passphrase?: string | undefined;
1940
+ /**
1941
+ * @default 'sha1'
1942
+ */
1943
+ oaepHash?: string | undefined;
1944
+ oaepLabel?: NodeJS.TypedArray | undefined;
1945
+ padding?: number | undefined;
1946
+ }
1947
+ /**
1948
+ * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using
1949
+ * the corresponding private key, for example using {@link privateDecrypt}.
1950
+ *
1951
+ * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an
1952
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`.
1953
+ *
1954
+ * Because RSA public keys can be derived from private keys, a private key may
1955
+ * be passed instead of a public key.
1956
+ * @since v0.11.14
1957
+ */
1958
+ function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
1959
+ /**
1960
+ * Decrypts `buffer` with `key`.`buffer` was previously encrypted using
1961
+ * the corresponding private key, for example using {@link privateEncrypt}.
1962
+ *
1963
+ * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an
1964
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`.
1965
+ *
1966
+ * Because RSA public keys can be derived from private keys, a private key may
1967
+ * be passed instead of a public key.
1968
+ * @since v1.1.0
1969
+ */
1970
+ function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
1971
+ /**
1972
+ * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
1973
+ * the corresponding public key, for example using {@link publicEncrypt}.
1974
+ *
1975
+ * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
1976
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`.
1977
+ * @since v0.11.14
1978
+ */
1979
+ function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
1980
+ /**
1981
+ * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
1982
+ * the corresponding public key, for example using {@link publicDecrypt}.
1983
+ *
1984
+ * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
1985
+ * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`.
1986
+ * @since v1.1.0
1987
+ */
1988
+ function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
1989
+ /**
1990
+ * ```js
1991
+ * const {
1992
+ * getCiphers
1993
+ * } = await import('crypto');
1994
+ *
1995
+ * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...]
1996
+ * ```
1997
+ * @since v0.9.3
1998
+ * @return An array with the names of the supported cipher algorithms.
1999
+ */
2000
+ function getCiphers(): string[];
2001
+ /**
2002
+ * ```js
2003
+ * const {
2004
+ * getCurves
2005
+ * } = await import('crypto');
2006
+ *
2007
+ * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
2008
+ * ```
2009
+ * @since v2.3.0
2010
+ * @return An array with the names of the supported elliptic curves.
2011
+ */
2012
+ function getCurves(): string[];
2013
+ /**
2014
+ * @since v10.0.0
2015
+ * @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}.
2016
+ */
2017
+ function getFips(): 1 | 0;
2018
+ /**
2019
+ * ```js
2020
+ * const {
2021
+ * getHashes
2022
+ * } = await import('crypto');
2023
+ *
2024
+ * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
2025
+ * ```
2026
+ * @since v0.9.3
2027
+ * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms.
2028
+ */
2029
+ function getHashes(): string[];
2030
+ /**
2031
+ * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH)
2032
+ * key exchanges.
2033
+ *
2034
+ * Instances of the `ECDH` class can be created using the {@link createECDH} function.
2035
+ *
2036
+ * ```js
2037
+ * import assert from 'assert';
2038
+ *
2039
+ * const {
2040
+ * createECDH
2041
+ * } = await import('crypto');
2042
+ *
2043
+ * // Generate Alice's keys...
2044
+ * const alice = createECDH('secp521r1');
2045
+ * const aliceKey = alice.generateKeys();
2046
+ *
2047
+ * // Generate Bob's keys...
2048
+ * const bob = createECDH('secp521r1');
2049
+ * const bobKey = bob.generateKeys();
2050
+ *
2051
+ * // Exchange and generate the secret...
2052
+ * const aliceSecret = alice.computeSecret(bobKey);
2053
+ * const bobSecret = bob.computeSecret(aliceKey);
2054
+ *
2055
+ * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
2056
+ * // OK
2057
+ * ```
2058
+ * @since v0.11.14
2059
+ */
2060
+ class ECDH {
2061
+ private constructor();
2062
+ /**
2063
+ * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the
2064
+ * format specified by `format`. The `format` argument specifies point encoding
2065
+ * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is
2066
+ * interpreted using the specified `inputEncoding`, and the returned key is encoded
2067
+ * using the specified `outputEncoding`.
2068
+ *
2069
+ * Use {@link getCurves} to obtain a list of available curve names.
2070
+ * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display
2071
+ * the name and description of each available elliptic curve.
2072
+ *
2073
+ * If `format` is not specified the point will be returned in `'uncompressed'`format.
2074
+ *
2075
+ * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
2076
+ *
2077
+ * Example (uncompressing a key):
2078
+ *
2079
+ * ```js
2080
+ * const {
2081
+ * createECDH,
2082
+ * ECDH
2083
+ * } = await import('crypto');
2084
+ *
2085
+ * const ecdh = createECDH('secp256k1');
2086
+ * ecdh.generateKeys();
2087
+ *
2088
+ * const compressedKey = ecdh.getPublicKey('hex', 'compressed');
2089
+ *
2090
+ * const uncompressedKey = ECDH.convertKey(compressedKey,
2091
+ * 'secp256k1',
2092
+ * 'hex',
2093
+ * 'hex',
2094
+ * 'uncompressed');
2095
+ *
2096
+ * // The converted key and the uncompressed public key should be the same
2097
+ * console.log(uncompressedKey === ecdh.getPublicKey('hex'));
2098
+ * ```
2099
+ * @since v10.0.0
2100
+ * @param inputEncoding The `encoding` of the `key` string.
2101
+ * @param outputEncoding The `encoding` of the return value.
2102
+ * @param [format='uncompressed']
2103
+ */
2104
+ static convertKey(
2105
+ key: BinaryLike,
2106
+ curve: string,
2107
+ inputEncoding?: BinaryToTextEncoding,
2108
+ outputEncoding?: 'latin1' | 'hex' | 'base64',
2109
+ format?: 'uncompressed' | 'compressed' | 'hybrid'
2110
+ ): Buffer | string;
2111
+ /**
2112
+ * Generates private and public EC Diffie-Hellman key values, and returns
2113
+ * the public key in the specified `format` and `encoding`. This key should be
2114
+ * transferred to the other party.
2115
+ *
2116
+ * 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.
2117
+ *
2118
+ * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
2119
+ * @since v0.11.14
2120
+ * @param encoding The `encoding` of the return value.
2121
+ * @param [format='uncompressed']
2122
+ */
2123
+ generateKeys(): Buffer;
2124
+ generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
2125
+ /**
2126
+ * Computes the shared secret using `otherPublicKey` as the other
2127
+ * party's public key and returns the computed shared secret. The supplied
2128
+ * key is interpreted using specified `inputEncoding`, and the returned secret
2129
+ * is encoded using the specified `outputEncoding`.
2130
+ * If the `inputEncoding` is not
2131
+ * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`.
2132
+ *
2133
+ * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned.
2134
+ *
2135
+ * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is
2136
+ * usually supplied from a remote user over an insecure network,
2137
+ * be sure to handle this exception accordingly.
2138
+ * @since v0.11.14
2139
+ * @param inputEncoding The `encoding` of the `otherPublicKey` string.
2140
+ * @param outputEncoding The `encoding` of the return value.
2141
+ */
2142
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
2143
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
2144
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
2145
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
2146
+ /**
2147
+ * If `encoding` is specified, a string is returned; otherwise a `Buffer` is
2148
+ * returned.
2149
+ * @since v0.11.14
2150
+ * @param encoding The `encoding` of the return value.
2151
+ * @return The EC Diffie-Hellman in the specified `encoding`.
2152
+ */
2153
+ getPrivateKey(): Buffer;
2154
+ getPrivateKey(encoding: BinaryToTextEncoding): string;
2155
+ /**
2156
+ * 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.
2157
+ *
2158
+ * If `encoding` is specified, a string is returned; otherwise a `Buffer` is
2159
+ * returned.
2160
+ * @since v0.11.14
2161
+ * @param encoding The `encoding` of the return value.
2162
+ * @param [format='uncompressed']
2163
+ * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
2164
+ */
2165
+ getPublicKey(): Buffer;
2166
+ getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
2167
+ /**
2168
+ * Sets the EC Diffie-Hellman private key.
2169
+ * If `encoding` is provided, `privateKey` is expected
2170
+ * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
2171
+ *
2172
+ * If `privateKey` is not valid for the curve specified when the `ECDH` object was
2173
+ * created, an error is thrown. Upon setting the private key, the associated
2174
+ * public point (key) is also generated and set in the `ECDH` object.
2175
+ * @since v0.11.14
2176
+ * @param encoding The `encoding` of the `privateKey` string.
2177
+ */
2178
+ setPrivateKey(privateKey: NodeJS.ArrayBufferView): void;
2179
+ setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void;
2180
+ }
2181
+ /**
2182
+ * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a
2183
+ * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent
2184
+ * OpenSSL releases, `openssl ecparam -list_curves` will also display the name
2185
+ * and description of each available elliptic curve.
2186
+ * @since v0.11.14
2187
+ */
2188
+ function createECDH(curveName: string): ECDH;
2189
+ /**
2190
+ * This function is based on a constant-time algorithm.
2191
+ * Returns true if `a` is equal to `b`, without leaking timing information that
2192
+ * would allow an attacker to guess one of the values. This is suitable for
2193
+ * comparing HMAC digests or secret values like authentication cookies or[capability urls](https://www.w3.org/TR/capability-urls/).
2194
+ *
2195
+ * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
2196
+ * must have the same byte length.
2197
+ *
2198
+ * If at least one of `a` and `b` is a `TypedArray` with more than one byte per
2199
+ * entry, such as `Uint16Array`, the result will be computed using the platform
2200
+ * byte order.
2201
+ *
2202
+ * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code
2203
+ * is timing-safe. Care should be taken to ensure that the surrounding code does
2204
+ * not introduce timing vulnerabilities.
2205
+ * @since v6.6.0
2206
+ */
2207
+ function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
2208
+ /** @deprecated since v10.0.0 */
2209
+ const DEFAULT_ENCODING: BufferEncoding;
2210
+ type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
2211
+ type KeyFormat = 'pem' | 'der';
2212
+ interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2213
+ format: T;
2214
+ cipher?: string | undefined;
2215
+ passphrase?: string | undefined;
2216
+ }
2217
+ interface KeyPairKeyObjectResult {
2218
+ publicKey: KeyObject;
2219
+ privateKey: KeyObject;
2220
+ }
2221
+ interface ED25519KeyPairKeyObjectOptions {}
2222
+ interface ED448KeyPairKeyObjectOptions {}
2223
+ interface X25519KeyPairKeyObjectOptions {}
2224
+ interface X448KeyPairKeyObjectOptions {}
2225
+ interface ECKeyPairKeyObjectOptions {
2226
+ /**
2227
+ * Name of the curve to use.
2228
+ */
2229
+ namedCurve: string;
2230
+ }
2231
+ interface RSAKeyPairKeyObjectOptions {
2232
+ /**
2233
+ * Key size in bits
2234
+ */
2235
+ modulusLength: number;
2236
+ /**
2237
+ * @default 0x10001
2238
+ */
2239
+ publicExponent?: number | undefined;
2240
+ }
2241
+ interface RSAPSSKeyPairKeyObjectOptions {
2242
+ /**
2243
+ * Key size in bits
2244
+ */
2245
+ modulusLength: number;
2246
+ /**
2247
+ * @default 0x10001
2248
+ */
2249
+ publicExponent?: number | undefined;
2250
+ }
2251
+ interface DSAKeyPairKeyObjectOptions {
2252
+ /**
2253
+ * Key size in bits
2254
+ */
2255
+ modulusLength: number;
2256
+ /**
2257
+ * Size of q in bits
2258
+ */
2259
+ divisorLength: number;
2260
+ }
2261
+ interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2262
+ /**
2263
+ * Key size in bits
2264
+ */
2265
+ modulusLength: number;
2266
+ /**
2267
+ * @default 0x10001
2268
+ */
2269
+ publicExponent?: number | undefined;
2270
+ publicKeyEncoding: {
2271
+ type: 'pkcs1' | 'spki';
2272
+ format: PubF;
2273
+ };
2274
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2275
+ type: 'pkcs1' | 'pkcs8';
2276
+ };
2277
+ }
2278
+ interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2279
+ /**
2280
+ * Key size in bits
2281
+ */
2282
+ modulusLength: number;
2283
+ /**
2284
+ * @default 0x10001
2285
+ */
2286
+ publicExponent?: number | undefined;
2287
+ publicKeyEncoding: {
2288
+ type: 'spki';
2289
+ format: PubF;
2290
+ };
2291
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2292
+ type: 'pkcs8';
2293
+ };
2294
+ }
2295
+ interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2296
+ /**
2297
+ * Key size in bits
2298
+ */
2299
+ modulusLength: number;
2300
+ /**
2301
+ * Size of q in bits
2302
+ */
2303
+ divisorLength: number;
2304
+ publicKeyEncoding: {
2305
+ type: 'spki';
2306
+ format: PubF;
2307
+ };
2308
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2309
+ type: 'pkcs8';
2310
+ };
2311
+ }
2312
+ interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2313
+ /**
2314
+ * Name of the curve to use.
2315
+ */
2316
+ namedCurve: string;
2317
+ publicKeyEncoding: {
2318
+ type: 'pkcs1' | 'spki';
2319
+ format: PubF;
2320
+ };
2321
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2322
+ type: 'sec1' | 'pkcs8';
2323
+ };
2324
+ }
2325
+ interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2326
+ publicKeyEncoding: {
2327
+ type: 'spki';
2328
+ format: PubF;
2329
+ };
2330
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2331
+ type: 'pkcs8';
2332
+ };
2333
+ }
2334
+ interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2335
+ publicKeyEncoding: {
2336
+ type: 'spki';
2337
+ format: PubF;
2338
+ };
2339
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2340
+ type: 'pkcs8';
2341
+ };
2342
+ }
2343
+ interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2344
+ publicKeyEncoding: {
2345
+ type: 'spki';
2346
+ format: PubF;
2347
+ };
2348
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2349
+ type: 'pkcs8';
2350
+ };
2351
+ }
2352
+ interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
2353
+ publicKeyEncoding: {
2354
+ type: 'spki';
2355
+ format: PubF;
2356
+ };
2357
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
2358
+ type: 'pkcs8';
2359
+ };
2360
+ }
2361
+ interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
2362
+ publicKey: T1;
2363
+ privateKey: T2;
2364
+ }
2365
+ /**
2366
+ * Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519,
2367
+ * Ed448, X25519, X448, and DH are currently supported.
2368
+ *
2369
+ * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2370
+ * behaves as if `keyObject.export()` had been called on its result. Otherwise,
2371
+ * the respective part of the key is returned as a `KeyObject`.
2372
+ *
2373
+ * When encoding public keys, it is recommended to use `'spki'`. When encoding
2374
+ * private keys, it is recommended to use `'pkcs8'` with a strong passphrase,
2375
+ * and to keep the passphrase confidential.
2376
+ *
2377
+ * ```js
2378
+ * const {
2379
+ * generateKeyPairSync
2380
+ * } = await import('crypto');
2381
+ *
2382
+ * const {
2383
+ * publicKey,
2384
+ * privateKey,
2385
+ * } = generateKeyPairSync('rsa', {
2386
+ * modulusLength: 4096,
2387
+ * publicKeyEncoding: {
2388
+ * type: 'spki',
2389
+ * format: 'pem'
2390
+ * },
2391
+ * privateKeyEncoding: {
2392
+ * type: 'pkcs8',
2393
+ * format: 'pem',
2394
+ * cipher: 'aes-256-cbc',
2395
+ * passphrase: 'top secret'
2396
+ * }
2397
+ * });
2398
+ * ```
2399
+ *
2400
+ * The return value `{ publicKey, privateKey }` represents the generated key pair.
2401
+ * When PEM encoding was selected, the respective key will be a string, otherwise
2402
+ * it will be a buffer containing the data encoded as DER.
2403
+ * @since v10.12.0
2404
+ * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2405
+ */
2406
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2407
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2408
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2409
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2410
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2411
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2412
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2413
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2414
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2415
+ function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2416
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2417
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2418
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2419
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2420
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2421
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2422
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2423
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2424
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2425
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2426
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2427
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2428
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2429
+ function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2430
+ function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2431
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2432
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2433
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2434
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2435
+ function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2436
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2437
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2438
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2439
+ function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2440
+ function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2441
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
2442
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
2443
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
2444
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
2445
+ function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2446
+ /**
2447
+ * Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519,
2448
+ * Ed448, X25519, X448, and DH are currently supported.
2449
+ *
2450
+ * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
2451
+ * behaves as if `keyObject.export()` had been called on its result. Otherwise,
2452
+ * the respective part of the key is returned as a `KeyObject`.
2453
+ *
2454
+ * It is recommended to encode public keys as `'spki'` and private keys as`'pkcs8'` with encryption for long-term storage:
2455
+ *
2456
+ * ```js
2457
+ * const {
2458
+ * generateKeyPair
2459
+ * } = await import('crypto');
2460
+ *
2461
+ * generateKeyPair('rsa', {
2462
+ * modulusLength: 4096,
2463
+ * publicKeyEncoding: {
2464
+ * type: 'spki',
2465
+ * format: 'pem'
2466
+ * },
2467
+ * privateKeyEncoding: {
2468
+ * type: 'pkcs8',
2469
+ * format: 'pem',
2470
+ * cipher: 'aes-256-cbc',
2471
+ * passphrase: 'top secret'
2472
+ * }
2473
+ * }, (err, publicKey, privateKey) => {
2474
+ * // Handle errors and use the generated key pair.
2475
+ * });
2476
+ * ```
2477
+ *
2478
+ * On completion, `callback` will be called with `err` set to `undefined` and`publicKey` / `privateKey` representing the generated key pair.
2479
+ *
2480
+ * If this method is invoked as its `util.promisify()` ed version, it returns
2481
+ * a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
2482
+ * @since v10.12.0
2483
+ * @param type Must be `'rsa'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
2484
+ */
2485
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2486
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2487
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2488
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2489
+ function generateKeyPair(type: 'rsa', options: RSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2490
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2491
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2492
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2493
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2494
+ function generateKeyPair(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2495
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2496
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2497
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2498
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2499
+ function generateKeyPair(type: 'dsa', options: DSAKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2500
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2501
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2502
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2503
+ function generateKeyPair(type: 'ec', options: ECKeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2504
+ function generateKeyPair(type: 'ec', options: ECKeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2505
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2506
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2507
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2508
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2509
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2510
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2511
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2512
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2513
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2514
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2515
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2516
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2517
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2518
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2519
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2520
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
2521
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
2522
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
2523
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
2524
+ function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
2525
+ namespace generateKeyPair {
2526
+ function __promisify__(
2527
+ type: 'rsa',
2528
+ options: RSAKeyPairOptions<'pem', 'pem'>
2529
+ ): Promise<{
2530
+ publicKey: string;
2531
+ privateKey: string;
2532
+ }>;
2533
+ function __promisify__(
2534
+ type: 'rsa',
2535
+ options: RSAKeyPairOptions<'pem', 'der'>
2536
+ ): Promise<{
2537
+ publicKey: string;
2538
+ privateKey: Buffer;
2539
+ }>;
2540
+ function __promisify__(
2541
+ type: 'rsa',
2542
+ options: RSAKeyPairOptions<'der', 'pem'>
2543
+ ): Promise<{
2544
+ publicKey: Buffer;
2545
+ privateKey: string;
2546
+ }>;
2547
+ function __promisify__(
2548
+ type: 'rsa',
2549
+ options: RSAKeyPairOptions<'der', 'der'>
2550
+ ): Promise<{
2551
+ publicKey: Buffer;
2552
+ privateKey: Buffer;
2553
+ }>;
2554
+ function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2555
+ function __promisify__(
2556
+ type: 'rsa-pss',
2557
+ options: RSAPSSKeyPairOptions<'pem', 'pem'>
2558
+ ): Promise<{
2559
+ publicKey: string;
2560
+ privateKey: string;
2561
+ }>;
2562
+ function __promisify__(
2563
+ type: 'rsa-pss',
2564
+ options: RSAPSSKeyPairOptions<'pem', 'der'>
2565
+ ): Promise<{
2566
+ publicKey: string;
2567
+ privateKey: Buffer;
2568
+ }>;
2569
+ function __promisify__(
2570
+ type: 'rsa-pss',
2571
+ options: RSAPSSKeyPairOptions<'der', 'pem'>
2572
+ ): Promise<{
2573
+ publicKey: Buffer;
2574
+ privateKey: string;
2575
+ }>;
2576
+ function __promisify__(
2577
+ type: 'rsa-pss',
2578
+ options: RSAPSSKeyPairOptions<'der', 'der'>
2579
+ ): Promise<{
2580
+ publicKey: Buffer;
2581
+ privateKey: Buffer;
2582
+ }>;
2583
+ function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2584
+ function __promisify__(
2585
+ type: 'dsa',
2586
+ options: DSAKeyPairOptions<'pem', 'pem'>
2587
+ ): Promise<{
2588
+ publicKey: string;
2589
+ privateKey: string;
2590
+ }>;
2591
+ function __promisify__(
2592
+ type: 'dsa',
2593
+ options: DSAKeyPairOptions<'pem', 'der'>
2594
+ ): Promise<{
2595
+ publicKey: string;
2596
+ privateKey: Buffer;
2597
+ }>;
2598
+ function __promisify__(
2599
+ type: 'dsa',
2600
+ options: DSAKeyPairOptions<'der', 'pem'>
2601
+ ): Promise<{
2602
+ publicKey: Buffer;
2603
+ privateKey: string;
2604
+ }>;
2605
+ function __promisify__(
2606
+ type: 'dsa',
2607
+ options: DSAKeyPairOptions<'der', 'der'>
2608
+ ): Promise<{
2609
+ publicKey: Buffer;
2610
+ privateKey: Buffer;
2611
+ }>;
2612
+ function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2613
+ function __promisify__(
2614
+ type: 'ec',
2615
+ options: ECKeyPairOptions<'pem', 'pem'>
2616
+ ): Promise<{
2617
+ publicKey: string;
2618
+ privateKey: string;
2619
+ }>;
2620
+ function __promisify__(
2621
+ type: 'ec',
2622
+ options: ECKeyPairOptions<'pem', 'der'>
2623
+ ): Promise<{
2624
+ publicKey: string;
2625
+ privateKey: Buffer;
2626
+ }>;
2627
+ function __promisify__(
2628
+ type: 'ec',
2629
+ options: ECKeyPairOptions<'der', 'pem'>
2630
+ ): Promise<{
2631
+ publicKey: Buffer;
2632
+ privateKey: string;
2633
+ }>;
2634
+ function __promisify__(
2635
+ type: 'ec',
2636
+ options: ECKeyPairOptions<'der', 'der'>
2637
+ ): Promise<{
2638
+ publicKey: Buffer;
2639
+ privateKey: Buffer;
2640
+ }>;
2641
+ function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2642
+ function __promisify__(
2643
+ type: 'ed25519',
2644
+ options: ED25519KeyPairOptions<'pem', 'pem'>
2645
+ ): Promise<{
2646
+ publicKey: string;
2647
+ privateKey: string;
2648
+ }>;
2649
+ function __promisify__(
2650
+ type: 'ed25519',
2651
+ options: ED25519KeyPairOptions<'pem', 'der'>
2652
+ ): Promise<{
2653
+ publicKey: string;
2654
+ privateKey: Buffer;
2655
+ }>;
2656
+ function __promisify__(
2657
+ type: 'ed25519',
2658
+ options: ED25519KeyPairOptions<'der', 'pem'>
2659
+ ): Promise<{
2660
+ publicKey: Buffer;
2661
+ privateKey: string;
2662
+ }>;
2663
+ function __promisify__(
2664
+ type: 'ed25519',
2665
+ options: ED25519KeyPairOptions<'der', 'der'>
2666
+ ): Promise<{
2667
+ publicKey: Buffer;
2668
+ privateKey: Buffer;
2669
+ }>;
2670
+ function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2671
+ function __promisify__(
2672
+ type: 'ed448',
2673
+ options: ED448KeyPairOptions<'pem', 'pem'>
2674
+ ): Promise<{
2675
+ publicKey: string;
2676
+ privateKey: string;
2677
+ }>;
2678
+ function __promisify__(
2679
+ type: 'ed448',
2680
+ options: ED448KeyPairOptions<'pem', 'der'>
2681
+ ): Promise<{
2682
+ publicKey: string;
2683
+ privateKey: Buffer;
2684
+ }>;
2685
+ function __promisify__(
2686
+ type: 'ed448',
2687
+ options: ED448KeyPairOptions<'der', 'pem'>
2688
+ ): Promise<{
2689
+ publicKey: Buffer;
2690
+ privateKey: string;
2691
+ }>;
2692
+ function __promisify__(
2693
+ type: 'ed448',
2694
+ options: ED448KeyPairOptions<'der', 'der'>
2695
+ ): Promise<{
2696
+ publicKey: Buffer;
2697
+ privateKey: Buffer;
2698
+ }>;
2699
+ function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2700
+ function __promisify__(
2701
+ type: 'x25519',
2702
+ options: X25519KeyPairOptions<'pem', 'pem'>
2703
+ ): Promise<{
2704
+ publicKey: string;
2705
+ privateKey: string;
2706
+ }>;
2707
+ function __promisify__(
2708
+ type: 'x25519',
2709
+ options: X25519KeyPairOptions<'pem', 'der'>
2710
+ ): Promise<{
2711
+ publicKey: string;
2712
+ privateKey: Buffer;
2713
+ }>;
2714
+ function __promisify__(
2715
+ type: 'x25519',
2716
+ options: X25519KeyPairOptions<'der', 'pem'>
2717
+ ): Promise<{
2718
+ publicKey: Buffer;
2719
+ privateKey: string;
2720
+ }>;
2721
+ function __promisify__(
2722
+ type: 'x25519',
2723
+ options: X25519KeyPairOptions<'der', 'der'>
2724
+ ): Promise<{
2725
+ publicKey: Buffer;
2726
+ privateKey: Buffer;
2727
+ }>;
2728
+ function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2729
+ function __promisify__(
2730
+ type: 'x448',
2731
+ options: X448KeyPairOptions<'pem', 'pem'>
2732
+ ): Promise<{
2733
+ publicKey: string;
2734
+ privateKey: string;
2735
+ }>;
2736
+ function __promisify__(
2737
+ type: 'x448',
2738
+ options: X448KeyPairOptions<'pem', 'der'>
2739
+ ): Promise<{
2740
+ publicKey: string;
2741
+ privateKey: Buffer;
2742
+ }>;
2743
+ function __promisify__(
2744
+ type: 'x448',
2745
+ options: X448KeyPairOptions<'der', 'pem'>
2746
+ ): Promise<{
2747
+ publicKey: Buffer;
2748
+ privateKey: string;
2749
+ }>;
2750
+ function __promisify__(
2751
+ type: 'x448',
2752
+ options: X448KeyPairOptions<'der', 'der'>
2753
+ ): Promise<{
2754
+ publicKey: Buffer;
2755
+ privateKey: Buffer;
2756
+ }>;
2757
+ function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
2758
+ }
2759
+ /**
2760
+ * Calculates and returns the signature for `data` using the given private key and
2761
+ * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
2762
+ * dependent upon the key type (especially Ed25519 and Ed448).
2763
+ *
2764
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been
2765
+ * passed to {@link createPrivateKey}. If it is an object, the following
2766
+ * additional properties can be passed:
2767
+ *
2768
+ * If the `callback` function is provided this function uses libuv's threadpool.
2769
+ * @since v12.0.0
2770
+ */
2771
+ function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
2772
+ function sign(
2773
+ algorithm: string | null | undefined,
2774
+ data: NodeJS.ArrayBufferView,
2775
+ key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
2776
+ callback: (error: Error | null, data: Buffer) => void
2777
+ ): void;
2778
+ /**
2779
+ * 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
2780
+ * key type (especially Ed25519 and Ed448).
2781
+ *
2782
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been
2783
+ * passed to {@link createPublicKey}. If it is an object, the following
2784
+ * additional properties can be passed:
2785
+ *
2786
+ * The `signature` argument is the previously calculated signature for the `data`.
2787
+ *
2788
+ * Because public keys can be derived from private keys, a private key or a public
2789
+ * key may be passed for `key`.
2790
+ *
2791
+ * If the `callback` function is provided this function uses libuv's threadpool.
2792
+ * @since v12.0.0
2793
+ */
2794
+ function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
2795
+ function verify(
2796
+ algorithm: string | null | undefined,
2797
+ data: NodeJS.ArrayBufferView,
2798
+ key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
2799
+ signature: NodeJS.ArrayBufferView,
2800
+ callback: (error: Error | null, result: boolean) => void
2801
+ ): void;
2802
+ /**
2803
+ * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
2804
+ * 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).
2805
+ * @since v13.9.0, v12.17.0
2806
+ */
2807
+ function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
2808
+ type CipherMode = 'cbc' | 'ccm' | 'cfb' | 'ctr' | 'ecb' | 'gcm' | 'ocb' | 'ofb' | 'stream' | 'wrap' | 'xts';
2809
+ interface CipherInfoOptions {
2810
+ /**
2811
+ * A test key length.
2812
+ */
2813
+ keyLength?: number | undefined;
2814
+ /**
2815
+ * A test IV length.
2816
+ */
2817
+ ivLength?: number | undefined;
2818
+ }
2819
+ interface CipherInfo {
2820
+ /**
2821
+ * The name of the cipher.
2822
+ */
2823
+ name: string;
2824
+ /**
2825
+ * The nid of the cipher.
2826
+ */
2827
+ nid: number;
2828
+ /**
2829
+ * The block size of the cipher in bytes.
2830
+ * This property is omitted when mode is 'stream'.
2831
+ */
2832
+ blockSize?: number | undefined;
2833
+ /**
2834
+ * The expected or default initialization vector length in bytes.
2835
+ * This property is omitted if the cipher does not use an initialization vector.
2836
+ */
2837
+ ivLength?: number | undefined;
2838
+ /**
2839
+ * The expected or default key length in bytes.
2840
+ */
2841
+ keyLength: number;
2842
+ /**
2843
+ * The cipher mode.
2844
+ */
2845
+ mode: CipherMode;
2846
+ }
2847
+ /**
2848
+ * Returns information about a given cipher.
2849
+ *
2850
+ * Some ciphers accept variable length keys and initialization vectors. By default,
2851
+ * the `crypto.getCipherInfo()` method will return the default values for these
2852
+ * ciphers. To test if a given key length or iv length is acceptable for given
2853
+ * cipher, use the `keyLength` and `ivLength` options. If the given values are
2854
+ * unacceptable, `undefined` will be returned.
2855
+ * @since v15.0.0
2856
+ * @param nameOrNid The name or nid of the cipher to query.
2857
+ */
2858
+ function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined;
2859
+ /**
2860
+ * 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.
2861
+ *
2862
+ * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set;
2863
+ * otherwise `err` will be `null`. The successfully generated `derivedKey` will
2864
+ * be passed to the callback as an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any
2865
+ * of the input arguments specify invalid values or types.
2866
+ *
2867
+ * ```js
2868
+ * import { Buffer } from 'buffer';
2869
+ * const {
2870
+ * hkdf
2871
+ * } = await import('crypto');
2872
+ *
2873
+ * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => {
2874
+ * if (err) throw err;
2875
+ * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
2876
+ * });
2877
+ * ```
2878
+ * @since v15.0.0
2879
+ * @param digest The digest algorithm to use.
2880
+ * @param ikm The input keying material. It must be at least one byte in length.
2881
+ * @param salt The salt value. Must be provided but can be zero-length.
2882
+ * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
2883
+ * @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`
2884
+ * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
2885
+ */
2886
+ function hkdf(digest: string, irm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => void): void;
2887
+ /**
2888
+ * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
2889
+ * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
2890
+ *
2891
+ * The successfully generated `derivedKey` will be returned as an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).
2892
+ *
2893
+ * An error will be thrown if any of the input arguments specify invalid values or
2894
+ * types, or if the derived key cannot be generated.
2895
+ *
2896
+ * ```js
2897
+ * import { Buffer } from 'buffer';
2898
+ * const {
2899
+ * hkdfSync
2900
+ * } = await import('crypto');
2901
+ *
2902
+ * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64);
2903
+ * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
2904
+ * ```
2905
+ * @since v15.0.0
2906
+ * @param digest The digest algorithm to use.
2907
+ * @param ikm The input keying material. It must be at least one byte in length.
2908
+ * @param salt The salt value. Must be provided but can be zero-length.
2909
+ * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
2910
+ * @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`
2911
+ * generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
2912
+ */
2913
+ function hkdfSync(digest: string, ikm: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number): ArrayBuffer;
2914
+ interface SecureHeapUsage {
2915
+ /**
2916
+ * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
2917
+ */
2918
+ total: number;
2919
+ /**
2920
+ * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag.
2921
+ */
2922
+ min: number;
2923
+ /**
2924
+ * The total number of bytes currently allocated from the secure heap.
2925
+ */
2926
+ used: number;
2927
+ /**
2928
+ * The calculated ratio of `used` to `total` allocated bytes.
2929
+ */
2930
+ utilization: number;
2931
+ }
2932
+ /**
2933
+ * @since v15.6.0
2934
+ */
2935
+ function secureHeapUsed(): SecureHeapUsage;
2936
+ interface RandomUUIDOptions {
2937
+ /**
2938
+ * By default, to improve performance,
2939
+ * Node.js will pre-emptively generate and persistently cache enough
2940
+ * random data to generate up to 128 random UUIDs. To generate a UUID
2941
+ * without using the cache, set `disableEntropyCache` to `true`.
2942
+ *
2943
+ * @default `false`
2944
+ */
2945
+ disableEntropyCache?: boolean | undefined;
2946
+ }
2947
+ /**
2948
+ * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
2949
+ * cryptographic pseudorandom number generator.
2950
+ * @since v15.6.0
2951
+ */
2952
+ function randomUUID(options?: RandomUUIDOptions): string;
2953
+ interface X509CheckOptions {
2954
+ /**
2955
+ * @default 'always'
2956
+ */
2957
+ subject: 'always' | 'never';
2958
+ /**
2959
+ * @default true
2960
+ */
2961
+ wildcards: boolean;
2962
+ /**
2963
+ * @default true
2964
+ */
2965
+ partialWildcards: boolean;
2966
+ /**
2967
+ * @default false
2968
+ */
2969
+ multiLabelWildcards: boolean;
2970
+ /**
2971
+ * @default false
2972
+ */
2973
+ singleLabelSubdomains: boolean;
2974
+ }
2975
+ /**
2976
+ * Encapsulates an X509 certificate and provides read-only access to
2977
+ * its information.
2978
+ *
2979
+ * ```js
2980
+ * const { X509Certificate } = await import('crypto');
2981
+ *
2982
+ * const x509 = new X509Certificate('{... pem encoded cert ...}');
2983
+ *
2984
+ * console.log(x509.subject);
2985
+ * ```
2986
+ * @since v15.6.0
2987
+ */
2988
+ class X509Certificate {
2989
+ /**
2990
+ * Will be \`true\` if this is a Certificate Authority (ca) certificate.
2991
+ * @since v15.6.0
2992
+ */
2993
+ readonly ca: boolean;
2994
+ /**
2995
+ * The SHA-1 fingerprint of this certificate.
2996
+ * @since v15.6.0
2997
+ */
2998
+ readonly fingerprint: string;
2999
+ /**
3000
+ * The SHA-256 fingerprint of this certificate.
3001
+ * @since v15.6.0
3002
+ */
3003
+ readonly fingerprint256: string;
3004
+ /**
3005
+ * The complete subject of this certificate.
3006
+ * @since v15.6.0
3007
+ */
3008
+ readonly subject: string;
3009
+ /**
3010
+ * The subject alternative name specified for this certificate.
3011
+ * @since v15.6.0
3012
+ */
3013
+ readonly subjectAltName: string;
3014
+ /**
3015
+ * The information access content of this certificate.
3016
+ * @since v15.6.0
3017
+ */
3018
+ readonly infoAccess: string;
3019
+ /**
3020
+ * An array detailing the key usages for this certificate.
3021
+ * @since v15.6.0
3022
+ */
3023
+ readonly keyUsage: string[];
3024
+ /**
3025
+ * The issuer identification included in this certificate.
3026
+ * @since v15.6.0
3027
+ */
3028
+ readonly issuer: string;
3029
+ /**
3030
+ * The issuer certificate or `undefined` if the issuer certificate is not
3031
+ * available.
3032
+ * @since v15.9.0
3033
+ */
3034
+ readonly issuerCertificate?: X509Certificate | undefined;
3035
+ /**
3036
+ * The public key `KeyObject` for this certificate.
3037
+ * @since v15.6.0
3038
+ */
3039
+ readonly publicKey: KeyObject;
3040
+ /**
3041
+ * A `Buffer` containing the DER encoding of this certificate.
3042
+ * @since v15.6.0
3043
+ */
3044
+ readonly raw: Buffer;
3045
+ /**
3046
+ * The serial number of this certificate.
3047
+ * @since v15.6.0
3048
+ */
3049
+ readonly serialNumber: string;
3050
+ /**
3051
+ * The date/time from which this certificate is considered valid.
3052
+ * @since v15.6.0
3053
+ */
3054
+ readonly validFrom: string;
3055
+ /**
3056
+ * The date/time until which this certificate is considered valid.
3057
+ * @since v15.6.0
3058
+ */
3059
+ readonly validTo: string;
3060
+ constructor(buffer: BinaryLike);
3061
+ /**
3062
+ * Checks whether the certificate matches the given email address.
3063
+ * @since v15.6.0
3064
+ * @return Returns `email` if the certificate matches, `undefined` if it does not.
3065
+ */
3066
+ checkEmail(email: string, options?: X509CheckOptions): string | undefined;
3067
+ /**
3068
+ * Checks whether the certificate matches the given host name.
3069
+ * @since v15.6.0
3070
+ * @return Returns `name` if the certificate matches, `undefined` if it does not.
3071
+ */
3072
+ checkHost(name: string, options?: X509CheckOptions): string | undefined;
3073
+ /**
3074
+ * Checks whether the certificate matches the given IP address (IPv4 or IPv6).
3075
+ * @since v15.6.0
3076
+ * @return Returns `ip` if the certificate matches, `undefined` if it does not.
3077
+ */
3078
+ checkIP(ip: string, options?: X509CheckOptions): string | undefined;
3079
+ /**
3080
+ * Checks whether this certificate was issued by the given `otherCert`.
3081
+ * @since v15.6.0
3082
+ */
3083
+ checkIssued(otherCert: X509Certificate): boolean;
3084
+ /**
3085
+ * Checks whether the public key for this certificate is consistent with
3086
+ * the given private key.
3087
+ * @since v15.6.0
3088
+ * @param privateKey A private key.
3089
+ */
3090
+ checkPrivateKey(privateKey: KeyObject): boolean;
3091
+ /**
3092
+ * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded
3093
+ * certificate.
3094
+ * @since v15.6.0
3095
+ */
3096
+ toJSON(): string;
3097
+ /**
3098
+ * Returns information about this certificate using the legacy `certificate object` encoding.
3099
+ * @since v15.6.0
3100
+ */
3101
+ toLegacyObject(): PeerCertificate;
3102
+ /**
3103
+ * Returns the PEM-encoded certificate.
3104
+ * @since v15.6.0
3105
+ */
3106
+ toString(): string;
3107
+ /**
3108
+ * Verifies that this certificate was signed by the given public key.
3109
+ * Does not perform any other validation checks on the certificate.
3110
+ * @since v15.6.0
3111
+ * @param publicKey A public key.
3112
+ */
3113
+ verify(publicKey: KeyObject): boolean;
3114
+ }
3115
+ type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint;
3116
+ interface GeneratePrimeOptions {
3117
+ add?: LargeNumberLike | undefined;
3118
+ rem?: LargeNumberLike | undefined;
3119
+ /**
3120
+ * @default false
3121
+ */
3122
+ safe?: boolean | undefined;
3123
+ bigint?: boolean | undefined;
3124
+ }
3125
+ interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions {
3126
+ bigint: true;
3127
+ }
3128
+ interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions {
3129
+ bigint?: false | undefined;
3130
+ }
3131
+ /**
3132
+ * Generates a pseudorandom prime of `size` bits.
3133
+ *
3134
+ * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime.
3135
+ *
3136
+ * The `options.add` and `options.rem` parameters can be used to enforce additional
3137
+ * requirements, e.g., for Diffie-Hellman:
3138
+ *
3139
+ * * If `options.add` and `options.rem` are both set, the prime will satisfy the
3140
+ * condition that `prime % add = rem`.
3141
+ * * If only `options.add` is set and `options.safe` is not `true`, the prime will
3142
+ * satisfy the condition that `prime % add = 1`.
3143
+ * * If only `options.add` is set and `options.safe` is set to `true`, the prime
3144
+ * will instead satisfy the condition that `prime % add = 3`. This is necessary
3145
+ * because `prime % add = 1` for `options.add > 2` would contradict the condition
3146
+ * enforced by `options.safe`.
3147
+ * * `options.rem` is ignored if `options.add` is not given.
3148
+ *
3149
+ * Both `options.add` and `options.rem` must be encoded as big-endian sequences
3150
+ * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`.
3151
+ *
3152
+ * By default, the prime is encoded as a big-endian sequence of octets
3153
+ * in an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
3154
+ * [&lt;bigint&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)is provided.
3155
+ * @since v15.8.0
3156
+ * @param size The size (in bits) of the prime to generate.
3157
+ */
3158
+ function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3159
+ function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void;
3160
+ function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
3161
+ function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void;
3162
+ /**
3163
+ * Generates a pseudorandom prime of `size` bits.
3164
+ *
3165
+ * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime.
3166
+ *
3167
+ * The `options.add` and `options.rem` parameters can be used to enforce additional
3168
+ * requirements, e.g., for Diffie-Hellman:
3169
+ *
3170
+ * * If `options.add` and `options.rem` are both set, the prime will satisfy the
3171
+ * condition that `prime % add = rem`.
3172
+ * * If only `options.add` is set and `options.safe` is not `true`, the prime will
3173
+ * satisfy the condition that `prime % add = 1`.
3174
+ * * If only `options.add` is set and `options.safe` is set to `true`, the prime
3175
+ * will instead satisfy the condition that `prime % add = 3`. This is necessary
3176
+ * because `prime % add = 1` for `options.add > 2` would contradict the condition
3177
+ * enforced by `options.safe`.
3178
+ * * `options.rem` is ignored if `options.add` is not given.
3179
+ *
3180
+ * Both `options.add` and `options.rem` must be encoded as big-endian sequences
3181
+ * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`.
3182
+ *
3183
+ * By default, the prime is encoded as a big-endian sequence of octets
3184
+ * in an [&lt;ArrayBuffer&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a
3185
+ * [&lt;bigint&gt;](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)is provided.
3186
+ * @since v15.8.0
3187
+ * @param size The size (in bits) of the prime to generate.
3188
+ */
3189
+ function generatePrimeSync(size: number): ArrayBuffer;
3190
+ function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint;
3191
+ function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer;
3192
+ function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint;
3193
+ interface CheckPrimeOptions {
3194
+ /**
3195
+ * The number of Miller-Rabin probabilistic primality iterations to perform.
3196
+ * 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.
3197
+ * Care must be used when selecting a number of checks.
3198
+ * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details.
3199
+ *
3200
+ * @default 0
3201
+ */
3202
+ checks?: number | undefined;
3203
+ }
3204
+ /**
3205
+ * Checks the primality of the `candidate`.
3206
+ * @since v15.8.0
3207
+ * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
3208
+ */
3209
+ function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
3210
+ function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void;
3211
+ /**
3212
+ * Checks the primality of the `candidate`.
3213
+ * @since v15.8.0
3214
+ * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
3215
+ * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`.
3216
+ */
3217
+ function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean;
3218
+ namespace webcrypto {
3219
+ class CryptoKey {} // placeholder
3220
+ }
3221
+ }
3222
+ declare module 'node:crypto' {
3223
+ export * from 'crypto';
3224
+ }