@types/node 24.3.0 → 24.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert/strict.d.ts +105 -2
- node/assert.d.ts +119 -95
- node/buffer.d.ts +1 -1
- node/child_process.d.ts +16 -10
- node/cluster.d.ts +3 -4
- node/crypto.d.ts +699 -179
- node/dns.d.ts +6 -1
- node/events.d.ts +80 -34
- node/fs/promises.d.ts +22 -0
- node/fs.d.ts +272 -11
- node/globals.d.ts +149 -346
- node/http.d.ts +71 -13
- node/http2.d.ts +5 -4
- node/https.d.ts +14 -12
- node/index.d.ts +9 -2
- node/inspector.d.ts +205 -4139
- node/inspector.generated.d.ts +4233 -0
- node/module.d.ts +1 -0
- node/net.d.ts +26 -5
- node/os.d.ts +13 -3
- node/package.json +3 -3
- node/perf_hooks.d.ts +6 -8
- node/process.d.ts +7 -19
- node/readline/promises.d.ts +1 -1
- node/sqlite.d.ts +40 -4
- node/stream/web.d.ts +6 -55
- node/stream.d.ts +29 -22
- node/test.d.ts +31 -26
- node/tls.d.ts +34 -2
- node/ts5.6/index.d.ts +9 -2
- node/ts5.7/index.d.ts +9 -2
- node/url.d.ts +14 -6
- node/util.d.ts +11 -4
- node/v8.d.ts +2 -2
- node/vm.d.ts +91 -58
- node/wasi.d.ts +21 -0
- node/web-globals/abortcontroller.d.ts +34 -0
- node/web-globals/crypto.d.ts +32 -0
- node/web-globals/domexception.d.ts +68 -0
- node/{dom-events.d.ts → web-globals/events.d.ts} +49 -51
- node/web-globals/fetch.d.ts +50 -0
- node/web-globals/navigator.d.ts +25 -0
- node/web-globals/storage.d.ts +24 -0
- node/web-globals/streams.d.ts +22 -0
- node/worker_threads.d.ts +84 -50
- node/zlib.d.ts +6 -0
node/crypto.d.ts
CHANGED
|
@@ -510,50 +510,50 @@ declare module "crypto" {
|
|
|
510
510
|
format: "jwk";
|
|
511
511
|
}
|
|
512
512
|
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
|
|
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;
|
|
526
526
|
[key: string]: unknown;
|
|
527
527
|
}
|
|
528
528
|
interface AsymmetricKeyDetails {
|
|
529
529
|
/**
|
|
530
530
|
* Key size in bits (RSA, DSA).
|
|
531
531
|
*/
|
|
532
|
-
modulusLength?: number
|
|
532
|
+
modulusLength?: number;
|
|
533
533
|
/**
|
|
534
534
|
* Public exponent (RSA).
|
|
535
535
|
*/
|
|
536
|
-
publicExponent?: bigint
|
|
536
|
+
publicExponent?: bigint;
|
|
537
537
|
/**
|
|
538
538
|
* Name of the message digest (RSA-PSS).
|
|
539
539
|
*/
|
|
540
|
-
hashAlgorithm?: string
|
|
540
|
+
hashAlgorithm?: string;
|
|
541
541
|
/**
|
|
542
542
|
* Name of the message digest used by MGF1 (RSA-PSS).
|
|
543
543
|
*/
|
|
544
|
-
mgf1HashAlgorithm?: string
|
|
544
|
+
mgf1HashAlgorithm?: string;
|
|
545
545
|
/**
|
|
546
546
|
* Minimal salt length in bytes (RSA-PSS).
|
|
547
547
|
*/
|
|
548
|
-
saltLength?: number
|
|
548
|
+
saltLength?: number;
|
|
549
549
|
/**
|
|
550
550
|
* Size of q in bits (DSA).
|
|
551
551
|
*/
|
|
552
|
-
divisorLength?: number
|
|
552
|
+
divisorLength?: number;
|
|
553
553
|
/**
|
|
554
554
|
* Name of the curve (EC).
|
|
555
555
|
*/
|
|
556
|
-
namedCurve?: string
|
|
556
|
+
namedCurve?: string;
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
|
|
@@ -591,24 +591,14 @@ declare module "crypto" {
|
|
|
591
591
|
*/
|
|
592
592
|
static from(key: webcrypto.CryptoKey): KeyObject;
|
|
593
593
|
/**
|
|
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)
|
|
594
|
+
* For asymmetric keys, this property represents the type of the key. See the
|
|
595
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
606
596
|
*
|
|
607
597
|
* This property is `undefined` for unrecognized `KeyObject` types and symmetric
|
|
608
598
|
* keys.
|
|
609
599
|
* @since v11.6.0
|
|
610
600
|
*/
|
|
611
|
-
asymmetricKeyType?: KeyType
|
|
601
|
+
asymmetricKeyType?: KeyType;
|
|
612
602
|
/**
|
|
613
603
|
* This property exists only on asymmetric keys. Depending on the type of the key,
|
|
614
604
|
* this object contains information about the key. None of the information obtained
|
|
@@ -622,7 +612,7 @@ declare module "crypto" {
|
|
|
622
612
|
* Other key details might be exposed via this API using additional attributes.
|
|
623
613
|
* @since v15.7.0
|
|
624
614
|
*/
|
|
625
|
-
asymmetricKeyDetails?: AsymmetricKeyDetails
|
|
615
|
+
asymmetricKeyDetails?: AsymmetricKeyDetails;
|
|
626
616
|
/**
|
|
627
617
|
* For symmetric keys, the following encoding options can be used:
|
|
628
618
|
*
|
|
@@ -661,7 +651,7 @@ declare module "crypto" {
|
|
|
661
651
|
* property is `undefined` for asymmetric keys.
|
|
662
652
|
* @since v11.6.0
|
|
663
653
|
*/
|
|
664
|
-
symmetricKeySize?: number
|
|
654
|
+
symmetricKeySize?: number;
|
|
665
655
|
/**
|
|
666
656
|
* Converts a `KeyObject` instance to a `CryptoKey`.
|
|
667
657
|
* @since 22.10.0
|
|
@@ -2456,7 +2446,22 @@ declare module "crypto" {
|
|
|
2456
2446
|
* @since v6.6.0
|
|
2457
2447
|
*/
|
|
2458
2448
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2459
|
-
type KeyType =
|
|
2449
|
+
type KeyType =
|
|
2450
|
+
| "dh"
|
|
2451
|
+
| "dsa"
|
|
2452
|
+
| "ec"
|
|
2453
|
+
| "ed25519"
|
|
2454
|
+
| "ed448"
|
|
2455
|
+
| "ml-dsa-44"
|
|
2456
|
+
| "ml-dsa-65"
|
|
2457
|
+
| "ml-dsa-87"
|
|
2458
|
+
| "ml-kem-1024"
|
|
2459
|
+
| "ml-kem-512"
|
|
2460
|
+
| "ml-kem-768"
|
|
2461
|
+
| "rsa-pss"
|
|
2462
|
+
| "rsa"
|
|
2463
|
+
| "x25519"
|
|
2464
|
+
| "x448";
|
|
2460
2465
|
type KeyFormat = "pem" | "der" | "jwk";
|
|
2461
2466
|
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2462
2467
|
format: T;
|
|
@@ -2471,6 +2476,8 @@ declare module "crypto" {
|
|
|
2471
2476
|
interface ED448KeyPairKeyObjectOptions {}
|
|
2472
2477
|
interface X25519KeyPairKeyObjectOptions {}
|
|
2473
2478
|
interface X448KeyPairKeyObjectOptions {}
|
|
2479
|
+
interface MLDSAKeyPairKeyObjectOptions {}
|
|
2480
|
+
interface MLKEMKeyPairKeyObjectOptions {}
|
|
2474
2481
|
interface ECKeyPairKeyObjectOptions {
|
|
2475
2482
|
/**
|
|
2476
2483
|
* Name of the curve to use
|
|
@@ -2505,15 +2512,15 @@ declare module "crypto" {
|
|
|
2505
2512
|
/**
|
|
2506
2513
|
* Name of the message digest
|
|
2507
2514
|
*/
|
|
2508
|
-
hashAlgorithm?: string;
|
|
2515
|
+
hashAlgorithm?: string | undefined;
|
|
2509
2516
|
/**
|
|
2510
2517
|
* Name of the message digest used by MGF1
|
|
2511
2518
|
*/
|
|
2512
|
-
mgf1HashAlgorithm?: string;
|
|
2519
|
+
mgf1HashAlgorithm?: string | undefined;
|
|
2513
2520
|
/**
|
|
2514
2521
|
* Minimal salt length in bytes
|
|
2515
2522
|
*/
|
|
2516
|
-
saltLength?: string;
|
|
2523
|
+
saltLength?: string | undefined;
|
|
2517
2524
|
}
|
|
2518
2525
|
interface DSAKeyPairKeyObjectOptions {
|
|
2519
2526
|
/**
|
|
@@ -2556,15 +2563,15 @@ declare module "crypto" {
|
|
|
2556
2563
|
/**
|
|
2557
2564
|
* Name of the message digest
|
|
2558
2565
|
*/
|
|
2559
|
-
hashAlgorithm?: string;
|
|
2566
|
+
hashAlgorithm?: string | undefined;
|
|
2560
2567
|
/**
|
|
2561
2568
|
* Name of the message digest used by MGF1
|
|
2562
2569
|
*/
|
|
2563
|
-
mgf1HashAlgorithm?: string;
|
|
2570
|
+
mgf1HashAlgorithm?: string | undefined;
|
|
2564
2571
|
/**
|
|
2565
2572
|
* Minimal salt length in bytes
|
|
2566
2573
|
*/
|
|
2567
|
-
saltLength?: string;
|
|
2574
|
+
saltLength?: string | undefined;
|
|
2568
2575
|
publicKeyEncoding: {
|
|
2569
2576
|
type: "spki";
|
|
2570
2577
|
format: PubF;
|
|
@@ -2635,13 +2642,31 @@ declare module "crypto" {
|
|
|
2635
2642
|
type: "pkcs8";
|
|
2636
2643
|
};
|
|
2637
2644
|
}
|
|
2645
|
+
interface MLDSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2646
|
+
publicKeyEncoding: {
|
|
2647
|
+
type: "spki";
|
|
2648
|
+
format: PubF;
|
|
2649
|
+
};
|
|
2650
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2651
|
+
type: "pkcs8";
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
interface MLKEMKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2655
|
+
publicKeyEncoding: {
|
|
2656
|
+
type: "spki";
|
|
2657
|
+
format: PubF;
|
|
2658
|
+
};
|
|
2659
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2660
|
+
type: "pkcs8";
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2638
2663
|
interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
|
2639
2664
|
publicKey: T1;
|
|
2640
2665
|
privateKey: T2;
|
|
2641
2666
|
}
|
|
2642
2667
|
/**
|
|
2643
2668
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2644
|
-
* Ed25519, Ed448, X25519, X448, and
|
|
2669
|
+
* Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
|
|
2645
2670
|
*
|
|
2646
2671
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
2647
2672
|
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
@@ -2678,7 +2703,8 @@ declare module "crypto" {
|
|
|
2678
2703
|
* When PEM encoding was selected, the respective key will be a string, otherwise
|
|
2679
2704
|
* it will be a buffer containing the data encoded as DER.
|
|
2680
2705
|
* @since v10.12.0
|
|
2681
|
-
* @param type
|
|
2706
|
+
* @param type The asymmetric key type to generate. See the
|
|
2707
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
2682
2708
|
*/
|
|
2683
2709
|
function generateKeyPairSync(
|
|
2684
2710
|
type: "rsa",
|
|
@@ -2816,6 +2842,46 @@ declare module "crypto" {
|
|
|
2816
2842
|
options: X448KeyPairOptions<"der", "der">,
|
|
2817
2843
|
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2818
2844
|
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2845
|
+
function generateKeyPairSync(
|
|
2846
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2847
|
+
options: MLDSAKeyPairOptions<"pem", "pem">,
|
|
2848
|
+
): KeyPairSyncResult<string, string>;
|
|
2849
|
+
function generateKeyPairSync(
|
|
2850
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2851
|
+
options: MLDSAKeyPairOptions<"pem", "der">,
|
|
2852
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2853
|
+
function generateKeyPairSync(
|
|
2854
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2855
|
+
options: MLDSAKeyPairOptions<"der", "pem">,
|
|
2856
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2857
|
+
function generateKeyPairSync(
|
|
2858
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2859
|
+
options: MLDSAKeyPairOptions<"der", "der">,
|
|
2860
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2861
|
+
function generateKeyPairSync(
|
|
2862
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
2863
|
+
options?: MLDSAKeyPairKeyObjectOptions,
|
|
2864
|
+
): KeyPairKeyObjectResult;
|
|
2865
|
+
function generateKeyPairSync(
|
|
2866
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2867
|
+
options: MLKEMKeyPairOptions<"pem", "pem">,
|
|
2868
|
+
): KeyPairSyncResult<string, string>;
|
|
2869
|
+
function generateKeyPairSync(
|
|
2870
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2871
|
+
options: MLKEMKeyPairOptions<"pem", "der">,
|
|
2872
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2873
|
+
function generateKeyPairSync(
|
|
2874
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2875
|
+
options: MLKEMKeyPairOptions<"der", "pem">,
|
|
2876
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2877
|
+
function generateKeyPairSync(
|
|
2878
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2879
|
+
options: MLKEMKeyPairOptions<"der", "der">,
|
|
2880
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2881
|
+
function generateKeyPairSync(
|
|
2882
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
2883
|
+
options?: MLKEMKeyPairKeyObjectOptions,
|
|
2884
|
+
): KeyPairKeyObjectResult;
|
|
2819
2885
|
/**
|
|
2820
2886
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2821
2887
|
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
@@ -2853,7 +2919,8 @@ declare module "crypto" {
|
|
|
2853
2919
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
2854
2920
|
* a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
|
|
2855
2921
|
* @since v10.12.0
|
|
2856
|
-
* @param type
|
|
2922
|
+
* @param type The asymmetric key type to generate. See the
|
|
2923
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v24.x/api/crypto.html#asymmetric-key-types).
|
|
2857
2924
|
*/
|
|
2858
2925
|
function generateKeyPair(
|
|
2859
2926
|
type: "rsa",
|
|
@@ -3055,6 +3122,56 @@ declare module "crypto" {
|
|
|
3055
3122
|
options: X448KeyPairKeyObjectOptions | undefined,
|
|
3056
3123
|
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3057
3124
|
): void;
|
|
3125
|
+
function generateKeyPair(
|
|
3126
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3127
|
+
options: MLDSAKeyPairOptions<"pem", "pem">,
|
|
3128
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3129
|
+
): void;
|
|
3130
|
+
function generateKeyPair(
|
|
3131
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3132
|
+
options: MLDSAKeyPairOptions<"pem", "der">,
|
|
3133
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3134
|
+
): void;
|
|
3135
|
+
function generateKeyPair(
|
|
3136
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3137
|
+
options: MLDSAKeyPairOptions<"der", "pem">,
|
|
3138
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3139
|
+
): void;
|
|
3140
|
+
function generateKeyPair(
|
|
3141
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3142
|
+
options: MLDSAKeyPairOptions<"der", "der">,
|
|
3143
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3144
|
+
): void;
|
|
3145
|
+
function generateKeyPair(
|
|
3146
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3147
|
+
options: MLDSAKeyPairKeyObjectOptions | undefined,
|
|
3148
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3149
|
+
): void;
|
|
3150
|
+
function generateKeyPair(
|
|
3151
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3152
|
+
options: MLKEMKeyPairOptions<"pem", "pem">,
|
|
3153
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3154
|
+
): void;
|
|
3155
|
+
function generateKeyPair(
|
|
3156
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3157
|
+
options: MLKEMKeyPairOptions<"pem", "der">,
|
|
3158
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3159
|
+
): void;
|
|
3160
|
+
function generateKeyPair(
|
|
3161
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3162
|
+
options: MLKEMKeyPairOptions<"der", "pem">,
|
|
3163
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3164
|
+
): void;
|
|
3165
|
+
function generateKeyPair(
|
|
3166
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3167
|
+
options: MLKEMKeyPairOptions<"der", "der">,
|
|
3168
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3169
|
+
): void;
|
|
3170
|
+
function generateKeyPair(
|
|
3171
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3172
|
+
options: MLKEMKeyPairKeyObjectOptions | undefined,
|
|
3173
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3174
|
+
): void;
|
|
3058
3175
|
namespace generateKeyPair {
|
|
3059
3176
|
function __promisify__(
|
|
3060
3177
|
type: "rsa",
|
|
@@ -3297,11 +3414,78 @@ declare module "crypto" {
|
|
|
3297
3414
|
privateKey: Buffer;
|
|
3298
3415
|
}>;
|
|
3299
3416
|
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3417
|
+
function __promisify__(
|
|
3418
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3419
|
+
options: MLDSAKeyPairOptions<"pem", "pem">,
|
|
3420
|
+
): Promise<{
|
|
3421
|
+
publicKey: string;
|
|
3422
|
+
privateKey: string;
|
|
3423
|
+
}>;
|
|
3424
|
+
function __promisify__(
|
|
3425
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3426
|
+
options: MLDSAKeyPairOptions<"pem", "der">,
|
|
3427
|
+
): Promise<{
|
|
3428
|
+
publicKey: string;
|
|
3429
|
+
privateKey: Buffer;
|
|
3430
|
+
}>;
|
|
3431
|
+
function __promisify__(
|
|
3432
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3433
|
+
options: MLDSAKeyPairOptions<"der", "pem">,
|
|
3434
|
+
): Promise<{
|
|
3435
|
+
publicKey: Buffer;
|
|
3436
|
+
privateKey: string;
|
|
3437
|
+
}>;
|
|
3438
|
+
function __promisify__(
|
|
3439
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3440
|
+
options: MLDSAKeyPairOptions<"der", "der">,
|
|
3441
|
+
): Promise<{
|
|
3442
|
+
publicKey: Buffer;
|
|
3443
|
+
privateKey: Buffer;
|
|
3444
|
+
}>;
|
|
3445
|
+
function __promisify__(
|
|
3446
|
+
type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
|
|
3447
|
+
options?: MLDSAKeyPairKeyObjectOptions,
|
|
3448
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3449
|
+
function __promisify__(
|
|
3450
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3451
|
+
options: MLKEMKeyPairOptions<"pem", "pem">,
|
|
3452
|
+
): Promise<{
|
|
3453
|
+
publicKey: string;
|
|
3454
|
+
privateKey: string;
|
|
3455
|
+
}>;
|
|
3456
|
+
function __promisify__(
|
|
3457
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3458
|
+
options: MLKEMKeyPairOptions<"pem", "der">,
|
|
3459
|
+
): Promise<{
|
|
3460
|
+
publicKey: string;
|
|
3461
|
+
privateKey: Buffer;
|
|
3462
|
+
}>;
|
|
3463
|
+
function __promisify__(
|
|
3464
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3465
|
+
options: MLKEMKeyPairOptions<"der", "pem">,
|
|
3466
|
+
): Promise<{
|
|
3467
|
+
publicKey: Buffer;
|
|
3468
|
+
privateKey: string;
|
|
3469
|
+
}>;
|
|
3470
|
+
function __promisify__(
|
|
3471
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3472
|
+
options: MLKEMKeyPairOptions<"der", "der">,
|
|
3473
|
+
): Promise<{
|
|
3474
|
+
publicKey: Buffer;
|
|
3475
|
+
privateKey: Buffer;
|
|
3476
|
+
}>;
|
|
3477
|
+
function __promisify__(
|
|
3478
|
+
type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
|
|
3479
|
+
options?: MLKEMKeyPairKeyObjectOptions,
|
|
3480
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3300
3481
|
}
|
|
3301
3482
|
/**
|
|
3302
3483
|
* Calculates and returns the signature for `data` using the given private key and
|
|
3303
3484
|
* algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
|
|
3304
|
-
* dependent upon the key type
|
|
3485
|
+
* dependent upon the key type.
|
|
3486
|
+
*
|
|
3487
|
+
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
3488
|
+
* ML-DSA.
|
|
3305
3489
|
*
|
|
3306
3490
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
3307
3491
|
* passed to {@link createPrivateKey}. If it is an object, the following
|
|
@@ -3322,8 +3506,12 @@ declare module "crypto" {
|
|
|
3322
3506
|
callback: (error: Error | null, data: Buffer) => void,
|
|
3323
3507
|
): void;
|
|
3324
3508
|
/**
|
|
3325
|
-
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
3326
|
-
*
|
|
3509
|
+
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
3510
|
+
* `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
|
3511
|
+
* key type.
|
|
3512
|
+
*
|
|
3513
|
+
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
3514
|
+
* ML-DSA.
|
|
3327
3515
|
*
|
|
3328
3516
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
3329
3517
|
* passed to {@link createPublicKey}. If it is an object, the following
|
|
@@ -3351,9 +3539,37 @@ declare module "crypto" {
|
|
|
3351
3539
|
callback: (error: Error | null, result: boolean) => void,
|
|
3352
3540
|
): void;
|
|
3353
3541
|
/**
|
|
3354
|
-
*
|
|
3355
|
-
*
|
|
3356
|
-
*
|
|
3542
|
+
* Key decapsulation using a KEM algorithm with a private key.
|
|
3543
|
+
*
|
|
3544
|
+
* Supported key types and their KEM algorithms are:
|
|
3545
|
+
*
|
|
3546
|
+
* * `'rsa'` RSA Secret Value Encapsulation
|
|
3547
|
+
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
3548
|
+
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
3549
|
+
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
3550
|
+
* * `'ml-kem-512'` ML-KEM
|
|
3551
|
+
* * `'ml-kem-768'` ML-KEM
|
|
3552
|
+
* * `'ml-kem-1024'` ML-KEM
|
|
3553
|
+
*
|
|
3554
|
+
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
3555
|
+
* passed to `crypto.createPrivateKey()`.
|
|
3556
|
+
*
|
|
3557
|
+
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3558
|
+
* @since v24.7.0
|
|
3559
|
+
*/
|
|
3560
|
+
function decapsulate(
|
|
3561
|
+
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
3562
|
+
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
3563
|
+
): Buffer;
|
|
3564
|
+
function decapsulate(
|
|
3565
|
+
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
3566
|
+
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
3567
|
+
callback: (err: Error, sharedKey: Buffer) => void,
|
|
3568
|
+
): void;
|
|
3569
|
+
/**
|
|
3570
|
+
* Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`.
|
|
3571
|
+
* Both keys must have the same `asymmetricKeyType` and must support either the DH or
|
|
3572
|
+
* ECDH operation.
|
|
3357
3573
|
*
|
|
3358
3574
|
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3359
3575
|
* @since v13.9.0, v12.17.0
|
|
@@ -3364,10 +3580,59 @@ declare module "crypto" {
|
|
|
3364
3580
|
callback: (err: Error | null, secret: Buffer) => void,
|
|
3365
3581
|
): void;
|
|
3366
3582
|
/**
|
|
3367
|
-
*
|
|
3368
|
-
*
|
|
3369
|
-
*
|
|
3370
|
-
*
|
|
3583
|
+
* Key encapsulation using a KEM algorithm with a public key.
|
|
3584
|
+
*
|
|
3585
|
+
* Supported key types and their KEM algorithms are:
|
|
3586
|
+
*
|
|
3587
|
+
* * `'rsa'` RSA Secret Value Encapsulation
|
|
3588
|
+
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
3589
|
+
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
3590
|
+
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
3591
|
+
* * `'ml-kem-512'` ML-KEM
|
|
3592
|
+
* * `'ml-kem-768'` ML-KEM
|
|
3593
|
+
* * `'ml-kem-1024'` ML-KEM
|
|
3594
|
+
*
|
|
3595
|
+
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
3596
|
+
* passed to `crypto.createPublicKey()`.
|
|
3597
|
+
*
|
|
3598
|
+
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3599
|
+
* @since v24.7.0
|
|
3600
|
+
*/
|
|
3601
|
+
function encapsulate(key: KeyLike | PublicKeyInput | JsonWebKeyInput): { sharedKey: Buffer; ciphertext: Buffer };
|
|
3602
|
+
function encapsulate(
|
|
3603
|
+
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
3604
|
+
callback: (err: Error, result: { sharedKey: Buffer; ciphertext: Buffer }) => void,
|
|
3605
|
+
): void;
|
|
3606
|
+
interface OneShotDigestOptions {
|
|
3607
|
+
/**
|
|
3608
|
+
* Encoding used to encode the returned digest.
|
|
3609
|
+
* @default 'hex'
|
|
3610
|
+
*/
|
|
3611
|
+
outputEncoding?: BinaryToTextEncoding | "buffer" | undefined;
|
|
3612
|
+
/**
|
|
3613
|
+
* For XOF hash functions such as 'shake256', the outputLength option
|
|
3614
|
+
* can be used to specify the desired output length in bytes.
|
|
3615
|
+
*/
|
|
3616
|
+
outputLength?: number | undefined;
|
|
3617
|
+
}
|
|
3618
|
+
interface OneShotDigestOptionsWithStringEncoding extends OneShotDigestOptions {
|
|
3619
|
+
outputEncoding?: BinaryToTextEncoding | undefined;
|
|
3620
|
+
}
|
|
3621
|
+
interface OneShotDigestOptionsWithBufferEncoding extends OneShotDigestOptions {
|
|
3622
|
+
outputEncoding: "buffer";
|
|
3623
|
+
}
|
|
3624
|
+
/**
|
|
3625
|
+
* A utility for creating one-shot hash digests of data. It can be faster than
|
|
3626
|
+
* the object-based `crypto.createHash()` when hashing a smaller amount of data
|
|
3627
|
+
* (<= 5MB) that's readily available. If the data can be big or if it is streamed,
|
|
3628
|
+
* it's still recommended to use `crypto.createHash()` instead.
|
|
3629
|
+
*
|
|
3630
|
+
* The `algorithm` is dependent on the available algorithms supported by the
|
|
3631
|
+
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
3632
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
3633
|
+
* display the available digest algorithms.
|
|
3634
|
+
*
|
|
3635
|
+
* If `options` is a string, then it specifies the `outputEncoding`.
|
|
3371
3636
|
*
|
|
3372
3637
|
* Example:
|
|
3373
3638
|
*
|
|
@@ -3387,16 +3652,25 @@ declare module "crypto" {
|
|
|
3387
3652
|
* console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
|
|
3388
3653
|
* ```
|
|
3389
3654
|
* @since v21.7.0, v20.12.0
|
|
3390
|
-
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
|
3391
|
-
*
|
|
3392
|
-
*
|
|
3655
|
+
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
|
3656
|
+
* input encoding is desired for a string input, user could encode the string
|
|
3657
|
+
* into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing
|
|
3658
|
+
* the encoded `TypedArray` into this API instead.
|
|
3393
3659
|
*/
|
|
3394
|
-
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
3395
|
-
function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer;
|
|
3396
3660
|
function hash(
|
|
3397
3661
|
algorithm: string,
|
|
3398
3662
|
data: BinaryLike,
|
|
3399
|
-
|
|
3663
|
+
options?: OneShotDigestOptionsWithStringEncoding | BinaryToTextEncoding,
|
|
3664
|
+
): string;
|
|
3665
|
+
function hash(
|
|
3666
|
+
algorithm: string,
|
|
3667
|
+
data: BinaryLike,
|
|
3668
|
+
options: OneShotDigestOptionsWithBufferEncoding | "buffer",
|
|
3669
|
+
): Buffer;
|
|
3670
|
+
function hash(
|
|
3671
|
+
algorithm: string,
|
|
3672
|
+
data: BinaryLike,
|
|
3673
|
+
options: OneShotDigestOptions | BinaryToTextEncoding | "buffer",
|
|
3400
3674
|
): string | Buffer;
|
|
3401
3675
|
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
|
3402
3676
|
interface CipherInfoOptions {
|
|
@@ -3561,23 +3835,23 @@ declare module "crypto" {
|
|
|
3561
3835
|
/**
|
|
3562
3836
|
* @default 'always'
|
|
3563
3837
|
*/
|
|
3564
|
-
subject?: "always" | "default" | "never";
|
|
3838
|
+
subject?: "always" | "default" | "never" | undefined;
|
|
3565
3839
|
/**
|
|
3566
3840
|
* @default true
|
|
3567
3841
|
*/
|
|
3568
|
-
wildcards?: boolean;
|
|
3842
|
+
wildcards?: boolean | undefined;
|
|
3569
3843
|
/**
|
|
3570
3844
|
* @default true
|
|
3571
3845
|
*/
|
|
3572
|
-
partialWildcards?: boolean;
|
|
3846
|
+
partialWildcards?: boolean | undefined;
|
|
3573
3847
|
/**
|
|
3574
3848
|
* @default false
|
|
3575
3849
|
*/
|
|
3576
|
-
multiLabelWildcards?: boolean;
|
|
3850
|
+
multiLabelWildcards?: boolean | undefined;
|
|
3577
3851
|
/**
|
|
3578
3852
|
* @default false
|
|
3579
3853
|
*/
|
|
3580
|
-
singleLabelSubdomains?: boolean;
|
|
3854
|
+
singleLabelSubdomains?: boolean | undefined;
|
|
3581
3855
|
}
|
|
3582
3856
|
/**
|
|
3583
3857
|
* Encapsulates an X509 certificate and provides read-only access to
|
|
@@ -3679,7 +3953,7 @@ declare module "crypto" {
|
|
|
3679
3953
|
* available.
|
|
3680
3954
|
* @since v15.9.0
|
|
3681
3955
|
*/
|
|
3682
|
-
readonly issuerCertificate
|
|
3956
|
+
readonly issuerCertificate: X509Certificate | undefined;
|
|
3683
3957
|
/**
|
|
3684
3958
|
* The public key `KeyObject` for this certificate.
|
|
3685
3959
|
* @since v15.6.0
|
|
@@ -3971,6 +4245,130 @@ declare module "crypto" {
|
|
|
3971
4245
|
* @return Returns `typedArray`.
|
|
3972
4246
|
*/
|
|
3973
4247
|
function getRandomValues<T extends webcrypto.BufferSource>(typedArray: T): T;
|
|
4248
|
+
type Argon2Algorithm = "argon2d" | "argon2i" | "argon2id";
|
|
4249
|
+
interface Argon2Parameters {
|
|
4250
|
+
/**
|
|
4251
|
+
* REQUIRED, this is the password for password hashing applications of Argon2.
|
|
4252
|
+
*/
|
|
4253
|
+
message: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
4254
|
+
/**
|
|
4255
|
+
* REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2.
|
|
4256
|
+
*/
|
|
4257
|
+
nonce: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
4258
|
+
/**
|
|
4259
|
+
* REQUIRED, degree of parallelism determines how many computational chains (lanes)
|
|
4260
|
+
* can be run. Must be greater than 1 and less than `2**24-1`.
|
|
4261
|
+
*/
|
|
4262
|
+
parallelism: number;
|
|
4263
|
+
/**
|
|
4264
|
+
* REQUIRED, the length of the key to generate. Must be greater than 4 and
|
|
4265
|
+
* less than `2**32-1`.
|
|
4266
|
+
*/
|
|
4267
|
+
tagLength: number;
|
|
4268
|
+
/**
|
|
4269
|
+
* REQUIRED, memory cost in 1KiB blocks. Must be greater than
|
|
4270
|
+
* `8 * parallelism` and less than `2**32-1`. The actual number of blocks is rounded
|
|
4271
|
+
* down to the nearest multiple of `4 * parallelism`.
|
|
4272
|
+
*/
|
|
4273
|
+
memory: number;
|
|
4274
|
+
/**
|
|
4275
|
+
* REQUIRED, number of passes (iterations). Must be greater than 1 and less
|
|
4276
|
+
* than `2**32-1`.
|
|
4277
|
+
*/
|
|
4278
|
+
passes: number;
|
|
4279
|
+
/**
|
|
4280
|
+
* OPTIONAL, Random additional input,
|
|
4281
|
+
* similar to the salt, that should **NOT** be stored with the derived key. This is known as pepper in
|
|
4282
|
+
* password hashing applications. If used, must have a length not greater than `2**32-1` bytes.
|
|
4283
|
+
*/
|
|
4284
|
+
secret?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
4285
|
+
/**
|
|
4286
|
+
* OPTIONAL, Additional data to
|
|
4287
|
+
* be added to the hash, functionally equivalent to salt or secret, but meant for
|
|
4288
|
+
* non-random data. If used, must have a length not greater than `2**32-1` bytes.
|
|
4289
|
+
*/
|
|
4290
|
+
associatedData?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
4291
|
+
}
|
|
4292
|
+
/**
|
|
4293
|
+
* Provides an asynchronous [Argon2](https://www.rfc-editor.org/rfc/rfc9106.html) implementation. Argon2 is a password-based
|
|
4294
|
+
* key derivation function that is designed to be expensive computationally and
|
|
4295
|
+
* memory-wise in order to make brute-force attacks unrewarding.
|
|
4296
|
+
*
|
|
4297
|
+
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
4298
|
+
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
4299
|
+
*
|
|
4300
|
+
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
4301
|
+
* 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).
|
|
4302
|
+
*
|
|
4303
|
+
* The `callback` function is called with two arguments: `err` and `derivedKey`.
|
|
4304
|
+
* `err` is an exception object when key derivation fails, otherwise `err` is
|
|
4305
|
+
* `null`. `derivedKey` is passed to the callback as a `Buffer`.
|
|
4306
|
+
*
|
|
4307
|
+
* An exception is thrown when any of the input arguments specify invalid values
|
|
4308
|
+
* or types.
|
|
4309
|
+
*
|
|
4310
|
+
* ```js
|
|
4311
|
+
* const { argon2, randomBytes } = await import('node:crypto');
|
|
4312
|
+
*
|
|
4313
|
+
* const parameters = {
|
|
4314
|
+
* message: 'password',
|
|
4315
|
+
* nonce: randomBytes(16),
|
|
4316
|
+
* parallelism: 4,
|
|
4317
|
+
* tagLength: 64,
|
|
4318
|
+
* memory: 65536,
|
|
4319
|
+
* passes: 3,
|
|
4320
|
+
* };
|
|
4321
|
+
*
|
|
4322
|
+
* argon2('argon2id', parameters, (err, derivedKey) => {
|
|
4323
|
+
* if (err) throw err;
|
|
4324
|
+
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
4325
|
+
* });
|
|
4326
|
+
* ```
|
|
4327
|
+
* @since v24.7.0
|
|
4328
|
+
* @param algorithm Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`.
|
|
4329
|
+
* @experimental
|
|
4330
|
+
*/
|
|
4331
|
+
function argon2(
|
|
4332
|
+
algorithm: Argon2Algorithm,
|
|
4333
|
+
parameters: Argon2Parameters,
|
|
4334
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
4335
|
+
): void;
|
|
4336
|
+
/**
|
|
4337
|
+
* Provides a synchronous [Argon2][] implementation. Argon2 is a password-based
|
|
4338
|
+
* key derivation function that is designed to be expensive computationally and
|
|
4339
|
+
* memory-wise in order to make brute-force attacks unrewarding.
|
|
4340
|
+
*
|
|
4341
|
+
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
4342
|
+
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
4343
|
+
*
|
|
4344
|
+
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
4345
|
+
* 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).
|
|
4346
|
+
*
|
|
4347
|
+
* An exception is thrown when key derivation fails, otherwise the derived key is
|
|
4348
|
+
* returned as a `Buffer`.
|
|
4349
|
+
*
|
|
4350
|
+
* An exception is thrown when any of the input arguments specify invalid values
|
|
4351
|
+
* or types.
|
|
4352
|
+
*
|
|
4353
|
+
* ```js
|
|
4354
|
+
* const { argon2Sync, randomBytes } = await import('node:crypto');
|
|
4355
|
+
*
|
|
4356
|
+
* const parameters = {
|
|
4357
|
+
* message: 'password',
|
|
4358
|
+
* nonce: randomBytes(16),
|
|
4359
|
+
* parallelism: 4,
|
|
4360
|
+
* tagLength: 64,
|
|
4361
|
+
* memory: 65536,
|
|
4362
|
+
* passes: 3,
|
|
4363
|
+
* };
|
|
4364
|
+
*
|
|
4365
|
+
* const derivedKey = argon2Sync('argon2id', parameters);
|
|
4366
|
+
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
4367
|
+
* ```
|
|
4368
|
+
* @since v24.7.0
|
|
4369
|
+
* @experimental
|
|
4370
|
+
*/
|
|
4371
|
+
function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): Buffer;
|
|
3974
4372
|
/**
|
|
3975
4373
|
* A convenient alias for `crypto.webcrypto.subtle`.
|
|
3976
4374
|
* @since v17.4.0
|
|
@@ -3985,21 +4383,30 @@ declare module "crypto" {
|
|
|
3985
4383
|
const webcrypto: webcrypto.Crypto;
|
|
3986
4384
|
namespace webcrypto {
|
|
3987
4385
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
3988
|
-
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
|
4386
|
+
type KeyFormat = "jwk" | "pkcs8" | "raw" | "raw-public" | "raw-secret" | "raw-seed" | "spki";
|
|
3989
4387
|
type KeyType = "private" | "public" | "secret";
|
|
3990
4388
|
type KeyUsage =
|
|
3991
|
-
| "decrypt"
|
|
3992
|
-
| "deriveBits"
|
|
3993
|
-
| "deriveKey"
|
|
3994
4389
|
| "encrypt"
|
|
4390
|
+
| "decrypt"
|
|
3995
4391
|
| "sign"
|
|
3996
|
-
| "unwrapKey"
|
|
3997
4392
|
| "verify"
|
|
3998
|
-
| "
|
|
4393
|
+
| "deriveKey"
|
|
4394
|
+
| "deriveBits"
|
|
4395
|
+
| "encapsulateBits"
|
|
4396
|
+
| "decapsulateBits"
|
|
4397
|
+
| "encapsulateKey"
|
|
4398
|
+
| "decapsulateKey"
|
|
4399
|
+
| "wrapKey"
|
|
4400
|
+
| "unwrapKey";
|
|
3999
4401
|
type AlgorithmIdentifier = Algorithm | string;
|
|
4000
4402
|
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
4001
4403
|
type NamedCurve = string;
|
|
4002
4404
|
type BigInteger = Uint8Array;
|
|
4405
|
+
interface AeadParams extends Algorithm {
|
|
4406
|
+
additionalData?: BufferSource;
|
|
4407
|
+
iv: BufferSource;
|
|
4408
|
+
tagLength: number;
|
|
4409
|
+
}
|
|
4003
4410
|
interface AesCbcParams extends Algorithm {
|
|
4004
4411
|
iv: BufferSource;
|
|
4005
4412
|
}
|
|
@@ -4010,6 +4417,8 @@ declare module "crypto" {
|
|
|
4010
4417
|
interface AesDerivedKeyParams extends Algorithm {
|
|
4011
4418
|
length: number;
|
|
4012
4419
|
}
|
|
4420
|
+
// TODO: remove in next major
|
|
4421
|
+
/** @deprecated Replaced by `AeadParams`. */
|
|
4013
4422
|
interface AesGcmParams extends Algorithm {
|
|
4014
4423
|
additionalData?: BufferSource;
|
|
4015
4424
|
iv: BufferSource;
|
|
@@ -4024,6 +4433,14 @@ declare module "crypto" {
|
|
|
4024
4433
|
interface Algorithm {
|
|
4025
4434
|
name: string;
|
|
4026
4435
|
}
|
|
4436
|
+
interface CShakeParams extends Algorithm {
|
|
4437
|
+
customization?: BufferSource;
|
|
4438
|
+
functionName?: BufferSource;
|
|
4439
|
+
length: number;
|
|
4440
|
+
}
|
|
4441
|
+
interface ContextParams extends Algorithm {
|
|
4442
|
+
context?: BufferSource;
|
|
4443
|
+
}
|
|
4027
4444
|
interface EcKeyAlgorithm extends KeyAlgorithm {
|
|
4028
4445
|
namedCurve: NamedCurve;
|
|
4029
4446
|
}
|
|
@@ -4135,22 +4552,15 @@ declare module "crypto" {
|
|
|
4135
4552
|
* An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
|
|
4136
4553
|
* @since v15.0.0
|
|
4137
4554
|
*/
|
|
4138
|
-
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(
|
|
4555
|
+
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float16Array | Float32Array | Float64Array>>(
|
|
4556
|
+
typedArray: T,
|
|
4557
|
+
): T;
|
|
4139
4558
|
/**
|
|
4140
4559
|
* Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
|
|
4141
4560
|
* The UUID is generated using a cryptographic pseudorandom number generator.
|
|
4142
4561
|
* @since v16.7.0
|
|
4143
4562
|
*/
|
|
4144
4563
|
randomUUID(): UUID;
|
|
4145
|
-
CryptoKey: CryptoKeyConstructor;
|
|
4146
|
-
}
|
|
4147
|
-
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
|
|
4148
|
-
interface CryptoKeyConstructor {
|
|
4149
|
-
/** Illegal constructor */
|
|
4150
|
-
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
4151
|
-
readonly length: 0;
|
|
4152
|
-
readonly name: "CryptoKey";
|
|
4153
|
-
readonly prototype: CryptoKey;
|
|
4154
4564
|
}
|
|
4155
4565
|
/**
|
|
4156
4566
|
* @since v15.0.0
|
|
@@ -4205,10 +4615,50 @@ declare module "crypto" {
|
|
|
4205
4615
|
*/
|
|
4206
4616
|
publicKey: CryptoKey;
|
|
4207
4617
|
}
|
|
4618
|
+
interface EncapsulatedBits {
|
|
4619
|
+
sharedKey: ArrayBuffer;
|
|
4620
|
+
ciphertext: ArrayBuffer;
|
|
4621
|
+
}
|
|
4622
|
+
interface EncapsulatedKey {
|
|
4623
|
+
sharedKey: CryptoKey;
|
|
4624
|
+
ciphertext: ArrayBuffer;
|
|
4625
|
+
}
|
|
4208
4626
|
/**
|
|
4209
4627
|
* @since v15.0.0
|
|
4210
4628
|
*/
|
|
4211
4629
|
interface SubtleCrypto {
|
|
4630
|
+
/**
|
|
4631
|
+
* The algorithms currently supported include:
|
|
4632
|
+
*
|
|
4633
|
+
* * `'ML-KEM-512'`
|
|
4634
|
+
* * `'ML-KEM-768'`
|
|
4635
|
+
* * `'ML-KEM-1024'`
|
|
4636
|
+
* @since v24.7.0
|
|
4637
|
+
* @returns Fulfills with `ArrayBuffer` upon success.
|
|
4638
|
+
*/
|
|
4639
|
+
decapsulateBits(
|
|
4640
|
+
decapsulationAlgorithm: AlgorithmIdentifier,
|
|
4641
|
+
decapsulationKey: CryptoKey,
|
|
4642
|
+
ciphertext: BufferSource,
|
|
4643
|
+
): Promise<ArrayBuffer>;
|
|
4644
|
+
/**
|
|
4645
|
+
* The algorithms currently supported include:
|
|
4646
|
+
*
|
|
4647
|
+
* * `'ML-KEM-512'`
|
|
4648
|
+
* * `'ML-KEM-768'`
|
|
4649
|
+
* * `'ML-KEM-1024'`
|
|
4650
|
+
* @since v24.7.0
|
|
4651
|
+
* @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
|
|
4652
|
+
* @returns Fulfills with `CryptoKey` upon success.
|
|
4653
|
+
*/
|
|
4654
|
+
decapsulateKey(
|
|
4655
|
+
decapsulationAlgorithm: AlgorithmIdentifier,
|
|
4656
|
+
decapsulationKey: CryptoKey,
|
|
4657
|
+
ciphertext: BufferSource,
|
|
4658
|
+
sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams,
|
|
4659
|
+
extractable: boolean,
|
|
4660
|
+
usages: KeyUsage[],
|
|
4661
|
+
): Promise<CryptoKey>;
|
|
4212
4662
|
/**
|
|
4213
4663
|
* Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
|
|
4214
4664
|
* `subtle.decrypt()` attempts to decipher the provided `data`. If successful,
|
|
@@ -4216,14 +4666,16 @@ declare module "crypto" {
|
|
|
4216
4666
|
*
|
|
4217
4667
|
* The algorithms currently supported include:
|
|
4218
4668
|
*
|
|
4219
|
-
*
|
|
4220
|
-
*
|
|
4221
|
-
*
|
|
4222
|
-
*
|
|
4669
|
+
* * `'AES-CBC'`
|
|
4670
|
+
* * `'AES-CTR'`
|
|
4671
|
+
* * `'AES-GCM'`
|
|
4672
|
+
* * `'AES-OCB'`
|
|
4673
|
+
* * `'ChaCha20-Poly1305'`
|
|
4674
|
+
* * `'RSA-OAEP'`
|
|
4223
4675
|
* @since v15.0.0
|
|
4224
4676
|
*/
|
|
4225
4677
|
decrypt(
|
|
4226
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4678
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4227
4679
|
key: CryptoKey,
|
|
4228
4680
|
data: BufferSource,
|
|
4229
4681
|
): Promise<ArrayBuffer>;
|
|
@@ -4237,11 +4689,11 @@ declare module "crypto" {
|
|
|
4237
4689
|
*
|
|
4238
4690
|
* The algorithms currently supported include:
|
|
4239
4691
|
*
|
|
4240
|
-
*
|
|
4241
|
-
*
|
|
4242
|
-
*
|
|
4243
|
-
*
|
|
4244
|
-
*
|
|
4692
|
+
* * `'ECDH'`
|
|
4693
|
+
* * `'HKDF'`
|
|
4694
|
+
* * `'PBKDF2'`
|
|
4695
|
+
* * `'X25519'`
|
|
4696
|
+
* * `'X448'`
|
|
4245
4697
|
* @since v15.0.0
|
|
4246
4698
|
*/
|
|
4247
4699
|
deriveBits(
|
|
@@ -4263,11 +4715,11 @@ declare module "crypto" {
|
|
|
4263
4715
|
*
|
|
4264
4716
|
* The algorithms currently supported include:
|
|
4265
4717
|
*
|
|
4266
|
-
*
|
|
4267
|
-
*
|
|
4268
|
-
*
|
|
4269
|
-
*
|
|
4270
|
-
*
|
|
4718
|
+
* * `'ECDH'`
|
|
4719
|
+
* * `'HKDF'`
|
|
4720
|
+
* * `'PBKDF2'`
|
|
4721
|
+
* * `'X25519'`
|
|
4722
|
+
* * `'X448'`
|
|
4271
4723
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4272
4724
|
* @since v15.0.0
|
|
4273
4725
|
*/
|
|
@@ -4284,15 +4736,50 @@ declare module "crypto" {
|
|
|
4284
4736
|
*
|
|
4285
4737
|
* If `algorithm` is provided as a `<string>`, it must be one of:
|
|
4286
4738
|
*
|
|
4287
|
-
*
|
|
4288
|
-
*
|
|
4289
|
-
*
|
|
4290
|
-
*
|
|
4739
|
+
* * `'cSHAKE128'`
|
|
4740
|
+
* * `'cSHAKE256'`
|
|
4741
|
+
* * `'SHA-1'`
|
|
4742
|
+
* * `'SHA-256'`
|
|
4743
|
+
* * `'SHA-384'`
|
|
4744
|
+
* * `'SHA-512'`
|
|
4745
|
+
* * `'SHA3-256'`
|
|
4746
|
+
* * `'SHA3-384'`
|
|
4747
|
+
* * `'SHA3-512'`
|
|
4291
4748
|
*
|
|
4292
4749
|
* If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
|
|
4293
4750
|
* @since v15.0.0
|
|
4294
4751
|
*/
|
|
4295
|
-
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
4752
|
+
digest(algorithm: AlgorithmIdentifier | CShakeParams, data: BufferSource): Promise<ArrayBuffer>;
|
|
4753
|
+
/**
|
|
4754
|
+
* The algorithms currently supported include:
|
|
4755
|
+
*
|
|
4756
|
+
* * `'ML-KEM-512'`
|
|
4757
|
+
* * `'ML-KEM-768'`
|
|
4758
|
+
* * `'ML-KEM-1024'`
|
|
4759
|
+
* @since v24.7.0
|
|
4760
|
+
* @returns Fulfills with `EncapsulatedBits` upon success.
|
|
4761
|
+
*/
|
|
4762
|
+
encapsulateBits(
|
|
4763
|
+
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
4764
|
+
encapsulationKey: CryptoKey,
|
|
4765
|
+
): Promise<EncapsulatedBits>;
|
|
4766
|
+
/**
|
|
4767
|
+
* The algorithms currently supported include:
|
|
4768
|
+
*
|
|
4769
|
+
* * `'ML-KEM-512'`
|
|
4770
|
+
* * `'ML-KEM-768'`
|
|
4771
|
+
* * `'ML-KEM-1024'`
|
|
4772
|
+
* @since v24.7.0
|
|
4773
|
+
* @param usages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
|
|
4774
|
+
* @returns Fulfills with `EncapsulatedKey` upon success.
|
|
4775
|
+
*/
|
|
4776
|
+
encapsulateKey(
|
|
4777
|
+
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
4778
|
+
encapsulationKey: CryptoKey,
|
|
4779
|
+
sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams,
|
|
4780
|
+
extractable: boolean,
|
|
4781
|
+
usages: KeyUsage[],
|
|
4782
|
+
): Promise<EncapsulatedKey>;
|
|
4296
4783
|
/**
|
|
4297
4784
|
* Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
|
|
4298
4785
|
* `subtle.encrypt()` attempts to encipher `data`. If successful,
|
|
@@ -4300,14 +4787,16 @@ declare module "crypto" {
|
|
|
4300
4787
|
*
|
|
4301
4788
|
* The algorithms currently supported include:
|
|
4302
4789
|
*
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
4305
|
-
*
|
|
4306
|
-
*
|
|
4790
|
+
* * `'AES-CBC'`
|
|
4791
|
+
* * `'AES-CTR'`
|
|
4792
|
+
* * `'AES-GCM'`
|
|
4793
|
+
* * `'AES-OCB'`
|
|
4794
|
+
* * `'ChaCha20-Poly1305'`
|
|
4795
|
+
* * `'RSA-OAEP'`
|
|
4307
4796
|
* @since v15.0.0
|
|
4308
4797
|
*/
|
|
4309
4798
|
encrypt(
|
|
4310
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4799
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4311
4800
|
key: CryptoKey,
|
|
4312
4801
|
data: BufferSource,
|
|
4313
4802
|
): Promise<ArrayBuffer>;
|
|
@@ -4321,35 +4810,45 @@ declare module "crypto" {
|
|
|
4321
4810
|
*
|
|
4322
4811
|
* When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
|
|
4323
4812
|
* JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
|
|
4324
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`,
|
|
4813
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
4814
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4325
4815
|
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
4326
4816
|
* @since v15.0.0
|
|
4327
4817
|
*/
|
|
4328
4818
|
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
4329
4819
|
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
4330
4820
|
/**
|
|
4331
|
-
* Using the method and parameters provided in `algorithm`,
|
|
4332
|
-
*
|
|
4333
|
-
*
|
|
4821
|
+
* Using the method and parameters provided in `algorithm`, `subtle.generateKey()`
|
|
4822
|
+
* attempts to generate new keying material. Depending the method used, the method
|
|
4823
|
+
* may generate either a single `CryptoKey` or a `CryptoKeyPair`.
|
|
4334
4824
|
*
|
|
4335
|
-
* The
|
|
4825
|
+
* The `CryptoKeyPair` (public and private key) generating algorithms supported
|
|
4826
|
+
* include:
|
|
4336
4827
|
*
|
|
4337
|
-
*
|
|
4338
|
-
*
|
|
4339
|
-
*
|
|
4340
|
-
*
|
|
4341
|
-
*
|
|
4342
|
-
*
|
|
4343
|
-
*
|
|
4344
|
-
*
|
|
4345
|
-
*
|
|
4346
|
-
*
|
|
4828
|
+
* * `'ECDH'`
|
|
4829
|
+
* * `'ECDSA'`
|
|
4830
|
+
* * `'Ed25519'`
|
|
4831
|
+
* * `'Ed448'`
|
|
4832
|
+
* * `'ML-DSA-44'`
|
|
4833
|
+
* * `'ML-DSA-65'`
|
|
4834
|
+
* * `'ML-DSA-87'`
|
|
4835
|
+
* * `'ML-KEM-512'`
|
|
4836
|
+
* * `'ML-KEM-768'`
|
|
4837
|
+
* * `'ML-KEM-1024'`
|
|
4838
|
+
* * `'RSA-OAEP'`
|
|
4839
|
+
* * `'RSA-PSS'`
|
|
4840
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
4841
|
+
* * `'X25519'`
|
|
4842
|
+
* * `'X448'`
|
|
4347
4843
|
*
|
|
4348
|
-
*
|
|
4349
|
-
*
|
|
4350
|
-
*
|
|
4351
|
-
*
|
|
4352
|
-
*
|
|
4844
|
+
* The {CryptoKey} (secret key) generating algorithms supported include:
|
|
4845
|
+
* * `'AES-CBC'`
|
|
4846
|
+
* * `'AES-CTR'`
|
|
4847
|
+
* * `'AES-GCM'`
|
|
4848
|
+
* * `'AES-KW'`
|
|
4849
|
+
* * `'AES-OCB'`
|
|
4850
|
+
* * `'ChaCha20-Poly1305'`
|
|
4851
|
+
* * `'HMAC'`
|
|
4353
4852
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4354
4853
|
* @since v15.0.0
|
|
4355
4854
|
*/
|
|
@@ -4368,13 +4867,22 @@ declare module "crypto" {
|
|
|
4368
4867
|
extractable: boolean,
|
|
4369
4868
|
keyUsages: KeyUsage[],
|
|
4370
4869
|
): Promise<CryptoKeyPair | CryptoKey>;
|
|
4870
|
+
/**
|
|
4871
|
+
* Derives the public key from a given private key.
|
|
4872
|
+
* @since v24.7.0
|
|
4873
|
+
* @param key A private key from which to derive the corresponding public key.
|
|
4874
|
+
* @param keyUsages See [Key usages](https://nodejs.org/docs/latest-v24.x/api/webcrypto.html#cryptokeyusages).
|
|
4875
|
+
* @returns Fulfills with a `CryptoKey` upon success.
|
|
4876
|
+
*/
|
|
4877
|
+
getPublicKey(key: CryptoKey, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
4371
4878
|
/**
|
|
4372
4879
|
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
4373
4880
|
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
4374
4881
|
* If the import is successful, the returned promise will be resolved with the created `<CryptoKey>`.
|
|
4375
4882
|
*
|
|
4376
4883
|
* If importing a `'PBKDF2'` key, `extractable` must be `false`.
|
|
4377
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`,
|
|
4884
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
4885
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4378
4886
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4379
4887
|
* @since v15.0.0
|
|
4380
4888
|
*/
|
|
@@ -4409,16 +4917,19 @@ declare module "crypto" {
|
|
|
4409
4917
|
*
|
|
4410
4918
|
* The algorithms currently supported include:
|
|
4411
4919
|
*
|
|
4412
|
-
*
|
|
4413
|
-
*
|
|
4414
|
-
*
|
|
4415
|
-
*
|
|
4416
|
-
*
|
|
4417
|
-
*
|
|
4920
|
+
* * `'ECDSA'`
|
|
4921
|
+
* * `'Ed25519'`
|
|
4922
|
+
* * `'Ed448'`
|
|
4923
|
+
* * `'HMAC'`
|
|
4924
|
+
* * `'ML-DSA-44'`
|
|
4925
|
+
* * `'ML-DSA-65'`
|
|
4926
|
+
* * `'ML-DSA-87'`
|
|
4927
|
+
* * `'RSA-PSS'`
|
|
4928
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
4418
4929
|
* @since v15.0.0
|
|
4419
4930
|
*/
|
|
4420
4931
|
sign(
|
|
4421
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4932
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params | ContextParams,
|
|
4422
4933
|
key: CryptoKey,
|
|
4423
4934
|
data: BufferSource,
|
|
4424
4935
|
): Promise<ArrayBuffer>;
|
|
@@ -4431,29 +4942,40 @@ declare module "crypto" {
|
|
|
4431
4942
|
*
|
|
4432
4943
|
* The wrapping algorithms currently supported include:
|
|
4433
4944
|
*
|
|
4434
|
-
*
|
|
4435
|
-
*
|
|
4436
|
-
*
|
|
4437
|
-
*
|
|
4438
|
-
*
|
|
4945
|
+
* * `'AES-CBC'`
|
|
4946
|
+
* * `'AES-CTR'`
|
|
4947
|
+
* * `'AES-GCM'`
|
|
4948
|
+
* * `'AES-KW'`
|
|
4949
|
+
* * `'AES-OCB'`
|
|
4950
|
+
* * `'ChaCha20-Poly1305'`
|
|
4951
|
+
* * `'RSA-OAEP'`
|
|
4439
4952
|
*
|
|
4440
4953
|
* The unwrapped key algorithms supported include:
|
|
4441
4954
|
*
|
|
4442
|
-
*
|
|
4443
|
-
*
|
|
4444
|
-
*
|
|
4445
|
-
*
|
|
4446
|
-
*
|
|
4447
|
-
*
|
|
4448
|
-
*
|
|
4449
|
-
*
|
|
4450
|
-
*
|
|
4451
|
-
*
|
|
4452
|
-
*
|
|
4453
|
-
*
|
|
4454
|
-
*
|
|
4455
|
-
*
|
|
4456
|
-
*
|
|
4955
|
+
* * `'AES-CBC'`
|
|
4956
|
+
* * `'AES-CTR'`
|
|
4957
|
+
* * `'AES-GCM'`
|
|
4958
|
+
* * `'AES-KW'`
|
|
4959
|
+
* * `'AES-OCB'`
|
|
4960
|
+
* * `'ChaCha20-Poly1305'`
|
|
4961
|
+
* * `'ECDH'`
|
|
4962
|
+
* * `'ECDSA'`
|
|
4963
|
+
* * `'Ed25519'`
|
|
4964
|
+
* * `'Ed448'`
|
|
4965
|
+
* * `'HMAC'`
|
|
4966
|
+
* * `'ML-DSA-44'`
|
|
4967
|
+
* * `'ML-DSA-65'`
|
|
4968
|
+
* * `'ML-DSA-87'`
|
|
4969
|
+
* * `'ML-KEM-512'`
|
|
4970
|
+
* * `'ML-KEM-768'`
|
|
4971
|
+
* * `'ML-KEM-1024'`
|
|
4972
|
+
* * `'RSA-OAEP'`
|
|
4973
|
+
* * `'RSA-PSS'`
|
|
4974
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
4975
|
+
* * `'X25519'`
|
|
4976
|
+
* * `'X448'`
|
|
4977
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
4978
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4457
4979
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4458
4980
|
* @since v15.0.0
|
|
4459
4981
|
*/
|
|
@@ -4461,7 +4983,7 @@ declare module "crypto" {
|
|
|
4461
4983
|
format: KeyFormat,
|
|
4462
4984
|
wrappedKey: BufferSource,
|
|
4463
4985
|
unwrappingKey: CryptoKey,
|
|
4464
|
-
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4986
|
+
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4465
4987
|
unwrappedKeyAlgorithm:
|
|
4466
4988
|
| AlgorithmIdentifier
|
|
4467
4989
|
| RsaHashedImportParams
|
|
@@ -4478,16 +5000,19 @@ declare module "crypto" {
|
|
|
4478
5000
|
*
|
|
4479
5001
|
* The algorithms currently supported include:
|
|
4480
5002
|
*
|
|
4481
|
-
*
|
|
4482
|
-
*
|
|
4483
|
-
*
|
|
4484
|
-
*
|
|
4485
|
-
*
|
|
4486
|
-
*
|
|
5003
|
+
* * `'ECDSA'`
|
|
5004
|
+
* * `'Ed25519'`
|
|
5005
|
+
* * `'Ed448'`[^secure-curves]
|
|
5006
|
+
* * `'HMAC'`
|
|
5007
|
+
* * `'ML-DSA-44'`
|
|
5008
|
+
* * `'ML-DSA-65'`
|
|
5009
|
+
* * `'ML-DSA-87'`
|
|
5010
|
+
* * `'RSA-PSS'`
|
|
5011
|
+
* * `'RSASSA-PKCS1-v1_5'`
|
|
4487
5012
|
* @since v15.0.0
|
|
4488
5013
|
*/
|
|
4489
5014
|
verify(
|
|
4490
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
5015
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params | ContextParams,
|
|
4491
5016
|
key: CryptoKey,
|
|
4492
5017
|
signature: BufferSource,
|
|
4493
5018
|
data: BufferSource,
|
|
@@ -4502,30 +5027,25 @@ declare module "crypto" {
|
|
|
4502
5027
|
*
|
|
4503
5028
|
* The wrapping algorithms currently supported include:
|
|
4504
5029
|
*
|
|
4505
|
-
*
|
|
4506
|
-
*
|
|
4507
|
-
*
|
|
4508
|
-
*
|
|
4509
|
-
*
|
|
4510
|
-
*
|
|
5030
|
+
* * `'AES-CBC'`
|
|
5031
|
+
* * `'AES-CTR'`
|
|
5032
|
+
* * `'AES-GCM'`
|
|
5033
|
+
* * `'AES-KW'`
|
|
5034
|
+
* * `'AES-OCB'`
|
|
5035
|
+
* * `'ChaCha20-Poly1305'`
|
|
5036
|
+
* * `'RSA-OAEP'`
|
|
5037
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, `'raw-secret'`,
|
|
5038
|
+
* `'raw-public'`, or `'raw-seed'`.
|
|
4511
5039
|
* @since v15.0.0
|
|
4512
5040
|
*/
|
|
4513
5041
|
wrapKey(
|
|
4514
5042
|
format: KeyFormat,
|
|
4515
5043
|
key: CryptoKey,
|
|
4516
5044
|
wrappingKey: CryptoKey,
|
|
4517
|
-
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
5045
|
+
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4518
5046
|
): Promise<ArrayBuffer>;
|
|
4519
5047
|
}
|
|
4520
5048
|
}
|
|
4521
|
-
|
|
4522
|
-
global {
|
|
4523
|
-
var crypto: typeof globalThis extends {
|
|
4524
|
-
crypto: infer T;
|
|
4525
|
-
onmessage: any;
|
|
4526
|
-
} ? T
|
|
4527
|
-
: webcrypto.Crypto;
|
|
4528
|
-
}
|
|
4529
5049
|
}
|
|
4530
5050
|
declare module "node:crypto" {
|
|
4531
5051
|
export * from "crypto";
|