@contrast/agent-bundle 5.45.1 → 5.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/node_modules/@contrast/agent/README.md +1 -1
- package/node_modules/@contrast/agent/package.json +12 -12
- package/node_modules/@contrast/agentify/package.json +15 -15
- package/node_modules/@contrast/architecture-components/package.json +5 -5
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/common.js +1 -1
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/handlers.js +24 -11
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/index.js +6 -4
- package/node_modules/@contrast/assess/lib/configuration-analysis/install/apollo-server.js +92 -0
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/express-session.js +2 -2
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/fastify-cookie.js +2 -2
- package/node_modules/@contrast/assess/lib/configuration-analysis/install/graphql-yoga.js +90 -0
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/hapi.js +2 -2
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/koa.js +3 -3
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/string/substring.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/handler.js +30 -26
- package/node_modules/@contrast/assess/lib/dataflow/sources/index.js +2 -0
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/fastify-websocket.js +63 -0
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +42 -38
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/index.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +76 -48
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-multer.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-routers.js +2 -2
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/{koa2.js → koa.js} +3 -3
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/socket.io.js +80 -0
- package/node_modules/@contrast/assess/lib/get-source-context.js +10 -21
- package/node_modules/@contrast/assess/lib/index.d.ts +4 -3
- package/node_modules/@contrast/assess/lib/index.js +2 -2
- package/node_modules/@contrast/assess/lib/make-source-context.js +5 -10
- package/node_modules/@contrast/assess/lib/policy.js +400 -0
- package/node_modules/@contrast/assess/lib/response-scanning/handlers/index.js +10 -14
- package/node_modules/@contrast/assess/package.json +12 -12
- package/node_modules/@contrast/common/lib/constants.d.ts +12 -4
- package/node_modules/@contrast/common/lib/constants.js +16 -7
- package/node_modules/@contrast/common/lib/types.d.ts +5 -1
- package/node_modules/@contrast/common/package.json +1 -1
- package/node_modules/@contrast/config/lib/common.js +1 -0
- package/node_modules/@contrast/config/lib/options.js +14 -0
- package/node_modules/@contrast/config/package.json +3 -3
- package/node_modules/@contrast/core/package.json +5 -5
- package/node_modules/@contrast/deadzones/package.json +5 -5
- package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -2
- package/node_modules/@contrast/dep-hooks/lib/package-finder.js +3 -2
- package/node_modules/@contrast/dep-hooks/package.json +4 -4
- package/node_modules/@contrast/esm-hooks/README.md +2 -2
- package/node_modules/@contrast/esm-hooks/package.json +6 -6
- package/node_modules/@contrast/instrumentation/package.json +5 -5
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +149 -149
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/index.js +2 -11
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/utils.js +2 -0
- package/node_modules/@contrast/library-analysis/lib/install/library-usage/index.js +3 -1
- package/node_modules/@contrast/library-analysis/lib/util.js +0 -2
- package/node_modules/@contrast/library-analysis/package.json +4 -4
- package/node_modules/@contrast/logger/package.json +3 -3
- package/node_modules/@contrast/metrics/package.json +6 -6
- package/node_modules/@contrast/patcher/package.json +2 -2
- package/node_modules/@contrast/protect/lib/error-handlers/index.js +1 -1
- package/node_modules/@contrast/protect/lib/error-handlers/install/{koa2.js → koa.js} +4 -4
- package/node_modules/@contrast/protect/lib/index.d.ts +1 -1
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +1 -12
- package/node_modules/@contrast/protect/lib/input-analysis/index.js +2 -3
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparsers.js +92 -0
- package/node_modules/@contrast/protect/lib/input-analysis/install/{koa2.js → koa.js} +5 -5
- package/node_modules/@contrast/protect/package.json +11 -11
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +6 -10
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/routes-observed.js +4 -0
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +22 -9
- package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
- package/node_modules/@contrast/reporter/package.json +6 -6
- package/node_modules/@contrast/rewriter/package.json +5 -5
- package/node_modules/@contrast/route-coverage/lib/index.d.ts +0 -2
- package/node_modules/@contrast/route-coverage/lib/index.js +10 -1
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +16 -1
- package/node_modules/@contrast/route-coverage/lib/install/fastify.js +25 -15
- package/node_modules/@contrast/route-coverage/lib/install/graphql.js +6 -1
- package/node_modules/@contrast/route-coverage/lib/install/koa.js +1 -1
- package/node_modules/@contrast/route-coverage/lib/install/socket.io.js +127 -0
- package/node_modules/@contrast/route-coverage/package.json +8 -8
- package/node_modules/@contrast/scopes/package.json +5 -5
- package/node_modules/@contrast/sec-obs/package.json +9 -9
- package/node_modules/@contrast/sources/lib/index.js +65 -22
- package/node_modules/@contrast/sources/lib/index.test.js +78 -33
- package/node_modules/@contrast/sources/lib/source-info.js +1 -10
- package/node_modules/@contrast/sources/package.json +3 -3
- package/node_modules/@contrast/telemetry/package.json +5 -5
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/node/assert.d.ts +154 -95
- package/node_modules/@types/node/buffer.buffer.d.ts +9 -0
- package/node_modules/@types/node/buffer.d.ts +8 -4
- package/node_modules/@types/node/child_process.d.ts +65 -42
- package/node_modules/@types/node/cluster.d.ts +4 -5
- package/node_modules/@types/node/crypto.d.ts +1173 -322
- package/node_modules/@types/node/dgram.d.ts +9 -8
- package/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/events.d.ts +80 -34
- package/node_modules/@types/node/fs/promises.d.ts +39 -21
- package/node_modules/@types/node/fs.d.ts +328 -87
- package/node_modules/@types/node/globals.d.ts +2 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/node/http.d.ts +94 -30
- package/node_modules/@types/node/http2.d.ts +178 -52
- package/node_modules/@types/node/https.d.ts +91 -62
- package/node_modules/@types/node/index.d.ts +2 -0
- package/node_modules/@types/node/inspector.d.ts +24 -0
- package/node_modules/@types/node/inspector.generated.d.ts +181 -0
- package/node_modules/@types/node/net.d.ts +12 -11
- package/node_modules/@types/node/os.d.ts +14 -3
- package/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/node/perf_hooks.d.ts +6 -8
- package/node_modules/@types/node/process.d.ts +12 -23
- package/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/node/sea.d.ts +9 -0
- package/node_modules/@types/node/sqlite.d.ts +119 -10
- package/node_modules/@types/node/stream/consumers.d.ts +2 -2
- package/node_modules/@types/node/stream/web.d.ts +6 -55
- package/node_modules/@types/node/stream.d.ts +38 -23
- package/node_modules/@types/node/string_decoder.d.ts +2 -2
- package/node_modules/@types/node/test.d.ts +31 -26
- package/node_modules/@types/node/tls.d.ts +90 -66
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +2 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +2 -0
- package/node_modules/@types/node/url.d.ts +8 -3
- package/node_modules/@types/node/util.d.ts +17 -3
- package/node_modules/@types/node/v8.d.ts +38 -5
- package/node_modules/@types/node/vm.d.ts +169 -88
- package/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +109 -48
- package/node_modules/@types/node/zlib.d.ts +31 -24
- package/node_modules/axios/CHANGELOG.md +403 -357
- package/node_modules/axios/README.md +80 -49
- package/node_modules/axios/dist/axios.js +121 -46
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +126 -57
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +126 -57
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +346 -97
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +4 -0
- package/node_modules/axios/index.d.ts +4 -0
- package/node_modules/axios/lib/adapters/adapters.js +85 -40
- package/node_modules/axios/lib/adapters/fetch.js +1 -1
- package/node_modules/axios/lib/adapters/http.js +220 -42
- package/node_modules/axios/lib/core/InterceptorManager.js +1 -1
- package/node_modules/axios/lib/core/mergeConfig.js +4 -4
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +6 -0
- package/node_modules/axios/lib/helpers/bind.js +7 -0
- package/node_modules/axios/lib/helpers/cookies.js +24 -13
- package/node_modules/axios/package.json +9 -4
- package/node_modules/detect-libc/lib/filesystem.js +1 -1
- package/node_modules/detect-libc/package.json +3 -1
- package/node_modules/node-abi/abi_registry.json +12 -2
- package/node_modules/node-abi/package.json +3 -6
- package/node_modules/semver/classes/range.js +1 -0
- package/node_modules/semver/classes/semver.js +19 -5
- package/node_modules/semver/internal/identifiers.js +4 -0
- package/node_modules/semver/package.json +3 -3
- package/node_modules/undici-types/agent.d.ts +1 -4
- package/node_modules/undici-types/client.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
- package/node_modules/undici-types/dispatcher.d.ts +0 -6
- package/node_modules/undici-types/errors.d.ts +5 -15
- package/node_modules/undici-types/eventsource.d.ts +6 -1
- package/node_modules/undici-types/h2c-client.d.ts +0 -2
- package/node_modules/undici-types/index.d.ts +6 -1
- package/node_modules/undici-types/interceptors.d.ts +5 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +0 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/webidl.d.ts +82 -21
- package/package.json +3 -3
- package/node_modules/@contrast/assess/lib/get-policy.js +0 -336
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-body5.js +0 -63
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparser4.js +0 -64
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/crypto.js)
|
|
18
18
|
*/
|
|
19
19
|
declare module "crypto" {
|
|
20
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
20
21
|
import * as stream from "node:stream";
|
|
21
22
|
import { PeerCertificate } from "node:tls";
|
|
22
23
|
/**
|
|
@@ -44,7 +45,7 @@ declare module "crypto" {
|
|
|
44
45
|
* @param encoding The `encoding` of the `spkac` string.
|
|
45
46
|
* @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
|
|
46
47
|
*/
|
|
47
|
-
static exportChallenge(spkac: BinaryLike):
|
|
48
|
+
static exportChallenge(spkac: BinaryLike): NonSharedBuffer;
|
|
48
49
|
/**
|
|
49
50
|
* ```js
|
|
50
51
|
* const { Certificate } = await import('node:crypto');
|
|
@@ -57,7 +58,7 @@ declare module "crypto" {
|
|
|
57
58
|
* @param encoding The `encoding` of the `spkac` string.
|
|
58
59
|
* @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
|
|
59
60
|
*/
|
|
60
|
-
static exportPublicKey(spkac: BinaryLike, encoding?: string):
|
|
61
|
+
static exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer;
|
|
61
62
|
/**
|
|
62
63
|
* ```js
|
|
63
64
|
* import { Buffer } from 'node:buffer';
|
|
@@ -78,7 +79,7 @@ declare module "crypto" {
|
|
|
78
79
|
* @returns The challenge component of the `spkac` data structure,
|
|
79
80
|
* which includes a public key and a challenge.
|
|
80
81
|
*/
|
|
81
|
-
exportChallenge(spkac: BinaryLike):
|
|
82
|
+
exportChallenge(spkac: BinaryLike): NonSharedBuffer;
|
|
82
83
|
/**
|
|
83
84
|
* @deprecated
|
|
84
85
|
* @param spkac
|
|
@@ -86,7 +87,7 @@ declare module "crypto" {
|
|
|
86
87
|
* @returns The public key component of the `spkac` data structure,
|
|
87
88
|
* which includes a public key and a challenge.
|
|
88
89
|
*/
|
|
89
|
-
exportPublicKey(spkac: BinaryLike, encoding?: string):
|
|
90
|
+
exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer;
|
|
90
91
|
/**
|
|
91
92
|
* @deprecated
|
|
92
93
|
* @param spkac
|
|
@@ -402,7 +403,7 @@ declare module "crypto" {
|
|
|
402
403
|
* @since v0.1.92
|
|
403
404
|
* @param encoding The `encoding` of the return value.
|
|
404
405
|
*/
|
|
405
|
-
digest():
|
|
406
|
+
digest(): NonSharedBuffer;
|
|
406
407
|
digest(encoding: BinaryToTextEncoding): string;
|
|
407
408
|
}
|
|
408
409
|
/**
|
|
@@ -496,7 +497,7 @@ declare module "crypto" {
|
|
|
496
497
|
* @since v0.1.94
|
|
497
498
|
* @param encoding The `encoding` of the return value.
|
|
498
499
|
*/
|
|
499
|
-
digest():
|
|
500
|
+
digest(): NonSharedBuffer;
|
|
500
501
|
digest(encoding: BinaryToTextEncoding): string;
|
|
501
502
|
}
|
|
502
503
|
type KeyObjectType = "secret" | "public" | "private";
|
|
@@ -510,50 +511,50 @@ declare module "crypto" {
|
|
|
510
511
|
format: "jwk";
|
|
511
512
|
}
|
|
512
513
|
interface JsonWebKey {
|
|
513
|
-
crv?: string
|
|
514
|
-
d?: string
|
|
515
|
-
dp?: string
|
|
516
|
-
dq?: string
|
|
517
|
-
e?: string
|
|
518
|
-
k?: string
|
|
519
|
-
kty?: string
|
|
520
|
-
n?: string
|
|
521
|
-
p?: string
|
|
522
|
-
q?: string
|
|
523
|
-
qi?: string
|
|
524
|
-
x?: string
|
|
525
|
-
y?: string
|
|
514
|
+
crv?: string;
|
|
515
|
+
d?: string;
|
|
516
|
+
dp?: string;
|
|
517
|
+
dq?: string;
|
|
518
|
+
e?: string;
|
|
519
|
+
k?: string;
|
|
520
|
+
kty?: string;
|
|
521
|
+
n?: string;
|
|
522
|
+
p?: string;
|
|
523
|
+
q?: string;
|
|
524
|
+
qi?: string;
|
|
525
|
+
x?: string;
|
|
526
|
+
y?: string;
|
|
526
527
|
[key: string]: unknown;
|
|
527
528
|
}
|
|
528
529
|
interface AsymmetricKeyDetails {
|
|
529
530
|
/**
|
|
530
531
|
* Key size in bits (RSA, DSA).
|
|
531
532
|
*/
|
|
532
|
-
modulusLength?: number
|
|
533
|
+
modulusLength?: number;
|
|
533
534
|
/**
|
|
534
535
|
* Public exponent (RSA).
|
|
535
536
|
*/
|
|
536
|
-
publicExponent?: bigint
|
|
537
|
+
publicExponent?: bigint;
|
|
537
538
|
/**
|
|
538
539
|
* Name of the message digest (RSA-PSS).
|
|
539
540
|
*/
|
|
540
|
-
hashAlgorithm?: string
|
|
541
|
+
hashAlgorithm?: string;
|
|
541
542
|
/**
|
|
542
543
|
* Name of the message digest used by MGF1 (RSA-PSS).
|
|
543
544
|
*/
|
|
544
|
-
mgf1HashAlgorithm?: string
|
|
545
|
+
mgf1HashAlgorithm?: string;
|
|
545
546
|
/**
|
|
546
547
|
* Minimal salt length in bytes (RSA-PSS).
|
|
547
548
|
*/
|
|
548
|
-
saltLength?: number
|
|
549
|
+
saltLength?: number;
|
|
549
550
|
/**
|
|
550
551
|
* Size of q in bits (DSA).
|
|
551
552
|
*/
|
|
552
|
-
divisorLength?: number
|
|
553
|
+
divisorLength?: number;
|
|
553
554
|
/**
|
|
554
555
|
* Name of the curve (EC).
|
|
555
556
|
*/
|
|
556
|
-
namedCurve?: string
|
|
557
|
+
namedCurve?: string;
|
|
557
558
|
}
|
|
558
559
|
/**
|
|
559
560
|
* Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
|
|
@@ -591,24 +592,14 @@ declare module "crypto" {
|
|
|
591
592
|
*/
|
|
592
593
|
static from(key: webcrypto.CryptoKey): KeyObject;
|
|
593
594
|
/**
|
|
594
|
-
* For asymmetric keys, this property represents the type of the key.
|
|
595
|
-
* types
|
|
596
|
-
*
|
|
597
|
-
* * `'rsa'` (OID 1.2.840.113549.1.1.1)
|
|
598
|
-
* * `'rsa-pss'` (OID 1.2.840.113549.1.1.10)
|
|
599
|
-
* * `'dsa'` (OID 1.2.840.10040.4.1)
|
|
600
|
-
* * `'ec'` (OID 1.2.840.10045.2.1)
|
|
601
|
-
* * `'x25519'` (OID 1.3.101.110)
|
|
602
|
-
* * `'x448'` (OID 1.3.101.111)
|
|
603
|
-
* * `'ed25519'` (OID 1.3.101.112)
|
|
604
|
-
* * `'ed448'` (OID 1.3.101.113)
|
|
605
|
-
* * `'dh'` (OID 1.2.840.113549.1.3.1)
|
|
595
|
+
* For asymmetric keys, this property represents the type of the key. See the
|
|
596
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
606
597
|
*
|
|
607
598
|
* This property is `undefined` for unrecognized `KeyObject` types and symmetric
|
|
608
599
|
* keys.
|
|
609
600
|
* @since v11.6.0
|
|
610
601
|
*/
|
|
611
|
-
asymmetricKeyType?: KeyType
|
|
602
|
+
asymmetricKeyType?: KeyType;
|
|
612
603
|
/**
|
|
613
604
|
* This property exists only on asymmetric keys. Depending on the type of the key,
|
|
614
605
|
* this object contains information about the key. None of the information obtained
|
|
@@ -622,7 +613,7 @@ declare module "crypto" {
|
|
|
622
613
|
* Other key details might be exposed via this API using additional attributes.
|
|
623
614
|
* @since v15.7.0
|
|
624
615
|
*/
|
|
625
|
-
asymmetricKeyDetails?: AsymmetricKeyDetails
|
|
616
|
+
asymmetricKeyDetails?: AsymmetricKeyDetails;
|
|
626
617
|
/**
|
|
627
618
|
* For symmetric keys, the following encoding options can be used:
|
|
628
619
|
*
|
|
@@ -646,8 +637,8 @@ declare module "crypto" {
|
|
|
646
637
|
* PKCS#1 and SEC1 encryption.
|
|
647
638
|
* @since v11.6.0
|
|
648
639
|
*/
|
|
649
|
-
export(options: KeyExportOptions<"pem">): string |
|
|
650
|
-
export(options?: KeyExportOptions<"der">):
|
|
640
|
+
export(options: KeyExportOptions<"pem">): string | NonSharedBuffer;
|
|
641
|
+
export(options?: KeyExportOptions<"der">): NonSharedBuffer;
|
|
651
642
|
export(options?: JwkKeyExportOptions): JsonWebKey;
|
|
652
643
|
/**
|
|
653
644
|
* Returns `true` or `false` depending on whether the keys have exactly the same
|
|
@@ -661,7 +652,7 @@ declare module "crypto" {
|
|
|
661
652
|
* property is `undefined` for asymmetric keys.
|
|
662
653
|
* @since v11.6.0
|
|
663
654
|
*/
|
|
664
|
-
symmetricKeySize?: number
|
|
655
|
+
symmetricKeySize?: number;
|
|
665
656
|
/**
|
|
666
657
|
* Converts a `KeyObject` instance to a `CryptoKey`.
|
|
667
658
|
* @since 22.10.0
|
|
@@ -896,8 +887,8 @@ declare module "crypto" {
|
|
|
896
887
|
* @param inputEncoding The `encoding` of the data.
|
|
897
888
|
* @param outputEncoding The `encoding` of the return value.
|
|
898
889
|
*/
|
|
899
|
-
update(data: BinaryLike):
|
|
900
|
-
update(data: string, inputEncoding: Encoding):
|
|
890
|
+
update(data: BinaryLike): NonSharedBuffer;
|
|
891
|
+
update(data: string, inputEncoding: Encoding): NonSharedBuffer;
|
|
901
892
|
update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
|
|
902
893
|
update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
|
|
903
894
|
/**
|
|
@@ -908,7 +899,7 @@ declare module "crypto" {
|
|
|
908
899
|
* @param outputEncoding The `encoding` of the return value.
|
|
909
900
|
* @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
|
|
910
901
|
*/
|
|
911
|
-
final():
|
|
902
|
+
final(): NonSharedBuffer;
|
|
912
903
|
final(outputEncoding: BufferEncoding): string;
|
|
913
904
|
/**
|
|
914
905
|
* When using block encryption algorithms, the `Cipheriv` class will automatically
|
|
@@ -934,7 +925,7 @@ declare module "crypto" {
|
|
|
934
925
|
plaintextLength: number;
|
|
935
926
|
},
|
|
936
927
|
): this;
|
|
937
|
-
getAuthTag():
|
|
928
|
+
getAuthTag(): NonSharedBuffer;
|
|
938
929
|
}
|
|
939
930
|
interface CipherGCM extends Cipheriv {
|
|
940
931
|
setAAD(
|
|
@@ -943,7 +934,7 @@ declare module "crypto" {
|
|
|
943
934
|
plaintextLength: number;
|
|
944
935
|
},
|
|
945
936
|
): this;
|
|
946
|
-
getAuthTag():
|
|
937
|
+
getAuthTag(): NonSharedBuffer;
|
|
947
938
|
}
|
|
948
939
|
interface CipherOCB extends Cipheriv {
|
|
949
940
|
setAAD(
|
|
@@ -952,7 +943,7 @@ declare module "crypto" {
|
|
|
952
943
|
plaintextLength: number;
|
|
953
944
|
},
|
|
954
945
|
): this;
|
|
955
|
-
getAuthTag():
|
|
946
|
+
getAuthTag(): NonSharedBuffer;
|
|
956
947
|
}
|
|
957
948
|
interface CipherChaCha20Poly1305 extends Cipheriv {
|
|
958
949
|
setAAD(
|
|
@@ -961,7 +952,7 @@ declare module "crypto" {
|
|
|
961
952
|
plaintextLength: number;
|
|
962
953
|
},
|
|
963
954
|
): this;
|
|
964
|
-
getAuthTag():
|
|
955
|
+
getAuthTag(): NonSharedBuffer;
|
|
965
956
|
}
|
|
966
957
|
/**
|
|
967
958
|
* Creates and returns a `Decipheriv` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
|
|
@@ -1146,8 +1137,8 @@ declare module "crypto" {
|
|
|
1146
1137
|
* @param inputEncoding The `encoding` of the `data` string.
|
|
1147
1138
|
* @param outputEncoding The `encoding` of the return value.
|
|
1148
1139
|
*/
|
|
1149
|
-
update(data: NodeJS.ArrayBufferView):
|
|
1150
|
-
update(data: string, inputEncoding: Encoding):
|
|
1140
|
+
update(data: NodeJS.ArrayBufferView): NonSharedBuffer;
|
|
1141
|
+
update(data: string, inputEncoding: Encoding): NonSharedBuffer;
|
|
1151
1142
|
update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
|
|
1152
1143
|
update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
|
|
1153
1144
|
/**
|
|
@@ -1158,7 +1149,7 @@ declare module "crypto" {
|
|
|
1158
1149
|
* @param outputEncoding The `encoding` of the return value.
|
|
1159
1150
|
* @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
|
|
1160
1151
|
*/
|
|
1161
|
-
final():
|
|
1152
|
+
final(): NonSharedBuffer;
|
|
1162
1153
|
final(outputEncoding: BufferEncoding): string;
|
|
1163
1154
|
/**
|
|
1164
1155
|
* When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and
|
|
@@ -1320,6 +1311,7 @@ declare module "crypto" {
|
|
|
1320
1311
|
* @since v0.1.92
|
|
1321
1312
|
* @param options `stream.Writable` options
|
|
1322
1313
|
*/
|
|
1314
|
+
// TODO: signing algorithm type
|
|
1323
1315
|
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
|
|
1324
1316
|
type DSAEncoding = "der" | "ieee-p1363";
|
|
1325
1317
|
interface SigningOptions {
|
|
@@ -1329,6 +1321,7 @@ declare module "crypto" {
|
|
|
1329
1321
|
padding?: number | undefined;
|
|
1330
1322
|
saltLength?: number | undefined;
|
|
1331
1323
|
dsaEncoding?: DSAEncoding | undefined;
|
|
1324
|
+
context?: ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
1332
1325
|
}
|
|
1333
1326
|
interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
|
|
1334
1327
|
interface SignKeyObjectInput extends SigningOptions {
|
|
@@ -1430,7 +1423,7 @@ declare module "crypto" {
|
|
|
1430
1423
|
* called. Multiple calls to `sign.sign()` will result in an error being thrown.
|
|
1431
1424
|
* @since v0.1.92
|
|
1432
1425
|
*/
|
|
1433
|
-
sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput):
|
|
1426
|
+
sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): NonSharedBuffer;
|
|
1434
1427
|
sign(
|
|
1435
1428
|
privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
|
|
1436
1429
|
outputFormat: BinaryToTextEncoding,
|
|
@@ -1589,7 +1582,7 @@ declare module "crypto" {
|
|
|
1589
1582
|
* @since v0.5.0
|
|
1590
1583
|
* @param encoding The `encoding` of the return value.
|
|
1591
1584
|
*/
|
|
1592
|
-
generateKeys():
|
|
1585
|
+
generateKeys(): NonSharedBuffer;
|
|
1593
1586
|
generateKeys(encoding: BinaryToTextEncoding): string;
|
|
1594
1587
|
/**
|
|
1595
1588
|
* Computes the shared secret using `otherPublicKey` as the other
|
|
@@ -1604,8 +1597,16 @@ declare module "crypto" {
|
|
|
1604
1597
|
* @param inputEncoding The `encoding` of an `otherPublicKey` string.
|
|
1605
1598
|
* @param outputEncoding The `encoding` of the return value.
|
|
1606
1599
|
*/
|
|
1607
|
-
computeSecret(
|
|
1608
|
-
|
|
1600
|
+
computeSecret(
|
|
1601
|
+
otherPublicKey: NodeJS.ArrayBufferView,
|
|
1602
|
+
inputEncoding?: null,
|
|
1603
|
+
outputEncoding?: null,
|
|
1604
|
+
): NonSharedBuffer;
|
|
1605
|
+
computeSecret(
|
|
1606
|
+
otherPublicKey: string,
|
|
1607
|
+
inputEncoding: BinaryToTextEncoding,
|
|
1608
|
+
outputEncoding?: null,
|
|
1609
|
+
): NonSharedBuffer;
|
|
1609
1610
|
computeSecret(
|
|
1610
1611
|
otherPublicKey: NodeJS.ArrayBufferView,
|
|
1611
1612
|
inputEncoding: null,
|
|
@@ -1623,7 +1624,7 @@ declare module "crypto" {
|
|
|
1623
1624
|
* @since v0.5.0
|
|
1624
1625
|
* @param encoding The `encoding` of the return value.
|
|
1625
1626
|
*/
|
|
1626
|
-
getPrime():
|
|
1627
|
+
getPrime(): NonSharedBuffer;
|
|
1627
1628
|
getPrime(encoding: BinaryToTextEncoding): string;
|
|
1628
1629
|
/**
|
|
1629
1630
|
* Returns the Diffie-Hellman generator in the specified `encoding`.
|
|
@@ -1632,7 +1633,7 @@ declare module "crypto" {
|
|
|
1632
1633
|
* @since v0.5.0
|
|
1633
1634
|
* @param encoding The `encoding` of the return value.
|
|
1634
1635
|
*/
|
|
1635
|
-
getGenerator():
|
|
1636
|
+
getGenerator(): NonSharedBuffer;
|
|
1636
1637
|
getGenerator(encoding: BinaryToTextEncoding): string;
|
|
1637
1638
|
/**
|
|
1638
1639
|
* Returns the Diffie-Hellman public key in the specified `encoding`.
|
|
@@ -1641,7 +1642,7 @@ declare module "crypto" {
|
|
|
1641
1642
|
* @since v0.5.0
|
|
1642
1643
|
* @param encoding The `encoding` of the return value.
|
|
1643
1644
|
*/
|
|
1644
|
-
getPublicKey():
|
|
1645
|
+
getPublicKey(): NonSharedBuffer;
|
|
1645
1646
|
getPublicKey(encoding: BinaryToTextEncoding): string;
|
|
1646
1647
|
/**
|
|
1647
1648
|
* Returns the Diffie-Hellman private key in the specified `encoding`.
|
|
@@ -1650,7 +1651,7 @@ declare module "crypto" {
|
|
|
1650
1651
|
* @since v0.5.0
|
|
1651
1652
|
* @param encoding The `encoding` of the return value.
|
|
1652
1653
|
*/
|
|
1653
|
-
getPrivateKey():
|
|
1654
|
+
getPrivateKey(): NonSharedBuffer;
|
|
1654
1655
|
getPrivateKey(encoding: BinaryToTextEncoding): string;
|
|
1655
1656
|
/**
|
|
1656
1657
|
* Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected
|
|
@@ -1794,7 +1795,7 @@ declare module "crypto" {
|
|
|
1794
1795
|
iterations: number,
|
|
1795
1796
|
keylen: number,
|
|
1796
1797
|
digest: string,
|
|
1797
|
-
callback: (err: Error | null, derivedKey:
|
|
1798
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
1798
1799
|
): void;
|
|
1799
1800
|
/**
|
|
1800
1801
|
* Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
|
|
@@ -1831,7 +1832,7 @@ declare module "crypto" {
|
|
|
1831
1832
|
iterations: number,
|
|
1832
1833
|
keylen: number,
|
|
1833
1834
|
digest: string,
|
|
1834
|
-
):
|
|
1835
|
+
): NonSharedBuffer;
|
|
1835
1836
|
/**
|
|
1836
1837
|
* Generates cryptographically strong pseudorandom data. The `size` argument
|
|
1837
1838
|
* is a number indicating the number of bytes to generate.
|
|
@@ -1884,10 +1885,10 @@ declare module "crypto" {
|
|
|
1884
1885
|
* @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`.
|
|
1885
1886
|
* @return if the `callback` function is not provided.
|
|
1886
1887
|
*/
|
|
1887
|
-
function randomBytes(size: number):
|
|
1888
|
-
function randomBytes(size: number, callback: (err: Error | null, buf:
|
|
1889
|
-
function pseudoRandomBytes(size: number):
|
|
1890
|
-
function pseudoRandomBytes(size: number, callback: (err: Error | null, buf:
|
|
1888
|
+
function randomBytes(size: number): NonSharedBuffer;
|
|
1889
|
+
function randomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void;
|
|
1890
|
+
function pseudoRandomBytes(size: number): NonSharedBuffer;
|
|
1891
|
+
function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void;
|
|
1891
1892
|
/**
|
|
1892
1893
|
* Return a random integer `n` such that `min <= n < max`. This
|
|
1893
1894
|
* implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
|
|
@@ -2117,14 +2118,14 @@ declare module "crypto" {
|
|
|
2117
2118
|
password: BinaryLike,
|
|
2118
2119
|
salt: BinaryLike,
|
|
2119
2120
|
keylen: number,
|
|
2120
|
-
callback: (err: Error | null, derivedKey:
|
|
2121
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
2121
2122
|
): void;
|
|
2122
2123
|
function scrypt(
|
|
2123
2124
|
password: BinaryLike,
|
|
2124
2125
|
salt: BinaryLike,
|
|
2125
2126
|
keylen: number,
|
|
2126
2127
|
options: ScryptOptions,
|
|
2127
|
-
callback: (err: Error | null, derivedKey:
|
|
2128
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
2128
2129
|
): void;
|
|
2129
2130
|
/**
|
|
2130
2131
|
* Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
|
|
@@ -2156,7 +2157,12 @@ declare module "crypto" {
|
|
|
2156
2157
|
* ```
|
|
2157
2158
|
* @since v10.5.0
|
|
2158
2159
|
*/
|
|
2159
|
-
function scryptSync(
|
|
2160
|
+
function scryptSync(
|
|
2161
|
+
password: BinaryLike,
|
|
2162
|
+
salt: BinaryLike,
|
|
2163
|
+
keylen: number,
|
|
2164
|
+
options?: ScryptOptions,
|
|
2165
|
+
): NonSharedBuffer;
|
|
2160
2166
|
interface RsaPublicKey {
|
|
2161
2167
|
key: KeyLike;
|
|
2162
2168
|
padding?: number | undefined;
|
|
@@ -2185,7 +2191,7 @@ declare module "crypto" {
|
|
|
2185
2191
|
function publicEncrypt(
|
|
2186
2192
|
key: RsaPublicKey | RsaPrivateKey | KeyLike,
|
|
2187
2193
|
buffer: NodeJS.ArrayBufferView | string,
|
|
2188
|
-
):
|
|
2194
|
+
): NonSharedBuffer;
|
|
2189
2195
|
/**
|
|
2190
2196
|
* Decrypts `buffer` with `key`.`buffer` was previously encrypted using
|
|
2191
2197
|
* the corresponding private key, for example using {@link privateEncrypt}.
|
|
@@ -2200,7 +2206,7 @@ declare module "crypto" {
|
|
|
2200
2206
|
function publicDecrypt(
|
|
2201
2207
|
key: RsaPublicKey | RsaPrivateKey | KeyLike,
|
|
2202
2208
|
buffer: NodeJS.ArrayBufferView | string,
|
|
2203
|
-
):
|
|
2209
|
+
): NonSharedBuffer;
|
|
2204
2210
|
/**
|
|
2205
2211
|
* Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
|
|
2206
2212
|
* the corresponding public key, for example using {@link publicEncrypt}.
|
|
@@ -2209,7 +2215,10 @@ declare module "crypto" {
|
|
|
2209
2215
|
* object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`.
|
|
2210
2216
|
* @since v0.11.14
|
|
2211
2217
|
*/
|
|
2212
|
-
function privateDecrypt(
|
|
2218
|
+
function privateDecrypt(
|
|
2219
|
+
privateKey: RsaPrivateKey | KeyLike,
|
|
2220
|
+
buffer: NodeJS.ArrayBufferView | string,
|
|
2221
|
+
): NonSharedBuffer;
|
|
2213
2222
|
/**
|
|
2214
2223
|
* Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
|
|
2215
2224
|
* the corresponding public key, for example using {@link publicDecrypt}.
|
|
@@ -2218,7 +2227,10 @@ declare module "crypto" {
|
|
|
2218
2227
|
* object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`.
|
|
2219
2228
|
* @since v1.1.0
|
|
2220
2229
|
*/
|
|
2221
|
-
function privateEncrypt(
|
|
2230
|
+
function privateEncrypt(
|
|
2231
|
+
privateKey: RsaPrivateKey | KeyLike,
|
|
2232
|
+
buffer: NodeJS.ArrayBufferView | string,
|
|
2233
|
+
): NonSharedBuffer;
|
|
2222
2234
|
/**
|
|
2223
2235
|
* ```js
|
|
2224
2236
|
* const {
|
|
@@ -2347,7 +2359,7 @@ declare module "crypto" {
|
|
|
2347
2359
|
inputEncoding?: BinaryToTextEncoding,
|
|
2348
2360
|
outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
|
|
2349
2361
|
format?: "uncompressed" | "compressed" | "hybrid",
|
|
2350
|
-
):
|
|
2362
|
+
): NonSharedBuffer | string;
|
|
2351
2363
|
/**
|
|
2352
2364
|
* Generates private and public EC Diffie-Hellman key values, and returns
|
|
2353
2365
|
* the public key in the specified `format` and `encoding`. This key should be
|
|
@@ -2360,7 +2372,7 @@ declare module "crypto" {
|
|
|
2360
2372
|
* @param encoding The `encoding` of the return value.
|
|
2361
2373
|
* @param [format='uncompressed']
|
|
2362
2374
|
*/
|
|
2363
|
-
generateKeys():
|
|
2375
|
+
generateKeys(): NonSharedBuffer;
|
|
2364
2376
|
generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
|
|
2365
2377
|
/**
|
|
2366
2378
|
* Computes the shared secret using `otherPublicKey` as the other
|
|
@@ -2379,8 +2391,8 @@ declare module "crypto" {
|
|
|
2379
2391
|
* @param inputEncoding The `encoding` of the `otherPublicKey` string.
|
|
2380
2392
|
* @param outputEncoding The `encoding` of the return value.
|
|
2381
2393
|
*/
|
|
2382
|
-
computeSecret(otherPublicKey: NodeJS.ArrayBufferView):
|
|
2383
|
-
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding):
|
|
2394
|
+
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): NonSharedBuffer;
|
|
2395
|
+
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): NonSharedBuffer;
|
|
2384
2396
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
|
|
2385
2397
|
computeSecret(
|
|
2386
2398
|
otherPublicKey: string,
|
|
@@ -2394,7 +2406,7 @@ declare module "crypto" {
|
|
|
2394
2406
|
* @param encoding The `encoding` of the return value.
|
|
2395
2407
|
* @return The EC Diffie-Hellman in the specified `encoding`.
|
|
2396
2408
|
*/
|
|
2397
|
-
getPrivateKey():
|
|
2409
|
+
getPrivateKey(): NonSharedBuffer;
|
|
2398
2410
|
getPrivateKey(encoding: BinaryToTextEncoding): string;
|
|
2399
2411
|
/**
|
|
2400
2412
|
* The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format.
|
|
@@ -2406,7 +2418,7 @@ declare module "crypto" {
|
|
|
2406
2418
|
* @param [format='uncompressed']
|
|
2407
2419
|
* @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
|
|
2408
2420
|
*/
|
|
2409
|
-
getPublicKey(encoding?: null, format?: ECDHKeyFormat):
|
|
2421
|
+
getPublicKey(encoding?: null, format?: ECDHKeyFormat): NonSharedBuffer;
|
|
2410
2422
|
getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
|
|
2411
2423
|
/**
|
|
2412
2424
|
* Sets the EC Diffie-Hellman private key.
|
|
@@ -2456,7 +2468,34 @@ declare module "crypto" {
|
|
|
2456
2468
|
* @since v6.6.0
|
|
2457
2469
|
*/
|
|
2458
2470
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2459
|
-
type KeyType =
|
|
2471
|
+
type KeyType =
|
|
2472
|
+
| "dh"
|
|
2473
|
+
| "dsa"
|
|
2474
|
+
| "ec"
|
|
2475
|
+
| "ed25519"
|
|
2476
|
+
| "ed448"
|
|
2477
|
+
| "ml-dsa-44"
|
|
2478
|
+
| "ml-dsa-65"
|
|
2479
|
+
| "ml-dsa-87"
|
|
2480
|
+
| "ml-kem-1024"
|
|
2481
|
+
| "ml-kem-512"
|
|
2482
|
+
| "ml-kem-768"
|
|
2483
|
+
| "rsa-pss"
|
|
2484
|
+
| "rsa"
|
|
2485
|
+
| "slh-dsa-sha2-128f"
|
|
2486
|
+
| "slh-dsa-sha2-128s"
|
|
2487
|
+
| "slh-dsa-sha2-192f"
|
|
2488
|
+
| "slh-dsa-sha2-192s"
|
|
2489
|
+
| "slh-dsa-sha2-256f"
|
|
2490
|
+
| "slh-dsa-sha2-256s"
|
|
2491
|
+
| "slh-dsa-shake-128f"
|
|
2492
|
+
| "slh-dsa-shake-128s"
|
|
2493
|
+
| "slh-dsa-shake-192f"
|
|
2494
|
+
| "slh-dsa-shake-192s"
|
|
2495
|
+
| "slh-dsa-shake-256f"
|
|
2496
|
+
| "slh-dsa-shake-256s"
|
|
2497
|
+
| "x25519"
|
|
2498
|
+
| "x448";
|
|
2460
2499
|
type KeyFormat = "pem" | "der" | "jwk";
|
|
2461
2500
|
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2462
2501
|
format: T;
|
|
@@ -2471,6 +2510,9 @@ declare module "crypto" {
|
|
|
2471
2510
|
interface ED448KeyPairKeyObjectOptions {}
|
|
2472
2511
|
interface X25519KeyPairKeyObjectOptions {}
|
|
2473
2512
|
interface X448KeyPairKeyObjectOptions {}
|
|
2513
|
+
interface MLDSAKeyPairKeyObjectOptions {}
|
|
2514
|
+
interface MLKEMKeyPairKeyObjectOptions {}
|
|
2515
|
+
interface SLHDSAKeyPairKeyObjectOptions {}
|
|
2474
2516
|
interface ECKeyPairKeyObjectOptions {
|
|
2475
2517
|
/**
|
|
2476
2518
|
* Name of the curve to use
|
|
@@ -2505,15 +2547,15 @@ declare module "crypto" {
|
|
|
2505
2547
|
/**
|
|
2506
2548
|
* Name of the message digest
|
|
2507
2549
|
*/
|
|
2508
|
-
hashAlgorithm?: string;
|
|
2550
|
+
hashAlgorithm?: string | undefined;
|
|
2509
2551
|
/**
|
|
2510
2552
|
* Name of the message digest used by MGF1
|
|
2511
2553
|
*/
|
|
2512
|
-
mgf1HashAlgorithm?: string;
|
|
2554
|
+
mgf1HashAlgorithm?: string | undefined;
|
|
2513
2555
|
/**
|
|
2514
2556
|
* Minimal salt length in bytes
|
|
2515
2557
|
*/
|
|
2516
|
-
saltLength?: string;
|
|
2558
|
+
saltLength?: string | undefined;
|
|
2517
2559
|
}
|
|
2518
2560
|
interface DSAKeyPairKeyObjectOptions {
|
|
2519
2561
|
/**
|
|
@@ -2556,15 +2598,15 @@ declare module "crypto" {
|
|
|
2556
2598
|
/**
|
|
2557
2599
|
* Name of the message digest
|
|
2558
2600
|
*/
|
|
2559
|
-
hashAlgorithm?: string;
|
|
2601
|
+
hashAlgorithm?: string | undefined;
|
|
2560
2602
|
/**
|
|
2561
2603
|
* Name of the message digest used by MGF1
|
|
2562
2604
|
*/
|
|
2563
|
-
mgf1HashAlgorithm?: string;
|
|
2605
|
+
mgf1HashAlgorithm?: string | undefined;
|
|
2564
2606
|
/**
|
|
2565
2607
|
* Minimal salt length in bytes
|
|
2566
2608
|
*/
|
|
2567
|
-
saltLength?: string;
|
|
2609
|
+
saltLength?: string | undefined;
|
|
2568
2610
|
publicKeyEncoding: {
|
|
2569
2611
|
type: "spki";
|
|
2570
2612
|
format: PubF;
|
|
@@ -2635,13 +2677,40 @@ declare module "crypto" {
|
|
|
2635
2677
|
type: "pkcs8";
|
|
2636
2678
|
};
|
|
2637
2679
|
}
|
|
2680
|
+
interface MLDSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2681
|
+
publicKeyEncoding: {
|
|
2682
|
+
type: "spki";
|
|
2683
|
+
format: PubF;
|
|
2684
|
+
};
|
|
2685
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2686
|
+
type: "pkcs8";
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2689
|
+
interface MLKEMKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2690
|
+
publicKeyEncoding: {
|
|
2691
|
+
type: "spki";
|
|
2692
|
+
format: PubF;
|
|
2693
|
+
};
|
|
2694
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2695
|
+
type: "pkcs8";
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
interface SLHDSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2699
|
+
publicKeyEncoding: {
|
|
2700
|
+
type: "spki";
|
|
2701
|
+
format: PubF;
|
|
2702
|
+
};
|
|
2703
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2704
|
+
type: "pkcs8";
|
|
2705
|
+
};
|
|
2706
|
+
}
|
|
2638
2707
|
interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
|
2639
2708
|
publicKey: T1;
|
|
2640
2709
|
privateKey: T2;
|
|
2641
2710
|
}
|
|
2642
2711
|
/**
|
|
2643
2712
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2644
|
-
* Ed25519, Ed448, X25519, X448, and
|
|
2713
|
+
* Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
|
|
2645
2714
|
*
|
|
2646
2715
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
2647
2716
|
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
@@ -2678,7 +2747,8 @@ declare module "crypto" {
|
|
|
2678
2747
|
* When PEM encoding was selected, the respective key will be a string, otherwise
|
|
2679
2748
|
* it will be a buffer containing the data encoded as DER.
|
|
2680
2749
|
* @since v10.12.0
|
|
2681
|
-
* @param type
|
|
2750
|
+
* @param type The asymmetric key type to generate. See the
|
|
2751
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
2682
2752
|
*/
|
|
2683
2753
|
function generateKeyPairSync(
|
|
2684
2754
|
type: "rsa",
|
|
@@ -2687,15 +2757,15 @@ declare module "crypto" {
|
|
|
2687
2757
|
function generateKeyPairSync(
|
|
2688
2758
|
type: "rsa",
|
|
2689
2759
|
options: RSAKeyPairOptions<"pem", "der">,
|
|
2690
|
-
): KeyPairSyncResult<string,
|
|
2760
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2691
2761
|
function generateKeyPairSync(
|
|
2692
2762
|
type: "rsa",
|
|
2693
2763
|
options: RSAKeyPairOptions<"der", "pem">,
|
|
2694
|
-
): KeyPairSyncResult<
|
|
2764
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2695
2765
|
function generateKeyPairSync(
|
|
2696
2766
|
type: "rsa",
|
|
2697
2767
|
options: RSAKeyPairOptions<"der", "der">,
|
|
2698
|
-
): KeyPairSyncResult<
|
|
2768
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2699
2769
|
function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2700
2770
|
function generateKeyPairSync(
|
|
2701
2771
|
type: "rsa-pss",
|
|
@@ -2704,15 +2774,15 @@ declare module "crypto" {
|
|
|
2704
2774
|
function generateKeyPairSync(
|
|
2705
2775
|
type: "rsa-pss",
|
|
2706
2776
|
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2707
|
-
): KeyPairSyncResult<string,
|
|
2777
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2708
2778
|
function generateKeyPairSync(
|
|
2709
2779
|
type: "rsa-pss",
|
|
2710
2780
|
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2711
|
-
): KeyPairSyncResult<
|
|
2781
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2712
2782
|
function generateKeyPairSync(
|
|
2713
2783
|
type: "rsa-pss",
|
|
2714
2784
|
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2715
|
-
): KeyPairSyncResult<
|
|
2785
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2716
2786
|
function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2717
2787
|
function generateKeyPairSync(
|
|
2718
2788
|
type: "dsa",
|
|
@@ -2721,15 +2791,15 @@ declare module "crypto" {
|
|
|
2721
2791
|
function generateKeyPairSync(
|
|
2722
2792
|
type: "dsa",
|
|
2723
2793
|
options: DSAKeyPairOptions<"pem", "der">,
|
|
2724
|
-
): KeyPairSyncResult<string,
|
|
2794
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2725
2795
|
function generateKeyPairSync(
|
|
2726
2796
|
type: "dsa",
|
|
2727
2797
|
options: DSAKeyPairOptions<"der", "pem">,
|
|
2728
|
-
): KeyPairSyncResult<
|
|
2798
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2729
2799
|
function generateKeyPairSync(
|
|
2730
2800
|
type: "dsa",
|
|
2731
2801
|
options: DSAKeyPairOptions<"der", "der">,
|
|
2732
|
-
): KeyPairSyncResult<
|
|
2802
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2733
2803
|
function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2734
2804
|
function generateKeyPairSync(
|
|
2735
2805
|
type: "ec",
|
|
@@ -2738,15 +2808,15 @@ declare module "crypto" {
|
|
|
2738
2808
|
function generateKeyPairSync(
|
|
2739
2809
|
type: "ec",
|
|
2740
2810
|
options: ECKeyPairOptions<"pem", "der">,
|
|
2741
|
-
): KeyPairSyncResult<string,
|
|
2811
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2742
2812
|
function generateKeyPairSync(
|
|
2743
2813
|
type: "ec",
|
|
2744
2814
|
options: ECKeyPairOptions<"der", "pem">,
|
|
2745
|
-
): KeyPairSyncResult<
|
|
2815
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2746
2816
|
function generateKeyPairSync(
|
|
2747
2817
|
type: "ec",
|
|
2748
2818
|
options: ECKeyPairOptions<"der", "der">,
|
|
2749
|
-
): KeyPairSyncResult<
|
|
2819
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2750
2820
|
function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2751
2821
|
function generateKeyPairSync(
|
|
2752
2822
|
type: "ed25519",
|
|
@@ -2755,15 +2825,15 @@ declare module "crypto" {
|
|
|
2755
2825
|
function generateKeyPairSync(
|
|
2756
2826
|
type: "ed25519",
|
|
2757
2827
|
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2758
|
-
): KeyPairSyncResult<string,
|
|
2828
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2759
2829
|
function generateKeyPairSync(
|
|
2760
2830
|
type: "ed25519",
|
|
2761
2831
|
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2762
|
-
): KeyPairSyncResult<
|
|
2832
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2763
2833
|
function generateKeyPairSync(
|
|
2764
2834
|
type: "ed25519",
|
|
2765
2835
|
options: ED25519KeyPairOptions<"der", "der">,
|
|
2766
|
-
): KeyPairSyncResult<
|
|
2836
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2767
2837
|
function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2768
2838
|
function generateKeyPairSync(
|
|
2769
2839
|
type: "ed448",
|
|
@@ -2772,15 +2842,15 @@ declare module "crypto" {
|
|
|
2772
2842
|
function generateKeyPairSync(
|
|
2773
2843
|
type: "ed448",
|
|
2774
2844
|
options: ED448KeyPairOptions<"pem", "der">,
|
|
2775
|
-
): KeyPairSyncResult<string,
|
|
2845
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2776
2846
|
function generateKeyPairSync(
|
|
2777
2847
|
type: "ed448",
|
|
2778
2848
|
options: ED448KeyPairOptions<"der", "pem">,
|
|
2779
|
-
): KeyPairSyncResult<
|
|
2849
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2780
2850
|
function generateKeyPairSync(
|
|
2781
2851
|
type: "ed448",
|
|
2782
2852
|
options: ED448KeyPairOptions<"der", "der">,
|
|
2783
|
-
): KeyPairSyncResult<
|
|
2853
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2784
2854
|
function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2785
2855
|
function generateKeyPairSync(
|
|
2786
2856
|
type: "x25519",
|
|
@@ -2789,15 +2859,15 @@ declare module "crypto" {
|
|
|
2789
2859
|
function generateKeyPairSync(
|
|
2790
2860
|
type: "x25519",
|
|
2791
2861
|
options: X25519KeyPairOptions<"pem", "der">,
|
|
2792
|
-
): KeyPairSyncResult<string,
|
|
2862
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2793
2863
|
function generateKeyPairSync(
|
|
2794
2864
|
type: "x25519",
|
|
2795
2865
|
options: X25519KeyPairOptions<"der", "pem">,
|
|
2796
|
-
): KeyPairSyncResult<
|
|
2866
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2797
2867
|
function generateKeyPairSync(
|
|
2798
2868
|
type: "x25519",
|
|
2799
2869
|
options: X25519KeyPairOptions<"der", "der">,
|
|
2800
|
-
): KeyPairSyncResult<
|
|
2870
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2801
2871
|
function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2802
2872
|
function generateKeyPairSync(
|
|
2803
2873
|
type: "x448",
|
|
@@ -2806,16 +2876,136 @@ declare module "crypto" {
|
|
|
2806
2876
|
function generateKeyPairSync(
|
|
2807
2877
|
type: "x448",
|
|
2808
2878
|
options: X448KeyPairOptions<"pem", "der">,
|
|
2809
|
-
): KeyPairSyncResult<string,
|
|
2879
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2810
2880
|
function generateKeyPairSync(
|
|
2811
2881
|
type: "x448",
|
|
2812
2882
|
options: X448KeyPairOptions<"der", "pem">,
|
|
2813
|
-
): KeyPairSyncResult<
|
|
2883
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2814
2884
|
function generateKeyPairSync(
|
|
2815
2885
|
type: "x448",
|
|
2816
2886
|
options: X448KeyPairOptions<"der", "der">,
|
|
2817
|
-
): KeyPairSyncResult<
|
|
2887
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2818
2888
|
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2889
|
+
function generateKeyPairSync(
|
|
2890
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2891
|
+
options: MLDSAKeyPairOptions<"pem", "pem">,
|
|
2892
|
+
): KeyPairSyncResult<string, string>;
|
|
2893
|
+
function generateKeyPairSync(
|
|
2894
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2895
|
+
options: MLDSAKeyPairOptions<"pem", "der">,
|
|
2896
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2897
|
+
function generateKeyPairSync(
|
|
2898
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2899
|
+
options: MLDSAKeyPairOptions<"der", "pem">,
|
|
2900
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2901
|
+
function generateKeyPairSync(
|
|
2902
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2903
|
+
options: MLDSAKeyPairOptions<"der", "der">,
|
|
2904
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2905
|
+
function generateKeyPairSync(
|
|
2906
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2907
|
+
options?: MLDSAKeyPairKeyObjectOptions,
|
|
2908
|
+
): KeyPairKeyObjectResult;
|
|
2909
|
+
function generateKeyPairSync(
|
|
2910
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2911
|
+
options: MLKEMKeyPairOptions<"pem", "pem">,
|
|
2912
|
+
): KeyPairSyncResult<string, string>;
|
|
2913
|
+
function generateKeyPairSync(
|
|
2914
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2915
|
+
options: MLKEMKeyPairOptions<"pem", "der">,
|
|
2916
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2917
|
+
function generateKeyPairSync(
|
|
2918
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2919
|
+
options: MLKEMKeyPairOptions<"der", "pem">,
|
|
2920
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2921
|
+
function generateKeyPairSync(
|
|
2922
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2923
|
+
options: MLKEMKeyPairOptions<"der", "der">,
|
|
2924
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2925
|
+
function generateKeyPairSync(
|
|
2926
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2927
|
+
options?: MLKEMKeyPairKeyObjectOptions,
|
|
2928
|
+
): KeyPairKeyObjectResult;
|
|
2929
|
+
function generateKeyPairSync(
|
|
2930
|
+
type:
|
|
2931
|
+
| "slh-dsa-sha2-128f"
|
|
2932
|
+
| "slh-dsa-sha2-128s"
|
|
2933
|
+
| "slh-dsa-sha2-192f"
|
|
2934
|
+
| "slh-dsa-sha2-192s"
|
|
2935
|
+
| "slh-dsa-sha2-256f"
|
|
2936
|
+
| "slh-dsa-sha2-256s"
|
|
2937
|
+
| "slh-dsa-shake-128f"
|
|
2938
|
+
| "slh-dsa-shake-128s"
|
|
2939
|
+
| "slh-dsa-shake-192f"
|
|
2940
|
+
| "slh-dsa-shake-192s"
|
|
2941
|
+
| "slh-dsa-shake-256f"
|
|
2942
|
+
| "slh-dsa-shake-256s",
|
|
2943
|
+
options: SLHDSAKeyPairOptions<"pem", "pem">,
|
|
2944
|
+
): KeyPairSyncResult<string, string>;
|
|
2945
|
+
function generateKeyPairSync(
|
|
2946
|
+
type:
|
|
2947
|
+
| "slh-dsa-sha2-128f"
|
|
2948
|
+
| "slh-dsa-sha2-128s"
|
|
2949
|
+
| "slh-dsa-sha2-192f"
|
|
2950
|
+
| "slh-dsa-sha2-192s"
|
|
2951
|
+
| "slh-dsa-sha2-256f"
|
|
2952
|
+
| "slh-dsa-sha2-256s"
|
|
2953
|
+
| "slh-dsa-shake-128f"
|
|
2954
|
+
| "slh-dsa-shake-128s"
|
|
2955
|
+
| "slh-dsa-shake-192f"
|
|
2956
|
+
| "slh-dsa-shake-192s"
|
|
2957
|
+
| "slh-dsa-shake-256f"
|
|
2958
|
+
| "slh-dsa-shake-256s",
|
|
2959
|
+
options: SLHDSAKeyPairOptions<"pem", "der">,
|
|
2960
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2961
|
+
function generateKeyPairSync(
|
|
2962
|
+
type:
|
|
2963
|
+
| "slh-dsa-sha2-128f"
|
|
2964
|
+
| "slh-dsa-sha2-128s"
|
|
2965
|
+
| "slh-dsa-sha2-192f"
|
|
2966
|
+
| "slh-dsa-sha2-192s"
|
|
2967
|
+
| "slh-dsa-sha2-256f"
|
|
2968
|
+
| "slh-dsa-sha2-256s"
|
|
2969
|
+
| "slh-dsa-shake-128f"
|
|
2970
|
+
| "slh-dsa-shake-128s"
|
|
2971
|
+
| "slh-dsa-shake-192f"
|
|
2972
|
+
| "slh-dsa-shake-192s"
|
|
2973
|
+
| "slh-dsa-shake-256f"
|
|
2974
|
+
| "slh-dsa-shake-256s",
|
|
2975
|
+
options: SLHDSAKeyPairOptions<"der", "pem">,
|
|
2976
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2977
|
+
function generateKeyPairSync(
|
|
2978
|
+
type:
|
|
2979
|
+
| "slh-dsa-sha2-128f"
|
|
2980
|
+
| "slh-dsa-sha2-128s"
|
|
2981
|
+
| "slh-dsa-sha2-192f"
|
|
2982
|
+
| "slh-dsa-sha2-192s"
|
|
2983
|
+
| "slh-dsa-sha2-256f"
|
|
2984
|
+
| "slh-dsa-sha2-256s"
|
|
2985
|
+
| "slh-dsa-shake-128f"
|
|
2986
|
+
| "slh-dsa-shake-128s"
|
|
2987
|
+
| "slh-dsa-shake-192f"
|
|
2988
|
+
| "slh-dsa-shake-192s"
|
|
2989
|
+
| "slh-dsa-shake-256f"
|
|
2990
|
+
| "slh-dsa-shake-256s",
|
|
2991
|
+
options: SLHDSAKeyPairOptions<"der", "der">,
|
|
2992
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2993
|
+
function generateKeyPairSync(
|
|
2994
|
+
type:
|
|
2995
|
+
| "slh-dsa-sha2-128f"
|
|
2996
|
+
| "slh-dsa-sha2-128s"
|
|
2997
|
+
| "slh-dsa-sha2-192f"
|
|
2998
|
+
| "slh-dsa-sha2-192s"
|
|
2999
|
+
| "slh-dsa-sha2-256f"
|
|
3000
|
+
| "slh-dsa-sha2-256s"
|
|
3001
|
+
| "slh-dsa-shake-128f"
|
|
3002
|
+
| "slh-dsa-shake-128s"
|
|
3003
|
+
| "slh-dsa-shake-192f"
|
|
3004
|
+
| "slh-dsa-shake-192s"
|
|
3005
|
+
| "slh-dsa-shake-256f"
|
|
3006
|
+
| "slh-dsa-shake-256s",
|
|
3007
|
+
options?: SLHDSAKeyPairKeyObjectOptions,
|
|
3008
|
+
): KeyPairKeyObjectResult;
|
|
2819
3009
|
/**
|
|
2820
3010
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2821
3011
|
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
@@ -2853,7 +3043,8 @@ declare module "crypto" {
|
|
|
2853
3043
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
2854
3044
|
* a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
|
|
2855
3045
|
* @since v10.12.0
|
|
2856
|
-
* @param type
|
|
3046
|
+
* @param type The asymmetric key type to generate. See the
|
|
3047
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
2857
3048
|
*/
|
|
2858
3049
|
function generateKeyPair(
|
|
2859
3050
|
type: "rsa",
|
|
@@ -2863,17 +3054,17 @@ declare module "crypto" {
|
|
|
2863
3054
|
function generateKeyPair(
|
|
2864
3055
|
type: "rsa",
|
|
2865
3056
|
options: RSAKeyPairOptions<"pem", "der">,
|
|
2866
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3057
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2867
3058
|
): void;
|
|
2868
3059
|
function generateKeyPair(
|
|
2869
3060
|
type: "rsa",
|
|
2870
3061
|
options: RSAKeyPairOptions<"der", "pem">,
|
|
2871
|
-
callback: (err: Error | null, publicKey:
|
|
3062
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2872
3063
|
): void;
|
|
2873
3064
|
function generateKeyPair(
|
|
2874
3065
|
type: "rsa",
|
|
2875
3066
|
options: RSAKeyPairOptions<"der", "der">,
|
|
2876
|
-
callback: (err: Error | null, publicKey:
|
|
3067
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2877
3068
|
): void;
|
|
2878
3069
|
function generateKeyPair(
|
|
2879
3070
|
type: "rsa",
|
|
@@ -2888,17 +3079,17 @@ declare module "crypto" {
|
|
|
2888
3079
|
function generateKeyPair(
|
|
2889
3080
|
type: "rsa-pss",
|
|
2890
3081
|
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2891
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3082
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2892
3083
|
): void;
|
|
2893
3084
|
function generateKeyPair(
|
|
2894
3085
|
type: "rsa-pss",
|
|
2895
3086
|
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2896
|
-
callback: (err: Error | null, publicKey:
|
|
3087
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2897
3088
|
): void;
|
|
2898
3089
|
function generateKeyPair(
|
|
2899
3090
|
type: "rsa-pss",
|
|
2900
3091
|
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2901
|
-
callback: (err: Error | null, publicKey:
|
|
3092
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2902
3093
|
): void;
|
|
2903
3094
|
function generateKeyPair(
|
|
2904
3095
|
type: "rsa-pss",
|
|
@@ -2913,17 +3104,17 @@ declare module "crypto" {
|
|
|
2913
3104
|
function generateKeyPair(
|
|
2914
3105
|
type: "dsa",
|
|
2915
3106
|
options: DSAKeyPairOptions<"pem", "der">,
|
|
2916
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3107
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2917
3108
|
): void;
|
|
2918
3109
|
function generateKeyPair(
|
|
2919
3110
|
type: "dsa",
|
|
2920
3111
|
options: DSAKeyPairOptions<"der", "pem">,
|
|
2921
|
-
callback: (err: Error | null, publicKey:
|
|
3112
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2922
3113
|
): void;
|
|
2923
3114
|
function generateKeyPair(
|
|
2924
3115
|
type: "dsa",
|
|
2925
3116
|
options: DSAKeyPairOptions<"der", "der">,
|
|
2926
|
-
callback: (err: Error | null, publicKey:
|
|
3117
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2927
3118
|
): void;
|
|
2928
3119
|
function generateKeyPair(
|
|
2929
3120
|
type: "dsa",
|
|
@@ -2938,17 +3129,17 @@ declare module "crypto" {
|
|
|
2938
3129
|
function generateKeyPair(
|
|
2939
3130
|
type: "ec",
|
|
2940
3131
|
options: ECKeyPairOptions<"pem", "der">,
|
|
2941
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3132
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2942
3133
|
): void;
|
|
2943
3134
|
function generateKeyPair(
|
|
2944
3135
|
type: "ec",
|
|
2945
3136
|
options: ECKeyPairOptions<"der", "pem">,
|
|
2946
|
-
callback: (err: Error | null, publicKey:
|
|
3137
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2947
3138
|
): void;
|
|
2948
3139
|
function generateKeyPair(
|
|
2949
3140
|
type: "ec",
|
|
2950
3141
|
options: ECKeyPairOptions<"der", "der">,
|
|
2951
|
-
callback: (err: Error | null, publicKey:
|
|
3142
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2952
3143
|
): void;
|
|
2953
3144
|
function generateKeyPair(
|
|
2954
3145
|
type: "ec",
|
|
@@ -2963,17 +3154,17 @@ declare module "crypto" {
|
|
|
2963
3154
|
function generateKeyPair(
|
|
2964
3155
|
type: "ed25519",
|
|
2965
3156
|
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2966
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3157
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2967
3158
|
): void;
|
|
2968
3159
|
function generateKeyPair(
|
|
2969
3160
|
type: "ed25519",
|
|
2970
3161
|
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2971
|
-
callback: (err: Error | null, publicKey:
|
|
3162
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2972
3163
|
): void;
|
|
2973
3164
|
function generateKeyPair(
|
|
2974
3165
|
type: "ed25519",
|
|
2975
3166
|
options: ED25519KeyPairOptions<"der", "der">,
|
|
2976
|
-
callback: (err: Error | null, publicKey:
|
|
3167
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2977
3168
|
): void;
|
|
2978
3169
|
function generateKeyPair(
|
|
2979
3170
|
type: "ed25519",
|
|
@@ -2988,17 +3179,17 @@ declare module "crypto" {
|
|
|
2988
3179
|
function generateKeyPair(
|
|
2989
3180
|
type: "ed448",
|
|
2990
3181
|
options: ED448KeyPairOptions<"pem", "der">,
|
|
2991
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3182
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2992
3183
|
): void;
|
|
2993
3184
|
function generateKeyPair(
|
|
2994
3185
|
type: "ed448",
|
|
2995
3186
|
options: ED448KeyPairOptions<"der", "pem">,
|
|
2996
|
-
callback: (err: Error | null, publicKey:
|
|
3187
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2997
3188
|
): void;
|
|
2998
3189
|
function generateKeyPair(
|
|
2999
3190
|
type: "ed448",
|
|
3000
3191
|
options: ED448KeyPairOptions<"der", "der">,
|
|
3001
|
-
callback: (err: Error | null, publicKey:
|
|
3192
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
3002
3193
|
): void;
|
|
3003
3194
|
function generateKeyPair(
|
|
3004
3195
|
type: "ed448",
|
|
@@ -3013,17 +3204,17 @@ declare module "crypto" {
|
|
|
3013
3204
|
function generateKeyPair(
|
|
3014
3205
|
type: "x25519",
|
|
3015
3206
|
options: X25519KeyPairOptions<"pem", "der">,
|
|
3016
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3207
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
3017
3208
|
): void;
|
|
3018
3209
|
function generateKeyPair(
|
|
3019
3210
|
type: "x25519",
|
|
3020
3211
|
options: X25519KeyPairOptions<"der", "pem">,
|
|
3021
|
-
callback: (err: Error | null, publicKey:
|
|
3212
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
3022
3213
|
): void;
|
|
3023
3214
|
function generateKeyPair(
|
|
3024
3215
|
type: "x25519",
|
|
3025
3216
|
options: X25519KeyPairOptions<"der", "der">,
|
|
3026
|
-
callback: (err: Error | null, publicKey:
|
|
3217
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
3027
3218
|
): void;
|
|
3028
3219
|
function generateKeyPair(
|
|
3029
3220
|
type: "x25519",
|
|
@@ -3038,23 +3229,158 @@ declare module "crypto" {
|
|
|
3038
3229
|
function generateKeyPair(
|
|
3039
3230
|
type: "x448",
|
|
3040
3231
|
options: X448KeyPairOptions<"pem", "der">,
|
|
3041
|
-
callback: (err: Error | null, publicKey: string, privateKey:
|
|
3232
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
3042
3233
|
): void;
|
|
3043
3234
|
function generateKeyPair(
|
|
3044
3235
|
type: "x448",
|
|
3045
3236
|
options: X448KeyPairOptions<"der", "pem">,
|
|
3046
|
-
callback: (err: Error | null, publicKey:
|
|
3237
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
3047
3238
|
): void;
|
|
3048
3239
|
function generateKeyPair(
|
|
3049
3240
|
type: "x448",
|
|
3050
3241
|
options: X448KeyPairOptions<"der", "der">,
|
|
3051
|
-
callback: (err: Error | null, publicKey:
|
|
3242
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
3052
3243
|
): void;
|
|
3053
3244
|
function generateKeyPair(
|
|
3054
3245
|
type: "x448",
|
|
3055
3246
|
options: X448KeyPairKeyObjectOptions | undefined,
|
|
3056
3247
|
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3057
3248
|
): void;
|
|
3249
|
+
function generateKeyPair(
|
|
3250
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3251
|
+
options: MLDSAKeyPairOptions<"pem", "pem">,
|
|
3252
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3253
|
+
): void;
|
|
3254
|
+
function generateKeyPair(
|
|
3255
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3256
|
+
options: MLDSAKeyPairOptions<"pem", "der">,
|
|
3257
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
3258
|
+
): void;
|
|
3259
|
+
function generateKeyPair(
|
|
3260
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3261
|
+
options: MLDSAKeyPairOptions<"der", "pem">,
|
|
3262
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
3263
|
+
): void;
|
|
3264
|
+
function generateKeyPair(
|
|
3265
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3266
|
+
options: MLDSAKeyPairOptions<"der", "der">,
|
|
3267
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
3268
|
+
): void;
|
|
3269
|
+
function generateKeyPair(
|
|
3270
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3271
|
+
options: MLDSAKeyPairKeyObjectOptions | undefined,
|
|
3272
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3273
|
+
): void;
|
|
3274
|
+
function generateKeyPair(
|
|
3275
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3276
|
+
options: MLKEMKeyPairOptions<"pem", "pem">,
|
|
3277
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3278
|
+
): void;
|
|
3279
|
+
function generateKeyPair(
|
|
3280
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3281
|
+
options: MLKEMKeyPairOptions<"pem", "der">,
|
|
3282
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
3283
|
+
): void;
|
|
3284
|
+
function generateKeyPair(
|
|
3285
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3286
|
+
options: MLKEMKeyPairOptions<"der", "pem">,
|
|
3287
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
3288
|
+
): void;
|
|
3289
|
+
function generateKeyPair(
|
|
3290
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3291
|
+
options: MLKEMKeyPairOptions<"der", "der">,
|
|
3292
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
3293
|
+
): void;
|
|
3294
|
+
function generateKeyPair(
|
|
3295
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3296
|
+
options: MLKEMKeyPairKeyObjectOptions | undefined,
|
|
3297
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3298
|
+
): void;
|
|
3299
|
+
function generateKeyPair(
|
|
3300
|
+
type:
|
|
3301
|
+
| "slh-dsa-sha2-128f"
|
|
3302
|
+
| "slh-dsa-sha2-128s"
|
|
3303
|
+
| "slh-dsa-sha2-192f"
|
|
3304
|
+
| "slh-dsa-sha2-192s"
|
|
3305
|
+
| "slh-dsa-sha2-256f"
|
|
3306
|
+
| "slh-dsa-sha2-256s"
|
|
3307
|
+
| "slh-dsa-shake-128f"
|
|
3308
|
+
| "slh-dsa-shake-128s"
|
|
3309
|
+
| "slh-dsa-shake-192f"
|
|
3310
|
+
| "slh-dsa-shake-192s"
|
|
3311
|
+
| "slh-dsa-shake-256f"
|
|
3312
|
+
| "slh-dsa-shake-256s",
|
|
3313
|
+
options: SLHDSAKeyPairOptions<"pem", "pem">,
|
|
3314
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3315
|
+
): void;
|
|
3316
|
+
function generateKeyPair(
|
|
3317
|
+
type:
|
|
3318
|
+
| "slh-dsa-sha2-128f"
|
|
3319
|
+
| "slh-dsa-sha2-128s"
|
|
3320
|
+
| "slh-dsa-sha2-192f"
|
|
3321
|
+
| "slh-dsa-sha2-192s"
|
|
3322
|
+
| "slh-dsa-sha2-256f"
|
|
3323
|
+
| "slh-dsa-sha2-256s"
|
|
3324
|
+
| "slh-dsa-shake-128f"
|
|
3325
|
+
| "slh-dsa-shake-128s"
|
|
3326
|
+
| "slh-dsa-shake-192f"
|
|
3327
|
+
| "slh-dsa-shake-192s"
|
|
3328
|
+
| "slh-dsa-shake-256f"
|
|
3329
|
+
| "slh-dsa-shake-256s",
|
|
3330
|
+
options: SLHDSAKeyPairOptions<"pem", "der">,
|
|
3331
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3332
|
+
): void;
|
|
3333
|
+
function generateKeyPair(
|
|
3334
|
+
type:
|
|
3335
|
+
| "slh-dsa-sha2-128f"
|
|
3336
|
+
| "slh-dsa-sha2-128s"
|
|
3337
|
+
| "slh-dsa-sha2-192f"
|
|
3338
|
+
| "slh-dsa-sha2-192s"
|
|
3339
|
+
| "slh-dsa-sha2-256f"
|
|
3340
|
+
| "slh-dsa-sha2-256s"
|
|
3341
|
+
| "slh-dsa-shake-128f"
|
|
3342
|
+
| "slh-dsa-shake-128s"
|
|
3343
|
+
| "slh-dsa-shake-192f"
|
|
3344
|
+
| "slh-dsa-shake-192s"
|
|
3345
|
+
| "slh-dsa-shake-256f"
|
|
3346
|
+
| "slh-dsa-shake-256s",
|
|
3347
|
+
options: SLHDSAKeyPairOptions<"der", "pem">,
|
|
3348
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3349
|
+
): void;
|
|
3350
|
+
function generateKeyPair(
|
|
3351
|
+
type:
|
|
3352
|
+
| "slh-dsa-sha2-128f"
|
|
3353
|
+
| "slh-dsa-sha2-128s"
|
|
3354
|
+
| "slh-dsa-sha2-192f"
|
|
3355
|
+
| "slh-dsa-sha2-192s"
|
|
3356
|
+
| "slh-dsa-sha2-256f"
|
|
3357
|
+
| "slh-dsa-sha2-256s"
|
|
3358
|
+
| "slh-dsa-shake-128f"
|
|
3359
|
+
| "slh-dsa-shake-128s"
|
|
3360
|
+
| "slh-dsa-shake-192f"
|
|
3361
|
+
| "slh-dsa-shake-192s"
|
|
3362
|
+
| "slh-dsa-shake-256f"
|
|
3363
|
+
| "slh-dsa-shake-256s",
|
|
3364
|
+
options: SLHDSAKeyPairOptions<"der", "der">,
|
|
3365
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3366
|
+
): void;
|
|
3367
|
+
function generateKeyPair(
|
|
3368
|
+
type:
|
|
3369
|
+
| "slh-dsa-sha2-128f"
|
|
3370
|
+
| "slh-dsa-sha2-128s"
|
|
3371
|
+
| "slh-dsa-sha2-192f"
|
|
3372
|
+
| "slh-dsa-sha2-192s"
|
|
3373
|
+
| "slh-dsa-sha2-256f"
|
|
3374
|
+
| "slh-dsa-sha2-256s"
|
|
3375
|
+
| "slh-dsa-shake-128f"
|
|
3376
|
+
| "slh-dsa-shake-128s"
|
|
3377
|
+
| "slh-dsa-shake-192f"
|
|
3378
|
+
| "slh-dsa-shake-192s"
|
|
3379
|
+
| "slh-dsa-shake-256f"
|
|
3380
|
+
| "slh-dsa-shake-256s",
|
|
3381
|
+
options: SLHDSAKeyPairKeyObjectOptions | undefined,
|
|
3382
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3383
|
+
): void;
|
|
3058
3384
|
namespace generateKeyPair {
|
|
3059
3385
|
function __promisify__(
|
|
3060
3386
|
type: "rsa",
|
|
@@ -3068,21 +3394,21 @@ declare module "crypto" {
|
|
|
3068
3394
|
options: RSAKeyPairOptions<"pem", "der">,
|
|
3069
3395
|
): Promise<{
|
|
3070
3396
|
publicKey: string;
|
|
3071
|
-
privateKey:
|
|
3397
|
+
privateKey: NonSharedBuffer;
|
|
3072
3398
|
}>;
|
|
3073
3399
|
function __promisify__(
|
|
3074
3400
|
type: "rsa",
|
|
3075
3401
|
options: RSAKeyPairOptions<"der", "pem">,
|
|
3076
3402
|
): Promise<{
|
|
3077
|
-
publicKey:
|
|
3403
|
+
publicKey: NonSharedBuffer;
|
|
3078
3404
|
privateKey: string;
|
|
3079
3405
|
}>;
|
|
3080
3406
|
function __promisify__(
|
|
3081
3407
|
type: "rsa",
|
|
3082
3408
|
options: RSAKeyPairOptions<"der", "der">,
|
|
3083
3409
|
): Promise<{
|
|
3084
|
-
publicKey:
|
|
3085
|
-
privateKey:
|
|
3410
|
+
publicKey: NonSharedBuffer;
|
|
3411
|
+
privateKey: NonSharedBuffer;
|
|
3086
3412
|
}>;
|
|
3087
3413
|
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3088
3414
|
function __promisify__(
|
|
@@ -3097,21 +3423,21 @@ declare module "crypto" {
|
|
|
3097
3423
|
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
3098
3424
|
): Promise<{
|
|
3099
3425
|
publicKey: string;
|
|
3100
|
-
privateKey:
|
|
3426
|
+
privateKey: NonSharedBuffer;
|
|
3101
3427
|
}>;
|
|
3102
3428
|
function __promisify__(
|
|
3103
3429
|
type: "rsa-pss",
|
|
3104
3430
|
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
3105
3431
|
): Promise<{
|
|
3106
|
-
publicKey:
|
|
3432
|
+
publicKey: NonSharedBuffer;
|
|
3107
3433
|
privateKey: string;
|
|
3108
3434
|
}>;
|
|
3109
3435
|
function __promisify__(
|
|
3110
3436
|
type: "rsa-pss",
|
|
3111
3437
|
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
3112
3438
|
): Promise<{
|
|
3113
|
-
publicKey:
|
|
3114
|
-
privateKey:
|
|
3439
|
+
publicKey: NonSharedBuffer;
|
|
3440
|
+
privateKey: NonSharedBuffer;
|
|
3115
3441
|
}>;
|
|
3116
3442
|
function __promisify__(
|
|
3117
3443
|
type: "rsa-pss",
|
|
@@ -3129,21 +3455,21 @@ declare module "crypto" {
|
|
|
3129
3455
|
options: DSAKeyPairOptions<"pem", "der">,
|
|
3130
3456
|
): Promise<{
|
|
3131
3457
|
publicKey: string;
|
|
3132
|
-
privateKey:
|
|
3458
|
+
privateKey: NonSharedBuffer;
|
|
3133
3459
|
}>;
|
|
3134
3460
|
function __promisify__(
|
|
3135
3461
|
type: "dsa",
|
|
3136
3462
|
options: DSAKeyPairOptions<"der", "pem">,
|
|
3137
3463
|
): Promise<{
|
|
3138
|
-
publicKey:
|
|
3464
|
+
publicKey: NonSharedBuffer;
|
|
3139
3465
|
privateKey: string;
|
|
3140
3466
|
}>;
|
|
3141
3467
|
function __promisify__(
|
|
3142
3468
|
type: "dsa",
|
|
3143
3469
|
options: DSAKeyPairOptions<"der", "der">,
|
|
3144
3470
|
): Promise<{
|
|
3145
|
-
publicKey:
|
|
3146
|
-
privateKey:
|
|
3471
|
+
publicKey: NonSharedBuffer;
|
|
3472
|
+
privateKey: NonSharedBuffer;
|
|
3147
3473
|
}>;
|
|
3148
3474
|
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3149
3475
|
function __promisify__(
|
|
@@ -3158,21 +3484,21 @@ declare module "crypto" {
|
|
|
3158
3484
|
options: ECKeyPairOptions<"pem", "der">,
|
|
3159
3485
|
): Promise<{
|
|
3160
3486
|
publicKey: string;
|
|
3161
|
-
privateKey:
|
|
3487
|
+
privateKey: NonSharedBuffer;
|
|
3162
3488
|
}>;
|
|
3163
3489
|
function __promisify__(
|
|
3164
3490
|
type: "ec",
|
|
3165
3491
|
options: ECKeyPairOptions<"der", "pem">,
|
|
3166
3492
|
): Promise<{
|
|
3167
|
-
publicKey:
|
|
3493
|
+
publicKey: NonSharedBuffer;
|
|
3168
3494
|
privateKey: string;
|
|
3169
3495
|
}>;
|
|
3170
3496
|
function __promisify__(
|
|
3171
3497
|
type: "ec",
|
|
3172
3498
|
options: ECKeyPairOptions<"der", "der">,
|
|
3173
3499
|
): Promise<{
|
|
3174
|
-
publicKey:
|
|
3175
|
-
privateKey:
|
|
3500
|
+
publicKey: NonSharedBuffer;
|
|
3501
|
+
privateKey: NonSharedBuffer;
|
|
3176
3502
|
}>;
|
|
3177
3503
|
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3178
3504
|
function __promisify__(
|
|
@@ -3187,21 +3513,21 @@ declare module "crypto" {
|
|
|
3187
3513
|
options: ED25519KeyPairOptions<"pem", "der">,
|
|
3188
3514
|
): Promise<{
|
|
3189
3515
|
publicKey: string;
|
|
3190
|
-
privateKey:
|
|
3516
|
+
privateKey: NonSharedBuffer;
|
|
3191
3517
|
}>;
|
|
3192
3518
|
function __promisify__(
|
|
3193
3519
|
type: "ed25519",
|
|
3194
3520
|
options: ED25519KeyPairOptions<"der", "pem">,
|
|
3195
3521
|
): Promise<{
|
|
3196
|
-
publicKey:
|
|
3522
|
+
publicKey: NonSharedBuffer;
|
|
3197
3523
|
privateKey: string;
|
|
3198
3524
|
}>;
|
|
3199
3525
|
function __promisify__(
|
|
3200
3526
|
type: "ed25519",
|
|
3201
3527
|
options: ED25519KeyPairOptions<"der", "der">,
|
|
3202
3528
|
): Promise<{
|
|
3203
|
-
publicKey:
|
|
3204
|
-
privateKey:
|
|
3529
|
+
publicKey: NonSharedBuffer;
|
|
3530
|
+
privateKey: NonSharedBuffer;
|
|
3205
3531
|
}>;
|
|
3206
3532
|
function __promisify__(
|
|
3207
3533
|
type: "ed25519",
|
|
@@ -3219,21 +3545,21 @@ declare module "crypto" {
|
|
|
3219
3545
|
options: ED448KeyPairOptions<"pem", "der">,
|
|
3220
3546
|
): Promise<{
|
|
3221
3547
|
publicKey: string;
|
|
3222
|
-
privateKey:
|
|
3548
|
+
privateKey: NonSharedBuffer;
|
|
3223
3549
|
}>;
|
|
3224
3550
|
function __promisify__(
|
|
3225
3551
|
type: "ed448",
|
|
3226
3552
|
options: ED448KeyPairOptions<"der", "pem">,
|
|
3227
3553
|
): Promise<{
|
|
3228
|
-
publicKey:
|
|
3554
|
+
publicKey: NonSharedBuffer;
|
|
3229
3555
|
privateKey: string;
|
|
3230
3556
|
}>;
|
|
3231
3557
|
function __promisify__(
|
|
3232
3558
|
type: "ed448",
|
|
3233
3559
|
options: ED448KeyPairOptions<"der", "der">,
|
|
3234
3560
|
): Promise<{
|
|
3235
|
-
publicKey:
|
|
3236
|
-
privateKey:
|
|
3561
|
+
publicKey: NonSharedBuffer;
|
|
3562
|
+
privateKey: NonSharedBuffer;
|
|
3237
3563
|
}>;
|
|
3238
3564
|
function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3239
3565
|
function __promisify__(
|
|
@@ -3248,21 +3574,21 @@ declare module "crypto" {
|
|
|
3248
3574
|
options: X25519KeyPairOptions<"pem", "der">,
|
|
3249
3575
|
): Promise<{
|
|
3250
3576
|
publicKey: string;
|
|
3251
|
-
privateKey:
|
|
3577
|
+
privateKey: NonSharedBuffer;
|
|
3252
3578
|
}>;
|
|
3253
3579
|
function __promisify__(
|
|
3254
3580
|
type: "x25519",
|
|
3255
3581
|
options: X25519KeyPairOptions<"der", "pem">,
|
|
3256
3582
|
): Promise<{
|
|
3257
|
-
publicKey:
|
|
3583
|
+
publicKey: NonSharedBuffer;
|
|
3258
3584
|
privateKey: string;
|
|
3259
3585
|
}>;
|
|
3260
3586
|
function __promisify__(
|
|
3261
3587
|
type: "x25519",
|
|
3262
3588
|
options: X25519KeyPairOptions<"der", "der">,
|
|
3263
3589
|
): Promise<{
|
|
3264
|
-
publicKey:
|
|
3265
|
-
privateKey:
|
|
3590
|
+
publicKey: NonSharedBuffer;
|
|
3591
|
+
privateKey: NonSharedBuffer;
|
|
3266
3592
|
}>;
|
|
3267
3593
|
function __promisify__(
|
|
3268
3594
|
type: "x25519",
|
|
@@ -3280,28 +3606,187 @@ declare module "crypto" {
|
|
|
3280
3606
|
options: X448KeyPairOptions<"pem", "der">,
|
|
3281
3607
|
): Promise<{
|
|
3282
3608
|
publicKey: string;
|
|
3283
|
-
privateKey:
|
|
3609
|
+
privateKey: NonSharedBuffer;
|
|
3284
3610
|
}>;
|
|
3285
3611
|
function __promisify__(
|
|
3286
3612
|
type: "x448",
|
|
3287
3613
|
options: X448KeyPairOptions<"der", "pem">,
|
|
3288
3614
|
): Promise<{
|
|
3289
|
-
publicKey:
|
|
3615
|
+
publicKey: NonSharedBuffer;
|
|
3290
3616
|
privateKey: string;
|
|
3291
3617
|
}>;
|
|
3292
3618
|
function __promisify__(
|
|
3293
3619
|
type: "x448",
|
|
3294
3620
|
options: X448KeyPairOptions<"der", "der">,
|
|
3621
|
+
): Promise<{
|
|
3622
|
+
publicKey: NonSharedBuffer;
|
|
3623
|
+
privateKey: NonSharedBuffer;
|
|
3624
|
+
}>;
|
|
3625
|
+
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3626
|
+
function __promisify__(
|
|
3627
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3628
|
+
options: MLDSAKeyPairOptions<"pem", "pem">,
|
|
3629
|
+
): Promise<{
|
|
3630
|
+
publicKey: string;
|
|
3631
|
+
privateKey: string;
|
|
3632
|
+
}>;
|
|
3633
|
+
function __promisify__(
|
|
3634
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3635
|
+
options: MLDSAKeyPairOptions<"pem", "der">,
|
|
3636
|
+
): Promise<{
|
|
3637
|
+
publicKey: string;
|
|
3638
|
+
privateKey: NonSharedBuffer;
|
|
3639
|
+
}>;
|
|
3640
|
+
function __promisify__(
|
|
3641
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3642
|
+
options: MLDSAKeyPairOptions<"der", "pem">,
|
|
3643
|
+
): Promise<{
|
|
3644
|
+
publicKey: NonSharedBuffer;
|
|
3645
|
+
privateKey: string;
|
|
3646
|
+
}>;
|
|
3647
|
+
function __promisify__(
|
|
3648
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3649
|
+
options: MLDSAKeyPairOptions<"der", "der">,
|
|
3650
|
+
): Promise<{
|
|
3651
|
+
publicKey: NonSharedBuffer;
|
|
3652
|
+
privateKey: NonSharedBuffer;
|
|
3653
|
+
}>;
|
|
3654
|
+
function __promisify__(
|
|
3655
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3656
|
+
options?: MLDSAKeyPairKeyObjectOptions,
|
|
3657
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3658
|
+
function __promisify__(
|
|
3659
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3660
|
+
options: MLKEMKeyPairOptions<"pem", "pem">,
|
|
3661
|
+
): Promise<{
|
|
3662
|
+
publicKey: string;
|
|
3663
|
+
privateKey: string;
|
|
3664
|
+
}>;
|
|
3665
|
+
function __promisify__(
|
|
3666
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3667
|
+
options: MLKEMKeyPairOptions<"pem", "der">,
|
|
3668
|
+
): Promise<{
|
|
3669
|
+
publicKey: string;
|
|
3670
|
+
privateKey: NonSharedBuffer;
|
|
3671
|
+
}>;
|
|
3672
|
+
function __promisify__(
|
|
3673
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3674
|
+
options: MLKEMKeyPairOptions<"der", "pem">,
|
|
3675
|
+
): Promise<{
|
|
3676
|
+
publicKey: NonSharedBuffer;
|
|
3677
|
+
privateKey: string;
|
|
3678
|
+
}>;
|
|
3679
|
+
function __promisify__(
|
|
3680
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3681
|
+
options: MLKEMKeyPairOptions<"der", "der">,
|
|
3682
|
+
): Promise<{
|
|
3683
|
+
publicKey: NonSharedBuffer;
|
|
3684
|
+
privateKey: NonSharedBuffer;
|
|
3685
|
+
}>;
|
|
3686
|
+
function __promisify__(
|
|
3687
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3688
|
+
options?: MLKEMKeyPairKeyObjectOptions,
|
|
3689
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3690
|
+
function __promisify__(
|
|
3691
|
+
type:
|
|
3692
|
+
| "slh-dsa-sha2-128f"
|
|
3693
|
+
| "slh-dsa-sha2-128s"
|
|
3694
|
+
| "slh-dsa-sha2-192f"
|
|
3695
|
+
| "slh-dsa-sha2-192s"
|
|
3696
|
+
| "slh-dsa-sha2-256f"
|
|
3697
|
+
| "slh-dsa-sha2-256s"
|
|
3698
|
+
| "slh-dsa-shake-128f"
|
|
3699
|
+
| "slh-dsa-shake-128s"
|
|
3700
|
+
| "slh-dsa-shake-192f"
|
|
3701
|
+
| "slh-dsa-shake-192s"
|
|
3702
|
+
| "slh-dsa-shake-256f"
|
|
3703
|
+
| "slh-dsa-shake-256s",
|
|
3704
|
+
options: SLHDSAKeyPairOptions<"pem", "pem">,
|
|
3705
|
+
): Promise<{
|
|
3706
|
+
publicKey: string;
|
|
3707
|
+
privateKey: string;
|
|
3708
|
+
}>;
|
|
3709
|
+
function __promisify__(
|
|
3710
|
+
type:
|
|
3711
|
+
| "slh-dsa-sha2-128f"
|
|
3712
|
+
| "slh-dsa-sha2-128s"
|
|
3713
|
+
| "slh-dsa-sha2-192f"
|
|
3714
|
+
| "slh-dsa-sha2-192s"
|
|
3715
|
+
| "slh-dsa-sha2-256f"
|
|
3716
|
+
| "slh-dsa-sha2-256s"
|
|
3717
|
+
| "slh-dsa-shake-128f"
|
|
3718
|
+
| "slh-dsa-shake-128s"
|
|
3719
|
+
| "slh-dsa-shake-192f"
|
|
3720
|
+
| "slh-dsa-shake-192s"
|
|
3721
|
+
| "slh-dsa-shake-256f"
|
|
3722
|
+
| "slh-dsa-shake-256s",
|
|
3723
|
+
options: SLHDSAKeyPairOptions<"pem", "der">,
|
|
3724
|
+
): Promise<{
|
|
3725
|
+
publicKey: string;
|
|
3726
|
+
privateKey: Buffer;
|
|
3727
|
+
}>;
|
|
3728
|
+
function __promisify__(
|
|
3729
|
+
type:
|
|
3730
|
+
| "slh-dsa-sha2-128f"
|
|
3731
|
+
| "slh-dsa-sha2-128s"
|
|
3732
|
+
| "slh-dsa-sha2-192f"
|
|
3733
|
+
| "slh-dsa-sha2-192s"
|
|
3734
|
+
| "slh-dsa-sha2-256f"
|
|
3735
|
+
| "slh-dsa-sha2-256s"
|
|
3736
|
+
| "slh-dsa-shake-128f"
|
|
3737
|
+
| "slh-dsa-shake-128s"
|
|
3738
|
+
| "slh-dsa-shake-192f"
|
|
3739
|
+
| "slh-dsa-shake-192s"
|
|
3740
|
+
| "slh-dsa-shake-256f"
|
|
3741
|
+
| "slh-dsa-shake-256s",
|
|
3742
|
+
options: SLHDSAKeyPairOptions<"der", "pem">,
|
|
3743
|
+
): Promise<{
|
|
3744
|
+
publicKey: Buffer;
|
|
3745
|
+
privateKey: string;
|
|
3746
|
+
}>;
|
|
3747
|
+
function __promisify__(
|
|
3748
|
+
type:
|
|
3749
|
+
| "slh-dsa-sha2-128f"
|
|
3750
|
+
| "slh-dsa-sha2-128s"
|
|
3751
|
+
| "slh-dsa-sha2-192f"
|
|
3752
|
+
| "slh-dsa-sha2-192s"
|
|
3753
|
+
| "slh-dsa-sha2-256f"
|
|
3754
|
+
| "slh-dsa-sha2-256s"
|
|
3755
|
+
| "slh-dsa-shake-128f"
|
|
3756
|
+
| "slh-dsa-shake-128s"
|
|
3757
|
+
| "slh-dsa-shake-192f"
|
|
3758
|
+
| "slh-dsa-shake-192s"
|
|
3759
|
+
| "slh-dsa-shake-256f"
|
|
3760
|
+
| "slh-dsa-shake-256s",
|
|
3761
|
+
options: SLHDSAKeyPairOptions<"der", "der">,
|
|
3295
3762
|
): Promise<{
|
|
3296
3763
|
publicKey: Buffer;
|
|
3297
3764
|
privateKey: Buffer;
|
|
3298
3765
|
}>;
|
|
3299
|
-
function __promisify__(
|
|
3766
|
+
function __promisify__(
|
|
3767
|
+
type:
|
|
3768
|
+
| "slh-dsa-sha2-128f"
|
|
3769
|
+
| "slh-dsa-sha2-128s"
|
|
3770
|
+
| "slh-dsa-sha2-192f"
|
|
3771
|
+
| "slh-dsa-sha2-192s"
|
|
3772
|
+
| "slh-dsa-sha2-256f"
|
|
3773
|
+
| "slh-dsa-sha2-256s"
|
|
3774
|
+
| "slh-dsa-shake-128f"
|
|
3775
|
+
| "slh-dsa-shake-128s"
|
|
3776
|
+
| "slh-dsa-shake-192f"
|
|
3777
|
+
| "slh-dsa-shake-192s"
|
|
3778
|
+
| "slh-dsa-shake-256f"
|
|
3779
|
+
| "slh-dsa-shake-256s",
|
|
3780
|
+
options?: SLHDSAKeyPairKeyObjectOptions,
|
|
3781
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3300
3782
|
}
|
|
3301
3783
|
/**
|
|
3302
3784
|
* Calculates and returns the signature for `data` using the given private key and
|
|
3303
3785
|
* algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
|
|
3304
|
-
* dependent upon the key type
|
|
3786
|
+
* dependent upon the key type.
|
|
3787
|
+
*
|
|
3788
|
+
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
3789
|
+
* ML-DSA.
|
|
3305
3790
|
*
|
|
3306
3791
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
3307
3792
|
* passed to {@link createPrivateKey}. If it is an object, the following
|
|
@@ -3314,16 +3799,20 @@ declare module "crypto" {
|
|
|
3314
3799
|
algorithm: string | null | undefined,
|
|
3315
3800
|
data: NodeJS.ArrayBufferView,
|
|
3316
3801
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
|
|
3317
|
-
):
|
|
3802
|
+
): NonSharedBuffer;
|
|
3318
3803
|
function sign(
|
|
3319
3804
|
algorithm: string | null | undefined,
|
|
3320
3805
|
data: NodeJS.ArrayBufferView,
|
|
3321
3806
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
|
|
3322
|
-
callback: (error: Error | null, data:
|
|
3807
|
+
callback: (error: Error | null, data: NonSharedBuffer) => void,
|
|
3323
3808
|
): void;
|
|
3324
3809
|
/**
|
|
3325
|
-
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
3326
|
-
*
|
|
3810
|
+
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
3811
|
+
* `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
|
3812
|
+
* key type.
|
|
3813
|
+
*
|
|
3814
|
+
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
3815
|
+
* ML-DSA.
|
|
3327
3816
|
*
|
|
3328
3817
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
3329
3818
|
* passed to {@link createPublicKey}. If it is an object, the following
|
|
@@ -3351,17 +3840,71 @@ declare module "crypto" {
|
|
|
3351
3840
|
callback: (error: Error | null, result: boolean) => void,
|
|
3352
3841
|
): void;
|
|
3353
3842
|
/**
|
|
3354
|
-
*
|
|
3355
|
-
*
|
|
3356
|
-
*
|
|
3843
|
+
* Key decapsulation using a KEM algorithm with a private key.
|
|
3844
|
+
*
|
|
3845
|
+
* Supported key types and their KEM algorithms are:
|
|
3846
|
+
*
|
|
3847
|
+
* * `'rsa'` RSA Secret Value Encapsulation
|
|
3848
|
+
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
3849
|
+
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
3850
|
+
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
3851
|
+
* * `'ml-kem-512'` ML-KEM
|
|
3852
|
+
* * `'ml-kem-768'` ML-KEM
|
|
3853
|
+
* * `'ml-kem-1024'` ML-KEM
|
|
3854
|
+
*
|
|
3855
|
+
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
3856
|
+
* passed to `crypto.createPrivateKey()`.
|
|
3857
|
+
*
|
|
3858
|
+
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3859
|
+
* @since v24.7.0
|
|
3860
|
+
*/
|
|
3861
|
+
function decapsulate(
|
|
3862
|
+
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
3863
|
+
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
3864
|
+
): NonSharedBuffer;
|
|
3865
|
+
function decapsulate(
|
|
3866
|
+
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
3867
|
+
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
3868
|
+
callback: (err: Error, sharedKey: NonSharedBuffer) => void,
|
|
3869
|
+
): void;
|
|
3870
|
+
/**
|
|
3871
|
+
* Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`.
|
|
3872
|
+
* Both keys must have the same `asymmetricKeyType` and must support either the DH or
|
|
3873
|
+
* ECDH operation.
|
|
3357
3874
|
*
|
|
3358
3875
|
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3359
3876
|
* @since v13.9.0, v12.17.0
|
|
3360
3877
|
*/
|
|
3361
|
-
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }):
|
|
3878
|
+
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer;
|
|
3362
3879
|
function diffieHellman(
|
|
3363
3880
|
options: { privateKey: KeyObject; publicKey: KeyObject },
|
|
3364
|
-
callback: (err: Error | null, secret:
|
|
3881
|
+
callback: (err: Error | null, secret: NonSharedBuffer) => void,
|
|
3882
|
+
): void;
|
|
3883
|
+
/**
|
|
3884
|
+
* Key encapsulation using a KEM algorithm with a public key.
|
|
3885
|
+
*
|
|
3886
|
+
* Supported key types and their KEM algorithms are:
|
|
3887
|
+
*
|
|
3888
|
+
* * `'rsa'` RSA Secret Value Encapsulation
|
|
3889
|
+
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
3890
|
+
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
3891
|
+
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
3892
|
+
* * `'ml-kem-512'` ML-KEM
|
|
3893
|
+
* * `'ml-kem-768'` ML-KEM
|
|
3894
|
+
* * `'ml-kem-1024'` ML-KEM
|
|
3895
|
+
*
|
|
3896
|
+
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
3897
|
+
* passed to `crypto.createPublicKey()`.
|
|
3898
|
+
*
|
|
3899
|
+
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3900
|
+
* @since v24.7.0
|
|
3901
|
+
*/
|
|
3902
|
+
function encapsulate(
|
|
3903
|
+
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
3904
|
+
): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer };
|
|
3905
|
+
function encapsulate(
|
|
3906
|
+
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
3907
|
+
callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void,
|
|
3365
3908
|
): void;
|
|
3366
3909
|
interface OneShotDigestOptions {
|
|
3367
3910
|
/**
|
|
@@ -3426,12 +3969,12 @@ declare module "crypto" {
|
|
|
3426
3969
|
algorithm: string,
|
|
3427
3970
|
data: BinaryLike,
|
|
3428
3971
|
options: OneShotDigestOptionsWithBufferEncoding | "buffer",
|
|
3429
|
-
):
|
|
3972
|
+
): NonSharedBuffer;
|
|
3430
3973
|
function hash(
|
|
3431
3974
|
algorithm: string,
|
|
3432
3975
|
data: BinaryLike,
|
|
3433
3976
|
options: OneShotDigestOptions | BinaryToTextEncoding | "buffer",
|
|
3434
|
-
): string |
|
|
3977
|
+
): string | NonSharedBuffer;
|
|
3435
3978
|
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
|
3436
3979
|
interface CipherInfoOptions {
|
|
3437
3980
|
/**
|
|
@@ -3595,23 +4138,23 @@ declare module "crypto" {
|
|
|
3595
4138
|
/**
|
|
3596
4139
|
* @default 'always'
|
|
3597
4140
|
*/
|
|
3598
|
-
subject?: "always" | "default" | "never";
|
|
4141
|
+
subject?: "always" | "default" | "never" | undefined;
|
|
3599
4142
|
/**
|
|
3600
4143
|
* @default true
|
|
3601
4144
|
*/
|
|
3602
|
-
wildcards?: boolean;
|
|
4145
|
+
wildcards?: boolean | undefined;
|
|
3603
4146
|
/**
|
|
3604
4147
|
* @default true
|
|
3605
4148
|
*/
|
|
3606
|
-
partialWildcards?: boolean;
|
|
4149
|
+
partialWildcards?: boolean | undefined;
|
|
3607
4150
|
/**
|
|
3608
4151
|
* @default false
|
|
3609
4152
|
*/
|
|
3610
|
-
multiLabelWildcards?: boolean;
|
|
4153
|
+
multiLabelWildcards?: boolean | undefined;
|
|
3611
4154
|
/**
|
|
3612
4155
|
* @default false
|
|
3613
4156
|
*/
|
|
3614
|
-
singleLabelSubdomains?: boolean;
|
|
4157
|
+
singleLabelSubdomains?: boolean | undefined;
|
|
3615
4158
|
}
|
|
3616
4159
|
/**
|
|
3617
4160
|
* Encapsulates an X509 certificate and provides read-only access to
|
|
@@ -3713,7 +4256,7 @@ declare module "crypto" {
|
|
|
3713
4256
|
* available.
|
|
3714
4257
|
* @since v15.9.0
|
|
3715
4258
|
*/
|
|
3716
|
-
readonly issuerCertificate
|
|
4259
|
+
readonly issuerCertificate: X509Certificate | undefined;
|
|
3717
4260
|
/**
|
|
3718
4261
|
* The public key `KeyObject` for this certificate.
|
|
3719
4262
|
* @since v15.6.0
|
|
@@ -3723,7 +4266,7 @@ declare module "crypto" {
|
|
|
3723
4266
|
* A `Buffer` containing the DER encoding of this certificate.
|
|
3724
4267
|
* @since v15.6.0
|
|
3725
4268
|
*/
|
|
3726
|
-
readonly raw:
|
|
4269
|
+
readonly raw: NonSharedBuffer;
|
|
3727
4270
|
/**
|
|
3728
4271
|
* The serial number of this certificate.
|
|
3729
4272
|
*
|
|
@@ -3733,6 +4276,16 @@ declare module "crypto" {
|
|
|
3733
4276
|
* @since v15.6.0
|
|
3734
4277
|
*/
|
|
3735
4278
|
readonly serialNumber: string;
|
|
4279
|
+
/**
|
|
4280
|
+
* The algorithm used to sign the certificate or `undefined` if the signature algorithm is unknown by OpenSSL.
|
|
4281
|
+
* @since v24.9.0
|
|
4282
|
+
*/
|
|
4283
|
+
readonly signatureAlgorithm: string | undefined;
|
|
4284
|
+
/**
|
|
4285
|
+
* The OID of the algorithm used to sign the certificate.
|
|
4286
|
+
* @since v24.9.0
|
|
4287
|
+
*/
|
|
4288
|
+
readonly signatureAlgorithmOid: string;
|
|
3736
4289
|
/**
|
|
3737
4290
|
* The date/time from which this certificate is considered valid.
|
|
3738
4291
|
* @since v15.6.0
|
|
@@ -4005,6 +4558,130 @@ declare module "crypto" {
|
|
|
4005
4558
|
* @return Returns `typedArray`.
|
|
4006
4559
|
*/
|
|
4007
4560
|
function getRandomValues<T extends webcrypto.BufferSource>(typedArray: T): T;
|
|
4561
|
+
type Argon2Algorithm = "argon2d" | "argon2i" | "argon2id";
|
|
4562
|
+
interface Argon2Parameters {
|
|
4563
|
+
/**
|
|
4564
|
+
* REQUIRED, this is the password for password hashing applications of Argon2.
|
|
4565
|
+
*/
|
|
4566
|
+
message: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
4567
|
+
/**
|
|
4568
|
+
* REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2.
|
|
4569
|
+
*/
|
|
4570
|
+
nonce: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
4571
|
+
/**
|
|
4572
|
+
* REQUIRED, degree of parallelism determines how many computational chains (lanes)
|
|
4573
|
+
* can be run. Must be greater than 1 and less than `2**24-1`.
|
|
4574
|
+
*/
|
|
4575
|
+
parallelism: number;
|
|
4576
|
+
/**
|
|
4577
|
+
* REQUIRED, the length of the key to generate. Must be greater than 4 and
|
|
4578
|
+
* less than `2**32-1`.
|
|
4579
|
+
*/
|
|
4580
|
+
tagLength: number;
|
|
4581
|
+
/**
|
|
4582
|
+
* REQUIRED, memory cost in 1KiB blocks. Must be greater than
|
|
4583
|
+
* `8 * parallelism` and less than `2**32-1`. The actual number of blocks is rounded
|
|
4584
|
+
* down to the nearest multiple of `4 * parallelism`.
|
|
4585
|
+
*/
|
|
4586
|
+
memory: number;
|
|
4587
|
+
/**
|
|
4588
|
+
* REQUIRED, number of passes (iterations). Must be greater than 1 and less
|
|
4589
|
+
* than `2**32-1`.
|
|
4590
|
+
*/
|
|
4591
|
+
passes: number;
|
|
4592
|
+
/**
|
|
4593
|
+
* OPTIONAL, Random additional input,
|
|
4594
|
+
* similar to the salt, that should **NOT** be stored with the derived key. This is known as pepper in
|
|
4595
|
+
* password hashing applications. If used, must have a length not greater than `2**32-1` bytes.
|
|
4596
|
+
*/
|
|
4597
|
+
secret?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
4598
|
+
/**
|
|
4599
|
+
* OPTIONAL, Additional data to
|
|
4600
|
+
* be added to the hash, functionally equivalent to salt or secret, but meant for
|
|
4601
|
+
* non-random data. If used, must have a length not greater than `2**32-1` bytes.
|
|
4602
|
+
*/
|
|
4603
|
+
associatedData?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
4604
|
+
}
|
|
4605
|
+
/**
|
|
4606
|
+
* Provides an asynchronous [Argon2](https://www.rfc-editor.org/rfc/rfc9106.html) implementation. Argon2 is a password-based
|
|
4607
|
+
* key derivation function that is designed to be expensive computationally and
|
|
4608
|
+
* memory-wise in order to make brute-force attacks unrewarding.
|
|
4609
|
+
*
|
|
4610
|
+
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
4611
|
+
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
4612
|
+
*
|
|
4613
|
+
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
4614
|
+
* consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v24.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
|
|
4615
|
+
*
|
|
4616
|
+
* The `callback` function is called with two arguments: `err` and `derivedKey`.
|
|
4617
|
+
* `err` is an exception object when key derivation fails, otherwise `err` is
|
|
4618
|
+
* `null`. `derivedKey` is passed to the callback as a `Buffer`.
|
|
4619
|
+
*
|
|
4620
|
+
* An exception is thrown when any of the input arguments specify invalid values
|
|
4621
|
+
* or types.
|
|
4622
|
+
*
|
|
4623
|
+
* ```js
|
|
4624
|
+
* const { argon2, randomBytes } = await import('node:crypto');
|
|
4625
|
+
*
|
|
4626
|
+
* const parameters = {
|
|
4627
|
+
* message: 'password',
|
|
4628
|
+
* nonce: randomBytes(16),
|
|
4629
|
+
* parallelism: 4,
|
|
4630
|
+
* tagLength: 64,
|
|
4631
|
+
* memory: 65536,
|
|
4632
|
+
* passes: 3,
|
|
4633
|
+
* };
|
|
4634
|
+
*
|
|
4635
|
+
* argon2('argon2id', parameters, (err, derivedKey) => {
|
|
4636
|
+
* if (err) throw err;
|
|
4637
|
+
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
4638
|
+
* });
|
|
4639
|
+
* ```
|
|
4640
|
+
* @since v24.7.0
|
|
4641
|
+
* @param algorithm Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`.
|
|
4642
|
+
* @experimental
|
|
4643
|
+
*/
|
|
4644
|
+
function argon2(
|
|
4645
|
+
algorithm: Argon2Algorithm,
|
|
4646
|
+
parameters: Argon2Parameters,
|
|
4647
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
4648
|
+
): void;
|
|
4649
|
+
/**
|
|
4650
|
+
* Provides a synchronous [Argon2][] implementation. Argon2 is a password-based
|
|
4651
|
+
* key derivation function that is designed to be expensive computationally and
|
|
4652
|
+
* memory-wise in order to make brute-force attacks unrewarding.
|
|
4653
|
+
*
|
|
4654
|
+
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
4655
|
+
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
4656
|
+
*
|
|
4657
|
+
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
4658
|
+
* consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v24.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
|
|
4659
|
+
*
|
|
4660
|
+
* An exception is thrown when key derivation fails, otherwise the derived key is
|
|
4661
|
+
* returned as a `Buffer`.
|
|
4662
|
+
*
|
|
4663
|
+
* An exception is thrown when any of the input arguments specify invalid values
|
|
4664
|
+
* or types.
|
|
4665
|
+
*
|
|
4666
|
+
* ```js
|
|
4667
|
+
* const { argon2Sync, randomBytes } = await import('node:crypto');
|
|
4668
|
+
*
|
|
4669
|
+
* const parameters = {
|
|
4670
|
+
* message: 'password',
|
|
4671
|
+
* nonce: randomBytes(16),
|
|
4672
|
+
* parallelism: 4,
|
|
4673
|
+
* tagLength: 64,
|
|
4674
|
+
* memory: 65536,
|
|
4675
|
+
* passes: 3,
|
|
4676
|
+
* };
|
|
4677
|
+
*
|
|
4678
|
+
* const derivedKey = argon2Sync('argon2id', parameters);
|
|
4679
|
+
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
4680
|
+
* ```
|
|
4681
|
+
* @since v24.7.0
|
|
4682
|
+
* @experimental
|
|
4683
|
+
*/
|
|
4684
|
+
function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer;
|
|
4008
4685
|
/**
|
|
4009
4686
|
* A convenient alias for `crypto.webcrypto.subtle`.
|
|
4010
4687
|
* @since v17.4.0
|
|
@@ -4019,21 +4696,30 @@ declare module "crypto" {
|
|
|
4019
4696
|
const webcrypto: webcrypto.Crypto;
|
|
4020
4697
|
namespace webcrypto {
|
|
4021
4698
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
4022
|
-
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
|
4699
|
+
type KeyFormat = "jwk" | "pkcs8" | "raw" | "raw-public" | "raw-secret" | "raw-seed" | "spki";
|
|
4023
4700
|
type KeyType = "private" | "public" | "secret";
|
|
4024
4701
|
type KeyUsage =
|
|
4025
|
-
| "decrypt"
|
|
4026
|
-
| "deriveBits"
|
|
4027
|
-
| "deriveKey"
|
|
4028
4702
|
| "encrypt"
|
|
4703
|
+
| "decrypt"
|
|
4029
4704
|
| "sign"
|
|
4030
|
-
| "unwrapKey"
|
|
4031
4705
|
| "verify"
|
|
4032
|
-
| "
|
|
4706
|
+
| "deriveKey"
|
|
4707
|
+
| "deriveBits"
|
|
4708
|
+
| "encapsulateBits"
|
|
4709
|
+
| "decapsulateBits"
|
|
4710
|
+
| "encapsulateKey"
|
|
4711
|
+
| "decapsulateKey"
|
|
4712
|
+
| "wrapKey"
|
|
4713
|
+
| "unwrapKey";
|
|
4033
4714
|
type AlgorithmIdentifier = Algorithm | string;
|
|
4034
4715
|
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
4035
4716
|
type NamedCurve = string;
|
|
4036
4717
|
type BigInteger = Uint8Array;
|
|
4718
|
+
interface AeadParams extends Algorithm {
|
|
4719
|
+
additionalData?: BufferSource;
|
|
4720
|
+
iv: BufferSource;
|
|
4721
|
+
tagLength: number;
|
|
4722
|
+
}
|
|
4037
4723
|
interface AesCbcParams extends Algorithm {
|
|
4038
4724
|
iv: BufferSource;
|
|
4039
4725
|
}
|
|
@@ -4044,6 +4730,8 @@ declare module "crypto" {
|
|
|
4044
4730
|
interface AesDerivedKeyParams extends Algorithm {
|
|
4045
4731
|
length: number;
|
|
4046
4732
|
}
|
|
4733
|
+
// TODO: remove in next major
|
|
4734
|
+
/** @deprecated Replaced by `AeadParams`. */
|
|
4047
4735
|
interface AesGcmParams extends Algorithm {
|
|
4048
4736
|
additionalData?: BufferSource;
|
|
4049
4737
|
iv: BufferSource;
|
|
@@ -4058,6 +4746,23 @@ declare module "crypto" {
|
|
|
4058
4746
|
interface Algorithm {
|
|
4059
4747
|
name: string;
|
|
4060
4748
|
}
|
|
4749
|
+
interface Argon2Params extends Algorithm {
|
|
4750
|
+
associatedData?: BufferSource;
|
|
4751
|
+
memory: number;
|
|
4752
|
+
nonce: BufferSource;
|
|
4753
|
+
parallelism: number;
|
|
4754
|
+
passes: number;
|
|
4755
|
+
secretValue?: BufferSource;
|
|
4756
|
+
version?: number;
|
|
4757
|
+
}
|
|
4758
|
+
interface CShakeParams extends Algorithm {
|
|
4759
|
+
customization?: BufferSource;
|
|
4760
|
+
functionName?: BufferSource;
|
|
4761
|
+
length: number;
|
|
4762
|
+
}
|
|
4763
|
+
interface ContextParams extends Algorithm {
|
|
4764
|
+
context?: BufferSource;
|
|
4765
|
+
}
|
|
4061
4766
|
interface EcKeyAlgorithm extends KeyAlgorithm {
|
|
4062
4767
|
namedCurve: NamedCurve;
|
|
4063
4768
|
}
|
|
@@ -4073,9 +4778,6 @@ declare module "crypto" {
|
|
|
4073
4778
|
interface EcdsaParams extends Algorithm {
|
|
4074
4779
|
hash: HashAlgorithmIdentifier;
|
|
4075
4780
|
}
|
|
4076
|
-
interface Ed448Params extends Algorithm {
|
|
4077
|
-
context?: BufferSource;
|
|
4078
|
-
}
|
|
4079
4781
|
interface HkdfParams extends Algorithm {
|
|
4080
4782
|
hash: HashAlgorithmIdentifier;
|
|
4081
4783
|
info: BufferSource;
|
|
@@ -4116,6 +4818,19 @@ declare module "crypto" {
|
|
|
4116
4818
|
interface KeyAlgorithm {
|
|
4117
4819
|
name: string;
|
|
4118
4820
|
}
|
|
4821
|
+
interface KmacImportParams extends Algorithm {
|
|
4822
|
+
length?: number;
|
|
4823
|
+
}
|
|
4824
|
+
interface KmacKeyAlgorithm extends KeyAlgorithm {
|
|
4825
|
+
length: number;
|
|
4826
|
+
}
|
|
4827
|
+
interface KmacKeyGenParams extends Algorithm {
|
|
4828
|
+
length?: number;
|
|
4829
|
+
}
|
|
4830
|
+
interface KmacParams extends Algorithm {
|
|
4831
|
+
customization?: BufferSource;
|
|
4832
|
+
length: number;
|
|
4833
|
+
}
|
|
4119
4834
|
interface Pbkdf2Params extends Algorithm {
|
|
4120
4835
|
hash: HashAlgorithmIdentifier;
|
|
4121
4836
|
iterations: number;
|
|
@@ -4169,22 +4884,15 @@ declare module "crypto" {
|
|
|
4169
4884
|
* An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
|
|
4170
4885
|
* @since v15.0.0
|
|
4171
4886
|
*/
|
|
4172
|
-
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(
|
|
4887
|
+
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float16Array | Float32Array | Float64Array>>(
|
|
4888
|
+
typedArray: T,
|
|
4889
|
+
): T;
|
|
4173
4890
|
/**
|
|
4174
4891
|
* Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
|
|
4175
4892
|
* The UUID is generated using a cryptographic pseudorandom number generator.
|
|
4176
4893
|
* @since v16.7.0
|
|
4177
4894
|
*/
|
|
4178
4895
|
randomUUID(): UUID;
|
|
4179
|
-
CryptoKey: CryptoKeyConstructor;
|
|
4180
|
-
}
|
|
4181
|
-
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
|
|
4182
|
-
interface CryptoKeyConstructor {
|
|
4183
|
-
/** Illegal constructor */
|
|
4184
|
-
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
4185
|
-
readonly length: 0;
|
|
4186
|
-
readonly name: "CryptoKey";
|
|
4187
|
-
readonly prototype: CryptoKey;
|
|
4188
4896
|
}
|
|
4189
4897
|
/**
|
|
4190
4898
|
* @since v15.0.0
|
|
@@ -4239,31 +4947,81 @@ declare module "crypto" {
|
|
|
4239
4947
|
*/
|
|
4240
4948
|
publicKey: CryptoKey;
|
|
4241
4949
|
}
|
|
4950
|
+
interface EncapsulatedBits {
|
|
4951
|
+
sharedKey: ArrayBuffer;
|
|
4952
|
+
ciphertext: ArrayBuffer;
|
|
4953
|
+
}
|
|
4954
|
+
interface EncapsulatedKey {
|
|
4955
|
+
sharedKey: CryptoKey;
|
|
4956
|
+
ciphertext: ArrayBuffer;
|
|
4957
|
+
}
|
|
4242
4958
|
/**
|
|
4243
4959
|
* @since v15.0.0
|
|
4244
4960
|
*/
|
|
4245
4961
|
interface SubtleCrypto {
|
|
4962
|
+
/**
|
|
4963
|
+
* A message recipient uses their asymmetric private key to decrypt an
|
|
4964
|
+
* "encapsulated key" (ciphertext), thereby recovering a temporary symmetric
|
|
4965
|
+
* key (represented as `ArrayBuffer`) which is then used to decrypt a message.
|
|
4966
|
+
*
|
|
4967
|
+
* The algorithms currently supported include:
|
|
4968
|
+
*
|
|
4969
|
+
* * `'ML-KEM-512'`
|
|
4970
|
+
* * `'ML-KEM-768'`
|
|
4971
|
+
* * `'ML-KEM-1024'`
|
|
4972
|
+
* @since v24.7.0
|
|
4973
|
+
* @returns Fulfills with `ArrayBuffer` upon success.
|
|
4974
|
+
*/
|
|
4975
|
+
decapsulateBits(
|
|
4976
|
+
decapsulationAlgorithm: AlgorithmIdentifier,
|
|
4977
|
+
decapsulationKey: CryptoKey,
|
|
4978
|
+
ciphertext: BufferSource,
|
|
4979
|
+
): Promise<ArrayBuffer>;
|
|
4980
|
+
/**
|
|
4981
|
+
* A message recipient uses their asymmetric private key to decrypt an
|
|
4982
|
+
* "encapsulated key" (ciphertext), thereby recovering a temporary symmetric
|
|
4983
|
+
* key (represented as `CryptoKey`) which is then used to decrypt a message.
|
|
4984
|
+
*
|
|
4985
|
+
* The algorithms currently supported include:
|
|
4986
|
+
*
|
|
4987
|
+
* * `'ML-KEM-512'`
|
|
4988
|
+
* * `'ML-KEM-768'`
|
|
4989
|
+
* * `'ML-KEM-1024'`
|
|
4990
|
+
* @since v24.7.0
|
|
4991
|
+
* @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
|
|
4992
|
+
* @returns Fulfills with `CryptoKey` upon success.
|
|
4993
|
+
*/
|
|
4994
|
+
decapsulateKey(
|
|
4995
|
+
decapsulationAlgorithm: AlgorithmIdentifier,
|
|
4996
|
+
decapsulationKey: CryptoKey,
|
|
4997
|
+
ciphertext: BufferSource,
|
|
4998
|
+
sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
|
|
4999
|
+
extractable: boolean,
|
|
5000
|
+
usages: KeyUsage[],
|
|
5001
|
+
): Promise<CryptoKey>;
|
|
4246
5002
|
/**
|
|
4247
5003
|
* Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
|
|
4248
|
-
*
|
|
5004
|
+
* this method attempts to decipher the provided `data`. If successful,
|
|
4249
5005
|
* the returned promise will be resolved with an `<ArrayBuffer>` containing the plaintext result.
|
|
4250
5006
|
*
|
|
4251
5007
|
* The algorithms currently supported include:
|
|
4252
5008
|
*
|
|
4253
|
-
*
|
|
4254
|
-
*
|
|
4255
|
-
*
|
|
4256
|
-
*
|
|
5009
|
+
* * `'AES-CBC'`
|
|
5010
|
+
* * `'AES-CTR'`
|
|
5011
|
+
* * `'AES-GCM'`
|
|
5012
|
+
* * `'AES-OCB'`
|
|
5013
|
+
* * `'ChaCha20-Poly1305'`
|
|
5014
|
+
* * `'RSA-OAEP'`
|
|
4257
5015
|
* @since v15.0.0
|
|
4258
5016
|
*/
|
|
4259
5017
|
decrypt(
|
|
4260
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
5018
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4261
5019
|
key: CryptoKey,
|
|
4262
5020
|
data: BufferSource,
|
|
4263
5021
|
): Promise<ArrayBuffer>;
|
|
4264
5022
|
/**
|
|
4265
5023
|
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
4266
|
-
*
|
|
5024
|
+
* this method attempts to generate `length` bits.
|
|
4267
5025
|
* The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
|
|
4268
5026
|
* When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
|
|
4269
5027
|
* for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
|
|
@@ -4271,11 +5029,14 @@ declare module "crypto" {
|
|
|
4271
5029
|
*
|
|
4272
5030
|
* The algorithms currently supported include:
|
|
4273
5031
|
*
|
|
4274
|
-
*
|
|
4275
|
-
*
|
|
4276
|
-
*
|
|
4277
|
-
*
|
|
4278
|
-
*
|
|
5032
|
+
* * `'Argon2d'`
|
|
5033
|
+
* * `'Argon2i'`
|
|
5034
|
+
* * `'Argon2id'`
|
|
5035
|
+
* * `'ECDH'`
|
|
5036
|
+
* * `'HKDF'`
|
|
5037
|
+
* * `'PBKDF2'`
|
|
5038
|
+
* * `'X25519'`
|
|
5039
|
+
* * `'X448'`
|
|
4279
5040
|
* @since v15.0.0
|
|
4280
5041
|
*/
|
|
4281
5042
|
deriveBits(
|
|
@@ -4284,31 +5045,34 @@ declare module "crypto" {
|
|
|
4284
5045
|
length?: number | null,
|
|
4285
5046
|
): Promise<ArrayBuffer>;
|
|
4286
5047
|
deriveBits(
|
|
4287
|
-
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
5048
|
+
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
|
|
4288
5049
|
baseKey: CryptoKey,
|
|
4289
5050
|
length: number,
|
|
4290
5051
|
): Promise<ArrayBuffer>;
|
|
4291
5052
|
/**
|
|
4292
5053
|
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
4293
|
-
*
|
|
5054
|
+
* this method attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
4294
5055
|
*
|
|
4295
5056
|
* Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
|
|
4296
5057
|
* then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
|
|
4297
5058
|
*
|
|
4298
5059
|
* The algorithms currently supported include:
|
|
4299
5060
|
*
|
|
4300
|
-
*
|
|
4301
|
-
*
|
|
4302
|
-
*
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
5061
|
+
* * `'Argon2d'`
|
|
5062
|
+
* * `'Argon2i'`
|
|
5063
|
+
* * `'Argon2id'`
|
|
5064
|
+
* * `'ECDH'`
|
|
5065
|
+
* * `'HKDF'`
|
|
5066
|
+
* * `'PBKDF2'`
|
|
5067
|
+
* * `'X25519'`
|
|
5068
|
+
* * `'X448'`
|
|
4305
5069
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4306
5070
|
* @since v15.0.0
|
|
4307
5071
|
*/
|
|
4308
5072
|
deriveKey(
|
|
4309
|
-
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
5073
|
+
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
|
|
4310
5074
|
baseKey: CryptoKey,
|
|
4311
|
-
derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams,
|
|
5075
|
+
derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
|
|
4312
5076
|
extractable: boolean,
|
|
4313
5077
|
keyUsages: readonly KeyUsage[],
|
|
4314
5078
|
): Promise<CryptoKey>;
|
|
@@ -4318,30 +5082,73 @@ declare module "crypto" {
|
|
|
4318
5082
|
*
|
|
4319
5083
|
* If `algorithm` is provided as a `<string>`, it must be one of:
|
|
4320
5084
|
*
|
|
4321
|
-
*
|
|
4322
|
-
*
|
|
4323
|
-
*
|
|
4324
|
-
*
|
|
5085
|
+
* * `'cSHAKE128'`
|
|
5086
|
+
* * `'cSHAKE256'`
|
|
5087
|
+
* * `'SHA-1'`
|
|
5088
|
+
* * `'SHA-256'`
|
|
5089
|
+
* * `'SHA-384'`
|
|
5090
|
+
* * `'SHA-512'`
|
|
5091
|
+
* * `'SHA3-256'`
|
|
5092
|
+
* * `'SHA3-384'`
|
|
5093
|
+
* * `'SHA3-512'`
|
|
4325
5094
|
*
|
|
4326
5095
|
* If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
|
|
4327
5096
|
* @since v15.0.0
|
|
4328
5097
|
*/
|
|
4329
|
-
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
5098
|
+
digest(algorithm: AlgorithmIdentifier | CShakeParams, data: BufferSource): Promise<ArrayBuffer>;
|
|
5099
|
+
/**
|
|
5100
|
+
* Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key.
|
|
5101
|
+
* This encrypted key is the "encapsulated key" represented as `EncapsulatedBits`.
|
|
5102
|
+
*
|
|
5103
|
+
* The algorithms currently supported include:
|
|
5104
|
+
*
|
|
5105
|
+
* * `'ML-KEM-512'`
|
|
5106
|
+
* * `'ML-KEM-768'`
|
|
5107
|
+
* * `'ML-KEM-1024'`
|
|
5108
|
+
* @since v24.7.0
|
|
5109
|
+
* @returns Fulfills with `EncapsulatedBits` upon success.
|
|
5110
|
+
*/
|
|
5111
|
+
encapsulateBits(
|
|
5112
|
+
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
5113
|
+
encapsulationKey: CryptoKey,
|
|
5114
|
+
): Promise<EncapsulatedBits>;
|
|
5115
|
+
/**
|
|
5116
|
+
* Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key.
|
|
5117
|
+
* This encrypted key is the "encapsulated key" represented as `EncapsulatedKey`.
|
|
5118
|
+
*
|
|
5119
|
+
* The algorithms currently supported include:
|
|
5120
|
+
*
|
|
5121
|
+
* * `'ML-KEM-512'`
|
|
5122
|
+
* * `'ML-KEM-768'`
|
|
5123
|
+
* * `'ML-KEM-1024'`
|
|
5124
|
+
* @since v24.7.0
|
|
5125
|
+
* @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
|
|
5126
|
+
* @returns Fulfills with `EncapsulatedKey` upon success.
|
|
5127
|
+
*/
|
|
5128
|
+
encapsulateKey(
|
|
5129
|
+
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
5130
|
+
encapsulationKey: CryptoKey,
|
|
5131
|
+
sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
|
|
5132
|
+
extractable: boolean,
|
|
5133
|
+
usages: KeyUsage[],
|
|
5134
|
+
): Promise<EncapsulatedKey>;
|
|
4330
5135
|
/**
|
|
4331
5136
|
* Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
|
|
4332
|
-
*
|
|
5137
|
+
* this method attempts to encipher `data`. If successful,
|
|
4333
5138
|
* the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
|
|
4334
5139
|
*
|
|
4335
5140
|
* The algorithms currently supported include:
|
|
4336
5141
|
*
|
|
4337
|
-
*
|
|
4338
|
-
*
|
|
4339
|
-
*
|
|
4340
|
-
*
|
|
5142
|
+
* * `'AES-CBC'`
|
|
5143
|
+
* * `'AES-CTR'`
|
|
5144
|
+
* * `'AES-GCM'`
|
|
5145
|
+
* * `'AES-OCB'`
|
|
5146
|
+
* * `'ChaCha20-Poly1305'`
|
|
5147
|
+
* * `'RSA-OAEP'`
|
|
4341
5148
|
* @since v15.0.0
|
|
4342
5149
|
*/
|
|
4343
5150
|
encrypt(
|
|
4344
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
5151
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4345
5152
|
key: CryptoKey,
|
|
4346
5153
|
data: BufferSource,
|
|
4347
5154
|
): Promise<ArrayBuffer>;
|
|
@@ -4355,35 +5162,47 @@ declare module "crypto" {
|
|
|
4355
5162
|
*
|
|
4356
5163
|
* When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
|
|
4357
5164
|
* JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
|
|
4358
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`,
|
|
5165
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
5166
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4359
5167
|
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
4360
5168
|
* @since v15.0.0
|
|
4361
5169
|
*/
|
|
4362
5170
|
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
4363
5171
|
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
4364
5172
|
/**
|
|
4365
|
-
* Using the
|
|
4366
|
-
*
|
|
4367
|
-
*
|
|
5173
|
+
* Using the parameters provided in `algorithm`, this method
|
|
5174
|
+
* attempts to generate new keying material. Depending on the algorithm used
|
|
5175
|
+
* either a single `CryptoKey` or a `CryptoKeyPair` is generated.
|
|
4368
5176
|
*
|
|
4369
|
-
* The
|
|
5177
|
+
* The `CryptoKeyPair` (public and private key) generating algorithms supported
|
|
5178
|
+
* include:
|
|
4370
5179
|
*
|
|
4371
|
-
*
|
|
4372
|
-
*
|
|
4373
|
-
*
|
|
4374
|
-
*
|
|
4375
|
-
*
|
|
4376
|
-
*
|
|
4377
|
-
*
|
|
4378
|
-
*
|
|
4379
|
-
*
|
|
4380
|
-
*
|
|
5180
|
+
* * `'ECDH'`
|
|
5181
|
+
* * `'ECDSA'`
|
|
5182
|
+
* * `'Ed25519'`
|
|
5183
|
+
* * `'Ed448'`
|
|
5184
|
+
* * `'ML-DSA-44'`
|
|
5185
|
+
* * `'ML-DSA-65'`
|
|
5186
|
+
* * `'ML-DSA-87'`
|
|
5187
|
+
* * `'ML-KEM-512'`
|
|
5188
|
+
* * `'ML-KEM-768'`
|
|
5189
|
+
* * `'ML-KEM-1024'`
|
|
5190
|
+
* * `'RSA-OAEP'`
|
|
5191
|
+
* * `'RSA-PSS'`
|
|
5192
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
5193
|
+
* * `'X25519'`
|
|
5194
|
+
* * `'X448'`
|
|
4381
5195
|
*
|
|
4382
|
-
*
|
|
4383
|
-
*
|
|
4384
|
-
*
|
|
4385
|
-
*
|
|
4386
|
-
*
|
|
5196
|
+
* The `CryptoKey` (secret key) generating algorithms supported include:
|
|
5197
|
+
* * `'AES-CBC'`
|
|
5198
|
+
* * `'AES-CTR'`
|
|
5199
|
+
* * `'AES-GCM'`
|
|
5200
|
+
* * `'AES-KW'`
|
|
5201
|
+
* * `'AES-OCB'`
|
|
5202
|
+
* * `'ChaCha20-Poly1305'`
|
|
5203
|
+
* * `'HMAC'`
|
|
5204
|
+
* * `'KMAC128'`
|
|
5205
|
+
* * `'KMAC256'`
|
|
4387
5206
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4388
5207
|
* @since v15.0.0
|
|
4389
5208
|
*/
|
|
@@ -4393,7 +5212,7 @@ declare module "crypto" {
|
|
|
4393
5212
|
keyUsages: readonly KeyUsage[],
|
|
4394
5213
|
): Promise<CryptoKeyPair>;
|
|
4395
5214
|
generateKey(
|
|
4396
|
-
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
|
|
5215
|
+
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params | KmacKeyGenParams,
|
|
4397
5216
|
extractable: boolean,
|
|
4398
5217
|
keyUsages: readonly KeyUsage[],
|
|
4399
5218
|
): Promise<CryptoKey>;
|
|
@@ -4403,12 +5222,23 @@ declare module "crypto" {
|
|
|
4403
5222
|
keyUsages: KeyUsage[],
|
|
4404
5223
|
): Promise<CryptoKeyPair | CryptoKey>;
|
|
4405
5224
|
/**
|
|
4406
|
-
*
|
|
4407
|
-
*
|
|
4408
|
-
*
|
|
5225
|
+
* Derives the public key from a given private key.
|
|
5226
|
+
* @since v24.7.0
|
|
5227
|
+
* @param key A private key from which to derive the corresponding public key.
|
|
5228
|
+
* @param keyUsages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
|
|
5229
|
+
* @returns Fulfills with a `CryptoKey` upon success.
|
|
5230
|
+
*/
|
|
5231
|
+
getPublicKey(key: CryptoKey, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
5232
|
+
/**
|
|
5233
|
+
* This method attempts to interpret the provided `keyData`
|
|
5234
|
+
* as the given `format` to create a `CryptoKey` instance using the provided
|
|
5235
|
+
* `algorithm`, `extractable`, and `keyUsages` arguments. If the import is
|
|
5236
|
+
* successful, the returned promise will be resolved with a {CryptoKey}
|
|
5237
|
+
* representation of the key material.
|
|
4409
5238
|
*
|
|
4410
|
-
* If importing
|
|
4411
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`,
|
|
5239
|
+
* If importing KDF algorithm keys, `extractable` must be `false`.
|
|
5240
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
5241
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4412
5242
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4413
5243
|
* @since v15.0.0
|
|
4414
5244
|
*/
|
|
@@ -4420,7 +5250,8 @@ declare module "crypto" {
|
|
|
4420
5250
|
| RsaHashedImportParams
|
|
4421
5251
|
| EcKeyImportParams
|
|
4422
5252
|
| HmacImportParams
|
|
4423
|
-
| AesKeyAlgorithm
|
|
5253
|
+
| AesKeyAlgorithm
|
|
5254
|
+
| KmacImportParams,
|
|
4424
5255
|
extractable: boolean,
|
|
4425
5256
|
keyUsages: readonly KeyUsage[],
|
|
4426
5257
|
): Promise<CryptoKey>;
|
|
@@ -4432,62 +5263,81 @@ declare module "crypto" {
|
|
|
4432
5263
|
| RsaHashedImportParams
|
|
4433
5264
|
| EcKeyImportParams
|
|
4434
5265
|
| HmacImportParams
|
|
4435
|
-
| AesKeyAlgorithm
|
|
5266
|
+
| AesKeyAlgorithm
|
|
5267
|
+
| KmacImportParams,
|
|
4436
5268
|
extractable: boolean,
|
|
4437
5269
|
keyUsages: KeyUsage[],
|
|
4438
5270
|
): Promise<CryptoKey>;
|
|
4439
5271
|
/**
|
|
4440
5272
|
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
4441
|
-
*
|
|
5273
|
+
* this method attempts to generate a cryptographic signature of `data`. If successful,
|
|
4442
5274
|
* the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
|
|
4443
5275
|
*
|
|
4444
5276
|
* The algorithms currently supported include:
|
|
4445
5277
|
*
|
|
4446
|
-
*
|
|
4447
|
-
*
|
|
4448
|
-
*
|
|
4449
|
-
*
|
|
4450
|
-
*
|
|
4451
|
-
*
|
|
5278
|
+
* * `'ECDSA'`
|
|
5279
|
+
* * `'Ed25519'`
|
|
5280
|
+
* * `'Ed448'`
|
|
5281
|
+
* * `'HMAC'`
|
|
5282
|
+
* * `'KMAC128'`
|
|
5283
|
+
* * `'KMAC256'`
|
|
5284
|
+
* * `'ML-DSA-44'`
|
|
5285
|
+
* * `'ML-DSA-65'`
|
|
5286
|
+
* * `'ML-DSA-87'`
|
|
5287
|
+
* * `'RSA-PSS'`
|
|
5288
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
4452
5289
|
* @since v15.0.0
|
|
4453
5290
|
*/
|
|
4454
5291
|
sign(
|
|
4455
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams |
|
|
5292
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams,
|
|
4456
5293
|
key: CryptoKey,
|
|
4457
5294
|
data: BufferSource,
|
|
4458
5295
|
): Promise<ArrayBuffer>;
|
|
4459
5296
|
/**
|
|
4460
5297
|
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
4461
|
-
*
|
|
5298
|
+
* This method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
4462
5299
|
* It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
|
|
4463
5300
|
* then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
|
|
4464
5301
|
* If successful, the returned promise is resolved with a `<CryptoKey>` object.
|
|
4465
5302
|
*
|
|
4466
5303
|
* The wrapping algorithms currently supported include:
|
|
4467
5304
|
*
|
|
4468
|
-
*
|
|
4469
|
-
*
|
|
4470
|
-
*
|
|
4471
|
-
*
|
|
4472
|
-
*
|
|
5305
|
+
* * `'AES-CBC'`
|
|
5306
|
+
* * `'AES-CTR'`
|
|
5307
|
+
* * `'AES-GCM'`
|
|
5308
|
+
* * `'AES-KW'`
|
|
5309
|
+
* * `'AES-OCB'`
|
|
5310
|
+
* * `'ChaCha20-Poly1305'`
|
|
5311
|
+
* * `'RSA-OAEP'`
|
|
4473
5312
|
*
|
|
4474
5313
|
* The unwrapped key algorithms supported include:
|
|
4475
5314
|
*
|
|
4476
|
-
*
|
|
4477
|
-
*
|
|
4478
|
-
*
|
|
4479
|
-
*
|
|
4480
|
-
*
|
|
4481
|
-
*
|
|
4482
|
-
*
|
|
4483
|
-
*
|
|
4484
|
-
*
|
|
4485
|
-
*
|
|
4486
|
-
*
|
|
4487
|
-
*
|
|
4488
|
-
*
|
|
4489
|
-
*
|
|
4490
|
-
*
|
|
5315
|
+
* * `'AES-CBC'`
|
|
5316
|
+
* * `'AES-CTR'`
|
|
5317
|
+
* * `'AES-GCM'`
|
|
5318
|
+
* * `'AES-KW'`
|
|
5319
|
+
* * `'AES-OCB'`
|
|
5320
|
+
* * `'ChaCha20-Poly1305'`
|
|
5321
|
+
* * `'ECDH'`
|
|
5322
|
+
* * `'ECDSA'`
|
|
5323
|
+
* * `'Ed25519'`
|
|
5324
|
+
* * `'Ed448'`
|
|
5325
|
+
* * `'HMAC'`
|
|
5326
|
+
* * `'KMAC128'`
|
|
5327
|
+
* * `'KMAC256'`
|
|
5328
|
+
* * `'ML-DSA-44'`
|
|
5329
|
+
* * `'ML-DSA-65'`
|
|
5330
|
+
* * `'ML-DSA-87'`
|
|
5331
|
+
* * `'ML-KEM-512'`
|
|
5332
|
+
* * `'ML-KEM-768'`
|
|
5333
|
+
* * `'ML-KEM-1024'`
|
|
5334
|
+
* * `'RSA-OAEP'`
|
|
5335
|
+
* * `'RSA-PSS'`
|
|
5336
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
5337
|
+
* * `'X25519'`
|
|
5338
|
+
* * `'X448'`
|
|
5339
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
5340
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4491
5341
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4492
5342
|
* @since v15.0.0
|
|
4493
5343
|
*/
|
|
@@ -4495,40 +5345,46 @@ declare module "crypto" {
|
|
|
4495
5345
|
format: KeyFormat,
|
|
4496
5346
|
wrappedKey: BufferSource,
|
|
4497
5347
|
unwrappingKey: CryptoKey,
|
|
4498
|
-
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
5348
|
+
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4499
5349
|
unwrappedKeyAlgorithm:
|
|
4500
5350
|
| AlgorithmIdentifier
|
|
4501
5351
|
| RsaHashedImportParams
|
|
4502
5352
|
| EcKeyImportParams
|
|
4503
5353
|
| HmacImportParams
|
|
4504
|
-
| AesKeyAlgorithm
|
|
5354
|
+
| AesKeyAlgorithm
|
|
5355
|
+
| KmacImportParams,
|
|
4505
5356
|
extractable: boolean,
|
|
4506
5357
|
keyUsages: KeyUsage[],
|
|
4507
5358
|
): Promise<CryptoKey>;
|
|
4508
5359
|
/**
|
|
4509
5360
|
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
4510
|
-
*
|
|
5361
|
+
* This method attempts to verify that `signature` is a valid cryptographic signature of `data`.
|
|
4511
5362
|
* The returned promise is resolved with either `true` or `false`.
|
|
4512
5363
|
*
|
|
4513
5364
|
* The algorithms currently supported include:
|
|
4514
5365
|
*
|
|
4515
|
-
*
|
|
4516
|
-
*
|
|
4517
|
-
*
|
|
4518
|
-
*
|
|
4519
|
-
*
|
|
4520
|
-
*
|
|
5366
|
+
* * `'ECDSA'`
|
|
5367
|
+
* * `'Ed25519'`
|
|
5368
|
+
* * `'Ed448'`
|
|
5369
|
+
* * `'HMAC'`
|
|
5370
|
+
* * `'KMAC128'`
|
|
5371
|
+
* * `'KMAC256'`
|
|
5372
|
+
* * `'ML-DSA-44'`
|
|
5373
|
+
* * `'ML-DSA-65'`
|
|
5374
|
+
* * `'ML-DSA-87'`
|
|
5375
|
+
* * `'RSA-PSS'`
|
|
5376
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
4521
5377
|
* @since v15.0.0
|
|
4522
5378
|
*/
|
|
4523
5379
|
verify(
|
|
4524
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams |
|
|
5380
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams,
|
|
4525
5381
|
key: CryptoKey,
|
|
4526
5382
|
signature: BufferSource,
|
|
4527
5383
|
data: BufferSource,
|
|
4528
5384
|
): Promise<boolean>;
|
|
4529
5385
|
/**
|
|
4530
5386
|
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
4531
|
-
*
|
|
5387
|
+
* This method exports the keying material into the format identified by `format`,
|
|
4532
5388
|
* then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
|
|
4533
5389
|
* It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
|
|
4534
5390
|
* then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
|
|
@@ -4536,30 +5392,25 @@ declare module "crypto" {
|
|
|
4536
5392
|
*
|
|
4537
5393
|
* The wrapping algorithms currently supported include:
|
|
4538
5394
|
*
|
|
4539
|
-
*
|
|
4540
|
-
*
|
|
4541
|
-
*
|
|
4542
|
-
*
|
|
4543
|
-
*
|
|
4544
|
-
*
|
|
5395
|
+
* * `'AES-CBC'`
|
|
5396
|
+
* * `'AES-CTR'`
|
|
5397
|
+
* * `'AES-GCM'`
|
|
5398
|
+
* * `'AES-KW'`
|
|
5399
|
+
* * `'AES-OCB'`
|
|
5400
|
+
* * `'ChaCha20-Poly1305'`
|
|
5401
|
+
* * `'RSA-OAEP'`
|
|
5402
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
5403
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4545
5404
|
* @since v15.0.0
|
|
4546
5405
|
*/
|
|
4547
5406
|
wrapKey(
|
|
4548
5407
|
format: KeyFormat,
|
|
4549
5408
|
key: CryptoKey,
|
|
4550
5409
|
wrappingKey: CryptoKey,
|
|
4551
|
-
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
5410
|
+
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4552
5411
|
): Promise<ArrayBuffer>;
|
|
4553
5412
|
}
|
|
4554
5413
|
}
|
|
4555
|
-
|
|
4556
|
-
global {
|
|
4557
|
-
var crypto: typeof globalThis extends {
|
|
4558
|
-
crypto: infer T;
|
|
4559
|
-
onmessage: any;
|
|
4560
|
-
} ? T
|
|
4561
|
-
: webcrypto.Crypto;
|
|
4562
|
-
}
|
|
4563
5414
|
}
|
|
4564
5415
|
declare module "node:crypto" {
|
|
4565
5416
|
export * from "crypto";
|