@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15
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/assert/strict.d.ts +113 -1
- package/assert.d.ts +162 -248
- package/async_hooks.d.ts +20 -5
- package/buffer.buffer.d.ts +24 -6
- package/buffer.d.ts +63 -168
- package/child_process.d.ts +117 -223
- package/cluster.d.ts +251 -329
- package/compatibility/iterators.d.ts +15 -0
- package/console.d.ts +60 -346
- package/constants.d.ts +15 -1
- package/crypto.d.ts +713 -1149
- package/dgram.d.ts +30 -50
- package/diagnostics_channel.d.ts +16 -3
- package/dns/promises.d.ts +15 -0
- package/dns.d.ts +150 -131
- package/domain.d.ts +25 -14
- package/events.d.ts +858 -719
- package/fs/promises.d.ts +117 -53
- package/fs.d.ts +729 -484
- package/globals.d.ts +142 -344
- package/globals.typedarray.d.ts +94 -0
- package/http.d.ts +358 -246
- package/http2.d.ts +578 -711
- package/https.d.ts +85 -216
- package/index.d.ts +39 -3
- package/inspector/promises.d.ts +54 -0
- package/inspector.d.ts +180 -3936
- package/inspector.generated.d.ts +4242 -0
- package/module.d.ts +60 -95
- package/my-shim.d.ts +15 -0
- package/net.d.ts +102 -186
- package/os.d.ts +32 -6
- package/package.json +3 -8
- package/path/posix.d.ts +20 -0
- package/path/win32.d.ts +20 -0
- package/path.d.ts +132 -122
- package/perf_hooks.d.ts +310 -644
- package/process.d.ts +192 -138
- package/punycode.d.ts +17 -2
- package/querystring.d.ts +16 -1
- package/quic.d.ts +926 -0
- package/readline/promises.d.ts +16 -1
- package/readline.d.ts +80 -118
- package/repl.d.ts +98 -96
- package/sea.d.ts +25 -1
- package/sqlite.d.ts +277 -13
- package/stream/consumers.d.ts +22 -7
- package/stream/promises.d.ts +148 -12
- package/stream/web.d.ts +187 -494
- package/stream.d.ts +608 -490
- package/string_decoder.d.ts +18 -3
- package/test/reporters.d.ts +112 -0
- package/test.d.ts +238 -199
- package/timers/promises.d.ts +16 -1
- package/timers.d.ts +16 -129
- package/tls.d.ts +163 -163
- package/trace_events.d.ts +21 -6
- package/ts5.6/buffer.buffer.d.ts +25 -8
- package/ts5.6/compatibility/float16array.d.ts +15 -0
- package/ts5.6/globals.typedarray.d.ts +31 -0
- package/ts5.6/index.d.ts +39 -3
- package/ts5.7/compatibility/float16array.d.ts +15 -0
- package/ts5.7/index.d.ts +39 -3
- package/tty.d.ts +70 -13
- package/undici-types/agent.d.ts +20 -4
- package/undici-types/api.d.ts +15 -0
- package/undici-types/balanced-pool.d.ts +15 -0
- package/undici-types/cache-interceptor.d.ts +15 -0
- package/undici-types/cache.d.ts +15 -0
- package/undici-types/client-stats.d.ts +31 -0
- package/undici-types/client.d.ts +21 -5
- package/undici-types/connector.d.ts +15 -0
- package/undici-types/content-type.d.ts +15 -0
- package/undici-types/cookies.d.ts +15 -0
- package/undici-types/diagnostics-channel.d.ts +24 -1
- package/undici-types/dispatcher.d.ts +18 -8
- package/undici-types/env-http-proxy-agent.d.ts +17 -1
- package/undici-types/errors.d.ts +20 -15
- package/undici-types/eventsource.d.ts +24 -4
- package/undici-types/fetch.d.ts +16 -0
- package/undici-types/formdata.d.ts +15 -0
- package/undici-types/global-dispatcher.d.ts +15 -0
- package/undici-types/global-origin.d.ts +15 -0
- package/undici-types/h2c-client.d.ts +15 -2
- package/undici-types/handlers.d.ts +16 -1
- package/undici-types/header.d.ts +15 -0
- package/undici-types/index.d.ts +21 -1
- package/undici-types/interceptors.d.ts +20 -0
- package/undici-types/mock-agent.d.ts +18 -0
- package/undici-types/mock-call-history.d.ts +15 -0
- package/undici-types/mock-client.d.ts +17 -0
- package/undici-types/mock-errors.d.ts +15 -0
- package/undici-types/mock-interceptor.d.ts +17 -1
- package/undici-types/mock-pool.d.ts +17 -0
- package/undici-types/package.json +1 -1
- package/undici-types/patch.d.ts +15 -0
- package/undici-types/pool-stats.d.ts +15 -0
- package/undici-types/pool.d.ts +17 -0
- package/undici-types/proxy-agent.d.ts +16 -0
- package/undici-types/readable.d.ts +15 -0
- package/undici-types/retry-agent.d.ts +15 -0
- package/undici-types/retry-handler.d.ts +24 -0
- package/undici-types/snapshot-agent.d.ts +125 -0
- package/undici-types/util.d.ts +15 -0
- package/undici-types/utility.d.ts +15 -0
- package/undici-types/webidl.d.ts +126 -36
- package/undici-types/websocket.d.ts +18 -1
- package/url.d.ts +107 -587
- package/util/types.d.ts +571 -0
- package/util.d.ts +158 -792
- package/v8.d.ts +82 -7
- package/vm.d.ts +267 -108
- package/wasi.d.ts +38 -2
- package/web-globals/abortcontroller.d.ts +75 -0
- package/web-globals/blob.d.ts +39 -0
- package/web-globals/console.d.ts +25 -0
- package/web-globals/crypto.d.ts +55 -0
- package/web-globals/domexception.d.ts +84 -0
- package/web-globals/encoding.d.ts +27 -0
- package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
- package/web-globals/fetch.d.ts +70 -0
- package/web-globals/importmeta.d.ts +29 -0
- package/web-globals/messaging.d.ts +39 -0
- package/web-globals/navigator.d.ts +41 -0
- package/web-globals/performance.d.ts +61 -0
- package/web-globals/storage.d.ts +40 -0
- package/web-globals/streams.d.ts +131 -0
- package/web-globals/timers.d.ts +60 -0
- package/web-globals/url.d.ts +40 -0
- package/worker_threads.d.ts +306 -349
- package/zlib.d.ts +59 -94
- package/ts5.1/compatibility/disposable.d.ts +0 -13
- package/ts5.1/index.d.ts +0 -100
package/crypto.d.ts
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// biome-ignore-all lint: generated file
|
|
2
|
+
// biome-ignore-all assist: generated file
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
|
|
6
|
+
/******************************************************************************
|
|
7
|
+
* GENERATED FILE, DO NOT MODIFY
|
|
8
|
+
* 这是生成的文件,千万不要修改
|
|
9
|
+
*
|
|
10
|
+
* @build-script/codegen - The Simple Code Generater
|
|
11
|
+
* https://github.com/GongT/baobao
|
|
12
|
+
*
|
|
13
|
+
******************************************************************************/
|
|
14
|
+
|
|
15
|
+
|
|
1
16
|
/**
|
|
2
17
|
* The `node:crypto` module provides cryptographic functionality that includes a
|
|
3
18
|
* set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify
|
|
@@ -14,10 +29,11 @@
|
|
|
14
29
|
* // Prints:
|
|
15
30
|
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
|
16
31
|
* ```
|
|
17
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
32
|
+
* @see [source](https://github.com/nodejs/node/blob/v25.x/lib/crypto.js)
|
|
18
33
|
*/
|
|
19
34
|
|
|
20
35
|
declare module "node:crypto" {
|
|
36
|
+
import { NonSharedBuffer } from 'node:buffer';
|
|
21
37
|
import * as stream from 'node:stream';
|
|
22
38
|
import { PeerCertificate } from 'node:tls';
|
|
23
39
|
/**
|
|
@@ -45,7 +61,7 @@ declare module "node:crypto" {
|
|
|
45
61
|
* @param encoding The `encoding` of the `spkac` string.
|
|
46
62
|
* @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
|
|
47
63
|
*/
|
|
48
|
-
static exportChallenge(spkac: BinaryLike):
|
|
64
|
+
static exportChallenge(spkac: BinaryLike): NonSharedBuffer;
|
|
49
65
|
/**
|
|
50
66
|
* ```js
|
|
51
67
|
* const { Certificate } = await import('node:crypto');
|
|
@@ -58,7 +74,7 @@ declare module "node:crypto" {
|
|
|
58
74
|
* @param encoding The `encoding` of the `spkac` string.
|
|
59
75
|
* @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
|
|
60
76
|
*/
|
|
61
|
-
static exportPublicKey(spkac: BinaryLike, encoding?: string):
|
|
77
|
+
static exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer;
|
|
62
78
|
/**
|
|
63
79
|
* ```js
|
|
64
80
|
* import { Buffer } from 'node:buffer';
|
|
@@ -79,7 +95,7 @@ declare module "node:crypto" {
|
|
|
79
95
|
* @returns The challenge component of the `spkac` data structure,
|
|
80
96
|
* which includes a public key and a challenge.
|
|
81
97
|
*/
|
|
82
|
-
exportChallenge(spkac: BinaryLike):
|
|
98
|
+
exportChallenge(spkac: BinaryLike): NonSharedBuffer;
|
|
83
99
|
/**
|
|
84
100
|
* @deprecated
|
|
85
101
|
* @param spkac
|
|
@@ -87,7 +103,7 @@ declare module "node:crypto" {
|
|
|
87
103
|
* @returns The public key component of the `spkac` data structure,
|
|
88
104
|
* which includes a public key and a challenge.
|
|
89
105
|
*/
|
|
90
|
-
exportPublicKey(spkac: BinaryLike, encoding?: string):
|
|
106
|
+
exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer;
|
|
91
107
|
/**
|
|
92
108
|
* @deprecated
|
|
93
109
|
* @param spkac
|
|
@@ -97,7 +113,7 @@ declare module "node:crypto" {
|
|
|
97
113
|
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
|
98
114
|
}
|
|
99
115
|
namespace constants {
|
|
100
|
-
// https://nodejs.org/dist/latest-
|
|
116
|
+
// https://nodejs.org/dist/latest-v25.x/docs/api/crypto.html#crypto-constants
|
|
101
117
|
const OPENSSL_VERSION_NUMBER: number;
|
|
102
118
|
/** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
|
|
103
119
|
const SSL_OP_ALL: number;
|
|
@@ -403,7 +419,7 @@ declare module "node:crypto" {
|
|
|
403
419
|
* @since v0.1.92
|
|
404
420
|
* @param encoding The `encoding` of the return value.
|
|
405
421
|
*/
|
|
406
|
-
digest():
|
|
422
|
+
digest(): NonSharedBuffer;
|
|
407
423
|
digest(encoding: BinaryToTextEncoding): string;
|
|
408
424
|
}
|
|
409
425
|
/**
|
|
@@ -471,7 +487,6 @@ declare module "node:crypto" {
|
|
|
471
487
|
* // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
|
|
472
488
|
* ```
|
|
473
489
|
* @since v0.1.94
|
|
474
|
-
* @deprecated Since v20.13.0 Calling `Hmac` class directly with `Hmac()` or `new Hmac()` is deprecated due to being internals, not intended for public use. Please use the {@link createHmac} method to create Hmac instances.
|
|
475
490
|
*/
|
|
476
491
|
class Hmac extends stream.Transform {
|
|
477
492
|
private constructor();
|
|
@@ -497,64 +512,98 @@ declare module "node:crypto" {
|
|
|
497
512
|
* @since v0.1.94
|
|
498
513
|
* @param encoding The `encoding` of the return value.
|
|
499
514
|
*/
|
|
500
|
-
digest():
|
|
515
|
+
digest(): NonSharedBuffer;
|
|
501
516
|
digest(encoding: BinaryToTextEncoding): string;
|
|
502
517
|
}
|
|
518
|
+
type KeyFormat = "pem" | "der" | "jwk";
|
|
503
519
|
type KeyObjectType = "secret" | "public" | "private";
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
520
|
+
type PublicKeyExportType = "pkcs1" | "spki";
|
|
521
|
+
type PrivateKeyExportType = "pkcs1" | "pkcs8" | "sec1";
|
|
522
|
+
type KeyExportOptions =
|
|
523
|
+
| SymmetricKeyExportOptions
|
|
524
|
+
| PublicKeyExportOptions
|
|
525
|
+
| PrivateKeyExportOptions
|
|
526
|
+
| JwkKeyExportOptions;
|
|
527
|
+
interface SymmetricKeyExportOptions {
|
|
528
|
+
format?: "buffer" | undefined;
|
|
529
|
+
}
|
|
530
|
+
interface PublicKeyExportOptions<T extends PublicKeyExportType = PublicKeyExportType> {
|
|
531
|
+
type: T;
|
|
532
|
+
format: Exclude<KeyFormat, "jwk">;
|
|
533
|
+
}
|
|
534
|
+
interface PrivateKeyExportOptions<T extends PrivateKeyExportType = PrivateKeyExportType> {
|
|
535
|
+
type: T;
|
|
536
|
+
format: Exclude<KeyFormat, "jwk">;
|
|
507
537
|
cipher?: string | undefined;
|
|
508
538
|
passphrase?: string | Buffer | undefined;
|
|
509
539
|
}
|
|
510
540
|
interface JwkKeyExportOptions {
|
|
511
541
|
format: "jwk";
|
|
512
542
|
}
|
|
513
|
-
interface
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
543
|
+
interface KeyPairExportOptions<
|
|
544
|
+
TPublic extends PublicKeyExportType = PublicKeyExportType,
|
|
545
|
+
TPrivate extends PrivateKeyExportType = PrivateKeyExportType,
|
|
546
|
+
> {
|
|
547
|
+
publicKeyEncoding?: PublicKeyExportOptions<TPublic> | JwkKeyExportOptions | undefined;
|
|
548
|
+
privateKeyEncoding?: PrivateKeyExportOptions<TPrivate> | JwkKeyExportOptions | undefined;
|
|
549
|
+
}
|
|
550
|
+
type KeyExportResult<T, Default> = T extends { format: infer F extends KeyFormat }
|
|
551
|
+
? { der: NonSharedBuffer; jwk: webcrypto.JsonWebKey; pem: string }[F]
|
|
552
|
+
: Default;
|
|
553
|
+
interface KeyPairExportResult<T extends KeyPairExportOptions> {
|
|
554
|
+
publicKey: KeyExportResult<T["publicKeyEncoding"], KeyObject>;
|
|
555
|
+
privateKey: KeyExportResult<T["privateKeyEncoding"], KeyObject>;
|
|
556
|
+
}
|
|
557
|
+
type KeyPairExportCallback<T extends KeyPairExportOptions> = (
|
|
558
|
+
err: Error | null,
|
|
559
|
+
publicKey: KeyExportResult<T["publicKeyEncoding"], KeyObject>,
|
|
560
|
+
privateKey: KeyExportResult<T["privateKeyEncoding"], KeyObject>,
|
|
561
|
+
) => void;
|
|
562
|
+
type MLDSAKeyType = `ml-dsa-${44 | 65 | 87}`;
|
|
563
|
+
type MLKEMKeyType = `ml-kem-${1024 | 512 | 768}`;
|
|
564
|
+
type SLHDSAKeyType = `slh-dsa-${"sha2" | "shake"}-${128 | 192 | 256}${"f" | "s"}`;
|
|
565
|
+
type AsymmetricKeyType =
|
|
566
|
+
| "dh"
|
|
567
|
+
| "dsa"
|
|
568
|
+
| "ec"
|
|
569
|
+
| "ed25519"
|
|
570
|
+
| "ed448"
|
|
571
|
+
| MLDSAKeyType
|
|
572
|
+
| MLKEMKeyType
|
|
573
|
+
| "rsa-pss"
|
|
574
|
+
| "rsa"
|
|
575
|
+
| SLHDSAKeyType
|
|
576
|
+
| "x25519"
|
|
577
|
+
| "x448";
|
|
529
578
|
interface AsymmetricKeyDetails {
|
|
530
579
|
/**
|
|
531
580
|
* Key size in bits (RSA, DSA).
|
|
532
581
|
*/
|
|
533
|
-
modulusLength?: number
|
|
582
|
+
modulusLength?: number;
|
|
534
583
|
/**
|
|
535
584
|
* Public exponent (RSA).
|
|
536
585
|
*/
|
|
537
|
-
publicExponent?: bigint
|
|
586
|
+
publicExponent?: bigint;
|
|
538
587
|
/**
|
|
539
588
|
* Name of the message digest (RSA-PSS).
|
|
540
589
|
*/
|
|
541
|
-
hashAlgorithm?: string
|
|
590
|
+
hashAlgorithm?: string;
|
|
542
591
|
/**
|
|
543
592
|
* Name of the message digest used by MGF1 (RSA-PSS).
|
|
544
593
|
*/
|
|
545
|
-
mgf1HashAlgorithm?: string
|
|
594
|
+
mgf1HashAlgorithm?: string;
|
|
546
595
|
/**
|
|
547
596
|
* Minimal salt length in bytes (RSA-PSS).
|
|
548
597
|
*/
|
|
549
|
-
saltLength?: number
|
|
598
|
+
saltLength?: number;
|
|
550
599
|
/**
|
|
551
600
|
* Size of q in bits (DSA).
|
|
552
601
|
*/
|
|
553
|
-
divisorLength?: number
|
|
602
|
+
divisorLength?: number;
|
|
554
603
|
/**
|
|
555
604
|
* Name of the curve (EC).
|
|
556
605
|
*/
|
|
557
|
-
namedCurve?: string
|
|
606
|
+
namedCurve?: string;
|
|
558
607
|
}
|
|
559
608
|
/**
|
|
560
609
|
* Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key,
|
|
@@ -592,24 +641,14 @@ declare module "node:crypto" {
|
|
|
592
641
|
*/
|
|
593
642
|
static from(key: webcrypto.CryptoKey): KeyObject;
|
|
594
643
|
/**
|
|
595
|
-
* For asymmetric keys, this property represents the type of the key.
|
|
596
|
-
* types
|
|
597
|
-
*
|
|
598
|
-
* * `'rsa'` (OID 1.2.840.113549.1.1.1)
|
|
599
|
-
* * `'rsa-pss'` (OID 1.2.840.113549.1.1.10)
|
|
600
|
-
* * `'dsa'` (OID 1.2.840.10040.4.1)
|
|
601
|
-
* * `'ec'` (OID 1.2.840.10045.2.1)
|
|
602
|
-
* * `'x25519'` (OID 1.3.101.110)
|
|
603
|
-
* * `'x448'` (OID 1.3.101.111)
|
|
604
|
-
* * `'ed25519'` (OID 1.3.101.112)
|
|
605
|
-
* * `'ed448'` (OID 1.3.101.113)
|
|
606
|
-
* * `'dh'` (OID 1.2.840.113549.1.3.1)
|
|
644
|
+
* For asymmetric keys, this property represents the type of the key. See the
|
|
645
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
|
|
607
646
|
*
|
|
608
647
|
* This property is `undefined` for unrecognized `KeyObject` types and symmetric
|
|
609
648
|
* keys.
|
|
610
649
|
* @since v11.6.0
|
|
611
650
|
*/
|
|
612
|
-
asymmetricKeyType?:
|
|
651
|
+
asymmetricKeyType?: AsymmetricKeyType;
|
|
613
652
|
/**
|
|
614
653
|
* This property exists only on asymmetric keys. Depending on the type of the key,
|
|
615
654
|
* this object contains information about the key. None of the information obtained
|
|
@@ -623,7 +662,7 @@ declare module "node:crypto" {
|
|
|
623
662
|
* Other key details might be exposed via this API using additional attributes.
|
|
624
663
|
* @since v15.7.0
|
|
625
664
|
*/
|
|
626
|
-
asymmetricKeyDetails?: AsymmetricKeyDetails
|
|
665
|
+
asymmetricKeyDetails?: AsymmetricKeyDetails;
|
|
627
666
|
/**
|
|
628
667
|
* For symmetric keys, the following encoding options can be used:
|
|
629
668
|
*
|
|
@@ -647,9 +686,7 @@ declare module "node:crypto" {
|
|
|
647
686
|
* PKCS#1 and SEC1 encryption.
|
|
648
687
|
* @since v11.6.0
|
|
649
688
|
*/
|
|
650
|
-
export(options
|
|
651
|
-
export(options?: KeyExportOptions<"der">): Buffer;
|
|
652
|
-
export(options?: JwkKeyExportOptions): JsonWebKey;
|
|
689
|
+
export<T extends KeyExportOptions = {}>(options?: T): KeyExportResult<T, NonSharedBuffer>;
|
|
653
690
|
/**
|
|
654
691
|
* Returns `true` or `false` depending on whether the keys have exactly the same
|
|
655
692
|
* type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing_attack).
|
|
@@ -662,7 +699,7 @@ declare module "node:crypto" {
|
|
|
662
699
|
* property is `undefined` for asymmetric keys.
|
|
663
700
|
* @since v11.6.0
|
|
664
701
|
*/
|
|
665
|
-
symmetricKeySize?: number
|
|
702
|
+
symmetricKeySize?: number;
|
|
666
703
|
/**
|
|
667
704
|
* Converts a `KeyObject` instance to a `CryptoKey`.
|
|
668
705
|
* @since 22.10.0
|
|
@@ -897,8 +934,8 @@ declare module "node:crypto" {
|
|
|
897
934
|
* @param inputEncoding The `encoding` of the data.
|
|
898
935
|
* @param outputEncoding The `encoding` of the return value.
|
|
899
936
|
*/
|
|
900
|
-
update(data: BinaryLike):
|
|
901
|
-
update(data: string, inputEncoding: Encoding):
|
|
937
|
+
update(data: BinaryLike): NonSharedBuffer;
|
|
938
|
+
update(data: string, inputEncoding: Encoding): NonSharedBuffer;
|
|
902
939
|
update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
|
|
903
940
|
update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
|
|
904
941
|
/**
|
|
@@ -909,7 +946,7 @@ declare module "node:crypto" {
|
|
|
909
946
|
* @param outputEncoding The `encoding` of the return value.
|
|
910
947
|
* @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
|
|
911
948
|
*/
|
|
912
|
-
final():
|
|
949
|
+
final(): NonSharedBuffer;
|
|
913
950
|
final(outputEncoding: BufferEncoding): string;
|
|
914
951
|
/**
|
|
915
952
|
* When using block encryption algorithms, the `Cipheriv` class will automatically
|
|
@@ -935,7 +972,7 @@ declare module "node:crypto" {
|
|
|
935
972
|
plaintextLength: number;
|
|
936
973
|
},
|
|
937
974
|
): this;
|
|
938
|
-
getAuthTag():
|
|
975
|
+
getAuthTag(): NonSharedBuffer;
|
|
939
976
|
}
|
|
940
977
|
interface CipherGCM extends Cipheriv {
|
|
941
978
|
setAAD(
|
|
@@ -944,7 +981,7 @@ declare module "node:crypto" {
|
|
|
944
981
|
plaintextLength: number;
|
|
945
982
|
},
|
|
946
983
|
): this;
|
|
947
|
-
getAuthTag():
|
|
984
|
+
getAuthTag(): NonSharedBuffer;
|
|
948
985
|
}
|
|
949
986
|
interface CipherOCB extends Cipheriv {
|
|
950
987
|
setAAD(
|
|
@@ -953,7 +990,7 @@ declare module "node:crypto" {
|
|
|
953
990
|
plaintextLength: number;
|
|
954
991
|
},
|
|
955
992
|
): this;
|
|
956
|
-
getAuthTag():
|
|
993
|
+
getAuthTag(): NonSharedBuffer;
|
|
957
994
|
}
|
|
958
995
|
interface CipherChaCha20Poly1305 extends Cipheriv {
|
|
959
996
|
setAAD(
|
|
@@ -962,7 +999,7 @@ declare module "node:crypto" {
|
|
|
962
999
|
plaintextLength: number;
|
|
963
1000
|
},
|
|
964
1001
|
): this;
|
|
965
|
-
getAuthTag():
|
|
1002
|
+
getAuthTag(): NonSharedBuffer;
|
|
966
1003
|
}
|
|
967
1004
|
/**
|
|
968
1005
|
* Creates and returns a `Decipheriv` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
|
|
@@ -1147,8 +1184,8 @@ declare module "node:crypto" {
|
|
|
1147
1184
|
* @param inputEncoding The `encoding` of the `data` string.
|
|
1148
1185
|
* @param outputEncoding The `encoding` of the return value.
|
|
1149
1186
|
*/
|
|
1150
|
-
update(data: NodeJS.ArrayBufferView):
|
|
1151
|
-
update(data: string, inputEncoding: Encoding):
|
|
1187
|
+
update(data: NodeJS.ArrayBufferView): NonSharedBuffer;
|
|
1188
|
+
update(data: string, inputEncoding: Encoding): NonSharedBuffer;
|
|
1152
1189
|
update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
|
|
1153
1190
|
update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
|
|
1154
1191
|
/**
|
|
@@ -1159,7 +1196,7 @@ declare module "node:crypto" {
|
|
|
1159
1196
|
* @param outputEncoding The `encoding` of the return value.
|
|
1160
1197
|
* @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
|
|
1161
1198
|
*/
|
|
1162
|
-
final():
|
|
1199
|
+
final(): NonSharedBuffer;
|
|
1163
1200
|
final(outputEncoding: BufferEncoding): string;
|
|
1164
1201
|
/**
|
|
1165
1202
|
* 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
|
|
@@ -1214,14 +1251,14 @@ declare module "node:crypto" {
|
|
|
1214
1251
|
interface PrivateKeyInput {
|
|
1215
1252
|
key: string | Buffer;
|
|
1216
1253
|
format?: KeyFormat | undefined;
|
|
1217
|
-
type?:
|
|
1254
|
+
type?: PrivateKeyExportType | undefined;
|
|
1218
1255
|
passphrase?: string | Buffer | undefined;
|
|
1219
1256
|
encoding?: string | undefined;
|
|
1220
1257
|
}
|
|
1221
1258
|
interface PublicKeyInput {
|
|
1222
1259
|
key: string | Buffer;
|
|
1223
1260
|
format?: KeyFormat | undefined;
|
|
1224
|
-
type?:
|
|
1261
|
+
type?: PublicKeyExportType | undefined;
|
|
1225
1262
|
encoding?: string | undefined;
|
|
1226
1263
|
}
|
|
1227
1264
|
/**
|
|
@@ -1274,7 +1311,7 @@ declare module "node:crypto" {
|
|
|
1274
1311
|
},
|
|
1275
1312
|
): KeyObject;
|
|
1276
1313
|
interface JsonWebKeyInput {
|
|
1277
|
-
key: JsonWebKey;
|
|
1314
|
+
key: webcrypto.JsonWebKey;
|
|
1278
1315
|
format: "jwk";
|
|
1279
1316
|
}
|
|
1280
1317
|
/**
|
|
@@ -1321,6 +1358,7 @@ declare module "node:crypto" {
|
|
|
1321
1358
|
* @since v0.1.92
|
|
1322
1359
|
* @param options `stream.Writable` options
|
|
1323
1360
|
*/
|
|
1361
|
+
// TODO: signing algorithm type
|
|
1324
1362
|
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
|
|
1325
1363
|
type DSAEncoding = "der" | "ieee-p1363";
|
|
1326
1364
|
interface SigningOptions {
|
|
@@ -1330,6 +1368,7 @@ declare module "node:crypto" {
|
|
|
1330
1368
|
padding?: number | undefined;
|
|
1331
1369
|
saltLength?: number | undefined;
|
|
1332
1370
|
dsaEncoding?: DSAEncoding | undefined;
|
|
1371
|
+
context?: ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
1333
1372
|
}
|
|
1334
1373
|
interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
|
|
1335
1374
|
interface SignKeyObjectInput extends SigningOptions {
|
|
@@ -1431,7 +1470,7 @@ declare module "node:crypto" {
|
|
|
1431
1470
|
* called. Multiple calls to `sign.sign()` will result in an error being thrown.
|
|
1432
1471
|
* @since v0.1.92
|
|
1433
1472
|
*/
|
|
1434
|
-
sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput):
|
|
1473
|
+
sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): NonSharedBuffer;
|
|
1435
1474
|
sign(
|
|
1436
1475
|
privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
|
|
1437
1476
|
outputFormat: BinaryToTextEncoding,
|
|
@@ -1590,7 +1629,7 @@ declare module "node:crypto" {
|
|
|
1590
1629
|
* @since v0.5.0
|
|
1591
1630
|
* @param encoding The `encoding` of the return value.
|
|
1592
1631
|
*/
|
|
1593
|
-
generateKeys():
|
|
1632
|
+
generateKeys(): NonSharedBuffer;
|
|
1594
1633
|
generateKeys(encoding: BinaryToTextEncoding): string;
|
|
1595
1634
|
/**
|
|
1596
1635
|
* Computes the shared secret using `otherPublicKey` as the other
|
|
@@ -1605,8 +1644,16 @@ declare module "node:crypto" {
|
|
|
1605
1644
|
* @param inputEncoding The `encoding` of an `otherPublicKey` string.
|
|
1606
1645
|
* @param outputEncoding The `encoding` of the return value.
|
|
1607
1646
|
*/
|
|
1608
|
-
computeSecret(
|
|
1609
|
-
|
|
1647
|
+
computeSecret(
|
|
1648
|
+
otherPublicKey: NodeJS.ArrayBufferView,
|
|
1649
|
+
inputEncoding?: null,
|
|
1650
|
+
outputEncoding?: null,
|
|
1651
|
+
): NonSharedBuffer;
|
|
1652
|
+
computeSecret(
|
|
1653
|
+
otherPublicKey: string,
|
|
1654
|
+
inputEncoding: BinaryToTextEncoding,
|
|
1655
|
+
outputEncoding?: null,
|
|
1656
|
+
): NonSharedBuffer;
|
|
1610
1657
|
computeSecret(
|
|
1611
1658
|
otherPublicKey: NodeJS.ArrayBufferView,
|
|
1612
1659
|
inputEncoding: null,
|
|
@@ -1624,7 +1671,7 @@ declare module "node:crypto" {
|
|
|
1624
1671
|
* @since v0.5.0
|
|
1625
1672
|
* @param encoding The `encoding` of the return value.
|
|
1626
1673
|
*/
|
|
1627
|
-
getPrime():
|
|
1674
|
+
getPrime(): NonSharedBuffer;
|
|
1628
1675
|
getPrime(encoding: BinaryToTextEncoding): string;
|
|
1629
1676
|
/**
|
|
1630
1677
|
* Returns the Diffie-Hellman generator in the specified `encoding`.
|
|
@@ -1633,7 +1680,7 @@ declare module "node:crypto" {
|
|
|
1633
1680
|
* @since v0.5.0
|
|
1634
1681
|
* @param encoding The `encoding` of the return value.
|
|
1635
1682
|
*/
|
|
1636
|
-
getGenerator():
|
|
1683
|
+
getGenerator(): NonSharedBuffer;
|
|
1637
1684
|
getGenerator(encoding: BinaryToTextEncoding): string;
|
|
1638
1685
|
/**
|
|
1639
1686
|
* Returns the Diffie-Hellman public key in the specified `encoding`.
|
|
@@ -1642,7 +1689,7 @@ declare module "node:crypto" {
|
|
|
1642
1689
|
* @since v0.5.0
|
|
1643
1690
|
* @param encoding The `encoding` of the return value.
|
|
1644
1691
|
*/
|
|
1645
|
-
getPublicKey():
|
|
1692
|
+
getPublicKey(): NonSharedBuffer;
|
|
1646
1693
|
getPublicKey(encoding: BinaryToTextEncoding): string;
|
|
1647
1694
|
/**
|
|
1648
1695
|
* Returns the Diffie-Hellman private key in the specified `encoding`.
|
|
@@ -1651,7 +1698,7 @@ declare module "node:crypto" {
|
|
|
1651
1698
|
* @since v0.5.0
|
|
1652
1699
|
* @param encoding The `encoding` of the return value.
|
|
1653
1700
|
*/
|
|
1654
|
-
getPrivateKey():
|
|
1701
|
+
getPrivateKey(): NonSharedBuffer;
|
|
1655
1702
|
getPrivateKey(encoding: BinaryToTextEncoding): string;
|
|
1656
1703
|
/**
|
|
1657
1704
|
* Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected
|
|
@@ -1795,7 +1842,7 @@ declare module "node:crypto" {
|
|
|
1795
1842
|
iterations: number,
|
|
1796
1843
|
keylen: number,
|
|
1797
1844
|
digest: string,
|
|
1798
|
-
callback: (err: Error | null, derivedKey:
|
|
1845
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
1799
1846
|
): void;
|
|
1800
1847
|
/**
|
|
1801
1848
|
* Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
|
|
@@ -1832,7 +1879,7 @@ declare module "node:crypto" {
|
|
|
1832
1879
|
iterations: number,
|
|
1833
1880
|
keylen: number,
|
|
1834
1881
|
digest: string,
|
|
1835
|
-
):
|
|
1882
|
+
): NonSharedBuffer;
|
|
1836
1883
|
/**
|
|
1837
1884
|
* Generates cryptographically strong pseudorandom data. The `size` argument
|
|
1838
1885
|
* is a number indicating the number of bytes to generate.
|
|
@@ -1885,10 +1932,10 @@ declare module "node:crypto" {
|
|
|
1885
1932
|
* @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`.
|
|
1886
1933
|
* @return if the `callback` function is not provided.
|
|
1887
1934
|
*/
|
|
1888
|
-
function randomBytes(size: number):
|
|
1889
|
-
function randomBytes(size: number, callback: (err: Error | null, buf:
|
|
1890
|
-
function pseudoRandomBytes(size: number):
|
|
1891
|
-
function pseudoRandomBytes(size: number, callback: (err: Error | null, buf:
|
|
1935
|
+
function randomBytes(size: number): NonSharedBuffer;
|
|
1936
|
+
function randomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void;
|
|
1937
|
+
function pseudoRandomBytes(size: number): NonSharedBuffer;
|
|
1938
|
+
function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void;
|
|
1892
1939
|
/**
|
|
1893
1940
|
* Return a random integer `n` such that `min <= n < max`. This
|
|
1894
1941
|
* implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
|
|
@@ -2118,14 +2165,14 @@ declare module "node:crypto" {
|
|
|
2118
2165
|
password: BinaryLike,
|
|
2119
2166
|
salt: BinaryLike,
|
|
2120
2167
|
keylen: number,
|
|
2121
|
-
callback: (err: Error | null, derivedKey:
|
|
2168
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
2122
2169
|
): void;
|
|
2123
2170
|
function scrypt(
|
|
2124
2171
|
password: BinaryLike,
|
|
2125
2172
|
salt: BinaryLike,
|
|
2126
2173
|
keylen: number,
|
|
2127
2174
|
options: ScryptOptions,
|
|
2128
|
-
callback: (err: Error | null, derivedKey:
|
|
2175
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
2129
2176
|
): void;
|
|
2130
2177
|
/**
|
|
2131
2178
|
* Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
|
|
@@ -2157,7 +2204,12 @@ declare module "node:crypto" {
|
|
|
2157
2204
|
* ```
|
|
2158
2205
|
* @since v10.5.0
|
|
2159
2206
|
*/
|
|
2160
|
-
function scryptSync(
|
|
2207
|
+
function scryptSync(
|
|
2208
|
+
password: BinaryLike,
|
|
2209
|
+
salt: BinaryLike,
|
|
2210
|
+
keylen: number,
|
|
2211
|
+
options?: ScryptOptions,
|
|
2212
|
+
): NonSharedBuffer;
|
|
2161
2213
|
interface RsaPublicKey {
|
|
2162
2214
|
key: KeyLike;
|
|
2163
2215
|
padding?: number | undefined;
|
|
@@ -2186,7 +2238,7 @@ declare module "node:crypto" {
|
|
|
2186
2238
|
function publicEncrypt(
|
|
2187
2239
|
key: RsaPublicKey | RsaPrivateKey | KeyLike,
|
|
2188
2240
|
buffer: NodeJS.ArrayBufferView | string,
|
|
2189
|
-
):
|
|
2241
|
+
): NonSharedBuffer;
|
|
2190
2242
|
/**
|
|
2191
2243
|
* Decrypts `buffer` with `key`.`buffer` was previously encrypted using
|
|
2192
2244
|
* the corresponding private key, for example using {@link privateEncrypt}.
|
|
@@ -2201,7 +2253,7 @@ declare module "node:crypto" {
|
|
|
2201
2253
|
function publicDecrypt(
|
|
2202
2254
|
key: RsaPublicKey | RsaPrivateKey | KeyLike,
|
|
2203
2255
|
buffer: NodeJS.ArrayBufferView | string,
|
|
2204
|
-
):
|
|
2256
|
+
): NonSharedBuffer;
|
|
2205
2257
|
/**
|
|
2206
2258
|
* Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
|
|
2207
2259
|
* the corresponding public key, for example using {@link publicEncrypt}.
|
|
@@ -2210,7 +2262,10 @@ declare module "node:crypto" {
|
|
|
2210
2262
|
* object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`.
|
|
2211
2263
|
* @since v0.11.14
|
|
2212
2264
|
*/
|
|
2213
|
-
function privateDecrypt(
|
|
2265
|
+
function privateDecrypt(
|
|
2266
|
+
privateKey: RsaPrivateKey | KeyLike,
|
|
2267
|
+
buffer: NodeJS.ArrayBufferView | string,
|
|
2268
|
+
): NonSharedBuffer;
|
|
2214
2269
|
/**
|
|
2215
2270
|
* Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
|
|
2216
2271
|
* the corresponding public key, for example using {@link publicDecrypt}.
|
|
@@ -2219,7 +2274,10 @@ declare module "node:crypto" {
|
|
|
2219
2274
|
* object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`.
|
|
2220
2275
|
* @since v1.1.0
|
|
2221
2276
|
*/
|
|
2222
|
-
function privateEncrypt(
|
|
2277
|
+
function privateEncrypt(
|
|
2278
|
+
privateKey: RsaPrivateKey | KeyLike,
|
|
2279
|
+
buffer: NodeJS.ArrayBufferView | string,
|
|
2280
|
+
): NonSharedBuffer;
|
|
2223
2281
|
/**
|
|
2224
2282
|
* ```js
|
|
2225
2283
|
* const {
|
|
@@ -2348,7 +2406,7 @@ declare module "node:crypto" {
|
|
|
2348
2406
|
inputEncoding?: BinaryToTextEncoding,
|
|
2349
2407
|
outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
|
|
2350
2408
|
format?: "uncompressed" | "compressed" | "hybrid",
|
|
2351
|
-
):
|
|
2409
|
+
): NonSharedBuffer | string;
|
|
2352
2410
|
/**
|
|
2353
2411
|
* Generates private and public EC Diffie-Hellman key values, and returns
|
|
2354
2412
|
* the public key in the specified `format` and `encoding`. This key should be
|
|
@@ -2361,7 +2419,7 @@ declare module "node:crypto" {
|
|
|
2361
2419
|
* @param encoding The `encoding` of the return value.
|
|
2362
2420
|
* @param [format='uncompressed']
|
|
2363
2421
|
*/
|
|
2364
|
-
generateKeys():
|
|
2422
|
+
generateKeys(): NonSharedBuffer;
|
|
2365
2423
|
generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
|
|
2366
2424
|
/**
|
|
2367
2425
|
* Computes the shared secret using `otherPublicKey` as the other
|
|
@@ -2380,8 +2438,8 @@ declare module "node:crypto" {
|
|
|
2380
2438
|
* @param inputEncoding The `encoding` of the `otherPublicKey` string.
|
|
2381
2439
|
* @param outputEncoding The `encoding` of the return value.
|
|
2382
2440
|
*/
|
|
2383
|
-
computeSecret(otherPublicKey: NodeJS.ArrayBufferView):
|
|
2384
|
-
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding):
|
|
2441
|
+
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): NonSharedBuffer;
|
|
2442
|
+
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): NonSharedBuffer;
|
|
2385
2443
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
|
|
2386
2444
|
computeSecret(
|
|
2387
2445
|
otherPublicKey: string,
|
|
@@ -2395,7 +2453,7 @@ declare module "node:crypto" {
|
|
|
2395
2453
|
* @param encoding The `encoding` of the return value.
|
|
2396
2454
|
* @return The EC Diffie-Hellman in the specified `encoding`.
|
|
2397
2455
|
*/
|
|
2398
|
-
getPrivateKey():
|
|
2456
|
+
getPrivateKey(): NonSharedBuffer;
|
|
2399
2457
|
getPrivateKey(encoding: BinaryToTextEncoding): string;
|
|
2400
2458
|
/**
|
|
2401
2459
|
* 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.
|
|
@@ -2407,7 +2465,7 @@ declare module "node:crypto" {
|
|
|
2407
2465
|
* @param [format='uncompressed']
|
|
2408
2466
|
* @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
|
|
2409
2467
|
*/
|
|
2410
|
-
getPublicKey(encoding?: null, format?: ECDHKeyFormat):
|
|
2468
|
+
getPublicKey(encoding?: null, format?: ECDHKeyFormat): NonSharedBuffer;
|
|
2411
2469
|
getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
|
|
2412
2470
|
/**
|
|
2413
2471
|
* Sets the EC Diffie-Hellman private key.
|
|
@@ -2457,66 +2515,27 @@ declare module "node:crypto" {
|
|
|
2457
2515
|
* @since v6.6.0
|
|
2458
2516
|
*/
|
|
2459
2517
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2460
|
-
|
|
2461
|
-
type KeyFormat = "pem" | "der" | "jwk";
|
|
2462
|
-
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2463
|
-
format: T;
|
|
2464
|
-
cipher?: string | undefined;
|
|
2465
|
-
passphrase?: string | undefined;
|
|
2466
|
-
}
|
|
2467
|
-
interface KeyPairKeyObjectResult {
|
|
2468
|
-
publicKey: KeyObject;
|
|
2469
|
-
privateKey: KeyObject;
|
|
2470
|
-
}
|
|
2471
|
-
interface ED25519KeyPairKeyObjectOptions {}
|
|
2472
|
-
interface ED448KeyPairKeyObjectOptions {}
|
|
2473
|
-
interface X25519KeyPairKeyObjectOptions {}
|
|
2474
|
-
interface X448KeyPairKeyObjectOptions {}
|
|
2475
|
-
interface ECKeyPairKeyObjectOptions {
|
|
2518
|
+
interface DHKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
|
|
2476
2519
|
/**
|
|
2477
|
-
*
|
|
2520
|
+
* The prime parameter
|
|
2478
2521
|
*/
|
|
2479
|
-
|
|
2522
|
+
prime?: Buffer | undefined;
|
|
2480
2523
|
/**
|
|
2481
|
-
*
|
|
2524
|
+
* Prime length in bits
|
|
2482
2525
|
*/
|
|
2483
|
-
|
|
2484
|
-
}
|
|
2485
|
-
interface RSAKeyPairKeyObjectOptions {
|
|
2526
|
+
primeLength?: number | undefined;
|
|
2486
2527
|
/**
|
|
2487
|
-
*
|
|
2528
|
+
* Custom generator
|
|
2529
|
+
* @default 2
|
|
2488
2530
|
*/
|
|
2489
|
-
|
|
2531
|
+
generator?: number | undefined;
|
|
2490
2532
|
/**
|
|
2491
|
-
*
|
|
2492
|
-
* @
|
|
2533
|
+
* Diffie-Hellman group name
|
|
2534
|
+
* @see {@link getDiffieHellman}
|
|
2493
2535
|
*/
|
|
2494
|
-
|
|
2536
|
+
groupName?: string | undefined;
|
|
2495
2537
|
}
|
|
2496
|
-
interface
|
|
2497
|
-
/**
|
|
2498
|
-
* Key size in bits
|
|
2499
|
-
*/
|
|
2500
|
-
modulusLength: number;
|
|
2501
|
-
/**
|
|
2502
|
-
* Public exponent
|
|
2503
|
-
* @default 0x10001
|
|
2504
|
-
*/
|
|
2505
|
-
publicExponent?: number | undefined;
|
|
2506
|
-
/**
|
|
2507
|
-
* Name of the message digest
|
|
2508
|
-
*/
|
|
2509
|
-
hashAlgorithm?: string;
|
|
2510
|
-
/**
|
|
2511
|
-
* Name of the message digest used by MGF1
|
|
2512
|
-
*/
|
|
2513
|
-
mgf1HashAlgorithm?: string;
|
|
2514
|
-
/**
|
|
2515
|
-
* Minimal salt length in bytes
|
|
2516
|
-
*/
|
|
2517
|
-
saltLength?: string;
|
|
2518
|
-
}
|
|
2519
|
-
interface DSAKeyPairKeyObjectOptions {
|
|
2538
|
+
interface DSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
|
|
2520
2539
|
/**
|
|
2521
2540
|
* Key size in bits
|
|
2522
2541
|
*/
|
|
@@ -2526,25 +2545,22 @@ declare module "node:crypto" {
|
|
|
2526
2545
|
*/
|
|
2527
2546
|
divisorLength: number;
|
|
2528
2547
|
}
|
|
2529
|
-
interface
|
|
2548
|
+
interface ECKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8" | "sec1"> {
|
|
2530
2549
|
/**
|
|
2531
|
-
*
|
|
2550
|
+
* Name of the curve to use
|
|
2532
2551
|
*/
|
|
2533
|
-
|
|
2552
|
+
namedCurve: string;
|
|
2534
2553
|
/**
|
|
2535
|
-
*
|
|
2536
|
-
* @default
|
|
2554
|
+
* Must be `'named'` or `'explicit'`
|
|
2555
|
+
* @default 'named'
|
|
2537
2556
|
*/
|
|
2538
|
-
|
|
2539
|
-
publicKeyEncoding: {
|
|
2540
|
-
type: "pkcs1" | "spki";
|
|
2541
|
-
format: PubF;
|
|
2542
|
-
};
|
|
2543
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2544
|
-
type: "pkcs1" | "pkcs8";
|
|
2545
|
-
};
|
|
2557
|
+
paramEncoding?: "explicit" | "named" | undefined;
|
|
2546
2558
|
}
|
|
2547
|
-
interface
|
|
2559
|
+
interface ED25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2560
|
+
interface ED448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2561
|
+
interface MLDSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2562
|
+
interface MLKEMKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2563
|
+
interface RSAPSSKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
|
|
2548
2564
|
/**
|
|
2549
2565
|
* Key size in bits
|
|
2550
2566
|
*/
|
|
@@ -2557,92 +2573,33 @@ declare module "node:crypto" {
|
|
|
2557
2573
|
/**
|
|
2558
2574
|
* Name of the message digest
|
|
2559
2575
|
*/
|
|
2560
|
-
hashAlgorithm?: string;
|
|
2576
|
+
hashAlgorithm?: string | undefined;
|
|
2561
2577
|
/**
|
|
2562
2578
|
* Name of the message digest used by MGF1
|
|
2563
2579
|
*/
|
|
2564
|
-
mgf1HashAlgorithm?: string;
|
|
2580
|
+
mgf1HashAlgorithm?: string | undefined;
|
|
2565
2581
|
/**
|
|
2566
2582
|
* Minimal salt length in bytes
|
|
2567
2583
|
*/
|
|
2568
|
-
saltLength?: string;
|
|
2569
|
-
publicKeyEncoding: {
|
|
2570
|
-
type: "spki";
|
|
2571
|
-
format: PubF;
|
|
2572
|
-
};
|
|
2573
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2574
|
-
type: "pkcs8";
|
|
2575
|
-
};
|
|
2584
|
+
saltLength?: string | undefined;
|
|
2576
2585
|
}
|
|
2577
|
-
interface
|
|
2586
|
+
interface RSAKeyPairOptions extends KeyPairExportOptions<"pkcs1" | "spki", "pkcs1" | "pkcs8"> {
|
|
2578
2587
|
/**
|
|
2579
2588
|
* Key size in bits
|
|
2580
2589
|
*/
|
|
2581
2590
|
modulusLength: number;
|
|
2582
2591
|
/**
|
|
2583
|
-
*
|
|
2592
|
+
* Public exponent
|
|
2593
|
+
* @default 0x10001
|
|
2584
2594
|
*/
|
|
2585
|
-
|
|
2586
|
-
publicKeyEncoding: {
|
|
2587
|
-
type: "spki";
|
|
2588
|
-
format: PubF;
|
|
2589
|
-
};
|
|
2590
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2591
|
-
type: "pkcs8";
|
|
2592
|
-
};
|
|
2593
|
-
}
|
|
2594
|
-
interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> extends ECKeyPairKeyObjectOptions {
|
|
2595
|
-
publicKeyEncoding: {
|
|
2596
|
-
type: "pkcs1" | "spki";
|
|
2597
|
-
format: PubF;
|
|
2598
|
-
};
|
|
2599
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2600
|
-
type: "sec1" | "pkcs8";
|
|
2601
|
-
};
|
|
2602
|
-
}
|
|
2603
|
-
interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2604
|
-
publicKeyEncoding: {
|
|
2605
|
-
type: "spki";
|
|
2606
|
-
format: PubF;
|
|
2607
|
-
};
|
|
2608
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2609
|
-
type: "pkcs8";
|
|
2610
|
-
};
|
|
2611
|
-
}
|
|
2612
|
-
interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2613
|
-
publicKeyEncoding: {
|
|
2614
|
-
type: "spki";
|
|
2615
|
-
format: PubF;
|
|
2616
|
-
};
|
|
2617
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2618
|
-
type: "pkcs8";
|
|
2619
|
-
};
|
|
2620
|
-
}
|
|
2621
|
-
interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2622
|
-
publicKeyEncoding: {
|
|
2623
|
-
type: "spki";
|
|
2624
|
-
format: PubF;
|
|
2625
|
-
};
|
|
2626
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2627
|
-
type: "pkcs8";
|
|
2628
|
-
};
|
|
2629
|
-
}
|
|
2630
|
-
interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2631
|
-
publicKeyEncoding: {
|
|
2632
|
-
type: "spki";
|
|
2633
|
-
format: PubF;
|
|
2634
|
-
};
|
|
2635
|
-
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2636
|
-
type: "pkcs8";
|
|
2637
|
-
};
|
|
2638
|
-
}
|
|
2639
|
-
interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
|
2640
|
-
publicKey: T1;
|
|
2641
|
-
privateKey: T2;
|
|
2595
|
+
publicExponent?: number | undefined;
|
|
2642
2596
|
}
|
|
2597
|
+
interface SLHDSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2598
|
+
interface X25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2599
|
+
interface X448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2643
2600
|
/**
|
|
2644
2601
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2645
|
-
* Ed25519, Ed448, X25519, X448, and
|
|
2602
|
+
* Ed25519, Ed448, X25519, X448, DH, and ML-DSA are currently supported.
|
|
2646
2603
|
*
|
|
2647
2604
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
2648
2605
|
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
@@ -2679,144 +2636,57 @@ declare module "node:crypto" {
|
|
|
2679
2636
|
* When PEM encoding was selected, the respective key will be a string, otherwise
|
|
2680
2637
|
* it will be a buffer containing the data encoded as DER.
|
|
2681
2638
|
* @since v10.12.0
|
|
2682
|
-
* @param type
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
options: RSAKeyPairOptions<"pem", "der">,
|
|
2691
|
-
): KeyPairSyncResult<string, Buffer>;
|
|
2692
|
-
function generateKeyPairSync(
|
|
2693
|
-
type: "rsa",
|
|
2694
|
-
options: RSAKeyPairOptions<"der", "pem">,
|
|
2695
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2696
|
-
function generateKeyPairSync(
|
|
2697
|
-
type: "rsa",
|
|
2698
|
-
options: RSAKeyPairOptions<"der", "der">,
|
|
2699
|
-
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2700
|
-
function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2701
|
-
function generateKeyPairSync(
|
|
2702
|
-
type: "rsa-pss",
|
|
2703
|
-
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2704
|
-
): KeyPairSyncResult<string, string>;
|
|
2705
|
-
function generateKeyPairSync(
|
|
2706
|
-
type: "rsa-pss",
|
|
2707
|
-
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2708
|
-
): KeyPairSyncResult<string, Buffer>;
|
|
2709
|
-
function generateKeyPairSync(
|
|
2710
|
-
type: "rsa-pss",
|
|
2711
|
-
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2712
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2713
|
-
function generateKeyPairSync(
|
|
2714
|
-
type: "rsa-pss",
|
|
2715
|
-
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2716
|
-
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2717
|
-
function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2718
|
-
function generateKeyPairSync(
|
|
2719
|
-
type: "dsa",
|
|
2720
|
-
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2721
|
-
): KeyPairSyncResult<string, string>;
|
|
2722
|
-
function generateKeyPairSync(
|
|
2639
|
+
* @param type The asymmetric key type to generate. See the
|
|
2640
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
|
|
2641
|
+
*/
|
|
2642
|
+
function generateKeyPairSync<T extends DHKeyPairOptions>(
|
|
2643
|
+
type: "dh",
|
|
2644
|
+
options: T,
|
|
2645
|
+
): KeyPairExportResult<T>;
|
|
2646
|
+
function generateKeyPairSync<T extends DSAKeyPairOptions>(
|
|
2723
2647
|
type: "dsa",
|
|
2724
|
-
options:
|
|
2725
|
-
):
|
|
2726
|
-
function generateKeyPairSync(
|
|
2727
|
-
type: "dsa",
|
|
2728
|
-
options: DSAKeyPairOptions<"der", "pem">,
|
|
2729
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2730
|
-
function generateKeyPairSync(
|
|
2731
|
-
type: "dsa",
|
|
2732
|
-
options: DSAKeyPairOptions<"der", "der">,
|
|
2733
|
-
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2734
|
-
function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2735
|
-
function generateKeyPairSync(
|
|
2736
|
-
type: "ec",
|
|
2737
|
-
options: ECKeyPairOptions<"pem", "pem">,
|
|
2738
|
-
): KeyPairSyncResult<string, string>;
|
|
2739
|
-
function generateKeyPairSync(
|
|
2648
|
+
options: T,
|
|
2649
|
+
): KeyPairExportResult<T>;
|
|
2650
|
+
function generateKeyPairSync<T extends ECKeyPairOptions>(
|
|
2740
2651
|
type: "ec",
|
|
2741
|
-
options:
|
|
2742
|
-
):
|
|
2743
|
-
function generateKeyPairSync(
|
|
2744
|
-
type: "ec",
|
|
2745
|
-
options: ECKeyPairOptions<"der", "pem">,
|
|
2746
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2747
|
-
function generateKeyPairSync(
|
|
2748
|
-
type: "ec",
|
|
2749
|
-
options: ECKeyPairOptions<"der", "der">,
|
|
2750
|
-
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2751
|
-
function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2752
|
-
function generateKeyPairSync(
|
|
2753
|
-
type: "ed25519",
|
|
2754
|
-
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2755
|
-
): KeyPairSyncResult<string, string>;
|
|
2756
|
-
function generateKeyPairSync(
|
|
2757
|
-
type: "ed25519",
|
|
2758
|
-
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2759
|
-
): KeyPairSyncResult<string, Buffer>;
|
|
2760
|
-
function generateKeyPairSync(
|
|
2761
|
-
type: "ed25519",
|
|
2762
|
-
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2763
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2764
|
-
function generateKeyPairSync(
|
|
2652
|
+
options: T,
|
|
2653
|
+
): KeyPairExportResult<T>;
|
|
2654
|
+
function generateKeyPairSync<T extends ED25519KeyPairOptions = {}>(
|
|
2765
2655
|
type: "ed25519",
|
|
2766
|
-
options
|
|
2767
|
-
):
|
|
2768
|
-
function generateKeyPairSync
|
|
2769
|
-
function generateKeyPairSync(
|
|
2656
|
+
options?: T,
|
|
2657
|
+
): KeyPairExportResult<T>;
|
|
2658
|
+
function generateKeyPairSync<T extends ED448KeyPairOptions = {}>(
|
|
2770
2659
|
type: "ed448",
|
|
2771
|
-
options
|
|
2772
|
-
):
|
|
2773
|
-
function generateKeyPairSync(
|
|
2774
|
-
type:
|
|
2775
|
-
options
|
|
2776
|
-
):
|
|
2777
|
-
function generateKeyPairSync(
|
|
2778
|
-
type:
|
|
2779
|
-
options
|
|
2780
|
-
):
|
|
2781
|
-
function generateKeyPairSync(
|
|
2782
|
-
type: "
|
|
2783
|
-
options:
|
|
2784
|
-
):
|
|
2785
|
-
function generateKeyPairSync
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
function generateKeyPairSync(
|
|
2795
|
-
type: "x25519",
|
|
2796
|
-
options: X25519KeyPairOptions<"der", "pem">,
|
|
2797
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2798
|
-
function generateKeyPairSync(
|
|
2660
|
+
options?: T,
|
|
2661
|
+
): KeyPairExportResult<T>;
|
|
2662
|
+
function generateKeyPairSync<T extends MLDSAKeyPairOptions = {}>(
|
|
2663
|
+
type: MLDSAKeyType,
|
|
2664
|
+
options?: T,
|
|
2665
|
+
): KeyPairExportResult<T>;
|
|
2666
|
+
function generateKeyPairSync<T extends MLKEMKeyPairOptions = {}>(
|
|
2667
|
+
type: MLKEMKeyType,
|
|
2668
|
+
options?: T,
|
|
2669
|
+
): KeyPairExportResult<T>;
|
|
2670
|
+
function generateKeyPairSync<T extends RSAPSSKeyPairOptions>(
|
|
2671
|
+
type: "rsa-pss",
|
|
2672
|
+
options: T,
|
|
2673
|
+
): KeyPairExportResult<T>;
|
|
2674
|
+
function generateKeyPairSync<T extends RSAKeyPairOptions>(
|
|
2675
|
+
type: "rsa",
|
|
2676
|
+
options: T,
|
|
2677
|
+
): KeyPairExportResult<T>;
|
|
2678
|
+
function generateKeyPairSync<T extends SLHDSAKeyPairOptions = {}>(
|
|
2679
|
+
type: SLHDSAKeyType,
|
|
2680
|
+
options?: T,
|
|
2681
|
+
): KeyPairExportResult<T>;
|
|
2682
|
+
function generateKeyPairSync<T extends X25519KeyPairOptions = {}>(
|
|
2799
2683
|
type: "x25519",
|
|
2800
|
-
options
|
|
2801
|
-
):
|
|
2802
|
-
function generateKeyPairSync
|
|
2803
|
-
function generateKeyPairSync(
|
|
2804
|
-
type: "x448",
|
|
2805
|
-
options: X448KeyPairOptions<"pem", "pem">,
|
|
2806
|
-
): KeyPairSyncResult<string, string>;
|
|
2807
|
-
function generateKeyPairSync(
|
|
2808
|
-
type: "x448",
|
|
2809
|
-
options: X448KeyPairOptions<"pem", "der">,
|
|
2810
|
-
): KeyPairSyncResult<string, Buffer>;
|
|
2811
|
-
function generateKeyPairSync(
|
|
2812
|
-
type: "x448",
|
|
2813
|
-
options: X448KeyPairOptions<"der", "pem">,
|
|
2814
|
-
): KeyPairSyncResult<Buffer, string>;
|
|
2815
|
-
function generateKeyPairSync(
|
|
2684
|
+
options?: T,
|
|
2685
|
+
): KeyPairExportResult<T>;
|
|
2686
|
+
function generateKeyPairSync<T extends X448KeyPairOptions = {}>(
|
|
2816
2687
|
type: "x448",
|
|
2817
|
-
options
|
|
2818
|
-
):
|
|
2819
|
-
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2688
|
+
options?: T,
|
|
2689
|
+
): KeyPairExportResult<T>;
|
|
2820
2690
|
/**
|
|
2821
2691
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2822
2692
|
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
@@ -2854,455 +2724,126 @@ declare module "node:crypto" {
|
|
|
2854
2724
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
2855
2725
|
* a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
|
|
2856
2726
|
* @since v10.12.0
|
|
2857
|
-
* @param type
|
|
2727
|
+
* @param type The asymmetric key type to generate. See the
|
|
2728
|
+
* supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
|
|
2858
2729
|
*/
|
|
2859
|
-
function generateKeyPair(
|
|
2860
|
-
type: "
|
|
2861
|
-
options:
|
|
2862
|
-
callback:
|
|
2863
|
-
): void;
|
|
2864
|
-
function generateKeyPair(
|
|
2865
|
-
type: "rsa",
|
|
2866
|
-
options: RSAKeyPairOptions<"pem", "der">,
|
|
2867
|
-
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2868
|
-
): void;
|
|
2869
|
-
function generateKeyPair(
|
|
2870
|
-
type: "rsa",
|
|
2871
|
-
options: RSAKeyPairOptions<"der", "pem">,
|
|
2872
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2873
|
-
): void;
|
|
2874
|
-
function generateKeyPair(
|
|
2875
|
-
type: "rsa",
|
|
2876
|
-
options: RSAKeyPairOptions<"der", "der">,
|
|
2877
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2878
|
-
): void;
|
|
2879
|
-
function generateKeyPair(
|
|
2880
|
-
type: "rsa",
|
|
2881
|
-
options: RSAKeyPairKeyObjectOptions,
|
|
2882
|
-
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2883
|
-
): void;
|
|
2884
|
-
function generateKeyPair(
|
|
2885
|
-
type: "rsa-pss",
|
|
2886
|
-
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2887
|
-
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2888
|
-
): void;
|
|
2889
|
-
function generateKeyPair(
|
|
2890
|
-
type: "rsa-pss",
|
|
2891
|
-
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2892
|
-
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2893
|
-
): void;
|
|
2894
|
-
function generateKeyPair(
|
|
2895
|
-
type: "rsa-pss",
|
|
2896
|
-
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2897
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2898
|
-
): void;
|
|
2899
|
-
function generateKeyPair(
|
|
2900
|
-
type: "rsa-pss",
|
|
2901
|
-
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2902
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2903
|
-
): void;
|
|
2904
|
-
function generateKeyPair(
|
|
2905
|
-
type: "rsa-pss",
|
|
2906
|
-
options: RSAPSSKeyPairKeyObjectOptions,
|
|
2907
|
-
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2908
|
-
): void;
|
|
2909
|
-
function generateKeyPair(
|
|
2910
|
-
type: "dsa",
|
|
2911
|
-
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2912
|
-
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2730
|
+
function generateKeyPair<T extends DHKeyPairOptions>(
|
|
2731
|
+
type: "dh",
|
|
2732
|
+
options: T,
|
|
2733
|
+
callback: KeyPairExportCallback<T>,
|
|
2913
2734
|
): void;
|
|
2914
|
-
function generateKeyPair(
|
|
2735
|
+
function generateKeyPair<T extends DSAKeyPairOptions>(
|
|
2915
2736
|
type: "dsa",
|
|
2916
|
-
options:
|
|
2917
|
-
callback:
|
|
2737
|
+
options: T,
|
|
2738
|
+
callback: KeyPairExportCallback<T>,
|
|
2918
2739
|
): void;
|
|
2919
|
-
function generateKeyPair(
|
|
2920
|
-
type: "dsa",
|
|
2921
|
-
options: DSAKeyPairOptions<"der", "pem">,
|
|
2922
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2923
|
-
): void;
|
|
2924
|
-
function generateKeyPair(
|
|
2925
|
-
type: "dsa",
|
|
2926
|
-
options: DSAKeyPairOptions<"der", "der">,
|
|
2927
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2928
|
-
): void;
|
|
2929
|
-
function generateKeyPair(
|
|
2930
|
-
type: "dsa",
|
|
2931
|
-
options: DSAKeyPairKeyObjectOptions,
|
|
2932
|
-
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2933
|
-
): void;
|
|
2934
|
-
function generateKeyPair(
|
|
2935
|
-
type: "ec",
|
|
2936
|
-
options: ECKeyPairOptions<"pem", "pem">,
|
|
2937
|
-
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2938
|
-
): void;
|
|
2939
|
-
function generateKeyPair(
|
|
2940
|
-
type: "ec",
|
|
2941
|
-
options: ECKeyPairOptions<"pem", "der">,
|
|
2942
|
-
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2943
|
-
): void;
|
|
2944
|
-
function generateKeyPair(
|
|
2945
|
-
type: "ec",
|
|
2946
|
-
options: ECKeyPairOptions<"der", "pem">,
|
|
2947
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2948
|
-
): void;
|
|
2949
|
-
function generateKeyPair(
|
|
2950
|
-
type: "ec",
|
|
2951
|
-
options: ECKeyPairOptions<"der", "der">,
|
|
2952
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2953
|
-
): void;
|
|
2954
|
-
function generateKeyPair(
|
|
2740
|
+
function generateKeyPair<T extends ECKeyPairOptions>(
|
|
2955
2741
|
type: "ec",
|
|
2956
|
-
options:
|
|
2957
|
-
callback:
|
|
2958
|
-
): void;
|
|
2959
|
-
function generateKeyPair(
|
|
2960
|
-
type: "ed25519",
|
|
2961
|
-
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2962
|
-
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2963
|
-
): void;
|
|
2964
|
-
function generateKeyPair(
|
|
2965
|
-
type: "ed25519",
|
|
2966
|
-
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2967
|
-
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2968
|
-
): void;
|
|
2969
|
-
function generateKeyPair(
|
|
2970
|
-
type: "ed25519",
|
|
2971
|
-
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2972
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2973
|
-
): void;
|
|
2974
|
-
function generateKeyPair(
|
|
2975
|
-
type: "ed25519",
|
|
2976
|
-
options: ED25519KeyPairOptions<"der", "der">,
|
|
2977
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2742
|
+
options: T,
|
|
2743
|
+
callback: KeyPairExportCallback<T>,
|
|
2978
2744
|
): void;
|
|
2979
|
-
function generateKeyPair(
|
|
2745
|
+
function generateKeyPair<T extends ED25519KeyPairOptions = {}>(
|
|
2980
2746
|
type: "ed25519",
|
|
2981
|
-
options:
|
|
2982
|
-
callback:
|
|
2747
|
+
options: T | undefined,
|
|
2748
|
+
callback: KeyPairExportCallback<T>,
|
|
2983
2749
|
): void;
|
|
2984
|
-
function generateKeyPair(
|
|
2750
|
+
function generateKeyPair<T extends ED448KeyPairOptions = {}>(
|
|
2985
2751
|
type: "ed448",
|
|
2986
|
-
options:
|
|
2987
|
-
callback:
|
|
2752
|
+
options: T | undefined,
|
|
2753
|
+
callback: KeyPairExportCallback<T>,
|
|
2988
2754
|
): void;
|
|
2989
|
-
function generateKeyPair(
|
|
2990
|
-
type:
|
|
2991
|
-
options:
|
|
2992
|
-
callback:
|
|
2993
|
-
): void;
|
|
2994
|
-
function generateKeyPair(
|
|
2995
|
-
type: "ed448",
|
|
2996
|
-
options: ED448KeyPairOptions<"der", "pem">,
|
|
2997
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2755
|
+
function generateKeyPair<T extends MLDSAKeyPairOptions = {}>(
|
|
2756
|
+
type: MLDSAKeyType,
|
|
2757
|
+
options: T | undefined,
|
|
2758
|
+
callback: KeyPairExportCallback<T>,
|
|
2998
2759
|
): void;
|
|
2999
|
-
function generateKeyPair(
|
|
3000
|
-
type:
|
|
3001
|
-
options:
|
|
3002
|
-
callback:
|
|
3003
|
-
): void;
|
|
3004
|
-
function generateKeyPair(
|
|
3005
|
-
type: "ed448",
|
|
3006
|
-
options: ED448KeyPairKeyObjectOptions | undefined,
|
|
3007
|
-
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2760
|
+
function generateKeyPair<T extends MLKEMKeyPairOptions = {}>(
|
|
2761
|
+
type: MLKEMKeyType,
|
|
2762
|
+
options: T | undefined,
|
|
2763
|
+
callback: KeyPairExportCallback<T>,
|
|
3008
2764
|
): void;
|
|
3009
|
-
function generateKeyPair(
|
|
3010
|
-
type: "
|
|
3011
|
-
options:
|
|
3012
|
-
callback:
|
|
3013
|
-
): void;
|
|
3014
|
-
function generateKeyPair(
|
|
3015
|
-
type: "x25519",
|
|
3016
|
-
options: X25519KeyPairOptions<"pem", "der">,
|
|
3017
|
-
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2765
|
+
function generateKeyPair<T extends RSAPSSKeyPairOptions>(
|
|
2766
|
+
type: "rsa-pss",
|
|
2767
|
+
options: T,
|
|
2768
|
+
callback: KeyPairExportCallback<T>,
|
|
3018
2769
|
): void;
|
|
3019
|
-
function generateKeyPair(
|
|
3020
|
-
type: "
|
|
3021
|
-
options:
|
|
3022
|
-
callback:
|
|
2770
|
+
function generateKeyPair<T extends RSAKeyPairOptions>(
|
|
2771
|
+
type: "rsa",
|
|
2772
|
+
options: T,
|
|
2773
|
+
callback: KeyPairExportCallback<T>,
|
|
3023
2774
|
): void;
|
|
3024
|
-
function generateKeyPair(
|
|
3025
|
-
type:
|
|
3026
|
-
options:
|
|
3027
|
-
callback:
|
|
2775
|
+
function generateKeyPair<T extends SLHDSAKeyPairOptions = {}>(
|
|
2776
|
+
type: SLHDSAKeyType,
|
|
2777
|
+
options: T | undefined,
|
|
2778
|
+
callback: KeyPairExportCallback<T>,
|
|
3028
2779
|
): void;
|
|
3029
|
-
function generateKeyPair(
|
|
2780
|
+
function generateKeyPair<T extends X25519KeyPairOptions = {}>(
|
|
3030
2781
|
type: "x25519",
|
|
3031
|
-
options:
|
|
3032
|
-
callback:
|
|
3033
|
-
): void;
|
|
3034
|
-
function generateKeyPair(
|
|
3035
|
-
type: "x448",
|
|
3036
|
-
options: X448KeyPairOptions<"pem", "pem">,
|
|
3037
|
-
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3038
|
-
): void;
|
|
3039
|
-
function generateKeyPair(
|
|
3040
|
-
type: "x448",
|
|
3041
|
-
options: X448KeyPairOptions<"pem", "der">,
|
|
3042
|
-
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3043
|
-
): void;
|
|
3044
|
-
function generateKeyPair(
|
|
3045
|
-
type: "x448",
|
|
3046
|
-
options: X448KeyPairOptions<"der", "pem">,
|
|
3047
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3048
|
-
): void;
|
|
3049
|
-
function generateKeyPair(
|
|
3050
|
-
type: "x448",
|
|
3051
|
-
options: X448KeyPairOptions<"der", "der">,
|
|
3052
|
-
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2782
|
+
options: T | undefined,
|
|
2783
|
+
callback: KeyPairExportCallback<T>,
|
|
3053
2784
|
): void;
|
|
3054
|
-
function generateKeyPair(
|
|
2785
|
+
function generateKeyPair<T extends X448KeyPairOptions = {}>(
|
|
3055
2786
|
type: "x448",
|
|
3056
|
-
options:
|
|
3057
|
-
callback:
|
|
2787
|
+
options: T | undefined,
|
|
2788
|
+
callback: KeyPairExportCallback<T>,
|
|
3058
2789
|
): void;
|
|
3059
2790
|
namespace generateKeyPair {
|
|
3060
|
-
function __promisify__(
|
|
3061
|
-
type: "
|
|
3062
|
-
options:
|
|
3063
|
-
): Promise<
|
|
3064
|
-
|
|
3065
|
-
privateKey: string;
|
|
3066
|
-
}>;
|
|
3067
|
-
function __promisify__(
|
|
3068
|
-
type: "rsa",
|
|
3069
|
-
options: RSAKeyPairOptions<"pem", "der">,
|
|
3070
|
-
): Promise<{
|
|
3071
|
-
publicKey: string;
|
|
3072
|
-
privateKey: Buffer;
|
|
3073
|
-
}>;
|
|
3074
|
-
function __promisify__(
|
|
3075
|
-
type: "rsa",
|
|
3076
|
-
options: RSAKeyPairOptions<"der", "pem">,
|
|
3077
|
-
): Promise<{
|
|
3078
|
-
publicKey: Buffer;
|
|
3079
|
-
privateKey: string;
|
|
3080
|
-
}>;
|
|
3081
|
-
function __promisify__(
|
|
3082
|
-
type: "rsa",
|
|
3083
|
-
options: RSAKeyPairOptions<"der", "der">,
|
|
3084
|
-
): Promise<{
|
|
3085
|
-
publicKey: Buffer;
|
|
3086
|
-
privateKey: Buffer;
|
|
3087
|
-
}>;
|
|
3088
|
-
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3089
|
-
function __promisify__(
|
|
3090
|
-
type: "rsa-pss",
|
|
3091
|
-
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
3092
|
-
): Promise<{
|
|
3093
|
-
publicKey: string;
|
|
3094
|
-
privateKey: string;
|
|
3095
|
-
}>;
|
|
3096
|
-
function __promisify__(
|
|
3097
|
-
type: "rsa-pss",
|
|
3098
|
-
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
3099
|
-
): Promise<{
|
|
3100
|
-
publicKey: string;
|
|
3101
|
-
privateKey: Buffer;
|
|
3102
|
-
}>;
|
|
3103
|
-
function __promisify__(
|
|
3104
|
-
type: "rsa-pss",
|
|
3105
|
-
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
3106
|
-
): Promise<{
|
|
3107
|
-
publicKey: Buffer;
|
|
3108
|
-
privateKey: string;
|
|
3109
|
-
}>;
|
|
3110
|
-
function __promisify__(
|
|
3111
|
-
type: "rsa-pss",
|
|
3112
|
-
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
3113
|
-
): Promise<{
|
|
3114
|
-
publicKey: Buffer;
|
|
3115
|
-
privateKey: Buffer;
|
|
3116
|
-
}>;
|
|
3117
|
-
function __promisify__(
|
|
3118
|
-
type: "rsa-pss",
|
|
3119
|
-
options: RSAPSSKeyPairKeyObjectOptions,
|
|
3120
|
-
): Promise<KeyPairKeyObjectResult>;
|
|
3121
|
-
function __promisify__(
|
|
3122
|
-
type: "dsa",
|
|
3123
|
-
options: DSAKeyPairOptions<"pem", "pem">,
|
|
3124
|
-
): Promise<{
|
|
3125
|
-
publicKey: string;
|
|
3126
|
-
privateKey: string;
|
|
3127
|
-
}>;
|
|
3128
|
-
function __promisify__(
|
|
3129
|
-
type: "dsa",
|
|
3130
|
-
options: DSAKeyPairOptions<"pem", "der">,
|
|
3131
|
-
): Promise<{
|
|
3132
|
-
publicKey: string;
|
|
3133
|
-
privateKey: Buffer;
|
|
3134
|
-
}>;
|
|
3135
|
-
function __promisify__(
|
|
2791
|
+
function __promisify__<T extends DHKeyPairOptions>(
|
|
2792
|
+
type: "dh",
|
|
2793
|
+
options: T,
|
|
2794
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2795
|
+
function __promisify__<T extends DSAKeyPairOptions>(
|
|
3136
2796
|
type: "dsa",
|
|
3137
|
-
options:
|
|
3138
|
-
): Promise<
|
|
3139
|
-
|
|
3140
|
-
privateKey: string;
|
|
3141
|
-
}>;
|
|
3142
|
-
function __promisify__(
|
|
3143
|
-
type: "dsa",
|
|
3144
|
-
options: DSAKeyPairOptions<"der", "der">,
|
|
3145
|
-
): Promise<{
|
|
3146
|
-
publicKey: Buffer;
|
|
3147
|
-
privateKey: Buffer;
|
|
3148
|
-
}>;
|
|
3149
|
-
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3150
|
-
function __promisify__(
|
|
3151
|
-
type: "ec",
|
|
3152
|
-
options: ECKeyPairOptions<"pem", "pem">,
|
|
3153
|
-
): Promise<{
|
|
3154
|
-
publicKey: string;
|
|
3155
|
-
privateKey: string;
|
|
3156
|
-
}>;
|
|
3157
|
-
function __promisify__(
|
|
3158
|
-
type: "ec",
|
|
3159
|
-
options: ECKeyPairOptions<"pem", "der">,
|
|
3160
|
-
): Promise<{
|
|
3161
|
-
publicKey: string;
|
|
3162
|
-
privateKey: Buffer;
|
|
3163
|
-
}>;
|
|
3164
|
-
function __promisify__(
|
|
2797
|
+
options: T,
|
|
2798
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2799
|
+
function __promisify__<T extends ECKeyPairOptions>(
|
|
3165
2800
|
type: "ec",
|
|
3166
|
-
options:
|
|
3167
|
-
): Promise<
|
|
3168
|
-
|
|
3169
|
-
privateKey: string;
|
|
3170
|
-
}>;
|
|
3171
|
-
function __promisify__(
|
|
3172
|
-
type: "ec",
|
|
3173
|
-
options: ECKeyPairOptions<"der", "der">,
|
|
3174
|
-
): Promise<{
|
|
3175
|
-
publicKey: Buffer;
|
|
3176
|
-
privateKey: Buffer;
|
|
3177
|
-
}>;
|
|
3178
|
-
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3179
|
-
function __promisify__(
|
|
3180
|
-
type: "ed25519",
|
|
3181
|
-
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
3182
|
-
): Promise<{
|
|
3183
|
-
publicKey: string;
|
|
3184
|
-
privateKey: string;
|
|
3185
|
-
}>;
|
|
3186
|
-
function __promisify__(
|
|
3187
|
-
type: "ed25519",
|
|
3188
|
-
options: ED25519KeyPairOptions<"pem", "der">,
|
|
3189
|
-
): Promise<{
|
|
3190
|
-
publicKey: string;
|
|
3191
|
-
privateKey: Buffer;
|
|
3192
|
-
}>;
|
|
3193
|
-
function __promisify__(
|
|
2801
|
+
options: T,
|
|
2802
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2803
|
+
function __promisify__<T extends ED25519KeyPairOptions = {}>(
|
|
3194
2804
|
type: "ed25519",
|
|
3195
|
-
options
|
|
3196
|
-
): Promise<
|
|
3197
|
-
|
|
3198
|
-
privateKey: string;
|
|
3199
|
-
}>;
|
|
3200
|
-
function __promisify__(
|
|
3201
|
-
type: "ed25519",
|
|
3202
|
-
options: ED25519KeyPairOptions<"der", "der">,
|
|
3203
|
-
): Promise<{
|
|
3204
|
-
publicKey: Buffer;
|
|
3205
|
-
privateKey: Buffer;
|
|
3206
|
-
}>;
|
|
3207
|
-
function __promisify__(
|
|
3208
|
-
type: "ed25519",
|
|
3209
|
-
options?: ED25519KeyPairKeyObjectOptions,
|
|
3210
|
-
): Promise<KeyPairKeyObjectResult>;
|
|
3211
|
-
function __promisify__(
|
|
3212
|
-
type: "ed448",
|
|
3213
|
-
options: ED448KeyPairOptions<"pem", "pem">,
|
|
3214
|
-
): Promise<{
|
|
3215
|
-
publicKey: string;
|
|
3216
|
-
privateKey: string;
|
|
3217
|
-
}>;
|
|
3218
|
-
function __promisify__(
|
|
3219
|
-
type: "ed448",
|
|
3220
|
-
options: ED448KeyPairOptions<"pem", "der">,
|
|
3221
|
-
): Promise<{
|
|
3222
|
-
publicKey: string;
|
|
3223
|
-
privateKey: Buffer;
|
|
3224
|
-
}>;
|
|
3225
|
-
function __promisify__(
|
|
3226
|
-
type: "ed448",
|
|
3227
|
-
options: ED448KeyPairOptions<"der", "pem">,
|
|
3228
|
-
): Promise<{
|
|
3229
|
-
publicKey: Buffer;
|
|
3230
|
-
privateKey: string;
|
|
3231
|
-
}>;
|
|
3232
|
-
function __promisify__(
|
|
2805
|
+
options?: T,
|
|
2806
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2807
|
+
function __promisify__<T extends ED448KeyPairOptions = {}>(
|
|
3233
2808
|
type: "ed448",
|
|
3234
|
-
options
|
|
3235
|
-
): Promise<
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
function __promisify__(
|
|
3241
|
-
type:
|
|
3242
|
-
options
|
|
3243
|
-
): Promise<
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
): Promise<{
|
|
3258
|
-
publicKey: Buffer;
|
|
3259
|
-
privateKey: string;
|
|
3260
|
-
}>;
|
|
3261
|
-
function __promisify__(
|
|
3262
|
-
type: "x25519",
|
|
3263
|
-
options: X25519KeyPairOptions<"der", "der">,
|
|
3264
|
-
): Promise<{
|
|
3265
|
-
publicKey: Buffer;
|
|
3266
|
-
privateKey: Buffer;
|
|
3267
|
-
}>;
|
|
3268
|
-
function __promisify__(
|
|
2809
|
+
options?: T,
|
|
2810
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2811
|
+
function __promisify__<T extends MLDSAKeyPairOptions = {}>(
|
|
2812
|
+
type: MLDSAKeyType,
|
|
2813
|
+
options?: T,
|
|
2814
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2815
|
+
function __promisify__<T extends MLKEMKeyPairOptions = {}>(
|
|
2816
|
+
type: MLKEMKeyType,
|
|
2817
|
+
options?: T,
|
|
2818
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2819
|
+
function __promisify__<T extends RSAPSSKeyPairOptions>(
|
|
2820
|
+
type: "rsa-pss",
|
|
2821
|
+
options: T,
|
|
2822
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2823
|
+
function __promisify__<T extends RSAKeyPairOptions>(
|
|
2824
|
+
type: "rsa",
|
|
2825
|
+
options: T,
|
|
2826
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2827
|
+
function __promisify__<T extends SLHDSAKeyPairOptions = {}>(
|
|
2828
|
+
type: SLHDSAKeyType,
|
|
2829
|
+
options?: T,
|
|
2830
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2831
|
+
function __promisify__<T extends X25519KeyPairOptions = {}>(
|
|
3269
2832
|
type: "x25519",
|
|
3270
|
-
options?:
|
|
3271
|
-
): Promise<
|
|
3272
|
-
function __promisify__(
|
|
2833
|
+
options?: T,
|
|
2834
|
+
): Promise<KeyPairExportResult<T>>;
|
|
2835
|
+
function __promisify__<T extends X448KeyPairOptions = {}>(
|
|
3273
2836
|
type: "x448",
|
|
3274
|
-
options
|
|
3275
|
-
): Promise<
|
|
3276
|
-
publicKey: string;
|
|
3277
|
-
privateKey: string;
|
|
3278
|
-
}>;
|
|
3279
|
-
function __promisify__(
|
|
3280
|
-
type: "x448",
|
|
3281
|
-
options: X448KeyPairOptions<"pem", "der">,
|
|
3282
|
-
): Promise<{
|
|
3283
|
-
publicKey: string;
|
|
3284
|
-
privateKey: Buffer;
|
|
3285
|
-
}>;
|
|
3286
|
-
function __promisify__(
|
|
3287
|
-
type: "x448",
|
|
3288
|
-
options: X448KeyPairOptions<"der", "pem">,
|
|
3289
|
-
): Promise<{
|
|
3290
|
-
publicKey: Buffer;
|
|
3291
|
-
privateKey: string;
|
|
3292
|
-
}>;
|
|
3293
|
-
function __promisify__(
|
|
3294
|
-
type: "x448",
|
|
3295
|
-
options: X448KeyPairOptions<"der", "der">,
|
|
3296
|
-
): Promise<{
|
|
3297
|
-
publicKey: Buffer;
|
|
3298
|
-
privateKey: Buffer;
|
|
3299
|
-
}>;
|
|
3300
|
-
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2837
|
+
options?: T,
|
|
2838
|
+
): Promise<KeyPairExportResult<T>>;
|
|
3301
2839
|
}
|
|
3302
2840
|
/**
|
|
3303
2841
|
* Calculates and returns the signature for `data` using the given private key and
|
|
3304
2842
|
* algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
|
|
3305
|
-
* dependent upon the key type
|
|
2843
|
+
* dependent upon the key type.
|
|
2844
|
+
*
|
|
2845
|
+
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
2846
|
+
* ML-DSA.
|
|
3306
2847
|
*
|
|
3307
2848
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
3308
2849
|
* passed to {@link createPrivateKey}. If it is an object, the following
|
|
@@ -3315,16 +2856,20 @@ declare module "node:crypto" {
|
|
|
3315
2856
|
algorithm: string | null | undefined,
|
|
3316
2857
|
data: NodeJS.ArrayBufferView,
|
|
3317
2858
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
|
|
3318
|
-
):
|
|
2859
|
+
): NonSharedBuffer;
|
|
3319
2860
|
function sign(
|
|
3320
2861
|
algorithm: string | null | undefined,
|
|
3321
2862
|
data: NodeJS.ArrayBufferView,
|
|
3322
2863
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
|
|
3323
|
-
callback: (error: Error | null, data:
|
|
2864
|
+
callback: (error: Error | null, data: NonSharedBuffer) => void,
|
|
3324
2865
|
): void;
|
|
3325
2866
|
/**
|
|
3326
|
-
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
3327
|
-
*
|
|
2867
|
+
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
2868
|
+
* `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
|
2869
|
+
* key type.
|
|
2870
|
+
*
|
|
2871
|
+
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
2872
|
+
* ML-DSA.
|
|
3328
2873
|
*
|
|
3329
2874
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
3330
2875
|
* passed to {@link createPublicKey}. If it is an object, the following
|
|
@@ -3352,23 +2897,102 @@ declare module "node:crypto" {
|
|
|
3352
2897
|
callback: (error: Error | null, result: boolean) => void,
|
|
3353
2898
|
): void;
|
|
3354
2899
|
/**
|
|
3355
|
-
*
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
2900
|
+
* Key decapsulation using a KEM algorithm with a private key.
|
|
2901
|
+
*
|
|
2902
|
+
* Supported key types and their KEM algorithms are:
|
|
2903
|
+
*
|
|
2904
|
+
* * `'rsa'` RSA Secret Value Encapsulation
|
|
2905
|
+
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
2906
|
+
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
2907
|
+
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
2908
|
+
* * `'ml-kem-512'` ML-KEM
|
|
2909
|
+
* * `'ml-kem-768'` ML-KEM
|
|
2910
|
+
* * `'ml-kem-1024'` ML-KEM
|
|
2911
|
+
*
|
|
2912
|
+
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
2913
|
+
* passed to `crypto.createPrivateKey()`.
|
|
2914
|
+
*
|
|
2915
|
+
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2916
|
+
* @since v24.7.0
|
|
2917
|
+
*/
|
|
2918
|
+
function decapsulate(
|
|
2919
|
+
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
2920
|
+
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
2921
|
+
): NonSharedBuffer;
|
|
2922
|
+
function decapsulate(
|
|
2923
|
+
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
2924
|
+
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
2925
|
+
callback: (err: Error, sharedKey: NonSharedBuffer) => void,
|
|
2926
|
+
): void;
|
|
2927
|
+
/**
|
|
2928
|
+
* Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`.
|
|
2929
|
+
* Both keys must have the same `asymmetricKeyType` and must support either the DH or
|
|
2930
|
+
* ECDH operation.
|
|
3358
2931
|
*
|
|
3359
2932
|
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3360
2933
|
* @since v13.9.0, v12.17.0
|
|
3361
2934
|
*/
|
|
3362
|
-
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }):
|
|
2935
|
+
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer;
|
|
3363
2936
|
function diffieHellman(
|
|
3364
2937
|
options: { privateKey: KeyObject; publicKey: KeyObject },
|
|
3365
|
-
callback: (err: Error | null, secret:
|
|
2938
|
+
callback: (err: Error | null, secret: NonSharedBuffer) => void,
|
|
2939
|
+
): void;
|
|
2940
|
+
/**
|
|
2941
|
+
* Key encapsulation using a KEM algorithm with a public key.
|
|
2942
|
+
*
|
|
2943
|
+
* Supported key types and their KEM algorithms are:
|
|
2944
|
+
*
|
|
2945
|
+
* * `'rsa'` RSA Secret Value Encapsulation
|
|
2946
|
+
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
2947
|
+
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
2948
|
+
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
2949
|
+
* * `'ml-kem-512'` ML-KEM
|
|
2950
|
+
* * `'ml-kem-768'` ML-KEM
|
|
2951
|
+
* * `'ml-kem-1024'` ML-KEM
|
|
2952
|
+
*
|
|
2953
|
+
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
2954
|
+
* passed to `crypto.createPublicKey()`.
|
|
2955
|
+
*
|
|
2956
|
+
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2957
|
+
* @since v24.7.0
|
|
2958
|
+
*/
|
|
2959
|
+
function encapsulate(
|
|
2960
|
+
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
2961
|
+
): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer };
|
|
2962
|
+
function encapsulate(
|
|
2963
|
+
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
2964
|
+
callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void,
|
|
3366
2965
|
): void;
|
|
2966
|
+
interface OneShotDigestOptions {
|
|
2967
|
+
/**
|
|
2968
|
+
* Encoding used to encode the returned digest.
|
|
2969
|
+
* @default 'hex'
|
|
2970
|
+
*/
|
|
2971
|
+
outputEncoding?: BinaryToTextEncoding | "buffer" | undefined;
|
|
2972
|
+
/**
|
|
2973
|
+
* For XOF hash functions such as 'shake256', the outputLength option
|
|
2974
|
+
* can be used to specify the desired output length in bytes.
|
|
2975
|
+
*/
|
|
2976
|
+
outputLength?: number | undefined;
|
|
2977
|
+
}
|
|
2978
|
+
interface OneShotDigestOptionsWithStringEncoding extends OneShotDigestOptions {
|
|
2979
|
+
outputEncoding?: BinaryToTextEncoding | undefined;
|
|
2980
|
+
}
|
|
2981
|
+
interface OneShotDigestOptionsWithBufferEncoding extends OneShotDigestOptions {
|
|
2982
|
+
outputEncoding: "buffer";
|
|
2983
|
+
}
|
|
3367
2984
|
/**
|
|
3368
|
-
* A utility for creating one-shot hash digests of data. It can be faster than
|
|
3369
|
-
*
|
|
3370
|
-
*
|
|
3371
|
-
*
|
|
2985
|
+
* A utility for creating one-shot hash digests of data. It can be faster than
|
|
2986
|
+
* the object-based `crypto.createHash()` when hashing a smaller amount of data
|
|
2987
|
+
* (<= 5MB) that's readily available. If the data can be big or if it is streamed,
|
|
2988
|
+
* it's still recommended to use `crypto.createHash()` instead.
|
|
2989
|
+
*
|
|
2990
|
+
* The `algorithm` is dependent on the available algorithms supported by the
|
|
2991
|
+
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
2992
|
+
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
2993
|
+
* display the available digest algorithms.
|
|
2994
|
+
*
|
|
2995
|
+
* If `options` is a string, then it specifies the `outputEncoding`.
|
|
3372
2996
|
*
|
|
3373
2997
|
* Example:
|
|
3374
2998
|
*
|
|
@@ -3388,17 +3012,26 @@ declare module "node:crypto" {
|
|
|
3388
3012
|
* console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
|
|
3389
3013
|
* ```
|
|
3390
3014
|
* @since v21.7.0, v20.12.0
|
|
3391
|
-
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
|
3392
|
-
*
|
|
3393
|
-
*
|
|
3015
|
+
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
|
3016
|
+
* input encoding is desired for a string input, user could encode the string
|
|
3017
|
+
* into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing
|
|
3018
|
+
* the encoded `TypedArray` into this API instead.
|
|
3394
3019
|
*/
|
|
3395
|
-
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
3396
|
-
function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): Buffer;
|
|
3397
3020
|
function hash(
|
|
3398
3021
|
algorithm: string,
|
|
3399
3022
|
data: BinaryLike,
|
|
3400
|
-
|
|
3401
|
-
): string
|
|
3023
|
+
options?: OneShotDigestOptionsWithStringEncoding | BinaryToTextEncoding,
|
|
3024
|
+
): string;
|
|
3025
|
+
function hash(
|
|
3026
|
+
algorithm: string,
|
|
3027
|
+
data: BinaryLike,
|
|
3028
|
+
options: OneShotDigestOptionsWithBufferEncoding | "buffer",
|
|
3029
|
+
): NonSharedBuffer;
|
|
3030
|
+
function hash(
|
|
3031
|
+
algorithm: string,
|
|
3032
|
+
data: BinaryLike,
|
|
3033
|
+
options: OneShotDigestOptions | BinaryToTextEncoding | "buffer",
|
|
3034
|
+
): string | NonSharedBuffer;
|
|
3402
3035
|
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
|
3403
3036
|
interface CipherInfoOptions {
|
|
3404
3037
|
/**
|
|
@@ -3562,23 +3195,23 @@ declare module "node:crypto" {
|
|
|
3562
3195
|
/**
|
|
3563
3196
|
* @default 'always'
|
|
3564
3197
|
*/
|
|
3565
|
-
subject?: "always" | "default" | "never";
|
|
3198
|
+
subject?: "always" | "default" | "never" | undefined;
|
|
3566
3199
|
/**
|
|
3567
3200
|
* @default true
|
|
3568
3201
|
*/
|
|
3569
|
-
wildcards?: boolean;
|
|
3202
|
+
wildcards?: boolean | undefined;
|
|
3570
3203
|
/**
|
|
3571
3204
|
* @default true
|
|
3572
3205
|
*/
|
|
3573
|
-
partialWildcards?: boolean;
|
|
3206
|
+
partialWildcards?: boolean | undefined;
|
|
3574
3207
|
/**
|
|
3575
3208
|
* @default false
|
|
3576
3209
|
*/
|
|
3577
|
-
multiLabelWildcards?: boolean;
|
|
3210
|
+
multiLabelWildcards?: boolean | undefined;
|
|
3578
3211
|
/**
|
|
3579
3212
|
* @default false
|
|
3580
3213
|
*/
|
|
3581
|
-
singleLabelSubdomains?: boolean;
|
|
3214
|
+
singleLabelSubdomains?: boolean | undefined;
|
|
3582
3215
|
}
|
|
3583
3216
|
/**
|
|
3584
3217
|
* Encapsulates an X509 certificate and provides read-only access to
|
|
@@ -3680,7 +3313,7 @@ declare module "node:crypto" {
|
|
|
3680
3313
|
* available.
|
|
3681
3314
|
* @since v15.9.0
|
|
3682
3315
|
*/
|
|
3683
|
-
readonly issuerCertificate
|
|
3316
|
+
readonly issuerCertificate: X509Certificate | undefined;
|
|
3684
3317
|
/**
|
|
3685
3318
|
* The public key `KeyObject` for this certificate.
|
|
3686
3319
|
* @since v15.6.0
|
|
@@ -3690,7 +3323,7 @@ declare module "node:crypto" {
|
|
|
3690
3323
|
* A `Buffer` containing the DER encoding of this certificate.
|
|
3691
3324
|
* @since v15.6.0
|
|
3692
3325
|
*/
|
|
3693
|
-
readonly raw:
|
|
3326
|
+
readonly raw: NonSharedBuffer;
|
|
3694
3327
|
/**
|
|
3695
3328
|
* The serial number of this certificate.
|
|
3696
3329
|
*
|
|
@@ -3700,6 +3333,16 @@ declare module "node:crypto" {
|
|
|
3700
3333
|
* @since v15.6.0
|
|
3701
3334
|
*/
|
|
3702
3335
|
readonly serialNumber: string;
|
|
3336
|
+
/**
|
|
3337
|
+
* The algorithm used to sign the certificate or `undefined` if the signature algorithm is unknown by OpenSSL.
|
|
3338
|
+
* @since v24.9.0
|
|
3339
|
+
*/
|
|
3340
|
+
readonly signatureAlgorithm: string | undefined;
|
|
3341
|
+
/**
|
|
3342
|
+
* The OID of the algorithm used to sign the certificate.
|
|
3343
|
+
* @since v24.9.0
|
|
3344
|
+
*/
|
|
3345
|
+
readonly signatureAlgorithmOid: string;
|
|
3703
3346
|
/**
|
|
3704
3347
|
* The date/time from which this certificate is considered valid.
|
|
3705
3348
|
* @since v15.6.0
|
|
@@ -3772,7 +3415,23 @@ declare module "node:crypto" {
|
|
|
3772
3415
|
*/
|
|
3773
3416
|
checkIP(ip: string): string | undefined;
|
|
3774
3417
|
/**
|
|
3775
|
-
* Checks whether this certificate was issued by the given `otherCert
|
|
3418
|
+
* Checks whether this certificate was potentially issued by the given `otherCert`
|
|
3419
|
+
* by comparing the certificate metadata.
|
|
3420
|
+
*
|
|
3421
|
+
* This is useful for pruning a list of possible issuer certificates which have been
|
|
3422
|
+
* selected using a more rudimentary filtering routine, i.e. just based on subject
|
|
3423
|
+
* and issuer names.
|
|
3424
|
+
*
|
|
3425
|
+
* Finally, to verify that this certificate's signature was produced by a private key
|
|
3426
|
+
* corresponding to `otherCert`'s public key use `x509.verify(publicKey)`
|
|
3427
|
+
* with `otherCert`'s public key represented as a `KeyObject`
|
|
3428
|
+
* like so
|
|
3429
|
+
*
|
|
3430
|
+
* ```js
|
|
3431
|
+
* if (!x509.verify(otherCert.publicKey)) {
|
|
3432
|
+
* throw new Error('otherCert did not issue x509');
|
|
3433
|
+
* }
|
|
3434
|
+
* ```
|
|
3776
3435
|
* @since v15.6.0
|
|
3777
3436
|
*/
|
|
3778
3437
|
checkIssued(otherCert: X509Certificate): boolean;
|
|
@@ -3955,7 +3614,136 @@ declare module "node:crypto" {
|
|
|
3955
3614
|
* @since v17.4.0
|
|
3956
3615
|
* @return Returns `typedArray`.
|
|
3957
3616
|
*/
|
|
3958
|
-
function getRandomValues<
|
|
3617
|
+
function getRandomValues<
|
|
3618
|
+
T extends Exclude<
|
|
3619
|
+
NodeJS.NonSharedTypedArray,
|
|
3620
|
+
NodeJS.NonSharedFloat16Array | NodeJS.NonSharedFloat32Array | NodeJS.NonSharedFloat64Array
|
|
3621
|
+
>,
|
|
3622
|
+
>(typedArray: T): T;
|
|
3623
|
+
type Argon2Algorithm = "argon2d" | "argon2i" | "argon2id";
|
|
3624
|
+
interface Argon2Parameters {
|
|
3625
|
+
/**
|
|
3626
|
+
* REQUIRED, this is the password for password hashing applications of Argon2.
|
|
3627
|
+
*/
|
|
3628
|
+
message: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
3629
|
+
/**
|
|
3630
|
+
* REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2.
|
|
3631
|
+
*/
|
|
3632
|
+
nonce: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
3633
|
+
/**
|
|
3634
|
+
* REQUIRED, degree of parallelism determines how many computational chains (lanes)
|
|
3635
|
+
* can be run. Must be greater than 1 and less than `2**24-1`.
|
|
3636
|
+
*/
|
|
3637
|
+
parallelism: number;
|
|
3638
|
+
/**
|
|
3639
|
+
* REQUIRED, the length of the key to generate. Must be greater than 4 and
|
|
3640
|
+
* less than `2**32-1`.
|
|
3641
|
+
*/
|
|
3642
|
+
tagLength: number;
|
|
3643
|
+
/**
|
|
3644
|
+
* REQUIRED, memory cost in 1KiB blocks. Must be greater than
|
|
3645
|
+
* `8 * parallelism` and less than `2**32-1`. The actual number of blocks is rounded
|
|
3646
|
+
* down to the nearest multiple of `4 * parallelism`.
|
|
3647
|
+
*/
|
|
3648
|
+
memory: number;
|
|
3649
|
+
/**
|
|
3650
|
+
* REQUIRED, number of passes (iterations). Must be greater than 1 and less
|
|
3651
|
+
* than `2**32-1`.
|
|
3652
|
+
*/
|
|
3653
|
+
passes: number;
|
|
3654
|
+
/**
|
|
3655
|
+
* OPTIONAL, Random additional input,
|
|
3656
|
+
* similar to the salt, that should **NOT** be stored with the derived key. This is known as pepper in
|
|
3657
|
+
* password hashing applications. If used, must have a length not greater than `2**32-1` bytes.
|
|
3658
|
+
*/
|
|
3659
|
+
secret?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
3660
|
+
/**
|
|
3661
|
+
* OPTIONAL, Additional data to
|
|
3662
|
+
* be added to the hash, functionally equivalent to salt or secret, but meant for
|
|
3663
|
+
* non-random data. If used, must have a length not greater than `2**32-1` bytes.
|
|
3664
|
+
*/
|
|
3665
|
+
associatedData?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
3666
|
+
}
|
|
3667
|
+
/**
|
|
3668
|
+
* Provides an asynchronous [Argon2](https://www.rfc-editor.org/rfc/rfc9106.html) implementation. Argon2 is a password-based
|
|
3669
|
+
* key derivation function that is designed to be expensive computationally and
|
|
3670
|
+
* memory-wise in order to make brute-force attacks unrewarding.
|
|
3671
|
+
*
|
|
3672
|
+
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
3673
|
+
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
3674
|
+
*
|
|
3675
|
+
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
3676
|
+
* consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v25.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
|
|
3677
|
+
*
|
|
3678
|
+
* The `callback` function is called with two arguments: `err` and `derivedKey`.
|
|
3679
|
+
* `err` is an exception object when key derivation fails, otherwise `err` is
|
|
3680
|
+
* `null`. `derivedKey` is passed to the callback as a `Buffer`.
|
|
3681
|
+
*
|
|
3682
|
+
* An exception is thrown when any of the input arguments specify invalid values
|
|
3683
|
+
* or types.
|
|
3684
|
+
*
|
|
3685
|
+
* ```js
|
|
3686
|
+
* const { argon2, randomBytes } = await import('node:crypto');
|
|
3687
|
+
*
|
|
3688
|
+
* const parameters = {
|
|
3689
|
+
* message: 'password',
|
|
3690
|
+
* nonce: randomBytes(16),
|
|
3691
|
+
* parallelism: 4,
|
|
3692
|
+
* tagLength: 64,
|
|
3693
|
+
* memory: 65536,
|
|
3694
|
+
* passes: 3,
|
|
3695
|
+
* };
|
|
3696
|
+
*
|
|
3697
|
+
* argon2('argon2id', parameters, (err, derivedKey) => {
|
|
3698
|
+
* if (err) throw err;
|
|
3699
|
+
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
3700
|
+
* });
|
|
3701
|
+
* ```
|
|
3702
|
+
* @since v24.7.0
|
|
3703
|
+
* @param algorithm Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`.
|
|
3704
|
+
* @experimental
|
|
3705
|
+
*/
|
|
3706
|
+
function argon2(
|
|
3707
|
+
algorithm: Argon2Algorithm,
|
|
3708
|
+
parameters: Argon2Parameters,
|
|
3709
|
+
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
3710
|
+
): void;
|
|
3711
|
+
/**
|
|
3712
|
+
* Provides a synchronous [Argon2][] implementation. Argon2 is a password-based
|
|
3713
|
+
* key derivation function that is designed to be expensive computationally and
|
|
3714
|
+
* memory-wise in order to make brute-force attacks unrewarding.
|
|
3715
|
+
*
|
|
3716
|
+
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
3717
|
+
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
3718
|
+
*
|
|
3719
|
+
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
3720
|
+
* consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v25.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
|
|
3721
|
+
*
|
|
3722
|
+
* An exception is thrown when key derivation fails, otherwise the derived key is
|
|
3723
|
+
* returned as a `Buffer`.
|
|
3724
|
+
*
|
|
3725
|
+
* An exception is thrown when any of the input arguments specify invalid values
|
|
3726
|
+
* or types.
|
|
3727
|
+
*
|
|
3728
|
+
* ```js
|
|
3729
|
+
* const { argon2Sync, randomBytes } = await import('node:crypto');
|
|
3730
|
+
*
|
|
3731
|
+
* const parameters = {
|
|
3732
|
+
* message: 'password',
|
|
3733
|
+
* nonce: randomBytes(16),
|
|
3734
|
+
* parallelism: 4,
|
|
3735
|
+
* tagLength: 64,
|
|
3736
|
+
* memory: 65536,
|
|
3737
|
+
* passes: 3,
|
|
3738
|
+
* };
|
|
3739
|
+
*
|
|
3740
|
+
* const derivedKey = argon2Sync('argon2id', parameters);
|
|
3741
|
+
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
3742
|
+
* ```
|
|
3743
|
+
* @since v24.7.0
|
|
3744
|
+
* @experimental
|
|
3745
|
+
*/
|
|
3746
|
+
function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer;
|
|
3959
3747
|
/**
|
|
3960
3748
|
* A convenient alias for `crypto.webcrypto.subtle`.
|
|
3961
3749
|
* @since v17.4.0
|
|
@@ -3969,37 +3757,40 @@ declare module "node:crypto" {
|
|
|
3969
3757
|
*/
|
|
3970
3758
|
const webcrypto: webcrypto.Crypto;
|
|
3971
3759
|
namespace webcrypto {
|
|
3972
|
-
type
|
|
3973
|
-
type
|
|
3760
|
+
type AlgorithmIdentifier = Algorithm | string;
|
|
3761
|
+
type BigInteger = NodeJS.NonSharedUint8Array;
|
|
3762
|
+
type KeyFormat = "jwk" | "pkcs8" | "raw" | "raw-public" | "raw-secret" | "raw-seed" | "spki";
|
|
3974
3763
|
type KeyType = "private" | "public" | "secret";
|
|
3975
3764
|
type KeyUsage =
|
|
3765
|
+
| "decapsulateBits"
|
|
3766
|
+
| "decapsulateKey"
|
|
3976
3767
|
| "decrypt"
|
|
3977
3768
|
| "deriveBits"
|
|
3978
3769
|
| "deriveKey"
|
|
3770
|
+
| "encapsulateBits"
|
|
3771
|
+
| "encapsulateKey"
|
|
3979
3772
|
| "encrypt"
|
|
3980
3773
|
| "sign"
|
|
3981
3774
|
| "unwrapKey"
|
|
3982
3775
|
| "verify"
|
|
3983
3776
|
| "wrapKey";
|
|
3984
|
-
type AlgorithmIdentifier = Algorithm | string;
|
|
3985
3777
|
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
3986
3778
|
type NamedCurve = string;
|
|
3987
|
-
|
|
3779
|
+
interface AeadParams extends Algorithm {
|
|
3780
|
+
additionalData?: NodeJS.BufferSource;
|
|
3781
|
+
iv: NodeJS.BufferSource;
|
|
3782
|
+
tagLength: number;
|
|
3783
|
+
}
|
|
3988
3784
|
interface AesCbcParams extends Algorithm {
|
|
3989
|
-
iv: BufferSource;
|
|
3785
|
+
iv: NodeJS.BufferSource;
|
|
3990
3786
|
}
|
|
3991
3787
|
interface AesCtrParams extends Algorithm {
|
|
3992
|
-
counter: BufferSource;
|
|
3788
|
+
counter: NodeJS.BufferSource;
|
|
3993
3789
|
length: number;
|
|
3994
3790
|
}
|
|
3995
3791
|
interface AesDerivedKeyParams extends Algorithm {
|
|
3996
3792
|
length: number;
|
|
3997
3793
|
}
|
|
3998
|
-
interface AesGcmParams extends Algorithm {
|
|
3999
|
-
additionalData?: BufferSource;
|
|
4000
|
-
iv: BufferSource;
|
|
4001
|
-
tagLength?: number;
|
|
4002
|
-
}
|
|
4003
3794
|
interface AesKeyAlgorithm extends KeyAlgorithm {
|
|
4004
3795
|
length: number;
|
|
4005
3796
|
}
|
|
@@ -4009,6 +3800,23 @@ declare module "node:crypto" {
|
|
|
4009
3800
|
interface Algorithm {
|
|
4010
3801
|
name: string;
|
|
4011
3802
|
}
|
|
3803
|
+
interface Argon2Params extends Algorithm {
|
|
3804
|
+
associatedData?: NodeJS.BufferSource;
|
|
3805
|
+
memory: number;
|
|
3806
|
+
nonce: NodeJS.BufferSource;
|
|
3807
|
+
parallelism: number;
|
|
3808
|
+
passes: number;
|
|
3809
|
+
secretValue?: NodeJS.BufferSource;
|
|
3810
|
+
version?: number;
|
|
3811
|
+
}
|
|
3812
|
+
interface CShakeParams extends Algorithm {
|
|
3813
|
+
customization?: NodeJS.BufferSource;
|
|
3814
|
+
functionName?: NodeJS.BufferSource;
|
|
3815
|
+
length: number;
|
|
3816
|
+
}
|
|
3817
|
+
interface ContextParams extends Algorithm {
|
|
3818
|
+
context?: NodeJS.BufferSource;
|
|
3819
|
+
}
|
|
4012
3820
|
interface EcKeyAlgorithm extends KeyAlgorithm {
|
|
4013
3821
|
namedCurve: NamedCurve;
|
|
4014
3822
|
}
|
|
@@ -4024,13 +3832,10 @@ declare module "node:crypto" {
|
|
|
4024
3832
|
interface EcdsaParams extends Algorithm {
|
|
4025
3833
|
hash: HashAlgorithmIdentifier;
|
|
4026
3834
|
}
|
|
4027
|
-
interface Ed448Params extends Algorithm {
|
|
4028
|
-
context?: BufferSource;
|
|
4029
|
-
}
|
|
4030
3835
|
interface HkdfParams extends Algorithm {
|
|
4031
3836
|
hash: HashAlgorithmIdentifier;
|
|
4032
|
-
info: BufferSource;
|
|
4033
|
-
salt: BufferSource;
|
|
3837
|
+
info: NodeJS.BufferSource;
|
|
3838
|
+
salt: NodeJS.BufferSource;
|
|
4034
3839
|
}
|
|
4035
3840
|
interface HmacImportParams extends Algorithm {
|
|
4036
3841
|
hash: HashAlgorithmIdentifier;
|
|
@@ -4067,10 +3872,23 @@ declare module "node:crypto" {
|
|
|
4067
3872
|
interface KeyAlgorithm {
|
|
4068
3873
|
name: string;
|
|
4069
3874
|
}
|
|
3875
|
+
interface KmacImportParams extends Algorithm {
|
|
3876
|
+
length?: number;
|
|
3877
|
+
}
|
|
3878
|
+
interface KmacKeyAlgorithm extends KeyAlgorithm {
|
|
3879
|
+
length: number;
|
|
3880
|
+
}
|
|
3881
|
+
interface KmacKeyGenParams extends Algorithm {
|
|
3882
|
+
length?: number;
|
|
3883
|
+
}
|
|
3884
|
+
interface KmacParams extends Algorithm {
|
|
3885
|
+
customization?: NodeJS.BufferSource;
|
|
3886
|
+
length: number;
|
|
3887
|
+
}
|
|
4070
3888
|
interface Pbkdf2Params extends Algorithm {
|
|
4071
3889
|
hash: HashAlgorithmIdentifier;
|
|
4072
3890
|
iterations: number;
|
|
4073
|
-
salt: BufferSource;
|
|
3891
|
+
salt: NodeJS.BufferSource;
|
|
4074
3892
|
}
|
|
4075
3893
|
interface RsaHashedImportParams extends Algorithm {
|
|
4076
3894
|
hash: HashAlgorithmIdentifier;
|
|
@@ -4090,7 +3908,7 @@ declare module "node:crypto" {
|
|
|
4090
3908
|
publicExponent: BigInteger;
|
|
4091
3909
|
}
|
|
4092
3910
|
interface RsaOaepParams extends Algorithm {
|
|
4093
|
-
label?: BufferSource;
|
|
3911
|
+
label?: NodeJS.BufferSource;
|
|
4094
3912
|
}
|
|
4095
3913
|
interface RsaOtherPrimesInfo {
|
|
4096
3914
|
d?: string;
|
|
@@ -4100,269 +3918,103 @@ declare module "node:crypto" {
|
|
|
4100
3918
|
interface RsaPssParams extends Algorithm {
|
|
4101
3919
|
saltLength: number;
|
|
4102
3920
|
}
|
|
4103
|
-
/**
|
|
4104
|
-
* Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class.
|
|
4105
|
-
* `Crypto` is a singleton that provides access to the remainder of the crypto API.
|
|
4106
|
-
* @since v15.0.0
|
|
4107
|
-
*/
|
|
4108
3921
|
interface Crypto {
|
|
4109
|
-
/**
|
|
4110
|
-
* Provides access to the `SubtleCrypto` API.
|
|
4111
|
-
* @since v15.0.0
|
|
4112
|
-
*/
|
|
4113
3922
|
readonly subtle: SubtleCrypto;
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
*/
|
|
4123
|
-
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(typedArray: T): T;
|
|
4124
|
-
/**
|
|
4125
|
-
* Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
|
|
4126
|
-
* The UUID is generated using a cryptographic pseudorandom number generator.
|
|
4127
|
-
* @since v16.7.0
|
|
4128
|
-
*/
|
|
3923
|
+
getRandomValues<
|
|
3924
|
+
T extends Exclude<
|
|
3925
|
+
NodeJS.NonSharedTypedArray,
|
|
3926
|
+
NodeJS.NonSharedFloat16Array | NodeJS.NonSharedFloat32Array | NodeJS.NonSharedFloat64Array
|
|
3927
|
+
>,
|
|
3928
|
+
>(
|
|
3929
|
+
typedArray: T,
|
|
3930
|
+
): T;
|
|
4129
3931
|
randomUUID(): UUID;
|
|
4130
|
-
CryptoKey: CryptoKeyConstructor;
|
|
4131
|
-
}
|
|
4132
|
-
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
|
|
4133
|
-
interface CryptoKeyConstructor {
|
|
4134
|
-
/** Illegal constructor */
|
|
4135
|
-
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
4136
|
-
readonly length: 0;
|
|
4137
|
-
readonly name: "CryptoKey";
|
|
4138
|
-
readonly prototype: CryptoKey;
|
|
4139
3932
|
}
|
|
4140
|
-
/**
|
|
4141
|
-
* @since v15.0.0
|
|
4142
|
-
*/
|
|
4143
3933
|
interface CryptoKey {
|
|
4144
|
-
/**
|
|
4145
|
-
* An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters.
|
|
4146
|
-
* @since v15.0.0
|
|
4147
|
-
*/
|
|
4148
3934
|
readonly algorithm: KeyAlgorithm;
|
|
4149
|
-
/**
|
|
4150
|
-
* When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`.
|
|
4151
|
-
* @since v15.0.0
|
|
4152
|
-
*/
|
|
4153
3935
|
readonly extractable: boolean;
|
|
4154
|
-
/**
|
|
4155
|
-
* A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key.
|
|
4156
|
-
* @since v15.0.0
|
|
4157
|
-
*/
|
|
4158
3936
|
readonly type: KeyType;
|
|
4159
|
-
/**
|
|
4160
|
-
* An array of strings identifying the operations for which the key may be used.
|
|
4161
|
-
*
|
|
4162
|
-
* The possible usages are:
|
|
4163
|
-
* - `'encrypt'` - The key may be used to encrypt data.
|
|
4164
|
-
* - `'decrypt'` - The key may be used to decrypt data.
|
|
4165
|
-
* - `'sign'` - The key may be used to generate digital signatures.
|
|
4166
|
-
* - `'verify'` - The key may be used to verify digital signatures.
|
|
4167
|
-
* - `'deriveKey'` - The key may be used to derive a new key.
|
|
4168
|
-
* - `'deriveBits'` - The key may be used to derive bits.
|
|
4169
|
-
* - `'wrapKey'` - The key may be used to wrap another key.
|
|
4170
|
-
* - `'unwrapKey'` - The key may be used to unwrap another key.
|
|
4171
|
-
*
|
|
4172
|
-
* Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`).
|
|
4173
|
-
* @since v15.0.0
|
|
4174
|
-
*/
|
|
4175
3937
|
readonly usages: KeyUsage[];
|
|
4176
3938
|
}
|
|
4177
|
-
/**
|
|
4178
|
-
* The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair.
|
|
4179
|
-
* @since v15.0.0
|
|
4180
|
-
*/
|
|
4181
3939
|
interface CryptoKeyPair {
|
|
4182
|
-
/**
|
|
4183
|
-
* A {@link CryptoKey} whose type will be `'private'`.
|
|
4184
|
-
* @since v15.0.0
|
|
4185
|
-
*/
|
|
4186
3940
|
privateKey: CryptoKey;
|
|
4187
|
-
/**
|
|
4188
|
-
* A {@link CryptoKey} whose type will be `'public'`.
|
|
4189
|
-
* @since v15.0.0
|
|
4190
|
-
*/
|
|
4191
3941
|
publicKey: CryptoKey;
|
|
4192
3942
|
}
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
3943
|
+
interface EncapsulatedBits {
|
|
3944
|
+
sharedKey: ArrayBuffer;
|
|
3945
|
+
ciphertext: ArrayBuffer;
|
|
3946
|
+
}
|
|
3947
|
+
interface EncapsulatedKey {
|
|
3948
|
+
sharedKey: CryptoKey;
|
|
3949
|
+
ciphertext: ArrayBuffer;
|
|
3950
|
+
}
|
|
4196
3951
|
interface SubtleCrypto {
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
3952
|
+
decapsulateBits(
|
|
3953
|
+
decapsulationAlgorithm: AlgorithmIdentifier,
|
|
3954
|
+
decapsulationKey: CryptoKey,
|
|
3955
|
+
ciphertext: NodeJS.BufferSource,
|
|
3956
|
+
): Promise<ArrayBuffer>;
|
|
3957
|
+
decapsulateKey(
|
|
3958
|
+
decapsulationAlgorithm: AlgorithmIdentifier,
|
|
3959
|
+
decapsulationKey: CryptoKey,
|
|
3960
|
+
ciphertext: NodeJS.BufferSource,
|
|
3961
|
+
sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
|
|
3962
|
+
extractable: boolean,
|
|
3963
|
+
usages: KeyUsage[],
|
|
3964
|
+
): Promise<CryptoKey>;
|
|
4210
3965
|
decrypt(
|
|
4211
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
3966
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4212
3967
|
key: CryptoKey,
|
|
4213
|
-
data: BufferSource,
|
|
3968
|
+
data: NodeJS.BufferSource,
|
|
4214
3969
|
): Promise<ArrayBuffer>;
|
|
4215
|
-
/**
|
|
4216
|
-
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
4217
|
-
* `subtle.deriveBits()` attempts to generate `length` bits.
|
|
4218
|
-
* The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
|
|
4219
|
-
* When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
|
|
4220
|
-
* for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
|
|
4221
|
-
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
|
|
4222
|
-
*
|
|
4223
|
-
* The algorithms currently supported include:
|
|
4224
|
-
*
|
|
4225
|
-
* - `'ECDH'`
|
|
4226
|
-
* - `'X25519'`
|
|
4227
|
-
* - `'X448'`
|
|
4228
|
-
* - `'HKDF'`
|
|
4229
|
-
* - `'PBKDF2'`
|
|
4230
|
-
* @since v15.0.0
|
|
4231
|
-
*/
|
|
4232
3970
|
deriveBits(
|
|
4233
|
-
algorithm: EcdhKeyDeriveParams,
|
|
3971
|
+
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
|
|
4234
3972
|
baseKey: CryptoKey,
|
|
4235
3973
|
length?: number | null,
|
|
4236
3974
|
): Promise<ArrayBuffer>;
|
|
4237
|
-
deriveBits(
|
|
4238
|
-
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
4239
|
-
baseKey: CryptoKey,
|
|
4240
|
-
length: number,
|
|
4241
|
-
): Promise<ArrayBuffer>;
|
|
4242
|
-
/**
|
|
4243
|
-
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
4244
|
-
* `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
4245
|
-
*
|
|
4246
|
-
* Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
|
|
4247
|
-
* then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
|
|
4248
|
-
*
|
|
4249
|
-
* The algorithms currently supported include:
|
|
4250
|
-
*
|
|
4251
|
-
* - `'ECDH'`
|
|
4252
|
-
* - `'X25519'`
|
|
4253
|
-
* - `'X448'`
|
|
4254
|
-
* - `'HKDF'`
|
|
4255
|
-
* - `'PBKDF2'`
|
|
4256
|
-
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4257
|
-
* @since v15.0.0
|
|
4258
|
-
*/
|
|
4259
3975
|
deriveKey(
|
|
4260
|
-
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
3976
|
+
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params | Argon2Params,
|
|
4261
3977
|
baseKey: CryptoKey,
|
|
4262
|
-
|
|
3978
|
+
derivedKeyType: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | KmacImportParams,
|
|
4263
3979
|
extractable: boolean,
|
|
4264
3980
|
keyUsages: readonly KeyUsage[],
|
|
4265
3981
|
): Promise<CryptoKey>;
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
* @since v15.0.0
|
|
4279
|
-
*/
|
|
4280
|
-
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
4281
|
-
/**
|
|
4282
|
-
* Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
|
|
4283
|
-
* `subtle.encrypt()` attempts to encipher `data`. If successful,
|
|
4284
|
-
* the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
|
|
4285
|
-
*
|
|
4286
|
-
* The algorithms currently supported include:
|
|
4287
|
-
*
|
|
4288
|
-
* - `'RSA-OAEP'`
|
|
4289
|
-
* - `'AES-CTR'`
|
|
4290
|
-
* - `'AES-CBC'`
|
|
4291
|
-
* - `'AES-GCM'`
|
|
4292
|
-
* @since v15.0.0
|
|
4293
|
-
*/
|
|
3982
|
+
digest(algorithm: AlgorithmIdentifier | CShakeParams, data: NodeJS.BufferSource): Promise<ArrayBuffer>;
|
|
3983
|
+
encapsulateBits(
|
|
3984
|
+
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
3985
|
+
encapsulationKey: CryptoKey,
|
|
3986
|
+
): Promise<EncapsulatedBits>;
|
|
3987
|
+
encapsulateKey(
|
|
3988
|
+
encapsulationAlgorithm: AlgorithmIdentifier,
|
|
3989
|
+
encapsulationKey: CryptoKey,
|
|
3990
|
+
sharedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | KmacImportParams,
|
|
3991
|
+
extractable: boolean,
|
|
3992
|
+
usages: KeyUsage[],
|
|
3993
|
+
): Promise<EncapsulatedKey>;
|
|
4294
3994
|
encrypt(
|
|
4295
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
3995
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4296
3996
|
key: CryptoKey,
|
|
4297
|
-
data: BufferSource,
|
|
3997
|
+
data: NodeJS.BufferSource,
|
|
4298
3998
|
): Promise<ArrayBuffer>;
|
|
4299
|
-
/**
|
|
4300
|
-
* Exports the given key into the specified format, if supported.
|
|
4301
|
-
*
|
|
4302
|
-
* If the `<CryptoKey>` is not extractable, the returned promise will reject.
|
|
4303
|
-
*
|
|
4304
|
-
* When `format` is either `'pkcs8'` or `'spki'` and the export is successful,
|
|
4305
|
-
* the returned promise will be resolved with an `<ArrayBuffer>` containing the exported key data.
|
|
4306
|
-
*
|
|
4307
|
-
* When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
|
|
4308
|
-
* JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
|
|
4309
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4310
|
-
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
4311
|
-
* @since v15.0.0
|
|
4312
|
-
*/
|
|
4313
3999
|
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
4314
4000
|
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
4315
|
-
|
|
4316
|
-
* Using the method and parameters provided in `algorithm`,
|
|
4317
|
-
* `subtle.generateKey()` attempts to generate new keying material.
|
|
4318
|
-
* Depending the method used, the method may generate either a single `<CryptoKey>` or a `<CryptoKeyPair>`.
|
|
4319
|
-
*
|
|
4320
|
-
* The `<CryptoKeyPair>` (public and private key) generating algorithms supported include:
|
|
4321
|
-
*
|
|
4322
|
-
* - `'RSASSA-PKCS1-v1_5'`
|
|
4323
|
-
* - `'RSA-PSS'`
|
|
4324
|
-
* - `'RSA-OAEP'`
|
|
4325
|
-
* - `'ECDSA'`
|
|
4326
|
-
* - `'Ed25519'`
|
|
4327
|
-
* - `'Ed448'`
|
|
4328
|
-
* - `'ECDH'`
|
|
4329
|
-
* - `'X25519'`
|
|
4330
|
-
* - `'X448'`
|
|
4331
|
-
* The `<CryptoKey>` (secret key) generating algorithms supported include:
|
|
4332
|
-
*
|
|
4333
|
-
* - `'HMAC'`
|
|
4334
|
-
* - `'AES-CTR'`
|
|
4335
|
-
* - `'AES-CBC'`
|
|
4336
|
-
* - `'AES-GCM'`
|
|
4337
|
-
* - `'AES-KW'`
|
|
4338
|
-
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4339
|
-
* @since v15.0.0
|
|
4340
|
-
*/
|
|
4001
|
+
exportKey(format: KeyFormat, key: CryptoKey): Promise<ArrayBuffer | JsonWebKey>;
|
|
4341
4002
|
generateKey(
|
|
4342
4003
|
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
|
4343
4004
|
extractable: boolean,
|
|
4344
|
-
keyUsages:
|
|
4005
|
+
keyUsages: KeyUsage[],
|
|
4345
4006
|
): Promise<CryptoKeyPair>;
|
|
4346
4007
|
generateKey(
|
|
4347
|
-
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
|
|
4008
|
+
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params | KmacKeyGenParams,
|
|
4348
4009
|
extractable: boolean,
|
|
4349
|
-
keyUsages:
|
|
4010
|
+
keyUsages: KeyUsage[],
|
|
4350
4011
|
): Promise<CryptoKey>;
|
|
4351
4012
|
generateKey(
|
|
4352
4013
|
algorithm: AlgorithmIdentifier,
|
|
4353
4014
|
extractable: boolean,
|
|
4354
4015
|
keyUsages: KeyUsage[],
|
|
4355
4016
|
): Promise<CryptoKeyPair | CryptoKey>;
|
|
4356
|
-
|
|
4357
|
-
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
4358
|
-
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
4359
|
-
* If the import is successful, the returned promise will be resolved with the created `<CryptoKey>`.
|
|
4360
|
-
*
|
|
4361
|
-
* If importing a `'PBKDF2'` key, `extractable` must be `false`.
|
|
4362
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4363
|
-
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4364
|
-
* @since v15.0.0
|
|
4365
|
-
*/
|
|
4017
|
+
getPublicKey(key: CryptoKey, keyUsages: KeyUsage[]): Promise<CryptoKey>;
|
|
4366
4018
|
importKey(
|
|
4367
4019
|
format: "jwk",
|
|
4368
4020
|
keyData: JsonWebKey,
|
|
@@ -4371,144 +4023,56 @@ declare module "node:crypto" {
|
|
|
4371
4023
|
| RsaHashedImportParams
|
|
4372
4024
|
| EcKeyImportParams
|
|
4373
4025
|
| HmacImportParams
|
|
4374
|
-
| AesKeyAlgorithm
|
|
4026
|
+
| AesKeyAlgorithm
|
|
4027
|
+
| KmacImportParams,
|
|
4375
4028
|
extractable: boolean,
|
|
4376
|
-
keyUsages:
|
|
4029
|
+
keyUsages: KeyUsage[],
|
|
4377
4030
|
): Promise<CryptoKey>;
|
|
4378
4031
|
importKey(
|
|
4379
4032
|
format: Exclude<KeyFormat, "jwk">,
|
|
4380
|
-
keyData: BufferSource,
|
|
4033
|
+
keyData: NodeJS.BufferSource,
|
|
4381
4034
|
algorithm:
|
|
4382
4035
|
| AlgorithmIdentifier
|
|
4383
4036
|
| RsaHashedImportParams
|
|
4384
4037
|
| EcKeyImportParams
|
|
4385
4038
|
| HmacImportParams
|
|
4386
|
-
| AesKeyAlgorithm
|
|
4039
|
+
| AesKeyAlgorithm
|
|
4040
|
+
| KmacImportParams,
|
|
4387
4041
|
extractable: boolean,
|
|
4388
4042
|
keyUsages: KeyUsage[],
|
|
4389
4043
|
): Promise<CryptoKey>;
|
|
4390
|
-
/**
|
|
4391
|
-
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
4392
|
-
* `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful,
|
|
4393
|
-
* the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
|
|
4394
|
-
*
|
|
4395
|
-
* The algorithms currently supported include:
|
|
4396
|
-
*
|
|
4397
|
-
* - `'RSASSA-PKCS1-v1_5'`
|
|
4398
|
-
* - `'RSA-PSS'`
|
|
4399
|
-
* - `'ECDSA'`
|
|
4400
|
-
* - `'Ed25519'`
|
|
4401
|
-
* - `'Ed448'`
|
|
4402
|
-
* - `'HMAC'`
|
|
4403
|
-
* @since v15.0.0
|
|
4404
|
-
*/
|
|
4405
4044
|
sign(
|
|
4406
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams |
|
|
4045
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams,
|
|
4407
4046
|
key: CryptoKey,
|
|
4408
|
-
data: BufferSource,
|
|
4047
|
+
data: NodeJS.BufferSource,
|
|
4409
4048
|
): Promise<ArrayBuffer>;
|
|
4410
|
-
/**
|
|
4411
|
-
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
4412
|
-
* The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
4413
|
-
* It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
|
|
4414
|
-
* then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
|
|
4415
|
-
* If successful, the returned promise is resolved with a `<CryptoKey>` object.
|
|
4416
|
-
*
|
|
4417
|
-
* The wrapping algorithms currently supported include:
|
|
4418
|
-
*
|
|
4419
|
-
* - `'RSA-OAEP'`
|
|
4420
|
-
* - `'AES-CTR'`
|
|
4421
|
-
* - `'AES-CBC'`
|
|
4422
|
-
* - `'AES-GCM'`
|
|
4423
|
-
* - `'AES-KW'`
|
|
4424
|
-
*
|
|
4425
|
-
* The unwrapped key algorithms supported include:
|
|
4426
|
-
*
|
|
4427
|
-
* - `'RSASSA-PKCS1-v1_5'`
|
|
4428
|
-
* - `'RSA-PSS'`
|
|
4429
|
-
* - `'RSA-OAEP'`
|
|
4430
|
-
* - `'ECDSA'`
|
|
4431
|
-
* - `'Ed25519'`
|
|
4432
|
-
* - `'Ed448'`
|
|
4433
|
-
* - `'ECDH'`
|
|
4434
|
-
* - `'X25519'`
|
|
4435
|
-
* - `'X448'`
|
|
4436
|
-
* - `'HMAC'`
|
|
4437
|
-
* - `'AES-CTR'`
|
|
4438
|
-
* - `'AES-CBC'`
|
|
4439
|
-
* - `'AES-GCM'`
|
|
4440
|
-
* - `'AES-KW'`
|
|
4441
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4442
|
-
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4443
|
-
* @since v15.0.0
|
|
4444
|
-
*/
|
|
4445
4049
|
unwrapKey(
|
|
4446
4050
|
format: KeyFormat,
|
|
4447
|
-
wrappedKey: BufferSource,
|
|
4051
|
+
wrappedKey: NodeJS.BufferSource,
|
|
4448
4052
|
unwrappingKey: CryptoKey,
|
|
4449
|
-
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4053
|
+
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4450
4054
|
unwrappedKeyAlgorithm:
|
|
4451
4055
|
| AlgorithmIdentifier
|
|
4452
4056
|
| RsaHashedImportParams
|
|
4453
4057
|
| EcKeyImportParams
|
|
4454
4058
|
| HmacImportParams
|
|
4455
|
-
| AesKeyAlgorithm
|
|
4059
|
+
| AesKeyAlgorithm
|
|
4060
|
+
| KmacImportParams,
|
|
4456
4061
|
extractable: boolean,
|
|
4457
4062
|
keyUsages: KeyUsage[],
|
|
4458
4063
|
): Promise<CryptoKey>;
|
|
4459
|
-
/**
|
|
4460
|
-
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
4461
|
-
* `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`.
|
|
4462
|
-
* The returned promise is resolved with either `true` or `false`.
|
|
4463
|
-
*
|
|
4464
|
-
* The algorithms currently supported include:
|
|
4465
|
-
*
|
|
4466
|
-
* - `'RSASSA-PKCS1-v1_5'`
|
|
4467
|
-
* - `'RSA-PSS'`
|
|
4468
|
-
* - `'ECDSA'`
|
|
4469
|
-
* - `'Ed25519'`
|
|
4470
|
-
* - `'Ed448'`
|
|
4471
|
-
* - `'HMAC'`
|
|
4472
|
-
* @since v15.0.0
|
|
4473
|
-
*/
|
|
4474
4064
|
verify(
|
|
4475
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams |
|
|
4065
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | ContextParams | KmacParams,
|
|
4476
4066
|
key: CryptoKey,
|
|
4477
|
-
signature: BufferSource,
|
|
4478
|
-
data: BufferSource,
|
|
4067
|
+
signature: NodeJS.BufferSource,
|
|
4068
|
+
data: NodeJS.BufferSource,
|
|
4479
4069
|
): Promise<boolean>;
|
|
4480
|
-
/**
|
|
4481
|
-
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
4482
|
-
* The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
|
|
4483
|
-
* then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
|
|
4484
|
-
* It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
|
|
4485
|
-
* then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
|
|
4486
|
-
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the encrypted key data.
|
|
4487
|
-
*
|
|
4488
|
-
* The wrapping algorithms currently supported include:
|
|
4489
|
-
*
|
|
4490
|
-
* - `'RSA-OAEP'`
|
|
4491
|
-
* - `'AES-CTR'`
|
|
4492
|
-
* - `'AES-CBC'`
|
|
4493
|
-
* - `'AES-GCM'`
|
|
4494
|
-
* - `'AES-KW'`
|
|
4495
|
-
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4496
|
-
* @since v15.0.0
|
|
4497
|
-
*/
|
|
4498
4070
|
wrapKey(
|
|
4499
4071
|
format: KeyFormat,
|
|
4500
4072
|
key: CryptoKey,
|
|
4501
4073
|
wrappingKey: CryptoKey,
|
|
4502
|
-
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4074
|
+
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AeadParams,
|
|
4503
4075
|
): Promise<ArrayBuffer>;
|
|
4504
4076
|
}
|
|
4505
4077
|
}
|
|
4506
|
-
|
|
4507
|
-
global {
|
|
4508
|
-
var crypto: typeof globalThis extends {
|
|
4509
|
-
crypto: infer T;
|
|
4510
|
-
onmessage: any;
|
|
4511
|
-
} ? T
|
|
4512
|
-
: webcrypto.Crypto;
|
|
4513
|
-
}
|
|
4514
4078
|
}
|