cdk-ecr-deployment 2.5.6 → 2.5.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +5 -4
- package/.jsii +673 -21
- package/.jsii.tabl.json +1 -0
- package/.projenrc.ts +100 -0
- package/API.md +4 -4
- package/README.md +4 -4
- package/lambda/go.mod +2 -5
- package/lambda/go.sum +39 -14
- package/lib/index.d.ts +7 -65
- package/lib/index.js +7 -45
- package/node_modules/@sindresorhus/is/dist/index.d.ts +12 -7
- package/node_modules/@sindresorhus/is/dist/index.js +9 -4
- package/node_modules/@sindresorhus/is/dist/types.d.ts +1 -0
- package/node_modules/@sindresorhus/is/package.json +1 -1
- package/node_modules/@sindresorhus/is/readme.md +25 -7
- package/node_modules/@types/cacheable-request/README.md +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +135 -75
- package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +67 -38
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +226 -104
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +87 -58
- package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +29 -29
- package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +5 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +888 -256
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +16 -16
- package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +52 -8
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +27 -18
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dom-events.d.ts +126 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +6 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +166 -93
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +169 -70
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +301 -126
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +22 -13
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +453 -125
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +74 -46
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +103 -53
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +6 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +20 -16
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +6 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +114 -22
- package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +36 -14
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +15 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +37 -26
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +96 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +95 -82
- package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +6 -6
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +145 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +51 -175
- package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +21 -21
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +2 -14
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +983 -824
- package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +6 -6
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +1052 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +26 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +127 -6
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +149 -50
- package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +30 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/crypto.d.ts +3969 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/events.d.ts +724 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/https.d.ts +441 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/module.d.ts +116 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/net.d.ts +888 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/os.d.ts +477 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/url.d.ts +901 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +11 -7
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +66 -56
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +528 -70
- package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +271 -14
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +421 -34
- package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +15 -21
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +81 -37
- package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +11 -11
- package/node_modules/@types/cacheable-request/package.json +5 -5
- package/node_modules/@types/keyv/README.md +1 -1
- package/node_modules/@types/keyv/index.d.ts +16 -3
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +135 -75
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +67 -38
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +226 -104
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +87 -58
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +29 -29
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +5 -5
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +888 -256
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +16 -16
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +52 -8
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +27 -18
- package/node_modules/@types/keyv/node_modules/@types/node/dom-events.d.ts +126 -0
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +6 -5
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +166 -93
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +169 -70
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +301 -126
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +22 -13
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +453 -125
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +74 -46
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +103 -53
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +6 -2
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +20 -16
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +6 -4
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +114 -22
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +36 -14
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +15 -3
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +37 -26
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +96 -15
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +95 -82
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +6 -6
- package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +145 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +51 -175
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +21 -21
- package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +2 -14
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +983 -824
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +6 -6
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +1052 -0
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +26 -1
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +127 -6
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +149 -50
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +30 -9
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/crypto.d.ts +3969 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/events.d.ts +724 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/https.d.ts +441 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/module.d.ts +116 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/net.d.ts +888 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/os.d.ts +477 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/url.d.ts +901 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +11 -7
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +66 -56
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +528 -70
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +271 -14
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +421 -34
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +15 -21
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +81 -37
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +11 -11
- package/node_modules/@types/keyv/package.json +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +135 -75
- package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +67 -38
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +226 -104
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +87 -58
- package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +29 -29
- package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +5 -5
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +888 -256
- package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +16 -16
- package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +60 -21
- package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +52 -8
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +27 -18
- package/node_modules/@types/responselike/node_modules/@types/node/dom-events.d.ts +126 -0
- package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +6 -5
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +166 -93
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +169 -70
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +301 -126
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +22 -13
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +453 -125
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +74 -46
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +103 -53
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +6 -2
- package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +20 -16
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +6 -4
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +114 -22
- package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +36 -14
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +15 -3
- package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +37 -26
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +96 -15
- package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +95 -82
- package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +6 -6
- package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +145 -0
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +51 -175
- package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +21 -21
- package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +2 -14
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +983 -824
- package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +6 -6
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +1052 -0
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +26 -1
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +127 -6
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +149 -50
- package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +30 -9
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/assert.d.ts +972 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/async_hooks.d.ts +530 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/buffer.d.ts +2354 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/child_process.d.ts +1395 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/cluster.d.ts +414 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/crypto.d.ts +3969 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dns/promises.d.ts +414 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dns.d.ts +668 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/events.d.ts +724 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs/promises.d.ts +1189 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/fs.d.ts +4044 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.d.ts +303 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http.d.ts +1724 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/http2.d.ts +2129 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/https.d.ts +441 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/inspector.d.ts +2748 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/module.d.ts +116 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/net.d.ts +888 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/os.d.ts +477 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/perf_hooks.d.ts +638 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/process.d.ts +1494 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/readline/promises.d.ts +145 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/readline.d.ts +526 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/stream.d.ts +1392 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/test.d.ts +1052 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/timers.d.ts +215 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tls.d.ts +1119 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/url.d.ts +901 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/util.d.ts +2052 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/vm.d.ts +894 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/wasi.d.ts +152 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/worker_threads.d.ts +693 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +11 -7
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +66 -56
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +528 -70
- package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +271 -14
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +421 -34
- package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +15 -21
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +81 -37
- package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +11 -11
- package/node_modules/cacheable-request/package.json +1 -1
- package/node_modules/clone-response/node_modules/mimic-response/index.js +32 -0
- package/node_modules/{get-stream → clone-response/node_modules/mimic-response}/license +1 -1
- package/node_modules/clone-response/node_modules/mimic-response/package.json +37 -0
- package/node_modules/clone-response/node_modules/mimic-response/readme.md +54 -0
- package/node_modules/clone-response/package.json +3 -6
- package/node_modules/got/dist/source/as-promise/index.js +1 -0
- package/node_modules/got/package.json +2 -1
- package/node_modules/http-cache-semantics/index.js +4 -3
- package/node_modules/http-cache-semantics/package.json +2 -8
- package/node_modules/keyv/README.md +141 -5
- package/node_modules/keyv/package.json +56 -50
- package/node_modules/keyv/src/index.d.ts +116 -0
- package/node_modules/keyv/src/index.js +179 -24
- package/node_modules/mimic-response/index.js +58 -13
- package/node_modules/mimic-response/license +1 -1
- package/node_modules/mimic-response/package.json +40 -35
- package/node_modules/mimic-response/readme.md +33 -9
- package/node_modules/responselike/package.json +3 -2
- package/package.json +54 -25
- package/rosetta/default.ts-fixture +17 -0
- package/changelog.md +0 -2
- package/node_modules/decompress-response/node_modules/mimic-response/index.js +0 -77
- package/node_modules/decompress-response/node_modules/mimic-response/package.json +0 -42
- package/node_modules/decompress-response/node_modules/mimic-response/readme.md +0 -78
- package/node_modules/keyv/.nyc_output/37411020-4142-4b08-b825-343ba2427bf7.json +0 -1
- package/node_modules/keyv/.nyc_output/cd79f2de-c8b8-4493-bc15-b2bde28efa4b.json +0 -1
- package/node_modules/keyv/.nyc_output/processinfo/37411020-4142-4b08-b825-343ba2427bf7.json +0 -1
- package/node_modules/keyv/.nyc_output/processinfo/cd79f2de-c8b8-4493-bc15-b2bde28efa4b.json +0 -1
- package/node_modules/keyv/.nyc_output/processinfo/index.json +0 -1
- package/node_modules/keyv/test/test.js +0 -132
- package/node_modules/keyv/test/testdb.sqlite +0 -0
- package/releasetag.txt +0 -1
- package/version.txt +0 -1
- /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/buffer-stream.js +0 -0
- /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/index.d.ts +0 -0
- /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/index.js +0 -0
- /package/node_modules/{decompress-response/node_modules/mimic-response → cacheable-request/node_modules/get-stream}/license +0 -0
- /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/package.json +0 -0
- /package/node_modules/{get-stream → cacheable-request/node_modules/get-stream}/readme.md +0 -0
- /package/node_modules/{decompress-response/node_modules/mimic-response → mimic-response}/index.d.ts +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `crypto` module provides cryptographic functionality that includes a
|
|
3
|
-
* wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify
|
|
2
|
+
* The `node:crypto` module provides cryptographic functionality that includes a
|
|
3
|
+
* set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify
|
|
4
|
+
* functions.
|
|
4
5
|
*
|
|
5
6
|
* ```js
|
|
6
|
-
* const { createHmac } = await import('crypto');
|
|
7
|
+
* const { createHmac } = await import('node:crypto');
|
|
7
8
|
*
|
|
8
9
|
* const secret = 'abcdefg';
|
|
9
10
|
* const hash = createHmac('sha256', secret)
|
|
@@ -13,47 +14,73 @@
|
|
|
13
14
|
* // Prints:
|
|
14
15
|
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
|
15
16
|
* ```
|
|
16
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
17
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js)
|
|
17
18
|
*/
|
|
18
19
|
declare module 'crypto' {
|
|
19
20
|
import * as stream from 'node:stream';
|
|
20
21
|
import { PeerCertificate } from 'node:tls';
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* SPKAC is a Certificate Signing Request mechanism originally implemented by
|
|
24
|
+
* Netscape and was specified formally as part of HTML5's `keygen` element.
|
|
25
|
+
*
|
|
26
|
+
* `<keygen>` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects
|
|
27
|
+
* should not use this element anymore.
|
|
28
|
+
*
|
|
29
|
+
* The `node:crypto` module provides the `Certificate` class for working with SPKAC
|
|
30
|
+
* data. The most common usage is handling output generated by the HTML5`<keygen>` element. Node.js uses [OpenSSL's SPKAC
|
|
31
|
+
* implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally.
|
|
32
|
+
* @since v0.11.8
|
|
33
|
+
*/
|
|
34
|
+
class Certificate {
|
|
22
35
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
36
|
+
* ```js
|
|
37
|
+
* const { Certificate } = await import('node:crypto');
|
|
38
|
+
* const spkac = getSpkacSomehow();
|
|
39
|
+
* const challenge = Certificate.exportChallenge(spkac);
|
|
40
|
+
* console.log(challenge.toString('utf8'));
|
|
41
|
+
* // Prints: the challenge as a UTF8 string
|
|
42
|
+
* ```
|
|
43
|
+
* @since v9.0.0
|
|
44
|
+
* @param encoding The `encoding` of the `spkac` string.
|
|
45
|
+
* @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
|
|
27
46
|
*/
|
|
28
|
-
exportChallenge(spkac: BinaryLike): Buffer;
|
|
47
|
+
static exportChallenge(spkac: BinaryLike): Buffer;
|
|
29
48
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
49
|
+
* ```js
|
|
50
|
+
* const { Certificate } = await import('node:crypto');
|
|
51
|
+
* const spkac = getSpkacSomehow();
|
|
52
|
+
* const publicKey = Certificate.exportPublicKey(spkac);
|
|
53
|
+
* console.log(publicKey);
|
|
54
|
+
* // Prints: the public key as <Buffer ...>
|
|
55
|
+
* ```
|
|
56
|
+
* @since v9.0.0
|
|
57
|
+
* @param encoding The `encoding` of the `spkac` string.
|
|
58
|
+
* @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
|
|
35
59
|
*/
|
|
36
|
-
exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
|
|
60
|
+
static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
|
|
37
61
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
62
|
+
* ```js
|
|
63
|
+
* import { Buffer } from 'node:buffer';
|
|
64
|
+
* const { Certificate } = await import('node:crypto');
|
|
65
|
+
*
|
|
66
|
+
* const spkac = getSpkacSomehow();
|
|
67
|
+
* console.log(Certificate.verifySpkac(Buffer.from(spkac)));
|
|
68
|
+
* // Prints: true or false
|
|
69
|
+
* ```
|
|
70
|
+
* @since v9.0.0
|
|
71
|
+
* @param encoding The `encoding` of the `spkac` string.
|
|
72
|
+
* @return `true` if the given `spkac` data structure is valid, `false` otherwise.
|
|
42
73
|
*/
|
|
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;
|
|
74
|
+
static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
|
50
75
|
/**
|
|
76
|
+
* @deprecated
|
|
51
77
|
* @param spkac
|
|
52
78
|
* @returns The challenge component of the `spkac` data structure,
|
|
53
79
|
* which includes a public key and a challenge.
|
|
54
80
|
*/
|
|
55
81
|
exportChallenge(spkac: BinaryLike): Buffer;
|
|
56
82
|
/**
|
|
83
|
+
* @deprecated
|
|
57
84
|
* @param spkac
|
|
58
85
|
* @param encoding The encoding of the spkac string.
|
|
59
86
|
* @returns The public key component of the `spkac` data structure,
|
|
@@ -61,14 +88,15 @@ declare module 'crypto' {
|
|
|
61
88
|
*/
|
|
62
89
|
exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
|
|
63
90
|
/**
|
|
91
|
+
* @deprecated
|
|
64
92
|
* @param spkac
|
|
65
93
|
* @returns `true` if the given `spkac` data structure is valid,
|
|
66
94
|
* `false` otherwise.
|
|
67
95
|
*/
|
|
68
96
|
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
|
69
|
-
}
|
|
97
|
+
}
|
|
70
98
|
namespace constants {
|
|
71
|
-
// https://nodejs.org/dist/latest-
|
|
99
|
+
// https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants
|
|
72
100
|
const OPENSSL_VERSION_NUMBER: number;
|
|
73
101
|
/** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
|
|
74
102
|
const SSL_OP_ALL: number;
|
|
@@ -84,18 +112,8 @@ declare module 'crypto' {
|
|
|
84
112
|
const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
|
|
85
113
|
/** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */
|
|
86
114
|
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
115
|
/** Allows initial connection to servers that do not support RI. */
|
|
90
116
|
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
117
|
/** Instructs OpenSSL to disable support for SSL/TLS compression. */
|
|
100
118
|
const SSL_OP_NO_COMPRESSION: number;
|
|
101
119
|
const SSL_OP_NO_QUERY_MTU: number;
|
|
@@ -107,16 +125,6 @@ declare module 'crypto' {
|
|
|
107
125
|
const SSL_OP_NO_TLSv1: number;
|
|
108
126
|
const SSL_OP_NO_TLSv1_1: number;
|
|
109
127
|
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
128
|
/** Instructs OpenSSL to disable version rollback attack detection. */
|
|
121
129
|
const SSL_OP_TLS_ROLLBACK_BUG: number;
|
|
122
130
|
const ENGINE_METHOD_RSA: number;
|
|
@@ -134,7 +142,6 @@ declare module 'crypto' {
|
|
|
134
142
|
const DH_CHECK_P_NOT_PRIME: number;
|
|
135
143
|
const DH_UNABLE_TO_CHECK_GENERATOR: number;
|
|
136
144
|
const DH_NOT_SUITABLE_GENERATOR: number;
|
|
137
|
-
const ALPN_ENABLED: number;
|
|
138
145
|
const RSA_PKCS1_PADDING: number;
|
|
139
146
|
const RSA_SSLV23_PADDING: number;
|
|
140
147
|
const RSA_NO_PADDING: number;
|
|
@@ -172,19 +179,19 @@ declare module 'crypto' {
|
|
|
172
179
|
*
|
|
173
180
|
* The `algorithm` is dependent on the available algorithms supported by the
|
|
174
181
|
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
175
|
-
* On recent releases of OpenSSL, `openssl list -digest-algorithms`
|
|
182
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
176
183
|
* display the available digest algorithms.
|
|
177
184
|
*
|
|
178
185
|
* Example: generating the sha256 sum of a file
|
|
179
186
|
*
|
|
180
187
|
* ```js
|
|
181
188
|
* import {
|
|
182
|
-
* createReadStream
|
|
183
|
-
* } from 'fs';
|
|
184
|
-
* import { argv } from 'process';
|
|
189
|
+
* createReadStream,
|
|
190
|
+
* } from 'node:fs';
|
|
191
|
+
* import { argv } from 'node:process';
|
|
185
192
|
* const {
|
|
186
|
-
* createHash
|
|
187
|
-
* } = await import('crypto');
|
|
193
|
+
* createHash,
|
|
194
|
+
* } = await import('node:crypto');
|
|
188
195
|
*
|
|
189
196
|
* const filename = argv[2];
|
|
190
197
|
*
|
|
@@ -212,22 +219,24 @@ declare module 'crypto' {
|
|
|
212
219
|
*
|
|
213
220
|
* The `algorithm` is dependent on the available algorithms supported by the
|
|
214
221
|
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
215
|
-
* On recent releases of OpenSSL, `openssl list -digest-algorithms`
|
|
222
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
216
223
|
* display the available digest algorithms.
|
|
217
224
|
*
|
|
218
225
|
* The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
|
|
219
|
-
* a `KeyObject`, its type must be `secret`.
|
|
226
|
+
* a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was
|
|
227
|
+
* obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not
|
|
228
|
+
* exceed the block size of `algorithm` (e.g., 512 bits for SHA-256).
|
|
220
229
|
*
|
|
221
230
|
* Example: generating the sha256 HMAC of a file
|
|
222
231
|
*
|
|
223
232
|
* ```js
|
|
224
233
|
* import {
|
|
225
|
-
* createReadStream
|
|
226
|
-
* } from 'fs';
|
|
227
|
-
* import { argv } from 'process';
|
|
234
|
+
* createReadStream,
|
|
235
|
+
* } from 'node:fs';
|
|
236
|
+
* import { argv } from 'node:process';
|
|
228
237
|
* const {
|
|
229
|
-
* createHmac
|
|
230
|
-
* } = await import('crypto');
|
|
238
|
+
* createHmac,
|
|
239
|
+
* } = await import('node:crypto');
|
|
231
240
|
*
|
|
232
241
|
* const filename = argv[2];
|
|
233
242
|
*
|
|
@@ -270,8 +279,8 @@ declare module 'crypto' {
|
|
|
270
279
|
*
|
|
271
280
|
* ```js
|
|
272
281
|
* const {
|
|
273
|
-
* createHash
|
|
274
|
-
* } = await import('crypto');
|
|
282
|
+
* createHash,
|
|
283
|
+
* } = await import('node:crypto');
|
|
275
284
|
*
|
|
276
285
|
* const hash = createHash('sha256');
|
|
277
286
|
*
|
|
@@ -293,9 +302,9 @@ declare module 'crypto' {
|
|
|
293
302
|
* Example: Using `Hash` and piped streams:
|
|
294
303
|
*
|
|
295
304
|
* ```js
|
|
296
|
-
* import { createReadStream } from 'fs';
|
|
297
|
-
* import { stdout } from 'process';
|
|
298
|
-
* const { createHash } = await import('crypto');
|
|
305
|
+
* import { createReadStream } from 'node:fs';
|
|
306
|
+
* import { stdout } from 'node:process';
|
|
307
|
+
* const { createHash } = await import('node:crypto');
|
|
299
308
|
*
|
|
300
309
|
* const hash = createHash('sha256');
|
|
301
310
|
*
|
|
@@ -307,8 +316,8 @@ declare module 'crypto' {
|
|
|
307
316
|
*
|
|
308
317
|
* ```js
|
|
309
318
|
* const {
|
|
310
|
-
* createHash
|
|
311
|
-
* } = await import('crypto');
|
|
319
|
+
* createHash,
|
|
320
|
+
* } = await import('node:crypto');
|
|
312
321
|
*
|
|
313
322
|
* const hash = createHash('sha256');
|
|
314
323
|
*
|
|
@@ -335,8 +344,8 @@ declare module 'crypto' {
|
|
|
335
344
|
* ```js
|
|
336
345
|
* // Calculate a rolling hash.
|
|
337
346
|
* const {
|
|
338
|
-
* createHash
|
|
339
|
-
* } = await import('crypto');
|
|
347
|
+
* createHash,
|
|
348
|
+
* } = await import('node:crypto');
|
|
340
349
|
*
|
|
341
350
|
* const hash = createHash('sha256');
|
|
342
351
|
*
|
|
@@ -395,8 +404,8 @@ declare module 'crypto' {
|
|
|
395
404
|
*
|
|
396
405
|
* ```js
|
|
397
406
|
* const {
|
|
398
|
-
* createHmac
|
|
399
|
-
* } = await import('crypto');
|
|
407
|
+
* createHmac,
|
|
408
|
+
* } = await import('node:crypto');
|
|
400
409
|
*
|
|
401
410
|
* const hmac = createHmac('sha256', 'a secret');
|
|
402
411
|
*
|
|
@@ -418,11 +427,11 @@ declare module 'crypto' {
|
|
|
418
427
|
* Example: Using `Hmac` and piped streams:
|
|
419
428
|
*
|
|
420
429
|
* ```js
|
|
421
|
-
* import { createReadStream } from 'fs';
|
|
422
|
-
* import { stdout } from 'process';
|
|
430
|
+
* import { createReadStream } from 'node:fs';
|
|
431
|
+
* import { stdout } from 'node:process';
|
|
423
432
|
* const {
|
|
424
|
-
* createHmac
|
|
425
|
-
* } = await import('crypto');
|
|
433
|
+
* createHmac,
|
|
434
|
+
* } = await import('node:crypto');
|
|
426
435
|
*
|
|
427
436
|
* const hmac = createHmac('sha256', 'a secret');
|
|
428
437
|
*
|
|
@@ -434,8 +443,8 @@ declare module 'crypto' {
|
|
|
434
443
|
*
|
|
435
444
|
* ```js
|
|
436
445
|
* const {
|
|
437
|
-
* createHmac
|
|
438
|
-
* } = await import('crypto');
|
|
446
|
+
* createHmac,
|
|
447
|
+
* } = await import('node:crypto');
|
|
439
448
|
*
|
|
440
449
|
* const hmac = createHmac('sha256', 'a secret');
|
|
441
450
|
*
|
|
@@ -529,9 +538,6 @@ declare module 'crypto' {
|
|
|
529
538
|
*/
|
|
530
539
|
namedCurve?: string | undefined;
|
|
531
540
|
}
|
|
532
|
-
interface JwkKeyExportOptions {
|
|
533
|
-
format: 'jwk';
|
|
534
|
-
}
|
|
535
541
|
/**
|
|
536
542
|
* Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
|
|
537
543
|
* and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject`
|
|
@@ -551,13 +557,13 @@ declare module 'crypto' {
|
|
|
551
557
|
* Example: Converting a `CryptoKey` instance to a `KeyObject`:
|
|
552
558
|
*
|
|
553
559
|
* ```js
|
|
554
|
-
* const {
|
|
555
|
-
* const { subtle } =
|
|
560
|
+
* const { KeyObject } = await import('node:crypto');
|
|
561
|
+
* const { subtle } = globalThis.crypto;
|
|
556
562
|
*
|
|
557
563
|
* const key = await subtle.generateKey({
|
|
558
564
|
* name: 'HMAC',
|
|
559
565
|
* hash: 'SHA-256',
|
|
560
|
-
* length: 256
|
|
566
|
+
* length: 256,
|
|
561
567
|
* }, true, ['sign', 'verify']);
|
|
562
568
|
*
|
|
563
569
|
* const keyObject = KeyObject.from(key);
|
|
@@ -662,25 +668,30 @@ declare module 'crypto' {
|
|
|
662
668
|
* Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
|
|
663
669
|
*
|
|
664
670
|
* The `options` argument controls stream behavior and is optional except when a
|
|
665
|
-
* cipher in CCM or OCB mode
|
|
671
|
+
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
|
666
672
|
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
|
|
667
673
|
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
|
|
674
|
+
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
|
668
675
|
*
|
|
669
676
|
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
|
670
|
-
* recent OpenSSL releases, `openssl list -cipher-algorithms`
|
|
677
|
+
* recent OpenSSL releases, `openssl list -cipher-algorithms` will
|
|
671
678
|
* display the available cipher algorithms.
|
|
672
679
|
*
|
|
673
680
|
* The `password` is used to derive the cipher key and initialization vector (IV).
|
|
674
681
|
* The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`.
|
|
675
682
|
*
|
|
683
|
+
* **This function is semantically insecure for all**
|
|
684
|
+
* **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,**
|
|
685
|
+
* **GCM, or CCM).**
|
|
686
|
+
*
|
|
676
687
|
* The implementation of `crypto.createCipher()` derives keys using the OpenSSL
|
|
677
|
-
* function [`EVP_BytesToKey`](https://www.openssl.org/docs/
|
|
688
|
+
* function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
|
|
678
689
|
* iteration, and no salt. The lack of salt allows dictionary attacks as the same
|
|
679
690
|
* password always creates the same key. The low iteration count and
|
|
680
691
|
* non-cryptographically secure hash algorithm allow passwords to be tested very
|
|
681
692
|
* rapidly.
|
|
682
693
|
*
|
|
683
|
-
* In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/
|
|
694
|
+
* In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that
|
|
684
695
|
* developers derive a key and IV on
|
|
685
696
|
* their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode
|
|
686
697
|
* (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when
|
|
@@ -700,12 +711,13 @@ declare module 'crypto' {
|
|
|
700
711
|
* initialization vector (`iv`).
|
|
701
712
|
*
|
|
702
713
|
* The `options` argument controls stream behavior and is optional except when a
|
|
703
|
-
* cipher in CCM or OCB mode
|
|
714
|
+
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
|
704
715
|
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
|
|
705
716
|
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
|
|
717
|
+
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
|
706
718
|
*
|
|
707
719
|
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
|
708
|
-
* recent OpenSSL releases, `openssl list -cipher-algorithms`
|
|
720
|
+
* recent OpenSSL releases, `openssl list -cipher-algorithms` will
|
|
709
721
|
* display the available cipher algorithms.
|
|
710
722
|
*
|
|
711
723
|
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
|
|
@@ -747,8 +759,8 @@ declare module 'crypto' {
|
|
|
747
759
|
* const {
|
|
748
760
|
* scrypt,
|
|
749
761
|
* randomFill,
|
|
750
|
-
* createCipheriv
|
|
751
|
-
* } = await import('crypto');
|
|
762
|
+
* createCipheriv,
|
|
763
|
+
* } = await import('node:crypto');
|
|
752
764
|
*
|
|
753
765
|
* const algorithm = 'aes-192-cbc';
|
|
754
766
|
* const password = 'Password used to generate key';
|
|
@@ -782,17 +794,17 @@ declare module 'crypto' {
|
|
|
782
794
|
* import {
|
|
783
795
|
* createReadStream,
|
|
784
796
|
* createWriteStream,
|
|
785
|
-
* } from 'fs';
|
|
797
|
+
* } from 'node:fs';
|
|
786
798
|
*
|
|
787
799
|
* import {
|
|
788
|
-
* pipeline
|
|
789
|
-
* } from 'stream';
|
|
800
|
+
* pipeline,
|
|
801
|
+
* } from 'node:stream';
|
|
790
802
|
*
|
|
791
803
|
* const {
|
|
792
804
|
* scrypt,
|
|
793
805
|
* randomFill,
|
|
794
|
-
* createCipheriv
|
|
795
|
-
* } = await import('crypto');
|
|
806
|
+
* createCipheriv,
|
|
807
|
+
* } = await import('node:crypto');
|
|
796
808
|
*
|
|
797
809
|
* const algorithm = 'aes-192-cbc';
|
|
798
810
|
* const password = 'Password used to generate key';
|
|
@@ -823,8 +835,8 @@ declare module 'crypto' {
|
|
|
823
835
|
* const {
|
|
824
836
|
* scrypt,
|
|
825
837
|
* randomFill,
|
|
826
|
-
* createCipheriv
|
|
827
|
-
* } = await import('crypto');
|
|
838
|
+
* createCipheriv,
|
|
839
|
+
* } = await import('node:crypto');
|
|
828
840
|
*
|
|
829
841
|
* const algorithm = 'aes-192-cbc';
|
|
830
842
|
* const password = 'Password used to generate key';
|
|
@@ -925,17 +937,22 @@ declare module 'crypto' {
|
|
|
925
937
|
* Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
|
|
926
938
|
*
|
|
927
939
|
* The `options` argument controls stream behavior and is optional except when a
|
|
928
|
-
* cipher in CCM or OCB mode
|
|
940
|
+
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
|
929
941
|
* authentication tag in bytes, see `CCM mode`.
|
|
942
|
+
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
|
943
|
+
*
|
|
944
|
+
* **This function is semantically insecure for all**
|
|
945
|
+
* **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,**
|
|
946
|
+
* **GCM, or CCM).**
|
|
930
947
|
*
|
|
931
948
|
* The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
|
|
932
|
-
* function [`EVP_BytesToKey`](https://www.openssl.org/docs/
|
|
949
|
+
* function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
|
|
933
950
|
* iteration, and no salt. The lack of salt allows dictionary attacks as the same
|
|
934
951
|
* password always creates the same key. The low iteration count and
|
|
935
952
|
* non-cryptographically secure hash algorithm allow passwords to be tested very
|
|
936
953
|
* rapidly.
|
|
937
954
|
*
|
|
938
|
-
* In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/
|
|
955
|
+
* In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that
|
|
939
956
|
* developers derive a key and IV on
|
|
940
957
|
* their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object.
|
|
941
958
|
* @since v0.1.94
|
|
@@ -951,12 +968,13 @@ declare module 'crypto' {
|
|
|
951
968
|
* Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
|
|
952
969
|
*
|
|
953
970
|
* The `options` argument controls stream behavior and is optional except when a
|
|
954
|
-
* cipher in CCM or OCB mode
|
|
971
|
+
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
|
|
955
972
|
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags
|
|
956
973
|
* to those with the specified length.
|
|
974
|
+
* For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
|
|
957
975
|
*
|
|
958
976
|
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
|
|
959
|
-
* recent OpenSSL releases, `openssl list -cipher-algorithms`
|
|
977
|
+
* recent OpenSSL releases, `openssl list -cipher-algorithms` will
|
|
960
978
|
* display the available cipher algorithms.
|
|
961
979
|
*
|
|
962
980
|
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
|
|
@@ -995,11 +1013,11 @@ declare module 'crypto' {
|
|
|
995
1013
|
* Example: Using `Decipher` objects as streams:
|
|
996
1014
|
*
|
|
997
1015
|
* ```js
|
|
998
|
-
* import { Buffer } from 'buffer';
|
|
1016
|
+
* import { Buffer } from 'node:buffer';
|
|
999
1017
|
* const {
|
|
1000
1018
|
* scryptSync,
|
|
1001
|
-
* createDecipheriv
|
|
1002
|
-
* } = await import('crypto');
|
|
1019
|
+
* createDecipheriv,
|
|
1020
|
+
* } = await import('node:crypto');
|
|
1003
1021
|
*
|
|
1004
1022
|
* const algorithm = 'aes-192-cbc';
|
|
1005
1023
|
* const password = 'Password used to generate key';
|
|
@@ -1014,6 +1032,7 @@ declare module 'crypto' {
|
|
|
1014
1032
|
*
|
|
1015
1033
|
* let decrypted = '';
|
|
1016
1034
|
* decipher.on('readable', () => {
|
|
1035
|
+
* let chunk;
|
|
1017
1036
|
* while (null !== (chunk = decipher.read())) {
|
|
1018
1037
|
* decrypted += chunk.toString('utf8');
|
|
1019
1038
|
* }
|
|
@@ -1036,12 +1055,12 @@ declare module 'crypto' {
|
|
|
1036
1055
|
* import {
|
|
1037
1056
|
* createReadStream,
|
|
1038
1057
|
* createWriteStream,
|
|
1039
|
-
* } from 'fs';
|
|
1040
|
-
* import { Buffer } from 'buffer';
|
|
1058
|
+
* } from 'node:fs';
|
|
1059
|
+
* import { Buffer } from 'node:buffer';
|
|
1041
1060
|
* const {
|
|
1042
1061
|
* scryptSync,
|
|
1043
|
-
* createDecipheriv
|
|
1044
|
-
* } = await import('crypto');
|
|
1062
|
+
* createDecipheriv,
|
|
1063
|
+
* } = await import('node:crypto');
|
|
1045
1064
|
*
|
|
1046
1065
|
* const algorithm = 'aes-192-cbc';
|
|
1047
1066
|
* const password = 'Password used to generate key';
|
|
@@ -1061,11 +1080,11 @@ declare module 'crypto' {
|
|
|
1061
1080
|
* Example: Using the `decipher.update()` and `decipher.final()` methods:
|
|
1062
1081
|
*
|
|
1063
1082
|
* ```js
|
|
1064
|
-
* import { Buffer } from 'buffer';
|
|
1083
|
+
* import { Buffer } from 'node:buffer';
|
|
1065
1084
|
* const {
|
|
1066
1085
|
* scryptSync,
|
|
1067
|
-
* createDecipheriv
|
|
1068
|
-
* } = await import('crypto');
|
|
1086
|
+
* createDecipheriv,
|
|
1087
|
+
* } = await import('node:crypto');
|
|
1069
1088
|
*
|
|
1070
1089
|
* const algorithm = 'aes-192-cbc';
|
|
1071
1090
|
* const password = 'Password used to generate key';
|
|
@@ -1162,25 +1181,30 @@ declare module 'crypto' {
|
|
|
1162
1181
|
format?: KeyFormat | undefined;
|
|
1163
1182
|
type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
|
|
1164
1183
|
passphrase?: string | Buffer | undefined;
|
|
1184
|
+
encoding?: string | undefined;
|
|
1165
1185
|
}
|
|
1166
1186
|
interface PublicKeyInput {
|
|
1167
1187
|
key: string | Buffer;
|
|
1168
1188
|
format?: KeyFormat | undefined;
|
|
1169
1189
|
type?: 'pkcs1' | 'spki' | undefined;
|
|
1190
|
+
encoding?: string | undefined;
|
|
1170
1191
|
}
|
|
1171
1192
|
/**
|
|
1172
1193
|
* Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
|
|
1173
1194
|
*
|
|
1174
1195
|
* ```js
|
|
1175
1196
|
* const {
|
|
1176
|
-
* generateKey
|
|
1177
|
-
* } = await import('crypto');
|
|
1197
|
+
* generateKey,
|
|
1198
|
+
* } = await import('node:crypto');
|
|
1178
1199
|
*
|
|
1179
|
-
* generateKey('hmac', { length:
|
|
1200
|
+
* generateKey('hmac', { length: 512 }, (err, key) => {
|
|
1180
1201
|
* if (err) throw err;
|
|
1181
1202
|
* console.log(key.export().toString('hex')); // 46e..........620
|
|
1182
1203
|
* });
|
|
1183
1204
|
* ```
|
|
1205
|
+
*
|
|
1206
|
+
* The size of a generated HMAC key should not exceed the block size of the
|
|
1207
|
+
* underlying hash function. See {@link createHmac} for more information.
|
|
1184
1208
|
* @since v15.0.0
|
|
1185
1209
|
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1186
1210
|
*/
|
|
@@ -1196,12 +1220,15 @@ declare module 'crypto' {
|
|
|
1196
1220
|
*
|
|
1197
1221
|
* ```js
|
|
1198
1222
|
* const {
|
|
1199
|
-
* generateKeySync
|
|
1200
|
-
* } = await import('crypto');
|
|
1223
|
+
* generateKeySync,
|
|
1224
|
+
* } = await import('node:crypto');
|
|
1201
1225
|
*
|
|
1202
|
-
* const key = generateKeySync('hmac', { length:
|
|
1226
|
+
* const key = generateKeySync('hmac', { length: 512 });
|
|
1203
1227
|
* console.log(key.export().toString('hex')); // e89..........41e
|
|
1204
1228
|
* ```
|
|
1229
|
+
*
|
|
1230
|
+
* The size of a generated HMAC key should not exceed the block size of the
|
|
1231
|
+
* underlying hash function. See {@link createHmac} for more information.
|
|
1205
1232
|
* @since v15.0.0
|
|
1206
1233
|
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1207
1234
|
*/
|
|
@@ -1263,7 +1290,7 @@ declare module 'crypto' {
|
|
|
1263
1290
|
type DSAEncoding = 'der' | 'ieee-p1363';
|
|
1264
1291
|
interface SigningOptions {
|
|
1265
1292
|
/**
|
|
1266
|
-
* @
|
|
1293
|
+
* @see crypto.constants.RSA_PKCS1_PADDING
|
|
1267
1294
|
*/
|
|
1268
1295
|
padding?: number | undefined;
|
|
1269
1296
|
saltLength?: number | undefined;
|
|
@@ -1277,6 +1304,7 @@ declare module 'crypto' {
|
|
|
1277
1304
|
interface VerifyKeyObjectInput extends SigningOptions {
|
|
1278
1305
|
key: KeyObject;
|
|
1279
1306
|
}
|
|
1307
|
+
interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
|
|
1280
1308
|
type KeyLike = string | Buffer | KeyObject;
|
|
1281
1309
|
/**
|
|
1282
1310
|
* The `Sign` class is a utility for generating signatures. It can be used in one
|
|
@@ -1296,11 +1324,11 @@ declare module 'crypto' {
|
|
|
1296
1324
|
* const {
|
|
1297
1325
|
* generateKeyPairSync,
|
|
1298
1326
|
* createSign,
|
|
1299
|
-
* createVerify
|
|
1300
|
-
* } = await import('crypto');
|
|
1327
|
+
* createVerify,
|
|
1328
|
+
* } = await import('node:crypto');
|
|
1301
1329
|
*
|
|
1302
1330
|
* const { privateKey, publicKey } = generateKeyPairSync('ec', {
|
|
1303
|
-
* namedCurve: 'sect239k1'
|
|
1331
|
+
* namedCurve: 'sect239k1',
|
|
1304
1332
|
* });
|
|
1305
1333
|
*
|
|
1306
1334
|
* const sign = createSign('SHA256');
|
|
@@ -1321,8 +1349,8 @@ declare module 'crypto' {
|
|
|
1321
1349
|
* const {
|
|
1322
1350
|
* generateKeyPairSync,
|
|
1323
1351
|
* createSign,
|
|
1324
|
-
* createVerify
|
|
1325
|
-
* } = await import('crypto');
|
|
1352
|
+
* createVerify,
|
|
1353
|
+
* } = await import('node:crypto');
|
|
1326
1354
|
*
|
|
1327
1355
|
* const { privateKey, publicKey } = generateKeyPairSync('rsa', {
|
|
1328
1356
|
* modulusLength: 2048,
|
|
@@ -1431,8 +1459,8 @@ declare module 'crypto' {
|
|
|
1431
1459
|
* be passed instead of a public key.
|
|
1432
1460
|
* @since v0.1.92
|
|
1433
1461
|
*/
|
|
1434
|
-
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
|
|
1435
|
-
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
|
|
1462
|
+
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: NodeJS.ArrayBufferView): boolean;
|
|
1463
|
+
verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
|
|
1436
1464
|
}
|
|
1437
1465
|
/**
|
|
1438
1466
|
* Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
|
|
@@ -1450,10 +1478,10 @@ declare module 'crypto' {
|
|
|
1450
1478
|
* @param [generator=2]
|
|
1451
1479
|
* @param generatorEncoding The `encoding` of the `generator` string.
|
|
1452
1480
|
*/
|
|
1453
|
-
function createDiffieHellman(primeLength: number, generator?: number
|
|
1454
|
-
function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
|
|
1455
|
-
function createDiffieHellman(prime: string,
|
|
1456
|
-
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator
|
|
1481
|
+
function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
|
|
1482
|
+
function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
|
|
1483
|
+
function createDiffieHellman(prime: ArrayBuffer | NodeJS.ArrayBufferView, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
|
|
1484
|
+
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator?: number | ArrayBuffer | NodeJS.ArrayBufferView): DiffieHellman;
|
|
1457
1485
|
function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
|
|
1458
1486
|
/**
|
|
1459
1487
|
* The `DiffieHellman` class is a utility for creating Diffie-Hellman key
|
|
@@ -1462,11 +1490,11 @@ declare module 'crypto' {
|
|
|
1462
1490
|
* Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function.
|
|
1463
1491
|
*
|
|
1464
1492
|
* ```js
|
|
1465
|
-
* import assert from 'assert';
|
|
1493
|
+
* import assert from 'node:assert';
|
|
1466
1494
|
*
|
|
1467
1495
|
* const {
|
|
1468
|
-
* createDiffieHellman
|
|
1469
|
-
* } = await import('crypto');
|
|
1496
|
+
* createDiffieHellman,
|
|
1497
|
+
* } = await import('node:crypto');
|
|
1470
1498
|
*
|
|
1471
1499
|
* // Generate Alice's keys...
|
|
1472
1500
|
* const alice = createDiffieHellman(2048);
|
|
@@ -1510,9 +1538,9 @@ declare module 'crypto' {
|
|
|
1510
1538
|
* @param inputEncoding The `encoding` of an `otherPublicKey` string.
|
|
1511
1539
|
* @param outputEncoding The `encoding` of the return value.
|
|
1512
1540
|
*/
|
|
1513
|
-
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
|
|
1514
|
-
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
|
|
1515
|
-
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
|
|
1541
|
+
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
|
|
1542
|
+
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
|
|
1543
|
+
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
|
|
1516
1544
|
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
|
|
1517
1545
|
/**
|
|
1518
1546
|
* Returns the Diffie-Hellman prime in the specified `encoding`.
|
|
@@ -1572,7 +1600,7 @@ declare module 'crypto' {
|
|
|
1572
1600
|
* A bit field containing any warnings and/or errors resulting from a check
|
|
1573
1601
|
* performed during initialization of the `DiffieHellman` object.
|
|
1574
1602
|
*
|
|
1575
|
-
* The following values are valid for this property (as defined in `constants`module):
|
|
1603
|
+
* The following values are valid for this property (as defined in `node:constants` module):
|
|
1576
1604
|
*
|
|
1577
1605
|
* * `DH_CHECK_P_NOT_SAFE_PRIME`
|
|
1578
1606
|
* * `DH_CHECK_P_NOT_PRIME`
|
|
@@ -1582,11 +1610,41 @@ declare module 'crypto' {
|
|
|
1582
1610
|
*/
|
|
1583
1611
|
verifyError: number;
|
|
1584
1612
|
}
|
|
1613
|
+
/**
|
|
1614
|
+
* The `DiffieHellmanGroup` class takes a well-known modp group as its argument.
|
|
1615
|
+
* It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation.
|
|
1616
|
+
* In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods.
|
|
1617
|
+
*
|
|
1618
|
+
* ```js
|
|
1619
|
+
* const { createDiffieHellmanGroup } = await import('node:crypto');
|
|
1620
|
+
* const dh = createDiffieHellmanGroup('modp1');
|
|
1621
|
+
* ```
|
|
1622
|
+
* The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt):
|
|
1623
|
+
* ```bash
|
|
1624
|
+
* $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
|
|
1625
|
+
* modp1 # 768 bits
|
|
1626
|
+
* modp2 # 1024 bits
|
|
1627
|
+
* modp5 # 1536 bits
|
|
1628
|
+
* modp14 # 2048 bits
|
|
1629
|
+
* modp15 # etc.
|
|
1630
|
+
* modp16
|
|
1631
|
+
* modp17
|
|
1632
|
+
* modp18
|
|
1633
|
+
* ```
|
|
1634
|
+
* @since v0.7.5
|
|
1635
|
+
*/
|
|
1636
|
+
const DiffieHellmanGroup: DiffieHellmanGroupConstructor;
|
|
1637
|
+
interface DiffieHellmanGroupConstructor {
|
|
1638
|
+
new (name: string): DiffieHellmanGroup;
|
|
1639
|
+
(name: string): DiffieHellmanGroup;
|
|
1640
|
+
readonly prototype: DiffieHellmanGroup;
|
|
1641
|
+
}
|
|
1642
|
+
type DiffieHellmanGroup = Omit<DiffieHellman, 'setPublicKey' | 'setPrivateKey'>;
|
|
1585
1643
|
/**
|
|
1586
1644
|
* Creates a predefined `DiffieHellmanGroup` key exchange object. The
|
|
1587
|
-
* supported groups are
|
|
1588
|
-
*
|
|
1589
|
-
* returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
|
|
1645
|
+
* supported groups are listed in the documentation for `DiffieHellmanGroup`.
|
|
1646
|
+
*
|
|
1647
|
+
* The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
|
|
1590
1648
|
* the keys (with `diffieHellman.setPublicKey()`, for example). The
|
|
1591
1649
|
* advantage of using this method is that the parties do not have to
|
|
1592
1650
|
* generate nor exchange a group modulus beforehand, saving both processor
|
|
@@ -1596,8 +1654,8 @@ declare module 'crypto' {
|
|
|
1596
1654
|
*
|
|
1597
1655
|
* ```js
|
|
1598
1656
|
* const {
|
|
1599
|
-
* getDiffieHellman
|
|
1600
|
-
* } = await import('crypto');
|
|
1657
|
+
* getDiffieHellman,
|
|
1658
|
+
* } = await import('node:crypto');
|
|
1601
1659
|
* const alice = getDiffieHellman('modp14');
|
|
1602
1660
|
* const bob = getDiffieHellman('modp14');
|
|
1603
1661
|
*
|
|
@@ -1612,7 +1670,12 @@ declare module 'crypto' {
|
|
|
1612
1670
|
* ```
|
|
1613
1671
|
* @since v0.7.5
|
|
1614
1672
|
*/
|
|
1615
|
-
function getDiffieHellman(groupName: string):
|
|
1673
|
+
function getDiffieHellman(groupName: string): DiffieHellmanGroup;
|
|
1674
|
+
/**
|
|
1675
|
+
* An alias for {@link getDiffieHellman}
|
|
1676
|
+
* @since v0.9.3
|
|
1677
|
+
*/
|
|
1678
|
+
function createDiffieHellmanGroup(name: string): DiffieHellmanGroup;
|
|
1616
1679
|
/**
|
|
1617
1680
|
* Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
|
|
1618
1681
|
* implementation. A selected HMAC digest algorithm specified by `digest` is
|
|
@@ -1622,9 +1685,6 @@ declare module 'crypto' {
|
|
|
1622
1685
|
* otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be
|
|
1623
1686
|
* thrown if any of the input arguments specify invalid values or types.
|
|
1624
1687
|
*
|
|
1625
|
-
* If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated,
|
|
1626
|
-
* please specify a `digest` explicitly.
|
|
1627
|
-
*
|
|
1628
1688
|
* The `iterations` argument must be a number set as high as possible. The
|
|
1629
1689
|
* higher the number of iterations, the more secure the derived key will be,
|
|
1630
1690
|
* but will take a longer amount of time to complete.
|
|
@@ -1636,8 +1696,8 @@ declare module 'crypto' {
|
|
|
1636
1696
|
*
|
|
1637
1697
|
* ```js
|
|
1638
1698
|
* const {
|
|
1639
|
-
* pbkdf2
|
|
1640
|
-
* } = await import('crypto');
|
|
1699
|
+
* pbkdf2,
|
|
1700
|
+
* } = await import('node:crypto');
|
|
1641
1701
|
*
|
|
1642
1702
|
* pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => {
|
|
1643
1703
|
* if (err) throw err;
|
|
@@ -1645,18 +1705,6 @@ declare module 'crypto' {
|
|
|
1645
1705
|
* });
|
|
1646
1706
|
* ```
|
|
1647
1707
|
*
|
|
1648
|
-
* The `crypto.DEFAULT_ENCODING` property can be used to change the way the`derivedKey` is passed to the callback. This property, however, has been
|
|
1649
|
-
* deprecated and use should be avoided.
|
|
1650
|
-
*
|
|
1651
|
-
* ```js
|
|
1652
|
-
* import crypto from 'crypto';
|
|
1653
|
-
* crypto.DEFAULT_ENCODING = 'hex';
|
|
1654
|
-
* crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => {
|
|
1655
|
-
* if (err) throw err;
|
|
1656
|
-
* console.log(derivedKey); // '3745e48...aa39b34'
|
|
1657
|
-
* });
|
|
1658
|
-
* ```
|
|
1659
|
-
*
|
|
1660
1708
|
* An array of supported digest functions can be retrieved using {@link getHashes}.
|
|
1661
1709
|
*
|
|
1662
1710
|
* This API uses libuv's threadpool, which can have surprising and
|
|
@@ -1672,9 +1720,6 @@ declare module 'crypto' {
|
|
|
1672
1720
|
* If an error occurs an `Error` will be thrown, otherwise the derived key will be
|
|
1673
1721
|
* returned as a `Buffer`.
|
|
1674
1722
|
*
|
|
1675
|
-
* If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated,
|
|
1676
|
-
* please specify a `digest` explicitly.
|
|
1677
|
-
*
|
|
1678
1723
|
* The `iterations` argument must be a number set as high as possible. The
|
|
1679
1724
|
* higher the number of iterations, the more secure the derived key will be,
|
|
1680
1725
|
* but will take a longer amount of time to complete.
|
|
@@ -1686,23 +1731,13 @@ declare module 'crypto' {
|
|
|
1686
1731
|
*
|
|
1687
1732
|
* ```js
|
|
1688
1733
|
* const {
|
|
1689
|
-
* pbkdf2Sync
|
|
1690
|
-
* } = await import('crypto');
|
|
1734
|
+
* pbkdf2Sync,
|
|
1735
|
+
* } = await import('node:crypto');
|
|
1691
1736
|
*
|
|
1692
1737
|
* const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512');
|
|
1693
1738
|
* console.log(key.toString('hex')); // '3745e48...08d59ae'
|
|
1694
1739
|
* ```
|
|
1695
1740
|
*
|
|
1696
|
-
* The `crypto.DEFAULT_ENCODING` property may be used to change the way the`derivedKey` is returned. This property, however, is deprecated and use
|
|
1697
|
-
* should be avoided.
|
|
1698
|
-
*
|
|
1699
|
-
* ```js
|
|
1700
|
-
* import crypto from 'crypto';
|
|
1701
|
-
* crypto.DEFAULT_ENCODING = 'hex';
|
|
1702
|
-
* const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512');
|
|
1703
|
-
* console.log(key); // '3745e48...aa39b34'
|
|
1704
|
-
* ```
|
|
1705
|
-
*
|
|
1706
1741
|
* An array of supported digest functions can be retrieved using {@link getHashes}.
|
|
1707
1742
|
* @since v0.9.3
|
|
1708
1743
|
*/
|
|
@@ -1718,8 +1753,8 @@ declare module 'crypto' {
|
|
|
1718
1753
|
* ```js
|
|
1719
1754
|
* // Asynchronous
|
|
1720
1755
|
* const {
|
|
1721
|
-
* randomBytes
|
|
1722
|
-
* } = await import('crypto');
|
|
1756
|
+
* randomBytes,
|
|
1757
|
+
* } = await import('node:crypto');
|
|
1723
1758
|
*
|
|
1724
1759
|
* randomBytes(256, (err, buf) => {
|
|
1725
1760
|
* if (err) throw err;
|
|
@@ -1734,8 +1769,8 @@ declare module 'crypto' {
|
|
|
1734
1769
|
* ```js
|
|
1735
1770
|
* // Synchronous
|
|
1736
1771
|
* const {
|
|
1737
|
-
* randomBytes
|
|
1738
|
-
* } = await import('crypto');
|
|
1772
|
+
* randomBytes,
|
|
1773
|
+
* } = await import('node:crypto');
|
|
1739
1774
|
*
|
|
1740
1775
|
* const buf = randomBytes(256);
|
|
1741
1776
|
* console.log(
|
|
@@ -1776,8 +1811,8 @@ declare module 'crypto' {
|
|
|
1776
1811
|
* ```js
|
|
1777
1812
|
* // Asynchronous
|
|
1778
1813
|
* const {
|
|
1779
|
-
* randomInt
|
|
1780
|
-
* } = await import('crypto');
|
|
1814
|
+
* randomInt,
|
|
1815
|
+
* } = await import('node:crypto');
|
|
1781
1816
|
*
|
|
1782
1817
|
* randomInt(3, (err, n) => {
|
|
1783
1818
|
* if (err) throw err;
|
|
@@ -1788,8 +1823,8 @@ declare module 'crypto' {
|
|
|
1788
1823
|
* ```js
|
|
1789
1824
|
* // Synchronous
|
|
1790
1825
|
* const {
|
|
1791
|
-
* randomInt
|
|
1792
|
-
* } = await import('crypto');
|
|
1826
|
+
* randomInt,
|
|
1827
|
+
* } = await import('node:crypto');
|
|
1793
1828
|
*
|
|
1794
1829
|
* const n = randomInt(3);
|
|
1795
1830
|
* console.log(`Random number chosen from (0, 1, 2): ${n}`);
|
|
@@ -1798,8 +1833,8 @@ declare module 'crypto' {
|
|
|
1798
1833
|
* ```js
|
|
1799
1834
|
* // With `min` argument
|
|
1800
1835
|
* const {
|
|
1801
|
-
* randomInt
|
|
1802
|
-
* } = await import('crypto');
|
|
1836
|
+
* randomInt,
|
|
1837
|
+
* } = await import('node:crypto');
|
|
1803
1838
|
*
|
|
1804
1839
|
* const n = randomInt(1, 7);
|
|
1805
1840
|
* console.log(`The dice rolled: ${n}`);
|
|
@@ -1817,8 +1852,8 @@ declare module 'crypto' {
|
|
|
1817
1852
|
* Synchronous version of {@link randomFill}.
|
|
1818
1853
|
*
|
|
1819
1854
|
* ```js
|
|
1820
|
-
* import { Buffer } from 'buffer';
|
|
1821
|
-
* const { randomFillSync } = await import('crypto');
|
|
1855
|
+
* import { Buffer } from 'node:buffer';
|
|
1856
|
+
* const { randomFillSync } = await import('node:crypto');
|
|
1822
1857
|
*
|
|
1823
1858
|
* const buf = Buffer.alloc(10);
|
|
1824
1859
|
* console.log(randomFillSync(buf).toString('hex'));
|
|
@@ -1834,8 +1869,8 @@ declare module 'crypto' {
|
|
|
1834
1869
|
* Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`.
|
|
1835
1870
|
*
|
|
1836
1871
|
* ```js
|
|
1837
|
-
* import { Buffer } from 'buffer';
|
|
1838
|
-
* const { randomFillSync } = await import('crypto');
|
|
1872
|
+
* import { Buffer } from 'node:buffer';
|
|
1873
|
+
* const { randomFillSync } = await import('node:crypto');
|
|
1839
1874
|
*
|
|
1840
1875
|
* const a = new Uint32Array(10);
|
|
1841
1876
|
* console.log(Buffer.from(randomFillSync(a).buffer,
|
|
@@ -1863,8 +1898,8 @@ declare module 'crypto' {
|
|
|
1863
1898
|
* If the `callback` function is not provided, an error will be thrown.
|
|
1864
1899
|
*
|
|
1865
1900
|
* ```js
|
|
1866
|
-
* import { Buffer } from 'buffer';
|
|
1867
|
-
* const { randomFill } = await import('crypto');
|
|
1901
|
+
* import { Buffer } from 'node:buffer';
|
|
1902
|
+
* const { randomFill } = await import('node:crypto');
|
|
1868
1903
|
*
|
|
1869
1904
|
* const buf = Buffer.alloc(10);
|
|
1870
1905
|
* randomFill(buf, (err, buf) => {
|
|
@@ -1893,8 +1928,8 @@ declare module 'crypto' {
|
|
|
1893
1928
|
* distribution and have no meaningful lower or upper bounds.
|
|
1894
1929
|
*
|
|
1895
1930
|
* ```js
|
|
1896
|
-
* import { Buffer } from 'buffer';
|
|
1897
|
-
* const { randomFill } = await import('crypto');
|
|
1931
|
+
* import { Buffer } from 'node:buffer';
|
|
1932
|
+
* const { randomFill } = await import('node:crypto');
|
|
1898
1933
|
*
|
|
1899
1934
|
* const a = new Uint32Array(10);
|
|
1900
1935
|
* randomFill(a, (err, buf) => {
|
|
@@ -1960,8 +1995,8 @@ declare module 'crypto' {
|
|
|
1960
1995
|
*
|
|
1961
1996
|
* ```js
|
|
1962
1997
|
* const {
|
|
1963
|
-
* scrypt
|
|
1964
|
-
* } = await import('crypto');
|
|
1998
|
+
* scrypt,
|
|
1999
|
+
* } = await import('node:crypto');
|
|
1965
2000
|
*
|
|
1966
2001
|
* // Using the factory defaults.
|
|
1967
2002
|
* scrypt('password', 'salt', 64, (err, derivedKey) => {
|
|
@@ -1996,8 +2031,8 @@ declare module 'crypto' {
|
|
|
1996
2031
|
*
|
|
1997
2032
|
* ```js
|
|
1998
2033
|
* const {
|
|
1999
|
-
* scryptSync
|
|
2000
|
-
* } = await import('crypto');
|
|
2034
|
+
* scryptSync,
|
|
2035
|
+
* } = await import('node:crypto');
|
|
2001
2036
|
* // Using the factory defaults.
|
|
2002
2037
|
*
|
|
2003
2038
|
* const key1 = scryptSync('password', 'salt', 64);
|
|
@@ -2068,8 +2103,8 @@ declare module 'crypto' {
|
|
|
2068
2103
|
/**
|
|
2069
2104
|
* ```js
|
|
2070
2105
|
* const {
|
|
2071
|
-
* getCiphers
|
|
2072
|
-
* } = await import('crypto');
|
|
2106
|
+
* getCiphers,
|
|
2107
|
+
* } = await import('node:crypto');
|
|
2073
2108
|
*
|
|
2074
2109
|
* console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...]
|
|
2075
2110
|
* ```
|
|
@@ -2080,8 +2115,8 @@ declare module 'crypto' {
|
|
|
2080
2115
|
/**
|
|
2081
2116
|
* ```js
|
|
2082
2117
|
* const {
|
|
2083
|
-
* getCurves
|
|
2084
|
-
* } = await import('crypto');
|
|
2118
|
+
* getCurves,
|
|
2119
|
+
* } = await import('node:crypto');
|
|
2085
2120
|
*
|
|
2086
2121
|
* console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
|
|
2087
2122
|
* ```
|
|
@@ -2094,11 +2129,18 @@ declare module 'crypto' {
|
|
|
2094
2129
|
* @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}.
|
|
2095
2130
|
*/
|
|
2096
2131
|
function getFips(): 1 | 0;
|
|
2132
|
+
/**
|
|
2133
|
+
* Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build.
|
|
2134
|
+
* Throws an error if FIPS mode is not available.
|
|
2135
|
+
* @since v10.0.0
|
|
2136
|
+
* @param bool `true` to enable FIPS mode.
|
|
2137
|
+
*/
|
|
2138
|
+
function setFips(bool: boolean): void;
|
|
2097
2139
|
/**
|
|
2098
2140
|
* ```js
|
|
2099
2141
|
* const {
|
|
2100
|
-
* getHashes
|
|
2101
|
-
* } = await import('crypto');
|
|
2142
|
+
* getHashes,
|
|
2143
|
+
* } = await import('node:crypto');
|
|
2102
2144
|
*
|
|
2103
2145
|
* console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
|
|
2104
2146
|
* ```
|
|
@@ -2113,11 +2155,11 @@ declare module 'crypto' {
|
|
|
2113
2155
|
* Instances of the `ECDH` class can be created using the {@link createECDH} function.
|
|
2114
2156
|
*
|
|
2115
2157
|
* ```js
|
|
2116
|
-
* import assert from 'assert';
|
|
2158
|
+
* import assert from 'node:assert';
|
|
2117
2159
|
*
|
|
2118
2160
|
* const {
|
|
2119
|
-
* createECDH
|
|
2120
|
-
* } = await import('crypto');
|
|
2161
|
+
* createECDH,
|
|
2162
|
+
* } = await import('node:crypto');
|
|
2121
2163
|
*
|
|
2122
2164
|
* // Generate Alice's keys...
|
|
2123
2165
|
* const alice = createECDH('secp521r1');
|
|
@@ -2158,8 +2200,8 @@ declare module 'crypto' {
|
|
|
2158
2200
|
* ```js
|
|
2159
2201
|
* const {
|
|
2160
2202
|
* createECDH,
|
|
2161
|
-
* ECDH
|
|
2162
|
-
* } = await import('crypto');
|
|
2203
|
+
* ECDH,
|
|
2204
|
+
* } = await import('node:crypto');
|
|
2163
2205
|
*
|
|
2164
2206
|
* const ecdh = createECDH('secp256k1');
|
|
2165
2207
|
* ecdh.generateKeys();
|
|
@@ -2241,7 +2283,7 @@ declare module 'crypto' {
|
|
|
2241
2283
|
* @param [format='uncompressed']
|
|
2242
2284
|
* @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
|
|
2243
2285
|
*/
|
|
2244
|
-
getPublicKey(): Buffer;
|
|
2286
|
+
getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer;
|
|
2245
2287
|
getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
|
|
2246
2288
|
/**
|
|
2247
2289
|
* Sets the EC Diffie-Hellman private key.
|
|
@@ -2266,28 +2308,33 @@ declare module 'crypto' {
|
|
|
2266
2308
|
*/
|
|
2267
2309
|
function createECDH(curveName: string): ECDH;
|
|
2268
2310
|
/**
|
|
2269
|
-
* This function
|
|
2270
|
-
*
|
|
2311
|
+
* This function compares the underlying bytes that represent the given`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time
|
|
2312
|
+
* algorithm.
|
|
2313
|
+
*
|
|
2314
|
+
* This function does not leak timing information that
|
|
2271
2315
|
* would allow an attacker to guess one of the values. This is suitable for
|
|
2272
2316
|
* comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
|
|
2273
2317
|
*
|
|
2274
2318
|
* `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
|
|
2275
|
-
* must have the same byte length.
|
|
2319
|
+
* must have the same byte length. An error is thrown if `a` and `b` have
|
|
2320
|
+
* different byte lengths.
|
|
2276
2321
|
*
|
|
2277
2322
|
* If at least one of `a` and `b` is a `TypedArray` with more than one byte per
|
|
2278
2323
|
* entry, such as `Uint16Array`, the result will be computed using the platform
|
|
2279
2324
|
* byte order.
|
|
2280
2325
|
*
|
|
2326
|
+
* **When both of the inputs are `Float32Array`s or`Float64Array`s, this function might return unexpected results due to IEEE 754**
|
|
2327
|
+
* **encoding of floating-point numbers. In particular, neither `x === y` nor`Object.is(x, y)` implies that the byte representations of two floating-point**
|
|
2328
|
+
* **numbers `x` and `y` are equal.**
|
|
2329
|
+
*
|
|
2281
2330
|
* Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code
|
|
2282
2331
|
* is timing-safe. Care should be taken to ensure that the surrounding code does
|
|
2283
2332
|
* not introduce timing vulnerabilities.
|
|
2284
2333
|
* @since v6.6.0
|
|
2285
2334
|
*/
|
|
2286
2335
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2287
|
-
/** @deprecated since v10.0.0 */
|
|
2288
|
-
const DEFAULT_ENCODING: BufferEncoding;
|
|
2289
2336
|
type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
|
|
2290
|
-
type KeyFormat = 'pem' | 'der';
|
|
2337
|
+
type KeyFormat = 'pem' | 'der' | 'jwk';
|
|
2291
2338
|
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2292
2339
|
format: T;
|
|
2293
2340
|
cipher?: string | undefined;
|
|
@@ -2483,8 +2530,8 @@ declare module 'crypto' {
|
|
|
2483
2530
|
*
|
|
2484
2531
|
* ```js
|
|
2485
2532
|
* const {
|
|
2486
|
-
* generateKeyPairSync
|
|
2487
|
-
* } = await import('crypto');
|
|
2533
|
+
* generateKeyPairSync,
|
|
2534
|
+
* } = await import('node:crypto');
|
|
2488
2535
|
*
|
|
2489
2536
|
* const {
|
|
2490
2537
|
* publicKey,
|
|
@@ -2493,14 +2540,14 @@ declare module 'crypto' {
|
|
|
2493
2540
|
* modulusLength: 4096,
|
|
2494
2541
|
* publicKeyEncoding: {
|
|
2495
2542
|
* type: 'spki',
|
|
2496
|
-
* format: 'pem'
|
|
2543
|
+
* format: 'pem',
|
|
2497
2544
|
* },
|
|
2498
2545
|
* privateKeyEncoding: {
|
|
2499
2546
|
* type: 'pkcs8',
|
|
2500
2547
|
* format: 'pem',
|
|
2501
2548
|
* cipher: 'aes-256-cbc',
|
|
2502
|
-
* passphrase: 'top secret'
|
|
2503
|
-
* }
|
|
2549
|
+
* passphrase: 'top secret',
|
|
2550
|
+
* },
|
|
2504
2551
|
* });
|
|
2505
2552
|
* ```
|
|
2506
2553
|
*
|
|
@@ -2562,21 +2609,21 @@ declare module 'crypto' {
|
|
|
2562
2609
|
*
|
|
2563
2610
|
* ```js
|
|
2564
2611
|
* const {
|
|
2565
|
-
* generateKeyPair
|
|
2566
|
-
* } = await import('crypto');
|
|
2612
|
+
* generateKeyPair,
|
|
2613
|
+
* } = await import('node:crypto');
|
|
2567
2614
|
*
|
|
2568
2615
|
* generateKeyPair('rsa', {
|
|
2569
2616
|
* modulusLength: 4096,
|
|
2570
2617
|
* publicKeyEncoding: {
|
|
2571
2618
|
* type: 'spki',
|
|
2572
|
-
* format: 'pem'
|
|
2619
|
+
* format: 'pem',
|
|
2573
2620
|
* },
|
|
2574
2621
|
* privateKeyEncoding: {
|
|
2575
2622
|
* type: 'pkcs8',
|
|
2576
2623
|
* format: 'pem',
|
|
2577
2624
|
* cipher: 'aes-256-cbc',
|
|
2578
|
-
* passphrase: 'top secret'
|
|
2579
|
-
* }
|
|
2625
|
+
* passphrase: 'top secret',
|
|
2626
|
+
* },
|
|
2580
2627
|
* }, (err, publicKey, privateKey) => {
|
|
2581
2628
|
* // Handle errors and use the generated key pair.
|
|
2582
2629
|
* });
|
|
@@ -2898,11 +2945,16 @@ declare module 'crypto' {
|
|
|
2898
2945
|
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2899
2946
|
* @since v12.0.0
|
|
2900
2947
|
*/
|
|
2901
|
-
function verify(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
|
|
2902
2948
|
function verify(
|
|
2903
2949
|
algorithm: string | null | undefined,
|
|
2904
2950
|
data: NodeJS.ArrayBufferView,
|
|
2905
|
-
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
|
|
2951
|
+
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
2952
|
+
signature: NodeJS.ArrayBufferView
|
|
2953
|
+
): boolean;
|
|
2954
|
+
function verify(
|
|
2955
|
+
algorithm: string | null | undefined,
|
|
2956
|
+
data: NodeJS.ArrayBufferView,
|
|
2957
|
+
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
2906
2958
|
signature: NodeJS.ArrayBufferView,
|
|
2907
2959
|
callback: (error: Error | null, result: boolean) => void
|
|
2908
2960
|
): void;
|
|
@@ -2972,10 +3024,10 @@ declare module 'crypto' {
|
|
|
2972
3024
|
* of the input arguments specify invalid values or types.
|
|
2973
3025
|
*
|
|
2974
3026
|
* ```js
|
|
2975
|
-
* import { Buffer } from 'buffer';
|
|
3027
|
+
* import { Buffer } from 'node:buffer';
|
|
2976
3028
|
* const {
|
|
2977
|
-
* hkdf
|
|
2978
|
-
* } = await import('crypto');
|
|
3029
|
+
* hkdf,
|
|
3030
|
+
* } = await import('node:crypto');
|
|
2979
3031
|
*
|
|
2980
3032
|
* hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => {
|
|
2981
3033
|
* if (err) throw err;
|
|
@@ -2984,7 +3036,7 @@ declare module 'crypto' {
|
|
|
2984
3036
|
* ```
|
|
2985
3037
|
* @since v15.0.0
|
|
2986
3038
|
* @param digest The digest algorithm to use.
|
|
2987
|
-
* @param ikm The input keying material.
|
|
3039
|
+
* @param ikm The input keying material. Must be provided but can be zero-length.
|
|
2988
3040
|
* @param salt The salt value. Must be provided but can be zero-length.
|
|
2989
3041
|
* @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
|
|
2990
3042
|
* @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`
|
|
@@ -3001,17 +3053,17 @@ declare module 'crypto' {
|
|
|
3001
3053
|
* types, or if the derived key cannot be generated.
|
|
3002
3054
|
*
|
|
3003
3055
|
* ```js
|
|
3004
|
-
* import { Buffer } from 'buffer';
|
|
3056
|
+
* import { Buffer } from 'node:buffer';
|
|
3005
3057
|
* const {
|
|
3006
|
-
* hkdfSync
|
|
3007
|
-
* } = await import('crypto');
|
|
3058
|
+
* hkdfSync,
|
|
3059
|
+
* } = await import('node:crypto');
|
|
3008
3060
|
*
|
|
3009
3061
|
* const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64);
|
|
3010
3062
|
* console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
|
|
3011
3063
|
* ```
|
|
3012
3064
|
* @since v15.0.0
|
|
3013
3065
|
* @param digest The digest algorithm to use.
|
|
3014
|
-
* @param ikm The input keying material.
|
|
3066
|
+
* @param ikm The input keying material. Must be provided but can be zero-length.
|
|
3015
3067
|
* @param salt The salt value. Must be provided but can be zero-length.
|
|
3016
3068
|
* @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
|
|
3017
3069
|
* @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
|
|
@@ -3051,40 +3103,41 @@ declare module 'crypto' {
|
|
|
3051
3103
|
*/
|
|
3052
3104
|
disableEntropyCache?: boolean | undefined;
|
|
3053
3105
|
}
|
|
3106
|
+
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
3054
3107
|
/**
|
|
3055
3108
|
* Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
|
|
3056
3109
|
* cryptographic pseudorandom number generator.
|
|
3057
3110
|
* @since v15.6.0, v14.17.0
|
|
3058
3111
|
*/
|
|
3059
|
-
function randomUUID(options?: RandomUUIDOptions):
|
|
3112
|
+
function randomUUID(options?: RandomUUIDOptions): UUID;
|
|
3060
3113
|
interface X509CheckOptions {
|
|
3061
3114
|
/**
|
|
3062
3115
|
* @default 'always'
|
|
3063
3116
|
*/
|
|
3064
|
-
subject
|
|
3117
|
+
subject?: 'always' | 'default' | 'never';
|
|
3065
3118
|
/**
|
|
3066
3119
|
* @default true
|
|
3067
3120
|
*/
|
|
3068
|
-
wildcards
|
|
3121
|
+
wildcards?: boolean;
|
|
3069
3122
|
/**
|
|
3070
3123
|
* @default true
|
|
3071
3124
|
*/
|
|
3072
|
-
partialWildcards
|
|
3125
|
+
partialWildcards?: boolean;
|
|
3073
3126
|
/**
|
|
3074
3127
|
* @default false
|
|
3075
3128
|
*/
|
|
3076
|
-
multiLabelWildcards
|
|
3129
|
+
multiLabelWildcards?: boolean;
|
|
3077
3130
|
/**
|
|
3078
3131
|
* @default false
|
|
3079
3132
|
*/
|
|
3080
|
-
singleLabelSubdomains
|
|
3133
|
+
singleLabelSubdomains?: boolean;
|
|
3081
3134
|
}
|
|
3082
3135
|
/**
|
|
3083
3136
|
* Encapsulates an X509 certificate and provides read-only access to
|
|
3084
3137
|
* its information.
|
|
3085
3138
|
*
|
|
3086
3139
|
* ```js
|
|
3087
|
-
* const { X509Certificate } = await import('crypto');
|
|
3140
|
+
* const { X509Certificate } = await import('node:crypto');
|
|
3088
3141
|
*
|
|
3089
3142
|
* const x509 = new X509Certificate('{... pem encoded cert ...}');
|
|
3090
3143
|
*
|
|
@@ -3094,12 +3147,16 @@ declare module 'crypto' {
|
|
|
3094
3147
|
*/
|
|
3095
3148
|
class X509Certificate {
|
|
3096
3149
|
/**
|
|
3097
|
-
* Will be \`true\` if this is a Certificate Authority (
|
|
3150
|
+
* Will be \`true\` if this is a Certificate Authority (CA) certificate.
|
|
3098
3151
|
* @since v15.6.0
|
|
3099
3152
|
*/
|
|
3100
3153
|
readonly ca: boolean;
|
|
3101
3154
|
/**
|
|
3102
3155
|
* The SHA-1 fingerprint of this certificate.
|
|
3156
|
+
*
|
|
3157
|
+
* Because SHA-1 is cryptographically broken and because the security of SHA-1 is
|
|
3158
|
+
* significantly worse than that of algorithms that are commonly used to sign
|
|
3159
|
+
* certificates, consider using `x509.fingerprint256` instead.
|
|
3103
3160
|
* @since v15.6.0
|
|
3104
3161
|
*/
|
|
3105
3162
|
readonly fingerprint: string;
|
|
@@ -3110,23 +3167,53 @@ declare module 'crypto' {
|
|
|
3110
3167
|
readonly fingerprint256: string;
|
|
3111
3168
|
/**
|
|
3112
3169
|
* The SHA-512 fingerprint of this certificate.
|
|
3113
|
-
*
|
|
3170
|
+
*
|
|
3171
|
+
* Because computing the SHA-256 fingerprint is usually faster and because it is
|
|
3172
|
+
* only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be
|
|
3173
|
+
* a better choice. While SHA-512 presumably provides a higher level of security in
|
|
3174
|
+
* general, the security of SHA-256 matches that of most algorithms that are
|
|
3175
|
+
* commonly used to sign certificates.
|
|
3176
|
+
* @since v17.2.0, v16.14.0
|
|
3114
3177
|
*/
|
|
3115
|
-
|
|
3178
|
+
readonly fingerprint512: string;
|
|
3116
3179
|
/**
|
|
3117
3180
|
* The complete subject of this certificate.
|
|
3118
3181
|
* @since v15.6.0
|
|
3119
3182
|
*/
|
|
3120
3183
|
readonly subject: string;
|
|
3121
3184
|
/**
|
|
3122
|
-
* The subject alternative name specified for this certificate
|
|
3123
|
-
*
|
|
3185
|
+
* The subject alternative name specified for this certificate.
|
|
3186
|
+
*
|
|
3187
|
+
* This is a comma-separated list of subject alternative names. Each entry begins
|
|
3188
|
+
* with a string identifying the kind of the subject alternative name followed by
|
|
3189
|
+
* a colon and the value associated with the entry.
|
|
3190
|
+
*
|
|
3191
|
+
* Earlier versions of Node.js incorrectly assumed that it is safe to split this
|
|
3192
|
+
* property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However,
|
|
3193
|
+
* both malicious and legitimate certificates can contain subject alternative names
|
|
3194
|
+
* that include this sequence when represented as a string.
|
|
3195
|
+
*
|
|
3196
|
+
* After the prefix denoting the type of the entry, the remainder of each entry
|
|
3197
|
+
* might be enclosed in quotes to indicate that the value is a JSON string literal.
|
|
3198
|
+
* For backward compatibility, Node.js only uses JSON string literals within this
|
|
3199
|
+
* property when necessary to avoid ambiguity. Third-party code should be prepared
|
|
3200
|
+
* to handle both possible entry formats.
|
|
3124
3201
|
* @since v15.6.0
|
|
3125
3202
|
*/
|
|
3126
3203
|
readonly subjectAltName: string | undefined;
|
|
3127
3204
|
/**
|
|
3128
|
-
*
|
|
3129
|
-
*
|
|
3205
|
+
* A textual representation of the certificate's authority information access
|
|
3206
|
+
* extension.
|
|
3207
|
+
*
|
|
3208
|
+
* This is a line feed separated list of access descriptions. Each line begins with
|
|
3209
|
+
* the access method and the kind of the access location, followed by a colon and
|
|
3210
|
+
* the value associated with the access location.
|
|
3211
|
+
*
|
|
3212
|
+
* After the prefix denoting the access method and the kind of the access location,
|
|
3213
|
+
* the remainder of each line might be enclosed in quotes to indicate that the
|
|
3214
|
+
* value is a JSON string literal. For backward compatibility, Node.js only uses
|
|
3215
|
+
* JSON string literals within this property when necessary to avoid ambiguity.
|
|
3216
|
+
* Third-party code should be prepared to handle both possible entry formats.
|
|
3130
3217
|
* @since v15.6.0
|
|
3131
3218
|
*/
|
|
3132
3219
|
readonly infoAccess: string | undefined;
|
|
@@ -3158,6 +3245,10 @@ declare module 'crypto' {
|
|
|
3158
3245
|
readonly raw: Buffer;
|
|
3159
3246
|
/**
|
|
3160
3247
|
* The serial number of this certificate.
|
|
3248
|
+
*
|
|
3249
|
+
* Serial numbers are assigned by certificate authorities and do not uniquely
|
|
3250
|
+
* identify certificates. Consider using `x509.fingerprint256` as a unique
|
|
3251
|
+
* identifier instead.
|
|
3161
3252
|
* @since v15.6.0
|
|
3162
3253
|
*/
|
|
3163
3254
|
readonly serialNumber: string;
|
|
@@ -3174,18 +3265,50 @@ declare module 'crypto' {
|
|
|
3174
3265
|
constructor(buffer: BinaryLike);
|
|
3175
3266
|
/**
|
|
3176
3267
|
* Checks whether the certificate matches the given email address.
|
|
3268
|
+
*
|
|
3269
|
+
* If the `'subject'` option is undefined or set to `'default'`, the certificate
|
|
3270
|
+
* subject is only considered if the subject alternative name extension either does
|
|
3271
|
+
* not exist or does not contain any email addresses.
|
|
3272
|
+
*
|
|
3273
|
+
* If the `'subject'` option is set to `'always'` and if the subject alternative
|
|
3274
|
+
* name extension either does not exist or does not contain a matching email
|
|
3275
|
+
* address, the certificate subject is considered.
|
|
3276
|
+
*
|
|
3277
|
+
* If the `'subject'` option is set to `'never'`, the certificate subject is never
|
|
3278
|
+
* considered, even if the certificate contains no subject alternative names.
|
|
3177
3279
|
* @since v15.6.0
|
|
3178
3280
|
* @return Returns `email` if the certificate matches, `undefined` if it does not.
|
|
3179
3281
|
*/
|
|
3180
3282
|
checkEmail(email: string, options?: Pick<X509CheckOptions, 'subject'>): string | undefined;
|
|
3181
3283
|
/**
|
|
3182
3284
|
* Checks whether the certificate matches the given host name.
|
|
3285
|
+
*
|
|
3286
|
+
* If the certificate matches the given host name, the matching subject name is
|
|
3287
|
+
* returned. The returned name might be an exact match (e.g., `foo.example.com`)
|
|
3288
|
+
* or it might contain wildcards (e.g., `*.example.com`). Because host name
|
|
3289
|
+
* comparisons are case-insensitive, the returned subject name might also differ
|
|
3290
|
+
* from the given `name` in capitalization.
|
|
3291
|
+
*
|
|
3292
|
+
* If the `'subject'` option is undefined or set to `'default'`, the certificate
|
|
3293
|
+
* subject is only considered if the subject alternative name extension either does
|
|
3294
|
+
* not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS").
|
|
3295
|
+
*
|
|
3296
|
+
* If the `'subject'` option is set to `'always'` and if the subject alternative
|
|
3297
|
+
* name extension either does not exist or does not contain a matching DNS name,
|
|
3298
|
+
* the certificate subject is considered.
|
|
3299
|
+
*
|
|
3300
|
+
* If the `'subject'` option is set to `'never'`, the certificate subject is never
|
|
3301
|
+
* considered, even if the certificate contains no subject alternative names.
|
|
3183
3302
|
* @since v15.6.0
|
|
3184
|
-
* @return Returns
|
|
3303
|
+
* @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`.
|
|
3185
3304
|
*/
|
|
3186
3305
|
checkHost(name: string, options?: X509CheckOptions): string | undefined;
|
|
3187
3306
|
/**
|
|
3188
3307
|
* Checks whether the certificate matches the given IP address (IPv4 or IPv6).
|
|
3308
|
+
*
|
|
3309
|
+
* Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they
|
|
3310
|
+
* must match the given `ip` address exactly. Other subject alternative names as
|
|
3311
|
+
* well as the subject field of the certificate are ignored.
|
|
3189
3312
|
* @since v15.6.0
|
|
3190
3313
|
* @return Returns `ip` if the certificate matches, `undefined` if it does not.
|
|
3191
3314
|
*/
|
|
@@ -3307,7 +3430,7 @@ declare module 'crypto' {
|
|
|
3307
3430
|
interface CheckPrimeOptions {
|
|
3308
3431
|
/**
|
|
3309
3432
|
* The number of Miller-Rabin probabilistic primality iterations to perform.
|
|
3310
|
-
* When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most 2
|
|
3433
|
+
* 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.
|
|
3311
3434
|
* Care must be used when selecting a number of checks.
|
|
3312
3435
|
* Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details.
|
|
3313
3436
|
*
|
|
@@ -3329,8 +3452,517 @@ declare module 'crypto' {
|
|
|
3329
3452
|
* @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`.
|
|
3330
3453
|
*/
|
|
3331
3454
|
function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean;
|
|
3455
|
+
/**
|
|
3456
|
+
* Load and set the `engine` for some or all OpenSSL functions (selected by flags).
|
|
3457
|
+
*
|
|
3458
|
+
* `engine` could be either an id or a path to the engine's shared library.
|
|
3459
|
+
*
|
|
3460
|
+
* The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags`is a bit field taking one of or a mix of the following flags (defined in`crypto.constants`):
|
|
3461
|
+
*
|
|
3462
|
+
* * `crypto.constants.ENGINE_METHOD_RSA`
|
|
3463
|
+
* * `crypto.constants.ENGINE_METHOD_DSA`
|
|
3464
|
+
* * `crypto.constants.ENGINE_METHOD_DH`
|
|
3465
|
+
* * `crypto.constants.ENGINE_METHOD_RAND`
|
|
3466
|
+
* * `crypto.constants.ENGINE_METHOD_EC`
|
|
3467
|
+
* * `crypto.constants.ENGINE_METHOD_CIPHERS`
|
|
3468
|
+
* * `crypto.constants.ENGINE_METHOD_DIGESTS`
|
|
3469
|
+
* * `crypto.constants.ENGINE_METHOD_PKEY_METHS`
|
|
3470
|
+
* * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS`
|
|
3471
|
+
* * `crypto.constants.ENGINE_METHOD_ALL`
|
|
3472
|
+
* * `crypto.constants.ENGINE_METHOD_NONE`
|
|
3473
|
+
* @since v0.11.11
|
|
3474
|
+
* @param flags
|
|
3475
|
+
*/
|
|
3476
|
+
function setEngine(engine: string, flags?: number): void;
|
|
3477
|
+
/**
|
|
3478
|
+
* A convenient alias for {@link webcrypto.getRandomValues}. This
|
|
3479
|
+
* implementation is not compliant with the Web Crypto spec, to write
|
|
3480
|
+
* web-compatible code use {@link webcrypto.getRandomValues} instead.
|
|
3481
|
+
* @since v17.4.0
|
|
3482
|
+
* @return Returns `typedArray`.
|
|
3483
|
+
*/
|
|
3484
|
+
function getRandomValues<T extends webcrypto.BufferSource>(typedArray: T): T;
|
|
3485
|
+
/**
|
|
3486
|
+
* A convenient alias for `crypto.webcrypto.subtle`.
|
|
3487
|
+
* @since v17.4.0
|
|
3488
|
+
*/
|
|
3489
|
+
const subtle: webcrypto.SubtleCrypto;
|
|
3490
|
+
/**
|
|
3491
|
+
* An implementation of the Web Crypto API standard.
|
|
3492
|
+
*
|
|
3493
|
+
* See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details.
|
|
3494
|
+
* @since v15.0.0
|
|
3495
|
+
*/
|
|
3496
|
+
const webcrypto: webcrypto.Crypto;
|
|
3332
3497
|
namespace webcrypto {
|
|
3333
|
-
|
|
3498
|
+
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
3499
|
+
type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki';
|
|
3500
|
+
type KeyType = 'private' | 'public' | 'secret';
|
|
3501
|
+
type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey';
|
|
3502
|
+
type AlgorithmIdentifier = Algorithm | string;
|
|
3503
|
+
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
3504
|
+
type NamedCurve = string;
|
|
3505
|
+
type BigInteger = Uint8Array;
|
|
3506
|
+
interface AesCbcParams extends Algorithm {
|
|
3507
|
+
iv: BufferSource;
|
|
3508
|
+
}
|
|
3509
|
+
interface AesCtrParams extends Algorithm {
|
|
3510
|
+
counter: BufferSource;
|
|
3511
|
+
length: number;
|
|
3512
|
+
}
|
|
3513
|
+
interface AesDerivedKeyParams extends Algorithm {
|
|
3514
|
+
length: number;
|
|
3515
|
+
}
|
|
3516
|
+
interface AesGcmParams extends Algorithm {
|
|
3517
|
+
additionalData?: BufferSource;
|
|
3518
|
+
iv: BufferSource;
|
|
3519
|
+
tagLength?: number;
|
|
3520
|
+
}
|
|
3521
|
+
interface AesKeyAlgorithm extends KeyAlgorithm {
|
|
3522
|
+
length: number;
|
|
3523
|
+
}
|
|
3524
|
+
interface AesKeyGenParams extends Algorithm {
|
|
3525
|
+
length: number;
|
|
3526
|
+
}
|
|
3527
|
+
interface Algorithm {
|
|
3528
|
+
name: string;
|
|
3529
|
+
}
|
|
3530
|
+
interface EcKeyAlgorithm extends KeyAlgorithm {
|
|
3531
|
+
namedCurve: NamedCurve;
|
|
3532
|
+
}
|
|
3533
|
+
interface EcKeyGenParams extends Algorithm {
|
|
3534
|
+
namedCurve: NamedCurve;
|
|
3535
|
+
}
|
|
3536
|
+
interface EcKeyImportParams extends Algorithm {
|
|
3537
|
+
namedCurve: NamedCurve;
|
|
3538
|
+
}
|
|
3539
|
+
interface EcdhKeyDeriveParams extends Algorithm {
|
|
3540
|
+
public: CryptoKey;
|
|
3541
|
+
}
|
|
3542
|
+
interface EcdsaParams extends Algorithm {
|
|
3543
|
+
hash: HashAlgorithmIdentifier;
|
|
3544
|
+
}
|
|
3545
|
+
interface Ed448Params extends Algorithm {
|
|
3546
|
+
context?: BufferSource;
|
|
3547
|
+
}
|
|
3548
|
+
interface HkdfParams extends Algorithm {
|
|
3549
|
+
hash: HashAlgorithmIdentifier;
|
|
3550
|
+
info: BufferSource;
|
|
3551
|
+
salt: BufferSource;
|
|
3552
|
+
}
|
|
3553
|
+
interface HmacImportParams extends Algorithm {
|
|
3554
|
+
hash: HashAlgorithmIdentifier;
|
|
3555
|
+
length?: number;
|
|
3556
|
+
}
|
|
3557
|
+
interface HmacKeyAlgorithm extends KeyAlgorithm {
|
|
3558
|
+
hash: KeyAlgorithm;
|
|
3559
|
+
length: number;
|
|
3560
|
+
}
|
|
3561
|
+
interface HmacKeyGenParams extends Algorithm {
|
|
3562
|
+
hash: HashAlgorithmIdentifier;
|
|
3563
|
+
length?: number;
|
|
3564
|
+
}
|
|
3565
|
+
interface JsonWebKey {
|
|
3566
|
+
alg?: string;
|
|
3567
|
+
crv?: string;
|
|
3568
|
+
d?: string;
|
|
3569
|
+
dp?: string;
|
|
3570
|
+
dq?: string;
|
|
3571
|
+
e?: string;
|
|
3572
|
+
ext?: boolean;
|
|
3573
|
+
k?: string;
|
|
3574
|
+
key_ops?: string[];
|
|
3575
|
+
kty?: string;
|
|
3576
|
+
n?: string;
|
|
3577
|
+
oth?: RsaOtherPrimesInfo[];
|
|
3578
|
+
p?: string;
|
|
3579
|
+
q?: string;
|
|
3580
|
+
qi?: string;
|
|
3581
|
+
use?: string;
|
|
3582
|
+
x?: string;
|
|
3583
|
+
y?: string;
|
|
3584
|
+
}
|
|
3585
|
+
interface KeyAlgorithm {
|
|
3586
|
+
name: string;
|
|
3587
|
+
}
|
|
3588
|
+
interface Pbkdf2Params extends Algorithm {
|
|
3589
|
+
hash: HashAlgorithmIdentifier;
|
|
3590
|
+
iterations: number;
|
|
3591
|
+
salt: BufferSource;
|
|
3592
|
+
}
|
|
3593
|
+
interface RsaHashedImportParams extends Algorithm {
|
|
3594
|
+
hash: HashAlgorithmIdentifier;
|
|
3595
|
+
}
|
|
3596
|
+
interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
|
|
3597
|
+
hash: KeyAlgorithm;
|
|
3598
|
+
}
|
|
3599
|
+
interface RsaHashedKeyGenParams extends RsaKeyGenParams {
|
|
3600
|
+
hash: HashAlgorithmIdentifier;
|
|
3601
|
+
}
|
|
3602
|
+
interface RsaKeyAlgorithm extends KeyAlgorithm {
|
|
3603
|
+
modulusLength: number;
|
|
3604
|
+
publicExponent: BigInteger;
|
|
3605
|
+
}
|
|
3606
|
+
interface RsaKeyGenParams extends Algorithm {
|
|
3607
|
+
modulusLength: number;
|
|
3608
|
+
publicExponent: BigInteger;
|
|
3609
|
+
}
|
|
3610
|
+
interface RsaOaepParams extends Algorithm {
|
|
3611
|
+
label?: BufferSource;
|
|
3612
|
+
}
|
|
3613
|
+
interface RsaOtherPrimesInfo {
|
|
3614
|
+
d?: string;
|
|
3615
|
+
r?: string;
|
|
3616
|
+
t?: string;
|
|
3617
|
+
}
|
|
3618
|
+
interface RsaPssParams extends Algorithm {
|
|
3619
|
+
saltLength: number;
|
|
3620
|
+
}
|
|
3621
|
+
/**
|
|
3622
|
+
* Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class.
|
|
3623
|
+
* `Crypto` is a singleton that provides access to the remainder of the crypto API.
|
|
3624
|
+
* @since v15.0.0
|
|
3625
|
+
*/
|
|
3626
|
+
interface Crypto {
|
|
3627
|
+
/**
|
|
3628
|
+
* Provides access to the `SubtleCrypto` API.
|
|
3629
|
+
* @since v15.0.0
|
|
3630
|
+
*/
|
|
3631
|
+
readonly subtle: SubtleCrypto;
|
|
3632
|
+
/**
|
|
3633
|
+
* Generates cryptographically strong random values.
|
|
3634
|
+
* The given `typedArray` is filled with random values, and a reference to `typedArray` is returned.
|
|
3635
|
+
*
|
|
3636
|
+
* The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted.
|
|
3637
|
+
*
|
|
3638
|
+
* An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
|
|
3639
|
+
* @since v15.0.0
|
|
3640
|
+
*/
|
|
3641
|
+
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(typedArray: T): T;
|
|
3642
|
+
/**
|
|
3643
|
+
* Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
|
|
3644
|
+
* The UUID is generated using a cryptographic pseudorandom number generator.
|
|
3645
|
+
* @since v16.7.0
|
|
3646
|
+
*/
|
|
3647
|
+
randomUUID(): UUID;
|
|
3648
|
+
CryptoKey: CryptoKeyConstructor;
|
|
3649
|
+
}
|
|
3650
|
+
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
|
|
3651
|
+
interface CryptoKeyConstructor {
|
|
3652
|
+
/** Illegal constructor */
|
|
3653
|
+
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
3654
|
+
readonly length: 0;
|
|
3655
|
+
readonly name: 'CryptoKey';
|
|
3656
|
+
readonly prototype: CryptoKey;
|
|
3657
|
+
}
|
|
3658
|
+
/**
|
|
3659
|
+
* @since v15.0.0
|
|
3660
|
+
*/
|
|
3661
|
+
interface CryptoKey {
|
|
3662
|
+
/**
|
|
3663
|
+
* An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters.
|
|
3664
|
+
* @since v15.0.0
|
|
3665
|
+
*/
|
|
3666
|
+
readonly algorithm: KeyAlgorithm;
|
|
3667
|
+
/**
|
|
3668
|
+
* When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`.
|
|
3669
|
+
* @since v15.0.0
|
|
3670
|
+
*/
|
|
3671
|
+
readonly extractable: boolean;
|
|
3672
|
+
/**
|
|
3673
|
+
* A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key.
|
|
3674
|
+
* @since v15.0.0
|
|
3675
|
+
*/
|
|
3676
|
+
readonly type: KeyType;
|
|
3677
|
+
/**
|
|
3678
|
+
* An array of strings identifying the operations for which the key may be used.
|
|
3679
|
+
*
|
|
3680
|
+
* The possible usages are:
|
|
3681
|
+
* - `'encrypt'` - The key may be used to encrypt data.
|
|
3682
|
+
* - `'decrypt'` - The key may be used to decrypt data.
|
|
3683
|
+
* - `'sign'` - The key may be used to generate digital signatures.
|
|
3684
|
+
* - `'verify'` - The key may be used to verify digital signatures.
|
|
3685
|
+
* - `'deriveKey'` - The key may be used to derive a new key.
|
|
3686
|
+
* - `'deriveBits'` - The key may be used to derive bits.
|
|
3687
|
+
* - `'wrapKey'` - The key may be used to wrap another key.
|
|
3688
|
+
* - `'unwrapKey'` - The key may be used to unwrap another key.
|
|
3689
|
+
*
|
|
3690
|
+
* Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`).
|
|
3691
|
+
* @since v15.0.0
|
|
3692
|
+
*/
|
|
3693
|
+
readonly usages: KeyUsage[];
|
|
3694
|
+
}
|
|
3695
|
+
/**
|
|
3696
|
+
* The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair.
|
|
3697
|
+
* @since v15.0.0
|
|
3698
|
+
*/
|
|
3699
|
+
interface CryptoKeyPair {
|
|
3700
|
+
/**
|
|
3701
|
+
* A {@link CryptoKey} whose type will be `'private'`.
|
|
3702
|
+
* @since v15.0.0
|
|
3703
|
+
*/
|
|
3704
|
+
privateKey: CryptoKey;
|
|
3705
|
+
/**
|
|
3706
|
+
* A {@link CryptoKey} whose type will be `'public'`.
|
|
3707
|
+
* @since v15.0.0
|
|
3708
|
+
*/
|
|
3709
|
+
publicKey: CryptoKey;
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* @since v15.0.0
|
|
3713
|
+
*/
|
|
3714
|
+
interface SubtleCrypto {
|
|
3715
|
+
/**
|
|
3716
|
+
* Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
|
|
3717
|
+
* `subtle.decrypt()` attempts to decipher the provided `data`. If successful,
|
|
3718
|
+
* the returned promise will be resolved with an `<ArrayBuffer>` containing the plaintext result.
|
|
3719
|
+
*
|
|
3720
|
+
* The algorithms currently supported include:
|
|
3721
|
+
*
|
|
3722
|
+
* - `'RSA-OAEP'`
|
|
3723
|
+
* - `'AES-CTR'`
|
|
3724
|
+
* - `'AES-CBC'`
|
|
3725
|
+
* - `'AES-GCM'`
|
|
3726
|
+
* @since v15.0.0
|
|
3727
|
+
*/
|
|
3728
|
+
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3729
|
+
/**
|
|
3730
|
+
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
3731
|
+
* `subtle.deriveBits()` attempts to generate `length` bits.
|
|
3732
|
+
* The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
|
|
3733
|
+
* When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
|
|
3734
|
+
* for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
|
|
3735
|
+
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
|
|
3736
|
+
*
|
|
3737
|
+
* The algorithms currently supported include:
|
|
3738
|
+
*
|
|
3739
|
+
* - `'ECDH'`
|
|
3740
|
+
* - `'X25519'`
|
|
3741
|
+
* - `'X448'`
|
|
3742
|
+
* - `'HKDF'`
|
|
3743
|
+
* - `'PBKDF2'`
|
|
3744
|
+
* @since v15.0.0
|
|
3745
|
+
*/
|
|
3746
|
+
deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
|
|
3747
|
+
deriveBits(algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
|
|
3748
|
+
/**
|
|
3749
|
+
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
3750
|
+
* `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
3751
|
+
*
|
|
3752
|
+
* Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
|
|
3753
|
+
* then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
|
|
3754
|
+
*
|
|
3755
|
+
* The algorithms currently supported include:
|
|
3756
|
+
*
|
|
3757
|
+
* - `'ECDH'`
|
|
3758
|
+
* - `'X25519'`
|
|
3759
|
+
* - `'X448'`
|
|
3760
|
+
* - `'HKDF'`
|
|
3761
|
+
* - `'PBKDF2'`
|
|
3762
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3763
|
+
* @since v15.0.0
|
|
3764
|
+
*/
|
|
3765
|
+
deriveKey(
|
|
3766
|
+
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
3767
|
+
baseKey: CryptoKey,
|
|
3768
|
+
derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params,
|
|
3769
|
+
extractable: boolean,
|
|
3770
|
+
keyUsages: ReadonlyArray<KeyUsage>
|
|
3771
|
+
): Promise<CryptoKey>;
|
|
3772
|
+
/**
|
|
3773
|
+
* Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
|
|
3774
|
+
* If successful, the returned promise is resolved with an `<ArrayBuffer>` containing the computed digest.
|
|
3775
|
+
*
|
|
3776
|
+
* If `algorithm` is provided as a `<string>`, it must be one of:
|
|
3777
|
+
*
|
|
3778
|
+
* - `'SHA-1'`
|
|
3779
|
+
* - `'SHA-256'`
|
|
3780
|
+
* - `'SHA-384'`
|
|
3781
|
+
* - `'SHA-512'`
|
|
3782
|
+
*
|
|
3783
|
+
* If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
|
|
3784
|
+
* @since v15.0.0
|
|
3785
|
+
*/
|
|
3786
|
+
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
3787
|
+
/**
|
|
3788
|
+
* Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
|
|
3789
|
+
* `subtle.encrypt()` attempts to encipher `data`. If successful,
|
|
3790
|
+
* the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
|
|
3791
|
+
*
|
|
3792
|
+
* The algorithms currently supported include:
|
|
3793
|
+
*
|
|
3794
|
+
* - `'RSA-OAEP'`
|
|
3795
|
+
* - `'AES-CTR'`
|
|
3796
|
+
* - `'AES-CBC'`
|
|
3797
|
+
* - `'AES-GCM'`
|
|
3798
|
+
* @since v15.0.0
|
|
3799
|
+
*/
|
|
3800
|
+
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3801
|
+
/**
|
|
3802
|
+
* Exports the given key into the specified format, if supported.
|
|
3803
|
+
*
|
|
3804
|
+
* If the `<CryptoKey>` is not extractable, the returned promise will reject.
|
|
3805
|
+
*
|
|
3806
|
+
* When `format` is either `'pkcs8'` or `'spki'` and the export is successful,
|
|
3807
|
+
* the returned promise will be resolved with an `<ArrayBuffer>` containing the exported key data.
|
|
3808
|
+
*
|
|
3809
|
+
* When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
|
|
3810
|
+
* JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
|
|
3811
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3812
|
+
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
3813
|
+
* @since v15.0.0
|
|
3814
|
+
*/
|
|
3815
|
+
exportKey(format: 'jwk', key: CryptoKey): Promise<JsonWebKey>;
|
|
3816
|
+
exportKey(format: Exclude<KeyFormat, 'jwk'>, key: CryptoKey): Promise<ArrayBuffer>;
|
|
3817
|
+
/**
|
|
3818
|
+
* Using the method and parameters provided in `algorithm`,
|
|
3819
|
+
* `subtle.generateKey()` attempts to generate new keying material.
|
|
3820
|
+
* Depending the method used, the method may generate either a single `<CryptoKey>` or a `<CryptoKeyPair>`.
|
|
3821
|
+
*
|
|
3822
|
+
* The `<CryptoKeyPair>` (public and private key) generating algorithms supported include:
|
|
3823
|
+
*
|
|
3824
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3825
|
+
* - `'RSA-PSS'`
|
|
3826
|
+
* - `'RSA-OAEP'`
|
|
3827
|
+
* - `'ECDSA'`
|
|
3828
|
+
* - `'Ed25519'`
|
|
3829
|
+
* - `'Ed448'`
|
|
3830
|
+
* - `'ECDH'`
|
|
3831
|
+
* - `'X25519'`
|
|
3832
|
+
* - `'X448'`
|
|
3833
|
+
* The `<CryptoKey>` (secret key) generating algorithms supported include:
|
|
3834
|
+
*
|
|
3835
|
+
* - `'HMAC'`
|
|
3836
|
+
* - `'AES-CTR'`
|
|
3837
|
+
* - `'AES-CBC'`
|
|
3838
|
+
* - `'AES-GCM'`
|
|
3839
|
+
* - `'AES-KW'`
|
|
3840
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3841
|
+
* @since v15.0.0
|
|
3842
|
+
*/
|
|
3843
|
+
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
|
|
3844
|
+
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
|
|
3845
|
+
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
|
|
3846
|
+
/**
|
|
3847
|
+
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
3848
|
+
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
3849
|
+
* If the import is successful, the returned promise will be resolved with the created `<CryptoKey>`.
|
|
3850
|
+
*
|
|
3851
|
+
* If importing a `'PBKDF2'` key, `extractable` must be `false`.
|
|
3852
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3853
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3854
|
+
* @since v15.0.0
|
|
3855
|
+
*/
|
|
3856
|
+
importKey(
|
|
3857
|
+
format: 'jwk',
|
|
3858
|
+
keyData: JsonWebKey,
|
|
3859
|
+
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
|
3860
|
+
extractable: boolean,
|
|
3861
|
+
keyUsages: ReadonlyArray<KeyUsage>
|
|
3862
|
+
): Promise<CryptoKey>;
|
|
3863
|
+
importKey(
|
|
3864
|
+
format: Exclude<KeyFormat, 'jwk'>,
|
|
3865
|
+
keyData: BufferSource,
|
|
3866
|
+
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
|
3867
|
+
extractable: boolean,
|
|
3868
|
+
keyUsages: KeyUsage[]
|
|
3869
|
+
): Promise<CryptoKey>;
|
|
3870
|
+
/**
|
|
3871
|
+
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
3872
|
+
* `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful,
|
|
3873
|
+
* the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
|
|
3874
|
+
*
|
|
3875
|
+
* The algorithms currently supported include:
|
|
3876
|
+
*
|
|
3877
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3878
|
+
* - `'RSA-PSS'`
|
|
3879
|
+
* - `'ECDSA'`
|
|
3880
|
+
* - `'Ed25519'`
|
|
3881
|
+
* - `'Ed448'`
|
|
3882
|
+
* - `'HMAC'`
|
|
3883
|
+
* @since v15.0.0
|
|
3884
|
+
*/
|
|
3885
|
+
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3886
|
+
/**
|
|
3887
|
+
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3888
|
+
* The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
3889
|
+
* It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
|
|
3890
|
+
* then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
|
|
3891
|
+
* If successful, the returned promise is resolved with a `<CryptoKey>` object.
|
|
3892
|
+
*
|
|
3893
|
+
* The wrapping algorithms currently supported include:
|
|
3894
|
+
*
|
|
3895
|
+
* - `'RSA-OAEP'`
|
|
3896
|
+
* - `'AES-CTR'`
|
|
3897
|
+
* - `'AES-CBC'`
|
|
3898
|
+
* - `'AES-GCM'`
|
|
3899
|
+
* - `'AES-KW'`
|
|
3900
|
+
*
|
|
3901
|
+
* The unwrapped key algorithms supported include:
|
|
3902
|
+
*
|
|
3903
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3904
|
+
* - `'RSA-PSS'`
|
|
3905
|
+
* - `'RSA-OAEP'`
|
|
3906
|
+
* - `'ECDSA'`
|
|
3907
|
+
* - `'Ed25519'`
|
|
3908
|
+
* - `'Ed448'`
|
|
3909
|
+
* - `'ECDH'`
|
|
3910
|
+
* - `'X25519'`
|
|
3911
|
+
* - `'X448'`
|
|
3912
|
+
* - `'HMAC'`
|
|
3913
|
+
* - `'AES-CTR'`
|
|
3914
|
+
* - `'AES-CBC'`
|
|
3915
|
+
* - `'AES-GCM'`
|
|
3916
|
+
* - `'AES-KW'`
|
|
3917
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3918
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3919
|
+
* @since v15.0.0
|
|
3920
|
+
*/
|
|
3921
|
+
unwrapKey(
|
|
3922
|
+
format: KeyFormat,
|
|
3923
|
+
wrappedKey: BufferSource,
|
|
3924
|
+
unwrappingKey: CryptoKey,
|
|
3925
|
+
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
3926
|
+
unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
|
3927
|
+
extractable: boolean,
|
|
3928
|
+
keyUsages: KeyUsage[]
|
|
3929
|
+
): Promise<CryptoKey>;
|
|
3930
|
+
/**
|
|
3931
|
+
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
3932
|
+
* `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`.
|
|
3933
|
+
* The returned promise is resolved with either `true` or `false`.
|
|
3934
|
+
*
|
|
3935
|
+
* The algorithms currently supported include:
|
|
3936
|
+
*
|
|
3937
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3938
|
+
* - `'RSA-PSS'`
|
|
3939
|
+
* - `'ECDSA'`
|
|
3940
|
+
* - `'Ed25519'`
|
|
3941
|
+
* - `'Ed448'`
|
|
3942
|
+
* - `'HMAC'`
|
|
3943
|
+
* @since v15.0.0
|
|
3944
|
+
*/
|
|
3945
|
+
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
|
|
3946
|
+
/**
|
|
3947
|
+
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3948
|
+
* The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
|
|
3949
|
+
* then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
|
|
3950
|
+
* It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
|
|
3951
|
+
* then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
|
|
3952
|
+
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the encrypted key data.
|
|
3953
|
+
*
|
|
3954
|
+
* The wrapping algorithms currently supported include:
|
|
3955
|
+
*
|
|
3956
|
+
* - `'RSA-OAEP'`
|
|
3957
|
+
* - `'AES-CTR'`
|
|
3958
|
+
* - `'AES-CBC'`
|
|
3959
|
+
* - `'AES-GCM'`
|
|
3960
|
+
* - `'AES-KW'`
|
|
3961
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3962
|
+
* @since v15.0.0
|
|
3963
|
+
*/
|
|
3964
|
+
wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
|
|
3965
|
+
}
|
|
3334
3966
|
}
|
|
3335
3967
|
}
|
|
3336
3968
|
declare module 'node:crypto' {
|