@types/node 18.17.18 → 18.17.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node v18.17/README.md +1 -1
- node v18.17/assert/strict.d.ts +4 -4
- node v18.17/assert.d.ts +48 -24
- node v18.17/async_hooks.d.ts +10 -7
- node v18.17/buffer.d.ts +32 -34
- node v18.17/child_process.d.ts +262 -122
- node v18.17/cluster.d.ts +107 -89
- node v18.17/console.d.ts +7 -7
- node v18.17/constants.d.ts +12 -11
- node v18.17/crypto.d.ts +746 -268
- node v18.17/dgram.d.ts +81 -45
- node v18.17/diagnostics_channel.d.ts +3 -3
- node v18.17/dns/promises.d.ts +28 -25
- node v18.17/dns.d.ts +203 -62
- node v18.17/dom-events.d.ts +67 -71
- node v18.17/domain.d.ts +4 -4
- node v18.17/events.d.ts +15 -7
- node v18.17/fs/promises.d.ts +102 -73
- node v18.17/fs.d.ts +513 -311
- node v18.17/globals.d.ts +16 -18
- node v18.17/http.d.ts +185 -185
- node v18.17/http2.d.ts +628 -376
- node v18.17/https.d.ts +107 -105
- node v18.17/module.d.ts +11 -8
- node v18.17/net.d.ts +112 -93
- node v18.17/os.d.ts +7 -7
- node v18.17/package.json +2 -2
- node v18.17/path.d.ts +13 -13
- node v18.17/perf_hooks.d.ts +20 -19
- node v18.17/process.d.ts +155 -125
- node v18.17/punycode.d.ts +3 -3
- node v18.17/querystring.d.ts +14 -4
- node v18.17/readline/promises.d.ts +5 -5
- node v18.17/readline.d.ts +69 -56
- node v18.17/repl.d.ts +67 -61
- node v18.17/stream/consumers.d.ts +4 -4
- node v18.17/stream/promises.d.ts +56 -15
- node v18.17/stream/web.d.ts +26 -20
- node v18.17/stream.d.ts +356 -226
- node v18.17/string_decoder.d.ts +3 -3
- node v18.17/test.d.ts +76 -91
- node v18.17/timers/promises.d.ts +4 -4
- node v18.17/timers.d.ts +23 -8
- node v18.17/tls.d.ts +151 -71
- node v18.17/trace_events.d.ts +3 -3
- node v18.17/ts4.8/assert/strict.d.ts +4 -4
- node v18.17/ts4.8/assert.d.ts +48 -24
- node v18.17/ts4.8/async_hooks.d.ts +10 -7
- node v18.17/ts4.8/buffer.d.ts +32 -34
- node v18.17/ts4.8/child_process.d.ts +262 -122
- node v18.17/ts4.8/cluster.d.ts +107 -89
- node v18.17/ts4.8/console.d.ts +7 -7
- node v18.17/ts4.8/constants.d.ts +12 -11
- node v18.17/ts4.8/crypto.d.ts +746 -268
- node v18.17/ts4.8/dgram.d.ts +81 -45
- node v18.17/ts4.8/diagnostics_channel.d.ts +3 -3
- node v18.17/ts4.8/dns/promises.d.ts +28 -25
- node v18.17/ts4.8/dns.d.ts +203 -62
- node v18.17/ts4.8/dom-events.d.ts +67 -71
- node v18.17/ts4.8/domain.d.ts +4 -4
- node v18.17/ts4.8/events.d.ts +15 -7
- node v18.17/ts4.8/fs/promises.d.ts +102 -73
- node v18.17/ts4.8/fs.d.ts +514 -312
- node v18.17/ts4.8/globals.d.ts +44 -46
- node v18.17/ts4.8/http.d.ts +185 -185
- node v18.17/ts4.8/http2.d.ts +628 -376
- node v18.17/ts4.8/https.d.ts +107 -105
- node v18.17/ts4.8/module.d.ts +11 -8
- node v18.17/ts4.8/net.d.ts +112 -93
- node v18.17/ts4.8/os.d.ts +7 -7
- node v18.17/ts4.8/path.d.ts +13 -13
- node v18.17/ts4.8/perf_hooks.d.ts +20 -19
- node v18.17/ts4.8/process.d.ts +155 -125
- node v18.17/ts4.8/punycode.d.ts +3 -3
- node v18.17/ts4.8/querystring.d.ts +14 -4
- node v18.17/ts4.8/readline/promises.d.ts +5 -5
- node v18.17/ts4.8/readline.d.ts +69 -56
- node v18.17/ts4.8/repl.d.ts +67 -61
- node v18.17/ts4.8/stream/consumers.d.ts +4 -4
- node v18.17/ts4.8/stream/promises.d.ts +56 -15
- node v18.17/ts4.8/stream/web.d.ts +26 -20
- node v18.17/ts4.8/stream.d.ts +321 -217
- node v18.17/ts4.8/string_decoder.d.ts +3 -3
- node v18.17/ts4.8/test.d.ts +75 -90
- node v18.17/ts4.8/timers/promises.d.ts +4 -4
- node v18.17/ts4.8/timers.d.ts +23 -8
- node v18.17/ts4.8/tls.d.ts +151 -71
- node v18.17/ts4.8/trace_events.d.ts +3 -3
- node v18.17/ts4.8/tty.d.ts +10 -10
- node v18.17/ts4.8/url.d.ts +26 -14
- node v18.17/ts4.8/util.d.ts +178 -117
- node v18.17/ts4.8/v8.d.ts +4 -4
- node v18.17/ts4.8/vm.d.ts +60 -42
- node v18.17/ts4.8/wasi.d.ts +3 -3
- node v18.17/ts4.8/worker_threads.d.ts +82 -85
- node v18.17/ts4.8/zlib.d.ts +9 -9
- node v18.17/tty.d.ts +10 -10
- node v18.17/url.d.ts +26 -14
- node v18.17/util.d.ts +178 -117
- node v18.17/v8.d.ts +4 -4
- node v18.17/vm.d.ts +60 -42
- node v18.17/wasi.d.ts +3 -3
- node v18.17/worker_threads.d.ts +82 -85
- node v18.17/zlib.d.ts +9 -9
node v18.17/ts4.8/crypto.d.ts
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/crypto.js)
|
|
17
17
|
*/
|
|
18
|
-
declare module
|
|
19
|
-
import * as stream from
|
|
20
|
-
import { PeerCertificate } from
|
|
18
|
+
declare module "crypto" {
|
|
19
|
+
import * as stream from "node:stream";
|
|
20
|
+
import { PeerCertificate } from "node:tls";
|
|
21
21
|
/**
|
|
22
22
|
* SPKAC is a Certificate Signing Request mechanism originally implemented by
|
|
23
23
|
* Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/keygen).
|
|
@@ -277,11 +277,11 @@ declare module 'crypto' {
|
|
|
277
277
|
*/
|
|
278
278
|
function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
|
|
279
279
|
// https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
|
|
280
|
-
type BinaryToTextEncoding =
|
|
281
|
-
type CharacterEncoding =
|
|
282
|
-
type LegacyCharacterEncoding =
|
|
280
|
+
type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
|
|
281
|
+
type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
|
|
282
|
+
type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
|
|
283
283
|
type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
|
|
284
|
-
type ECDHKeyFormat =
|
|
284
|
+
type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
|
|
285
285
|
/**
|
|
286
286
|
* The `Hash` class is a utility for creating hash digests of data. It can be
|
|
287
287
|
* used in one of two ways:
|
|
@@ -500,15 +500,15 @@ declare module 'crypto' {
|
|
|
500
500
|
digest(): Buffer;
|
|
501
501
|
digest(encoding: BinaryToTextEncoding): string;
|
|
502
502
|
}
|
|
503
|
-
type KeyObjectType =
|
|
503
|
+
type KeyObjectType = "secret" | "public" | "private";
|
|
504
504
|
interface KeyExportOptions<T extends KeyFormat> {
|
|
505
|
-
type:
|
|
505
|
+
type: "pkcs1" | "spki" | "pkcs8" | "sec1";
|
|
506
506
|
format: T;
|
|
507
507
|
cipher?: string | undefined;
|
|
508
508
|
passphrase?: string | Buffer | undefined;
|
|
509
509
|
}
|
|
510
510
|
interface JwkKeyExportOptions {
|
|
511
|
-
format:
|
|
511
|
+
format: "jwk";
|
|
512
512
|
}
|
|
513
513
|
interface JsonWebKey {
|
|
514
514
|
crv?: string | undefined;
|
|
@@ -652,8 +652,8 @@ declare module 'crypto' {
|
|
|
652
652
|
* PKCS#1 and SEC1 encryption.
|
|
653
653
|
* @since v11.6.0
|
|
654
654
|
*/
|
|
655
|
-
export(options: KeyExportOptions<
|
|
656
|
-
export(options?: KeyExportOptions<
|
|
655
|
+
export(options: KeyExportOptions<"pem">): string | Buffer;
|
|
656
|
+
export(options?: KeyExportOptions<"der">): Buffer;
|
|
657
657
|
export(options?: JwkKeyExportOptions): JsonWebKey;
|
|
658
658
|
/**
|
|
659
659
|
* For secret keys, this property represents the size of the key in bytes. This
|
|
@@ -668,9 +668,9 @@ declare module 'crypto' {
|
|
|
668
668
|
*/
|
|
669
669
|
type: KeyObjectType;
|
|
670
670
|
}
|
|
671
|
-
type CipherCCMTypes =
|
|
672
|
-
type CipherGCMTypes =
|
|
673
|
-
type CipherOCBTypes =
|
|
671
|
+
type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
|
|
672
|
+
type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
|
|
673
|
+
type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
|
|
674
674
|
type BinaryLike = string | NodeJS.ArrayBufferView;
|
|
675
675
|
type CipherKey = BinaryLike | KeyObject;
|
|
676
676
|
interface CipherCCMOptions extends stream.TransformOptions {
|
|
@@ -750,10 +750,30 @@ declare module 'crypto' {
|
|
|
750
750
|
* @since v0.1.94
|
|
751
751
|
* @param options `stream.transform` options
|
|
752
752
|
*/
|
|
753
|
-
function createCipheriv(
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
753
|
+
function createCipheriv(
|
|
754
|
+
algorithm: CipherCCMTypes,
|
|
755
|
+
key: CipherKey,
|
|
756
|
+
iv: BinaryLike,
|
|
757
|
+
options: CipherCCMOptions,
|
|
758
|
+
): CipherCCM;
|
|
759
|
+
function createCipheriv(
|
|
760
|
+
algorithm: CipherOCBTypes,
|
|
761
|
+
key: CipherKey,
|
|
762
|
+
iv: BinaryLike,
|
|
763
|
+
options: CipherOCBOptions,
|
|
764
|
+
): CipherOCB;
|
|
765
|
+
function createCipheriv(
|
|
766
|
+
algorithm: CipherGCMTypes,
|
|
767
|
+
key: CipherKey,
|
|
768
|
+
iv: BinaryLike,
|
|
769
|
+
options?: CipherGCMOptions,
|
|
770
|
+
): CipherGCM;
|
|
771
|
+
function createCipheriv(
|
|
772
|
+
algorithm: string,
|
|
773
|
+
key: CipherKey,
|
|
774
|
+
iv: BinaryLike | null,
|
|
775
|
+
options?: stream.TransformOptions,
|
|
776
|
+
): Cipher;
|
|
757
777
|
/**
|
|
758
778
|
* Instances of the `Cipher` class are used to encrypt data. The class can be
|
|
759
779
|
* used in one of two ways:
|
|
@@ -925,7 +945,7 @@ declare module 'crypto' {
|
|
|
925
945
|
buffer: NodeJS.ArrayBufferView,
|
|
926
946
|
options: {
|
|
927
947
|
plaintextLength: number;
|
|
928
|
-
}
|
|
948
|
+
},
|
|
929
949
|
): this;
|
|
930
950
|
getAuthTag(): Buffer;
|
|
931
951
|
}
|
|
@@ -934,7 +954,7 @@ declare module 'crypto' {
|
|
|
934
954
|
buffer: NodeJS.ArrayBufferView,
|
|
935
955
|
options?: {
|
|
936
956
|
plaintextLength: number;
|
|
937
|
-
}
|
|
957
|
+
},
|
|
938
958
|
): this;
|
|
939
959
|
getAuthTag(): Buffer;
|
|
940
960
|
}
|
|
@@ -943,7 +963,7 @@ declare module 'crypto' {
|
|
|
943
963
|
buffer: NodeJS.ArrayBufferView,
|
|
944
964
|
options?: {
|
|
945
965
|
plaintextLength: number;
|
|
946
|
-
}
|
|
966
|
+
},
|
|
947
967
|
): this;
|
|
948
968
|
getAuthTag(): Buffer;
|
|
949
969
|
}
|
|
@@ -1003,10 +1023,30 @@ declare module 'crypto' {
|
|
|
1003
1023
|
* @since v0.1.94
|
|
1004
1024
|
* @param options `stream.transform` options
|
|
1005
1025
|
*/
|
|
1006
|
-
function createDecipheriv(
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1026
|
+
function createDecipheriv(
|
|
1027
|
+
algorithm: CipherCCMTypes,
|
|
1028
|
+
key: CipherKey,
|
|
1029
|
+
iv: BinaryLike,
|
|
1030
|
+
options: CipherCCMOptions,
|
|
1031
|
+
): DecipherCCM;
|
|
1032
|
+
function createDecipheriv(
|
|
1033
|
+
algorithm: CipherOCBTypes,
|
|
1034
|
+
key: CipherKey,
|
|
1035
|
+
iv: BinaryLike,
|
|
1036
|
+
options: CipherOCBOptions,
|
|
1037
|
+
): DecipherOCB;
|
|
1038
|
+
function createDecipheriv(
|
|
1039
|
+
algorithm: CipherGCMTypes,
|
|
1040
|
+
key: CipherKey,
|
|
1041
|
+
iv: BinaryLike,
|
|
1042
|
+
options?: CipherGCMOptions,
|
|
1043
|
+
): DecipherGCM;
|
|
1044
|
+
function createDecipheriv(
|
|
1045
|
+
algorithm: string,
|
|
1046
|
+
key: CipherKey,
|
|
1047
|
+
iv: BinaryLike | null,
|
|
1048
|
+
options?: stream.TransformOptions,
|
|
1049
|
+
): Decipher;
|
|
1010
1050
|
/**
|
|
1011
1051
|
* Instances of the `Decipher` class are used to decrypt data. The class can be
|
|
1012
1052
|
* used in one of two ways:
|
|
@@ -1164,7 +1204,7 @@ declare module 'crypto' {
|
|
|
1164
1204
|
buffer: NodeJS.ArrayBufferView,
|
|
1165
1205
|
options: {
|
|
1166
1206
|
plaintextLength: number;
|
|
1167
|
-
}
|
|
1207
|
+
},
|
|
1168
1208
|
): this;
|
|
1169
1209
|
}
|
|
1170
1210
|
interface DecipherGCM extends Decipher {
|
|
@@ -1173,7 +1213,7 @@ declare module 'crypto' {
|
|
|
1173
1213
|
buffer: NodeJS.ArrayBufferView,
|
|
1174
1214
|
options?: {
|
|
1175
1215
|
plaintextLength: number;
|
|
1176
|
-
}
|
|
1216
|
+
},
|
|
1177
1217
|
): this;
|
|
1178
1218
|
}
|
|
1179
1219
|
interface DecipherOCB extends Decipher {
|
|
@@ -1182,20 +1222,20 @@ declare module 'crypto' {
|
|
|
1182
1222
|
buffer: NodeJS.ArrayBufferView,
|
|
1183
1223
|
options?: {
|
|
1184
1224
|
plaintextLength: number;
|
|
1185
|
-
}
|
|
1225
|
+
},
|
|
1186
1226
|
): this;
|
|
1187
1227
|
}
|
|
1188
1228
|
interface PrivateKeyInput {
|
|
1189
1229
|
key: string | Buffer;
|
|
1190
1230
|
format?: KeyFormat | undefined;
|
|
1191
|
-
type?:
|
|
1231
|
+
type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
|
|
1192
1232
|
passphrase?: string | Buffer | undefined;
|
|
1193
1233
|
encoding?: string | undefined;
|
|
1194
1234
|
}
|
|
1195
1235
|
interface PublicKeyInput {
|
|
1196
1236
|
key: string | Buffer;
|
|
1197
1237
|
format?: KeyFormat | undefined;
|
|
1198
|
-
type?:
|
|
1238
|
+
type?: "pkcs1" | "spki" | undefined;
|
|
1199
1239
|
encoding?: string | undefined;
|
|
1200
1240
|
}
|
|
1201
1241
|
/**
|
|
@@ -1215,11 +1255,11 @@ declare module 'crypto' {
|
|
|
1215
1255
|
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1216
1256
|
*/
|
|
1217
1257
|
function generateKey(
|
|
1218
|
-
type:
|
|
1258
|
+
type: "hmac" | "aes",
|
|
1219
1259
|
options: {
|
|
1220
1260
|
length: number;
|
|
1221
1261
|
},
|
|
1222
|
-
callback: (err: Error | null, key: KeyObject) => void
|
|
1262
|
+
callback: (err: Error | null, key: KeyObject) => void,
|
|
1223
1263
|
): void;
|
|
1224
1264
|
/**
|
|
1225
1265
|
* Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
|
|
@@ -1236,14 +1276,14 @@ declare module 'crypto' {
|
|
|
1236
1276
|
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1237
1277
|
*/
|
|
1238
1278
|
function generateKeySync(
|
|
1239
|
-
type:
|
|
1279
|
+
type: "hmac" | "aes",
|
|
1240
1280
|
options: {
|
|
1241
1281
|
length: number;
|
|
1242
|
-
}
|
|
1282
|
+
},
|
|
1243
1283
|
): KeyObject;
|
|
1244
1284
|
interface JsonWebKeyInput {
|
|
1245
1285
|
key: JsonWebKey;
|
|
1246
|
-
format:
|
|
1286
|
+
format: "jwk";
|
|
1247
1287
|
}
|
|
1248
1288
|
/**
|
|
1249
1289
|
* Creates and returns a new key object containing a private key. If `key` is a
|
|
@@ -1290,7 +1330,7 @@ declare module 'crypto' {
|
|
|
1290
1330
|
* @param options `stream.Writable` options
|
|
1291
1331
|
*/
|
|
1292
1332
|
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
|
|
1293
|
-
type DSAEncoding =
|
|
1333
|
+
type DSAEncoding = "der" | "ieee-p1363";
|
|
1294
1334
|
interface SigningOptions {
|
|
1295
1335
|
/**
|
|
1296
1336
|
* @see crypto.constants.RSA_PKCS1_PADDING
|
|
@@ -1399,7 +1439,10 @@ declare module 'crypto' {
|
|
|
1399
1439
|
* @since v0.1.92
|
|
1400
1440
|
*/
|
|
1401
1441
|
sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
|
1402
|
-
sign(
|
|
1442
|
+
sign(
|
|
1443
|
+
privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
1444
|
+
outputFormat: BinaryToTextEncoding,
|
|
1445
|
+
): string;
|
|
1403
1446
|
}
|
|
1404
1447
|
/**
|
|
1405
1448
|
* Creates and returns a `Verify` object that uses the given algorithm.
|
|
@@ -1462,8 +1505,15 @@ declare module 'crypto' {
|
|
|
1462
1505
|
* be passed instead of a public key.
|
|
1463
1506
|
* @since v0.1.92
|
|
1464
1507
|
*/
|
|
1465
|
-
verify(
|
|
1466
|
-
|
|
1508
|
+
verify(
|
|
1509
|
+
object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
1510
|
+
signature: NodeJS.ArrayBufferView,
|
|
1511
|
+
): boolean;
|
|
1512
|
+
verify(
|
|
1513
|
+
object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
1514
|
+
signature: string,
|
|
1515
|
+
signature_format?: BinaryToTextEncoding,
|
|
1516
|
+
): boolean;
|
|
1467
1517
|
}
|
|
1468
1518
|
/**
|
|
1469
1519
|
* Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
|
|
@@ -1482,10 +1532,26 @@ declare module 'crypto' {
|
|
|
1482
1532
|
* @param generatorEncoding The `encoding` of the `generator` string.
|
|
1483
1533
|
*/
|
|
1484
1534
|
function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
|
|
1485
|
-
function createDiffieHellman(
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1535
|
+
function createDiffieHellman(
|
|
1536
|
+
prime: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1537
|
+
generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1538
|
+
): DiffieHellman;
|
|
1539
|
+
function createDiffieHellman(
|
|
1540
|
+
prime: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1541
|
+
generator: string,
|
|
1542
|
+
generatorEncoding: BinaryToTextEncoding,
|
|
1543
|
+
): DiffieHellman;
|
|
1544
|
+
function createDiffieHellman(
|
|
1545
|
+
prime: string,
|
|
1546
|
+
primeEncoding: BinaryToTextEncoding,
|
|
1547
|
+
generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1548
|
+
): DiffieHellman;
|
|
1549
|
+
function createDiffieHellman(
|
|
1550
|
+
prime: string,
|
|
1551
|
+
primeEncoding: BinaryToTextEncoding,
|
|
1552
|
+
generator: string,
|
|
1553
|
+
generatorEncoding: BinaryToTextEncoding,
|
|
1554
|
+
): DiffieHellman;
|
|
1489
1555
|
/**
|
|
1490
1556
|
* The `DiffieHellman` class is a utility for creating Diffie-Hellman key
|
|
1491
1557
|
* exchanges.
|
|
@@ -1543,8 +1609,16 @@ declare module 'crypto' {
|
|
|
1543
1609
|
*/
|
|
1544
1610
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
|
|
1545
1611
|
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
|
|
1546
|
-
computeSecret(
|
|
1547
|
-
|
|
1612
|
+
computeSecret(
|
|
1613
|
+
otherPublicKey: NodeJS.ArrayBufferView,
|
|
1614
|
+
inputEncoding: null,
|
|
1615
|
+
outputEncoding: BinaryToTextEncoding,
|
|
1616
|
+
): string;
|
|
1617
|
+
computeSecret(
|
|
1618
|
+
otherPublicKey: string,
|
|
1619
|
+
inputEncoding: BinaryToTextEncoding,
|
|
1620
|
+
outputEncoding: BinaryToTextEncoding,
|
|
1621
|
+
): string;
|
|
1548
1622
|
/**
|
|
1549
1623
|
* Returns the Diffie-Hellman prime in the specified `encoding`.
|
|
1550
1624
|
* If `encoding` is provided a string is
|
|
@@ -1642,7 +1716,7 @@ declare module 'crypto' {
|
|
|
1642
1716
|
(name: string): DiffieHellmanGroup;
|
|
1643
1717
|
readonly prototype: DiffieHellmanGroup;
|
|
1644
1718
|
}
|
|
1645
|
-
type DiffieHellmanGroup = Omit<DiffieHellman,
|
|
1719
|
+
type DiffieHellmanGroup = Omit<DiffieHellman, "setPublicKey" | "setPrivateKey">;
|
|
1646
1720
|
/**
|
|
1647
1721
|
* Creates a predefined `DiffieHellmanGroup` key exchange object. The
|
|
1648
1722
|
* supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
|
|
@@ -1729,7 +1803,14 @@ declare module 'crypto' {
|
|
|
1729
1803
|
* negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
|
|
1730
1804
|
* @since v0.5.5
|
|
1731
1805
|
*/
|
|
1732
|
-
function pbkdf2(
|
|
1806
|
+
function pbkdf2(
|
|
1807
|
+
password: BinaryLike,
|
|
1808
|
+
salt: BinaryLike,
|
|
1809
|
+
iterations: number,
|
|
1810
|
+
keylen: number,
|
|
1811
|
+
digest: string,
|
|
1812
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
1813
|
+
): void;
|
|
1733
1814
|
/**
|
|
1734
1815
|
* Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
|
|
1735
1816
|
* implementation. A selected HMAC digest algorithm specified by `digest` is
|
|
@@ -1772,7 +1853,13 @@ declare module 'crypto' {
|
|
|
1772
1853
|
* An array of supported digest functions can be retrieved using {@link getHashes}.
|
|
1773
1854
|
* @since v0.9.3
|
|
1774
1855
|
*/
|
|
1775
|
-
function pbkdf2Sync(
|
|
1856
|
+
function pbkdf2Sync(
|
|
1857
|
+
password: BinaryLike,
|
|
1858
|
+
salt: BinaryLike,
|
|
1859
|
+
iterations: number,
|
|
1860
|
+
keylen: number,
|
|
1861
|
+
digest: string,
|
|
1862
|
+
): Buffer;
|
|
1776
1863
|
/**
|
|
1777
1864
|
* Generates cryptographically strong pseudorandom data. The `size` argument
|
|
1778
1865
|
* is a number indicating the number of bytes to generate.
|
|
@@ -1996,9 +2083,21 @@ declare module 'crypto' {
|
|
|
1996
2083
|
* @param [size=buffer.length - offset]
|
|
1997
2084
|
* @param callback `function(err, buf) {}`.
|
|
1998
2085
|
*/
|
|
1999
|
-
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2000
|
-
|
|
2001
|
-
|
|
2086
|
+
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2087
|
+
buffer: T,
|
|
2088
|
+
callback: (err: Error | null, buf: T) => void,
|
|
2089
|
+
): void;
|
|
2090
|
+
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2091
|
+
buffer: T,
|
|
2092
|
+
offset: number,
|
|
2093
|
+
callback: (err: Error | null, buf: T) => void,
|
|
2094
|
+
): void;
|
|
2095
|
+
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2096
|
+
buffer: T,
|
|
2097
|
+
offset: number,
|
|
2098
|
+
size: number,
|
|
2099
|
+
callback: (err: Error | null, buf: T) => void,
|
|
2100
|
+
): void;
|
|
2002
2101
|
interface ScryptOptions {
|
|
2003
2102
|
cost?: number | undefined;
|
|
2004
2103
|
blockSize?: number | undefined;
|
|
@@ -2042,8 +2141,19 @@ declare module 'crypto' {
|
|
|
2042
2141
|
* ```
|
|
2043
2142
|
* @since v10.5.0
|
|
2044
2143
|
*/
|
|
2045
|
-
function scrypt(
|
|
2046
|
-
|
|
2144
|
+
function scrypt(
|
|
2145
|
+
password: BinaryLike,
|
|
2146
|
+
salt: BinaryLike,
|
|
2147
|
+
keylen: number,
|
|
2148
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
2149
|
+
): void;
|
|
2150
|
+
function scrypt(
|
|
2151
|
+
password: BinaryLike,
|
|
2152
|
+
salt: BinaryLike,
|
|
2153
|
+
keylen: number,
|
|
2154
|
+
options: ScryptOptions,
|
|
2155
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
2156
|
+
): void;
|
|
2047
2157
|
/**
|
|
2048
2158
|
* Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
|
|
2049
2159
|
* key derivation function that is designed to be expensive computationally and
|
|
@@ -2256,8 +2366,8 @@ declare module 'crypto' {
|
|
|
2256
2366
|
key: BinaryLike,
|
|
2257
2367
|
curve: string,
|
|
2258
2368
|
inputEncoding?: BinaryToTextEncoding,
|
|
2259
|
-
outputEncoding?:
|
|
2260
|
-
format?:
|
|
2369
|
+
outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
|
|
2370
|
+
format?: "uncompressed" | "compressed" | "hybrid",
|
|
2261
2371
|
): Buffer | string;
|
|
2262
2372
|
/**
|
|
2263
2373
|
* Generates private and public EC Diffie-Hellman key values, and returns
|
|
@@ -2293,7 +2403,11 @@ declare module 'crypto' {
|
|
|
2293
2403
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
|
|
2294
2404
|
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
|
|
2295
2405
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
|
|
2296
|
-
computeSecret(
|
|
2406
|
+
computeSecret(
|
|
2407
|
+
otherPublicKey: string,
|
|
2408
|
+
inputEncoding: BinaryToTextEncoding,
|
|
2409
|
+
outputEncoding: BinaryToTextEncoding,
|
|
2410
|
+
): string;
|
|
2297
2411
|
/**
|
|
2298
2412
|
* If `encoding` is specified, a string is returned; otherwise a `Buffer` is
|
|
2299
2413
|
* returned.
|
|
@@ -2359,8 +2473,8 @@ declare module 'crypto' {
|
|
|
2359
2473
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2360
2474
|
/** @deprecated since v10.0.0 */
|
|
2361
2475
|
const DEFAULT_ENCODING: BufferEncoding;
|
|
2362
|
-
type KeyType =
|
|
2363
|
-
type KeyFormat =
|
|
2476
|
+
type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
|
|
2477
|
+
type KeyFormat = "pem" | "der" | "jwk";
|
|
2364
2478
|
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2365
2479
|
format: T;
|
|
2366
2480
|
cipher?: string | undefined;
|
|
@@ -2435,11 +2549,11 @@ declare module 'crypto' {
|
|
|
2435
2549
|
*/
|
|
2436
2550
|
publicExponent?: number | undefined;
|
|
2437
2551
|
publicKeyEncoding: {
|
|
2438
|
-
type:
|
|
2552
|
+
type: "pkcs1" | "spki";
|
|
2439
2553
|
format: PubF;
|
|
2440
2554
|
};
|
|
2441
2555
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2442
|
-
type:
|
|
2556
|
+
type: "pkcs1" | "pkcs8";
|
|
2443
2557
|
};
|
|
2444
2558
|
}
|
|
2445
2559
|
interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
@@ -2465,11 +2579,11 @@ declare module 'crypto' {
|
|
|
2465
2579
|
*/
|
|
2466
2580
|
saltLength?: string;
|
|
2467
2581
|
publicKeyEncoding: {
|
|
2468
|
-
type:
|
|
2582
|
+
type: "spki";
|
|
2469
2583
|
format: PubF;
|
|
2470
2584
|
};
|
|
2471
2585
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2472
|
-
type:
|
|
2586
|
+
type: "pkcs8";
|
|
2473
2587
|
};
|
|
2474
2588
|
}
|
|
2475
2589
|
interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
@@ -2482,11 +2596,11 @@ declare module 'crypto' {
|
|
|
2482
2596
|
*/
|
|
2483
2597
|
divisorLength: number;
|
|
2484
2598
|
publicKeyEncoding: {
|
|
2485
|
-
type:
|
|
2599
|
+
type: "spki";
|
|
2486
2600
|
format: PubF;
|
|
2487
2601
|
};
|
|
2488
2602
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2489
|
-
type:
|
|
2603
|
+
type: "pkcs8";
|
|
2490
2604
|
};
|
|
2491
2605
|
}
|
|
2492
2606
|
interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
@@ -2495,47 +2609,47 @@ declare module 'crypto' {
|
|
|
2495
2609
|
*/
|
|
2496
2610
|
namedCurve: string;
|
|
2497
2611
|
publicKeyEncoding: {
|
|
2498
|
-
type:
|
|
2612
|
+
type: "pkcs1" | "spki";
|
|
2499
2613
|
format: PubF;
|
|
2500
2614
|
};
|
|
2501
2615
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2502
|
-
type:
|
|
2616
|
+
type: "sec1" | "pkcs8";
|
|
2503
2617
|
};
|
|
2504
2618
|
}
|
|
2505
2619
|
interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2506
2620
|
publicKeyEncoding: {
|
|
2507
|
-
type:
|
|
2621
|
+
type: "spki";
|
|
2508
2622
|
format: PubF;
|
|
2509
2623
|
};
|
|
2510
2624
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2511
|
-
type:
|
|
2625
|
+
type: "pkcs8";
|
|
2512
2626
|
};
|
|
2513
2627
|
}
|
|
2514
2628
|
interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2515
2629
|
publicKeyEncoding: {
|
|
2516
|
-
type:
|
|
2630
|
+
type: "spki";
|
|
2517
2631
|
format: PubF;
|
|
2518
2632
|
};
|
|
2519
2633
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2520
|
-
type:
|
|
2634
|
+
type: "pkcs8";
|
|
2521
2635
|
};
|
|
2522
2636
|
}
|
|
2523
2637
|
interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2524
2638
|
publicKeyEncoding: {
|
|
2525
|
-
type:
|
|
2639
|
+
type: "spki";
|
|
2526
2640
|
format: PubF;
|
|
2527
2641
|
};
|
|
2528
2642
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2529
|
-
type:
|
|
2643
|
+
type: "pkcs8";
|
|
2530
2644
|
};
|
|
2531
2645
|
}
|
|
2532
2646
|
interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2533
2647
|
publicKeyEncoding: {
|
|
2534
|
-
type:
|
|
2648
|
+
type: "spki";
|
|
2535
2649
|
format: PubF;
|
|
2536
2650
|
};
|
|
2537
2651
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2538
|
-
type:
|
|
2652
|
+
type: "pkcs8";
|
|
2539
2653
|
};
|
|
2540
2654
|
}
|
|
2541
2655
|
interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
|
@@ -2583,46 +2697,142 @@ declare module 'crypto' {
|
|
|
2583
2697
|
* @since v10.12.0
|
|
2584
2698
|
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
|
|
2585
2699
|
*/
|
|
2586
|
-
function generateKeyPairSync(
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
function generateKeyPairSync(
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
function generateKeyPairSync(
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
function generateKeyPairSync(
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
function generateKeyPairSync(type:
|
|
2603
|
-
function generateKeyPairSync(
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
function generateKeyPairSync(
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
function generateKeyPairSync(
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
function generateKeyPairSync(
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
function generateKeyPairSync(type:
|
|
2620
|
-
function generateKeyPairSync(
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
function generateKeyPairSync(
|
|
2625
|
-
|
|
2700
|
+
function generateKeyPairSync(
|
|
2701
|
+
type: "rsa",
|
|
2702
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2703
|
+
): KeyPairSyncResult<string, string>;
|
|
2704
|
+
function generateKeyPairSync(
|
|
2705
|
+
type: "rsa",
|
|
2706
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2707
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2708
|
+
function generateKeyPairSync(
|
|
2709
|
+
type: "rsa",
|
|
2710
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2711
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2712
|
+
function generateKeyPairSync(
|
|
2713
|
+
type: "rsa",
|
|
2714
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2715
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2716
|
+
function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2717
|
+
function generateKeyPairSync(
|
|
2718
|
+
type: "rsa-pss",
|
|
2719
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2720
|
+
): KeyPairSyncResult<string, string>;
|
|
2721
|
+
function generateKeyPairSync(
|
|
2722
|
+
type: "rsa-pss",
|
|
2723
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2724
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2725
|
+
function generateKeyPairSync(
|
|
2726
|
+
type: "rsa-pss",
|
|
2727
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2728
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2729
|
+
function generateKeyPairSync(
|
|
2730
|
+
type: "rsa-pss",
|
|
2731
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2732
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2733
|
+
function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2734
|
+
function generateKeyPairSync(
|
|
2735
|
+
type: "dsa",
|
|
2736
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2737
|
+
): KeyPairSyncResult<string, string>;
|
|
2738
|
+
function generateKeyPairSync(
|
|
2739
|
+
type: "dsa",
|
|
2740
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2741
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2742
|
+
function generateKeyPairSync(
|
|
2743
|
+
type: "dsa",
|
|
2744
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2745
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2746
|
+
function generateKeyPairSync(
|
|
2747
|
+
type: "dsa",
|
|
2748
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2749
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2750
|
+
function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2751
|
+
function generateKeyPairSync(
|
|
2752
|
+
type: "ec",
|
|
2753
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2754
|
+
): KeyPairSyncResult<string, string>;
|
|
2755
|
+
function generateKeyPairSync(
|
|
2756
|
+
type: "ec",
|
|
2757
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2758
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2759
|
+
function generateKeyPairSync(
|
|
2760
|
+
type: "ec",
|
|
2761
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2762
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2763
|
+
function generateKeyPairSync(
|
|
2764
|
+
type: "ec",
|
|
2765
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2766
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2767
|
+
function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2768
|
+
function generateKeyPairSync(
|
|
2769
|
+
type: "ed25519",
|
|
2770
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2771
|
+
): KeyPairSyncResult<string, string>;
|
|
2772
|
+
function generateKeyPairSync(
|
|
2773
|
+
type: "ed25519",
|
|
2774
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2775
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2776
|
+
function generateKeyPairSync(
|
|
2777
|
+
type: "ed25519",
|
|
2778
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2779
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2780
|
+
function generateKeyPairSync(
|
|
2781
|
+
type: "ed25519",
|
|
2782
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2783
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2784
|
+
function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2785
|
+
function generateKeyPairSync(
|
|
2786
|
+
type: "ed448",
|
|
2787
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
2788
|
+
): KeyPairSyncResult<string, string>;
|
|
2789
|
+
function generateKeyPairSync(
|
|
2790
|
+
type: "ed448",
|
|
2791
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
2792
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2793
|
+
function generateKeyPairSync(
|
|
2794
|
+
type: "ed448",
|
|
2795
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
2796
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2797
|
+
function generateKeyPairSync(
|
|
2798
|
+
type: "ed448",
|
|
2799
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
2800
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2801
|
+
function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2802
|
+
function generateKeyPairSync(
|
|
2803
|
+
type: "x25519",
|
|
2804
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
2805
|
+
): KeyPairSyncResult<string, string>;
|
|
2806
|
+
function generateKeyPairSync(
|
|
2807
|
+
type: "x25519",
|
|
2808
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
2809
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2810
|
+
function generateKeyPairSync(
|
|
2811
|
+
type: "x25519",
|
|
2812
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
2813
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2814
|
+
function generateKeyPairSync(
|
|
2815
|
+
type: "x25519",
|
|
2816
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
2817
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2818
|
+
function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2819
|
+
function generateKeyPairSync(
|
|
2820
|
+
type: "x448",
|
|
2821
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
2822
|
+
): KeyPairSyncResult<string, string>;
|
|
2823
|
+
function generateKeyPairSync(
|
|
2824
|
+
type: "x448",
|
|
2825
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
2826
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2827
|
+
function generateKeyPairSync(
|
|
2828
|
+
type: "x448",
|
|
2829
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
2830
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2831
|
+
function generateKeyPairSync(
|
|
2832
|
+
type: "x448",
|
|
2833
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
2834
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2835
|
+
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2626
2836
|
/**
|
|
2627
2837
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2628
2838
|
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
@@ -2662,279 +2872,448 @@ declare module 'crypto' {
|
|
|
2662
2872
|
* @since v10.12.0
|
|
2663
2873
|
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
|
|
2664
2874
|
*/
|
|
2665
|
-
function generateKeyPair(
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
function generateKeyPair(
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
function generateKeyPair(
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
function generateKeyPair(
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
function generateKeyPair(
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
function generateKeyPair(
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
function generateKeyPair(
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
function generateKeyPair(
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2875
|
+
function generateKeyPair(
|
|
2876
|
+
type: "rsa",
|
|
2877
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2878
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2879
|
+
): void;
|
|
2880
|
+
function generateKeyPair(
|
|
2881
|
+
type: "rsa",
|
|
2882
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2883
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2884
|
+
): void;
|
|
2885
|
+
function generateKeyPair(
|
|
2886
|
+
type: "rsa",
|
|
2887
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2888
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2889
|
+
): void;
|
|
2890
|
+
function generateKeyPair(
|
|
2891
|
+
type: "rsa",
|
|
2892
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2893
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2894
|
+
): void;
|
|
2895
|
+
function generateKeyPair(
|
|
2896
|
+
type: "rsa",
|
|
2897
|
+
options: RSAKeyPairKeyObjectOptions,
|
|
2898
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2899
|
+
): void;
|
|
2900
|
+
function generateKeyPair(
|
|
2901
|
+
type: "rsa-pss",
|
|
2902
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2903
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2904
|
+
): void;
|
|
2905
|
+
function generateKeyPair(
|
|
2906
|
+
type: "rsa-pss",
|
|
2907
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2908
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2909
|
+
): void;
|
|
2910
|
+
function generateKeyPair(
|
|
2911
|
+
type: "rsa-pss",
|
|
2912
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2913
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2914
|
+
): void;
|
|
2915
|
+
function generateKeyPair(
|
|
2916
|
+
type: "rsa-pss",
|
|
2917
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2918
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2919
|
+
): void;
|
|
2920
|
+
function generateKeyPair(
|
|
2921
|
+
type: "rsa-pss",
|
|
2922
|
+
options: RSAPSSKeyPairKeyObjectOptions,
|
|
2923
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2924
|
+
): void;
|
|
2925
|
+
function generateKeyPair(
|
|
2926
|
+
type: "dsa",
|
|
2927
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2928
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2929
|
+
): void;
|
|
2930
|
+
function generateKeyPair(
|
|
2931
|
+
type: "dsa",
|
|
2932
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2933
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2934
|
+
): void;
|
|
2935
|
+
function generateKeyPair(
|
|
2936
|
+
type: "dsa",
|
|
2937
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2938
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2939
|
+
): void;
|
|
2940
|
+
function generateKeyPair(
|
|
2941
|
+
type: "dsa",
|
|
2942
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2943
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2944
|
+
): void;
|
|
2945
|
+
function generateKeyPair(
|
|
2946
|
+
type: "dsa",
|
|
2947
|
+
options: DSAKeyPairKeyObjectOptions,
|
|
2948
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2949
|
+
): void;
|
|
2950
|
+
function generateKeyPair(
|
|
2951
|
+
type: "ec",
|
|
2952
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2953
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2954
|
+
): void;
|
|
2955
|
+
function generateKeyPair(
|
|
2956
|
+
type: "ec",
|
|
2957
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2958
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2959
|
+
): void;
|
|
2960
|
+
function generateKeyPair(
|
|
2961
|
+
type: "ec",
|
|
2962
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2963
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2964
|
+
): void;
|
|
2965
|
+
function generateKeyPair(
|
|
2966
|
+
type: "ec",
|
|
2967
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2968
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2969
|
+
): void;
|
|
2970
|
+
function generateKeyPair(
|
|
2971
|
+
type: "ec",
|
|
2972
|
+
options: ECKeyPairKeyObjectOptions,
|
|
2973
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2974
|
+
): void;
|
|
2975
|
+
function generateKeyPair(
|
|
2976
|
+
type: "ed25519",
|
|
2977
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2978
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2979
|
+
): void;
|
|
2980
|
+
function generateKeyPair(
|
|
2981
|
+
type: "ed25519",
|
|
2982
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2983
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2984
|
+
): void;
|
|
2985
|
+
function generateKeyPair(
|
|
2986
|
+
type: "ed25519",
|
|
2987
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2988
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2989
|
+
): void;
|
|
2990
|
+
function generateKeyPair(
|
|
2991
|
+
type: "ed25519",
|
|
2992
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2993
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2994
|
+
): void;
|
|
2995
|
+
function generateKeyPair(
|
|
2996
|
+
type: "ed25519",
|
|
2997
|
+
options: ED25519KeyPairKeyObjectOptions | undefined,
|
|
2998
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2999
|
+
): void;
|
|
3000
|
+
function generateKeyPair(
|
|
3001
|
+
type: "ed448",
|
|
3002
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
3003
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3004
|
+
): void;
|
|
3005
|
+
function generateKeyPair(
|
|
3006
|
+
type: "ed448",
|
|
3007
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
3008
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3009
|
+
): void;
|
|
3010
|
+
function generateKeyPair(
|
|
3011
|
+
type: "ed448",
|
|
3012
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
3013
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3014
|
+
): void;
|
|
3015
|
+
function generateKeyPair(
|
|
3016
|
+
type: "ed448",
|
|
3017
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
3018
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3019
|
+
): void;
|
|
3020
|
+
function generateKeyPair(
|
|
3021
|
+
type: "ed448",
|
|
3022
|
+
options: ED448KeyPairKeyObjectOptions | undefined,
|
|
3023
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3024
|
+
): void;
|
|
3025
|
+
function generateKeyPair(
|
|
3026
|
+
type: "x25519",
|
|
3027
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
3028
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3029
|
+
): void;
|
|
3030
|
+
function generateKeyPair(
|
|
3031
|
+
type: "x25519",
|
|
3032
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
3033
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3034
|
+
): void;
|
|
3035
|
+
function generateKeyPair(
|
|
3036
|
+
type: "x25519",
|
|
3037
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
3038
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3039
|
+
): void;
|
|
3040
|
+
function generateKeyPair(
|
|
3041
|
+
type: "x25519",
|
|
3042
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
3043
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3044
|
+
): void;
|
|
3045
|
+
function generateKeyPair(
|
|
3046
|
+
type: "x25519",
|
|
3047
|
+
options: X25519KeyPairKeyObjectOptions | undefined,
|
|
3048
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3049
|
+
): void;
|
|
3050
|
+
function generateKeyPair(
|
|
3051
|
+
type: "x448",
|
|
3052
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
3053
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3054
|
+
): void;
|
|
3055
|
+
function generateKeyPair(
|
|
3056
|
+
type: "x448",
|
|
3057
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
3058
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3059
|
+
): void;
|
|
3060
|
+
function generateKeyPair(
|
|
3061
|
+
type: "x448",
|
|
3062
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
3063
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3064
|
+
): void;
|
|
3065
|
+
function generateKeyPair(
|
|
3066
|
+
type: "x448",
|
|
3067
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
3068
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3069
|
+
): void;
|
|
3070
|
+
function generateKeyPair(
|
|
3071
|
+
type: "x448",
|
|
3072
|
+
options: X448KeyPairKeyObjectOptions | undefined,
|
|
3073
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3074
|
+
): void;
|
|
2705
3075
|
namespace generateKeyPair {
|
|
2706
3076
|
function __promisify__(
|
|
2707
|
-
type:
|
|
2708
|
-
options: RSAKeyPairOptions<
|
|
3077
|
+
type: "rsa",
|
|
3078
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2709
3079
|
): Promise<{
|
|
2710
3080
|
publicKey: string;
|
|
2711
3081
|
privateKey: string;
|
|
2712
3082
|
}>;
|
|
2713
3083
|
function __promisify__(
|
|
2714
|
-
type:
|
|
2715
|
-
options: RSAKeyPairOptions<
|
|
3084
|
+
type: "rsa",
|
|
3085
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2716
3086
|
): Promise<{
|
|
2717
3087
|
publicKey: string;
|
|
2718
3088
|
privateKey: Buffer;
|
|
2719
3089
|
}>;
|
|
2720
3090
|
function __promisify__(
|
|
2721
|
-
type:
|
|
2722
|
-
options: RSAKeyPairOptions<
|
|
3091
|
+
type: "rsa",
|
|
3092
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2723
3093
|
): Promise<{
|
|
2724
3094
|
publicKey: Buffer;
|
|
2725
3095
|
privateKey: string;
|
|
2726
3096
|
}>;
|
|
2727
3097
|
function __promisify__(
|
|
2728
|
-
type:
|
|
2729
|
-
options: RSAKeyPairOptions<
|
|
3098
|
+
type: "rsa",
|
|
3099
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2730
3100
|
): Promise<{
|
|
2731
3101
|
publicKey: Buffer;
|
|
2732
3102
|
privateKey: Buffer;
|
|
2733
3103
|
}>;
|
|
2734
|
-
function __promisify__(type:
|
|
3104
|
+
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2735
3105
|
function __promisify__(
|
|
2736
|
-
type:
|
|
2737
|
-
options: RSAPSSKeyPairOptions<
|
|
3106
|
+
type: "rsa-pss",
|
|
3107
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2738
3108
|
): Promise<{
|
|
2739
3109
|
publicKey: string;
|
|
2740
3110
|
privateKey: string;
|
|
2741
3111
|
}>;
|
|
2742
3112
|
function __promisify__(
|
|
2743
|
-
type:
|
|
2744
|
-
options: RSAPSSKeyPairOptions<
|
|
3113
|
+
type: "rsa-pss",
|
|
3114
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2745
3115
|
): Promise<{
|
|
2746
3116
|
publicKey: string;
|
|
2747
3117
|
privateKey: Buffer;
|
|
2748
3118
|
}>;
|
|
2749
3119
|
function __promisify__(
|
|
2750
|
-
type:
|
|
2751
|
-
options: RSAPSSKeyPairOptions<
|
|
3120
|
+
type: "rsa-pss",
|
|
3121
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2752
3122
|
): Promise<{
|
|
2753
3123
|
publicKey: Buffer;
|
|
2754
3124
|
privateKey: string;
|
|
2755
3125
|
}>;
|
|
2756
3126
|
function __promisify__(
|
|
2757
|
-
type:
|
|
2758
|
-
options: RSAPSSKeyPairOptions<
|
|
3127
|
+
type: "rsa-pss",
|
|
3128
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2759
3129
|
): Promise<{
|
|
2760
3130
|
publicKey: Buffer;
|
|
2761
3131
|
privateKey: Buffer;
|
|
2762
3132
|
}>;
|
|
2763
|
-
function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2764
3133
|
function __promisify__(
|
|
2765
|
-
type:
|
|
2766
|
-
options:
|
|
3134
|
+
type: "rsa-pss",
|
|
3135
|
+
options: RSAPSSKeyPairKeyObjectOptions,
|
|
3136
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3137
|
+
function __promisify__(
|
|
3138
|
+
type: "dsa",
|
|
3139
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2767
3140
|
): Promise<{
|
|
2768
3141
|
publicKey: string;
|
|
2769
3142
|
privateKey: string;
|
|
2770
3143
|
}>;
|
|
2771
3144
|
function __promisify__(
|
|
2772
|
-
type:
|
|
2773
|
-
options: DSAKeyPairOptions<
|
|
3145
|
+
type: "dsa",
|
|
3146
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2774
3147
|
): Promise<{
|
|
2775
3148
|
publicKey: string;
|
|
2776
3149
|
privateKey: Buffer;
|
|
2777
3150
|
}>;
|
|
2778
3151
|
function __promisify__(
|
|
2779
|
-
type:
|
|
2780
|
-
options: DSAKeyPairOptions<
|
|
3152
|
+
type: "dsa",
|
|
3153
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2781
3154
|
): Promise<{
|
|
2782
3155
|
publicKey: Buffer;
|
|
2783
3156
|
privateKey: string;
|
|
2784
3157
|
}>;
|
|
2785
3158
|
function __promisify__(
|
|
2786
|
-
type:
|
|
2787
|
-
options: DSAKeyPairOptions<
|
|
3159
|
+
type: "dsa",
|
|
3160
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2788
3161
|
): Promise<{
|
|
2789
3162
|
publicKey: Buffer;
|
|
2790
3163
|
privateKey: Buffer;
|
|
2791
3164
|
}>;
|
|
2792
|
-
function __promisify__(type:
|
|
3165
|
+
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2793
3166
|
function __promisify__(
|
|
2794
|
-
type:
|
|
2795
|
-
options: ECKeyPairOptions<
|
|
3167
|
+
type: "ec",
|
|
3168
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2796
3169
|
): Promise<{
|
|
2797
3170
|
publicKey: string;
|
|
2798
3171
|
privateKey: string;
|
|
2799
3172
|
}>;
|
|
2800
3173
|
function __promisify__(
|
|
2801
|
-
type:
|
|
2802
|
-
options: ECKeyPairOptions<
|
|
3174
|
+
type: "ec",
|
|
3175
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2803
3176
|
): Promise<{
|
|
2804
3177
|
publicKey: string;
|
|
2805
3178
|
privateKey: Buffer;
|
|
2806
3179
|
}>;
|
|
2807
3180
|
function __promisify__(
|
|
2808
|
-
type:
|
|
2809
|
-
options: ECKeyPairOptions<
|
|
3181
|
+
type: "ec",
|
|
3182
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2810
3183
|
): Promise<{
|
|
2811
3184
|
publicKey: Buffer;
|
|
2812
3185
|
privateKey: string;
|
|
2813
3186
|
}>;
|
|
2814
3187
|
function __promisify__(
|
|
2815
|
-
type:
|
|
2816
|
-
options: ECKeyPairOptions<
|
|
3188
|
+
type: "ec",
|
|
3189
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2817
3190
|
): Promise<{
|
|
2818
3191
|
publicKey: Buffer;
|
|
2819
3192
|
privateKey: Buffer;
|
|
2820
3193
|
}>;
|
|
2821
|
-
function __promisify__(type:
|
|
3194
|
+
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2822
3195
|
function __promisify__(
|
|
2823
|
-
type:
|
|
2824
|
-
options: ED25519KeyPairOptions<
|
|
3196
|
+
type: "ed25519",
|
|
3197
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2825
3198
|
): Promise<{
|
|
2826
3199
|
publicKey: string;
|
|
2827
3200
|
privateKey: string;
|
|
2828
3201
|
}>;
|
|
2829
3202
|
function __promisify__(
|
|
2830
|
-
type:
|
|
2831
|
-
options: ED25519KeyPairOptions<
|
|
3203
|
+
type: "ed25519",
|
|
3204
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2832
3205
|
): Promise<{
|
|
2833
3206
|
publicKey: string;
|
|
2834
3207
|
privateKey: Buffer;
|
|
2835
3208
|
}>;
|
|
2836
3209
|
function __promisify__(
|
|
2837
|
-
type:
|
|
2838
|
-
options: ED25519KeyPairOptions<
|
|
3210
|
+
type: "ed25519",
|
|
3211
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2839
3212
|
): Promise<{
|
|
2840
3213
|
publicKey: Buffer;
|
|
2841
3214
|
privateKey: string;
|
|
2842
3215
|
}>;
|
|
2843
3216
|
function __promisify__(
|
|
2844
|
-
type:
|
|
2845
|
-
options: ED25519KeyPairOptions<
|
|
3217
|
+
type: "ed25519",
|
|
3218
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2846
3219
|
): Promise<{
|
|
2847
3220
|
publicKey: Buffer;
|
|
2848
3221
|
privateKey: Buffer;
|
|
2849
3222
|
}>;
|
|
2850
|
-
function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2851
3223
|
function __promisify__(
|
|
2852
|
-
type:
|
|
2853
|
-
options
|
|
3224
|
+
type: "ed25519",
|
|
3225
|
+
options?: ED25519KeyPairKeyObjectOptions,
|
|
3226
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3227
|
+
function __promisify__(
|
|
3228
|
+
type: "ed448",
|
|
3229
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
2854
3230
|
): Promise<{
|
|
2855
3231
|
publicKey: string;
|
|
2856
3232
|
privateKey: string;
|
|
2857
3233
|
}>;
|
|
2858
3234
|
function __promisify__(
|
|
2859
|
-
type:
|
|
2860
|
-
options: ED448KeyPairOptions<
|
|
3235
|
+
type: "ed448",
|
|
3236
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
2861
3237
|
): Promise<{
|
|
2862
3238
|
publicKey: string;
|
|
2863
3239
|
privateKey: Buffer;
|
|
2864
3240
|
}>;
|
|
2865
3241
|
function __promisify__(
|
|
2866
|
-
type:
|
|
2867
|
-
options: ED448KeyPairOptions<
|
|
3242
|
+
type: "ed448",
|
|
3243
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
2868
3244
|
): Promise<{
|
|
2869
3245
|
publicKey: Buffer;
|
|
2870
3246
|
privateKey: string;
|
|
2871
3247
|
}>;
|
|
2872
3248
|
function __promisify__(
|
|
2873
|
-
type:
|
|
2874
|
-
options: ED448KeyPairOptions<
|
|
3249
|
+
type: "ed448",
|
|
3250
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
2875
3251
|
): Promise<{
|
|
2876
3252
|
publicKey: Buffer;
|
|
2877
3253
|
privateKey: Buffer;
|
|
2878
3254
|
}>;
|
|
2879
|
-
function __promisify__(type:
|
|
3255
|
+
function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2880
3256
|
function __promisify__(
|
|
2881
|
-
type:
|
|
2882
|
-
options: X25519KeyPairOptions<
|
|
3257
|
+
type: "x25519",
|
|
3258
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
2883
3259
|
): Promise<{
|
|
2884
3260
|
publicKey: string;
|
|
2885
3261
|
privateKey: string;
|
|
2886
3262
|
}>;
|
|
2887
3263
|
function __promisify__(
|
|
2888
|
-
type:
|
|
2889
|
-
options: X25519KeyPairOptions<
|
|
3264
|
+
type: "x25519",
|
|
3265
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
2890
3266
|
): Promise<{
|
|
2891
3267
|
publicKey: string;
|
|
2892
3268
|
privateKey: Buffer;
|
|
2893
3269
|
}>;
|
|
2894
3270
|
function __promisify__(
|
|
2895
|
-
type:
|
|
2896
|
-
options: X25519KeyPairOptions<
|
|
3271
|
+
type: "x25519",
|
|
3272
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
2897
3273
|
): Promise<{
|
|
2898
3274
|
publicKey: Buffer;
|
|
2899
3275
|
privateKey: string;
|
|
2900
3276
|
}>;
|
|
2901
3277
|
function __promisify__(
|
|
2902
|
-
type:
|
|
2903
|
-
options: X25519KeyPairOptions<
|
|
3278
|
+
type: "x25519",
|
|
3279
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
2904
3280
|
): Promise<{
|
|
2905
3281
|
publicKey: Buffer;
|
|
2906
3282
|
privateKey: Buffer;
|
|
2907
3283
|
}>;
|
|
2908
|
-
function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2909
3284
|
function __promisify__(
|
|
2910
|
-
type:
|
|
2911
|
-
options
|
|
3285
|
+
type: "x25519",
|
|
3286
|
+
options?: X25519KeyPairKeyObjectOptions,
|
|
3287
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3288
|
+
function __promisify__(
|
|
3289
|
+
type: "x448",
|
|
3290
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
2912
3291
|
): Promise<{
|
|
2913
3292
|
publicKey: string;
|
|
2914
3293
|
privateKey: string;
|
|
2915
3294
|
}>;
|
|
2916
3295
|
function __promisify__(
|
|
2917
|
-
type:
|
|
2918
|
-
options: X448KeyPairOptions<
|
|
3296
|
+
type: "x448",
|
|
3297
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
2919
3298
|
): Promise<{
|
|
2920
3299
|
publicKey: string;
|
|
2921
3300
|
privateKey: Buffer;
|
|
2922
3301
|
}>;
|
|
2923
3302
|
function __promisify__(
|
|
2924
|
-
type:
|
|
2925
|
-
options: X448KeyPairOptions<
|
|
3303
|
+
type: "x448",
|
|
3304
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
2926
3305
|
): Promise<{
|
|
2927
3306
|
publicKey: Buffer;
|
|
2928
3307
|
privateKey: string;
|
|
2929
3308
|
}>;
|
|
2930
3309
|
function __promisify__(
|
|
2931
|
-
type:
|
|
2932
|
-
options: X448KeyPairOptions<
|
|
3310
|
+
type: "x448",
|
|
3311
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
2933
3312
|
): Promise<{
|
|
2934
3313
|
publicKey: Buffer;
|
|
2935
3314
|
privateKey: Buffer;
|
|
2936
3315
|
}>;
|
|
2937
|
-
function __promisify__(type:
|
|
3316
|
+
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2938
3317
|
}
|
|
2939
3318
|
/**
|
|
2940
3319
|
* Calculates and returns the signature for `data` using the given private key and
|
|
@@ -2948,12 +3327,16 @@ declare module 'crypto' {
|
|
|
2948
3327
|
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2949
3328
|
* @since v12.0.0
|
|
2950
3329
|
*/
|
|
2951
|
-
function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
|
2952
3330
|
function sign(
|
|
2953
3331
|
algorithm: string | null | undefined,
|
|
2954
3332
|
data: NodeJS.ArrayBufferView,
|
|
2955
3333
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
2956
|
-
|
|
3334
|
+
): Buffer;
|
|
3335
|
+
function sign(
|
|
3336
|
+
algorithm: string | null | undefined,
|
|
3337
|
+
data: NodeJS.ArrayBufferView,
|
|
3338
|
+
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
3339
|
+
callback: (error: Error | null, data: Buffer) => void,
|
|
2957
3340
|
): void;
|
|
2958
3341
|
/**
|
|
2959
3342
|
* Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
|
@@ -2975,14 +3358,14 @@ declare module 'crypto' {
|
|
|
2975
3358
|
algorithm: string | null | undefined,
|
|
2976
3359
|
data: NodeJS.ArrayBufferView,
|
|
2977
3360
|
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
2978
|
-
signature: NodeJS.ArrayBufferView
|
|
3361
|
+
signature: NodeJS.ArrayBufferView,
|
|
2979
3362
|
): boolean;
|
|
2980
3363
|
function verify(
|
|
2981
3364
|
algorithm: string | null | undefined,
|
|
2982
3365
|
data: NodeJS.ArrayBufferView,
|
|
2983
3366
|
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
2984
3367
|
signature: NodeJS.ArrayBufferView,
|
|
2985
|
-
callback: (error: Error | null, result: boolean) => void
|
|
3368
|
+
callback: (error: Error | null, result: boolean) => void,
|
|
2986
3369
|
): void;
|
|
2987
3370
|
/**
|
|
2988
3371
|
* Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
|
|
@@ -2990,7 +3373,7 @@ declare module 'crypto' {
|
|
|
2990
3373
|
* @since v13.9.0, v12.17.0
|
|
2991
3374
|
*/
|
|
2992
3375
|
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
|
|
2993
|
-
type CipherMode =
|
|
3376
|
+
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
|
2994
3377
|
interface CipherInfoOptions {
|
|
2995
3378
|
/**
|
|
2996
3379
|
* A test key length.
|
|
@@ -3068,7 +3451,14 @@ declare module 'crypto' {
|
|
|
3068
3451
|
* @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
|
|
3069
3452
|
* generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
|
|
3070
3453
|
*/
|
|
3071
|
-
function hkdf(
|
|
3454
|
+
function hkdf(
|
|
3455
|
+
digest: string,
|
|
3456
|
+
irm: BinaryLike | KeyObject,
|
|
3457
|
+
salt: BinaryLike,
|
|
3458
|
+
info: BinaryLike,
|
|
3459
|
+
keylen: number,
|
|
3460
|
+
callback: (err: Error | null, derivedKey: ArrayBuffer) => void,
|
|
3461
|
+
): void;
|
|
3072
3462
|
/**
|
|
3073
3463
|
* Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
|
|
3074
3464
|
* given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
|
|
@@ -3095,7 +3485,13 @@ declare module 'crypto' {
|
|
|
3095
3485
|
* @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
|
|
3096
3486
|
* generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
|
|
3097
3487
|
*/
|
|
3098
|
-
function hkdfSync(
|
|
3488
|
+
function hkdfSync(
|
|
3489
|
+
digest: string,
|
|
3490
|
+
ikm: BinaryLike | KeyObject,
|
|
3491
|
+
salt: BinaryLike,
|
|
3492
|
+
info: BinaryLike,
|
|
3493
|
+
keylen: number,
|
|
3494
|
+
): ArrayBuffer;
|
|
3099
3495
|
interface SecureHeapUsage {
|
|
3100
3496
|
/**
|
|
3101
3497
|
* The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
|
|
@@ -3139,7 +3535,7 @@ declare module 'crypto' {
|
|
|
3139
3535
|
/**
|
|
3140
3536
|
* @default 'always'
|
|
3141
3537
|
*/
|
|
3142
|
-
subject?:
|
|
3538
|
+
subject?: "always" | "default" | "never";
|
|
3143
3539
|
/**
|
|
3144
3540
|
* @default true
|
|
3145
3541
|
*/
|
|
@@ -3194,7 +3590,7 @@ declare module 'crypto' {
|
|
|
3194
3590
|
* The SHA-512 fingerprint of this certificate.
|
|
3195
3591
|
* @since v16.14.0
|
|
3196
3592
|
*/
|
|
3197
|
-
|
|
3593
|
+
readonly fingerprint512: string;
|
|
3198
3594
|
/**
|
|
3199
3595
|
* The complete subject of this certificate.
|
|
3200
3596
|
* @since v15.6.0
|
|
@@ -3274,7 +3670,7 @@ declare module 'crypto' {
|
|
|
3274
3670
|
* @since v15.6.0
|
|
3275
3671
|
* @return Returns `email` if the certificate matches, `undefined` if it does not.
|
|
3276
3672
|
*/
|
|
3277
|
-
checkEmail(email: string, options?: Pick<X509CheckOptions,
|
|
3673
|
+
checkEmail(email: string, options?: Pick<X509CheckOptions, "subject">): string | undefined;
|
|
3278
3674
|
/**
|
|
3279
3675
|
* Checks whether the certificate matches the given host name.
|
|
3280
3676
|
*
|
|
@@ -3388,9 +3784,21 @@ declare module 'crypto' {
|
|
|
3388
3784
|
* @param size The size (in bits) of the prime to generate.
|
|
3389
3785
|
*/
|
|
3390
3786
|
function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
|
|
3391
|
-
function generatePrime(
|
|
3392
|
-
|
|
3393
|
-
|
|
3787
|
+
function generatePrime(
|
|
3788
|
+
size: number,
|
|
3789
|
+
options: GeneratePrimeOptionsBigInt,
|
|
3790
|
+
callback: (err: Error | null, prime: bigint) => void,
|
|
3791
|
+
): void;
|
|
3792
|
+
function generatePrime(
|
|
3793
|
+
size: number,
|
|
3794
|
+
options: GeneratePrimeOptionsArrayBuffer,
|
|
3795
|
+
callback: (err: Error | null, prime: ArrayBuffer) => void,
|
|
3796
|
+
): void;
|
|
3797
|
+
function generatePrime(
|
|
3798
|
+
size: number,
|
|
3799
|
+
options: GeneratePrimeOptions,
|
|
3800
|
+
callback: (err: Error | null, prime: ArrayBuffer | bigint) => void,
|
|
3801
|
+
): void;
|
|
3394
3802
|
/**
|
|
3395
3803
|
* Generates a pseudorandom prime of `size` bits.
|
|
3396
3804
|
*
|
|
@@ -3439,7 +3847,11 @@ declare module 'crypto' {
|
|
|
3439
3847
|
* @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
|
|
3440
3848
|
*/
|
|
3441
3849
|
function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
|
|
3442
|
-
function checkPrime(
|
|
3850
|
+
function checkPrime(
|
|
3851
|
+
value: LargeNumberLike,
|
|
3852
|
+
options: CheckPrimeOptions,
|
|
3853
|
+
callback: (err: Error | null, result: boolean) => void,
|
|
3854
|
+
): void;
|
|
3443
3855
|
/**
|
|
3444
3856
|
* Checks the primality of the `candidate`.
|
|
3445
3857
|
* @since v15.8.0
|
|
@@ -3498,9 +3910,17 @@ declare module 'crypto' {
|
|
|
3498
3910
|
const webcrypto: webcrypto.Crypto;
|
|
3499
3911
|
namespace webcrypto {
|
|
3500
3912
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
3501
|
-
type KeyFormat =
|
|
3502
|
-
type KeyType =
|
|
3503
|
-
type KeyUsage =
|
|
3913
|
+
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
|
3914
|
+
type KeyType = "private" | "public" | "secret";
|
|
3915
|
+
type KeyUsage =
|
|
3916
|
+
| "decrypt"
|
|
3917
|
+
| "deriveBits"
|
|
3918
|
+
| "deriveKey"
|
|
3919
|
+
| "encrypt"
|
|
3920
|
+
| "sign"
|
|
3921
|
+
| "unwrapKey"
|
|
3922
|
+
| "verify"
|
|
3923
|
+
| "wrapKey";
|
|
3504
3924
|
type AlgorithmIdentifier = Algorithm | string;
|
|
3505
3925
|
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
3506
3926
|
type NamedCurve = string;
|
|
@@ -3654,7 +4074,7 @@ declare module 'crypto' {
|
|
|
3654
4074
|
/** Illegal constructor */
|
|
3655
4075
|
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
3656
4076
|
readonly length: 0;
|
|
3657
|
-
readonly name:
|
|
4077
|
+
readonly name: "CryptoKey";
|
|
3658
4078
|
readonly prototype: CryptoKey;
|
|
3659
4079
|
}
|
|
3660
4080
|
/**
|
|
@@ -3727,7 +4147,11 @@ declare module 'crypto' {
|
|
|
3727
4147
|
* - `'AES-GCM'`
|
|
3728
4148
|
* @since v15.0.0
|
|
3729
4149
|
*/
|
|
3730
|
-
decrypt(
|
|
4150
|
+
decrypt(
|
|
4151
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4152
|
+
key: CryptoKey,
|
|
4153
|
+
data: BufferSource,
|
|
4154
|
+
): Promise<ArrayBuffer>;
|
|
3731
4155
|
/**
|
|
3732
4156
|
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
3733
4157
|
* `subtle.deriveBits()` attempts to generate `length` bits.
|
|
@@ -3746,7 +4170,11 @@ declare module 'crypto' {
|
|
|
3746
4170
|
* @since v15.0.0
|
|
3747
4171
|
*/
|
|
3748
4172
|
deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
|
|
3749
|
-
deriveBits(
|
|
4173
|
+
deriveBits(
|
|
4174
|
+
algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params,
|
|
4175
|
+
baseKey: CryptoKey,
|
|
4176
|
+
length: number,
|
|
4177
|
+
): Promise<ArrayBuffer>;
|
|
3750
4178
|
/**
|
|
3751
4179
|
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
3752
4180
|
* `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
@@ -3767,9 +4195,14 @@ declare module 'crypto' {
|
|
|
3767
4195
|
deriveKey(
|
|
3768
4196
|
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
3769
4197
|
baseKey: CryptoKey,
|
|
3770
|
-
derivedKeyAlgorithm:
|
|
4198
|
+
derivedKeyAlgorithm:
|
|
4199
|
+
| AlgorithmIdentifier
|
|
4200
|
+
| AesDerivedKeyParams
|
|
4201
|
+
| HmacImportParams
|
|
4202
|
+
| HkdfParams
|
|
4203
|
+
| Pbkdf2Params,
|
|
3771
4204
|
extractable: boolean,
|
|
3772
|
-
keyUsages: ReadonlyArray<KeyUsage
|
|
4205
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
3773
4206
|
): Promise<CryptoKey>;
|
|
3774
4207
|
/**
|
|
3775
4208
|
* Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
|
|
@@ -3799,7 +4232,11 @@ declare module 'crypto' {
|
|
|
3799
4232
|
* - `'AES-GCM'`
|
|
3800
4233
|
* @since v15.0.0
|
|
3801
4234
|
*/
|
|
3802
|
-
encrypt(
|
|
4235
|
+
encrypt(
|
|
4236
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4237
|
+
key: CryptoKey,
|
|
4238
|
+
data: BufferSource,
|
|
4239
|
+
): Promise<ArrayBuffer>;
|
|
3803
4240
|
/**
|
|
3804
4241
|
* Exports the given key into the specified format, if supported.
|
|
3805
4242
|
*
|
|
@@ -3814,8 +4251,8 @@ declare module 'crypto' {
|
|
|
3814
4251
|
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
3815
4252
|
* @since v15.0.0
|
|
3816
4253
|
*/
|
|
3817
|
-
exportKey(format:
|
|
3818
|
-
exportKey(format: Exclude<KeyFormat,
|
|
4254
|
+
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
4255
|
+
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
3819
4256
|
/**
|
|
3820
4257
|
* Using the method and parameters provided in `algorithm`,
|
|
3821
4258
|
* `subtle.generateKey()` attempts to generate new keying material.
|
|
@@ -3842,9 +4279,21 @@ declare module 'crypto' {
|
|
|
3842
4279
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3843
4280
|
* @since v15.0.0
|
|
3844
4281
|
*/
|
|
3845
|
-
generateKey(
|
|
3846
|
-
|
|
3847
|
-
|
|
4282
|
+
generateKey(
|
|
4283
|
+
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
|
4284
|
+
extractable: boolean,
|
|
4285
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
4286
|
+
): Promise<CryptoKeyPair>;
|
|
4287
|
+
generateKey(
|
|
4288
|
+
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
|
|
4289
|
+
extractable: boolean,
|
|
4290
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
4291
|
+
): Promise<CryptoKey>;
|
|
4292
|
+
generateKey(
|
|
4293
|
+
algorithm: AlgorithmIdentifier,
|
|
4294
|
+
extractable: boolean,
|
|
4295
|
+
keyUsages: KeyUsage[],
|
|
4296
|
+
): Promise<CryptoKeyPair | CryptoKey>;
|
|
3848
4297
|
/**
|
|
3849
4298
|
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
3850
4299
|
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
@@ -3856,18 +4305,28 @@ declare module 'crypto' {
|
|
|
3856
4305
|
* @since v15.0.0
|
|
3857
4306
|
*/
|
|
3858
4307
|
importKey(
|
|
3859
|
-
format:
|
|
4308
|
+
format: "jwk",
|
|
3860
4309
|
keyData: JsonWebKey,
|
|
3861
|
-
algorithm:
|
|
4310
|
+
algorithm:
|
|
4311
|
+
| AlgorithmIdentifier
|
|
4312
|
+
| RsaHashedImportParams
|
|
4313
|
+
| EcKeyImportParams
|
|
4314
|
+
| HmacImportParams
|
|
4315
|
+
| AesKeyAlgorithm,
|
|
3862
4316
|
extractable: boolean,
|
|
3863
|
-
keyUsages: ReadonlyArray<KeyUsage
|
|
4317
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
3864
4318
|
): Promise<CryptoKey>;
|
|
3865
4319
|
importKey(
|
|
3866
|
-
format: Exclude<KeyFormat,
|
|
4320
|
+
format: Exclude<KeyFormat, "jwk">,
|
|
3867
4321
|
keyData: BufferSource,
|
|
3868
|
-
algorithm:
|
|
4322
|
+
algorithm:
|
|
4323
|
+
| AlgorithmIdentifier
|
|
4324
|
+
| RsaHashedImportParams
|
|
4325
|
+
| EcKeyImportParams
|
|
4326
|
+
| HmacImportParams
|
|
4327
|
+
| AesKeyAlgorithm,
|
|
3869
4328
|
extractable: boolean,
|
|
3870
|
-
keyUsages: KeyUsage[]
|
|
4329
|
+
keyUsages: KeyUsage[],
|
|
3871
4330
|
): Promise<CryptoKey>;
|
|
3872
4331
|
/**
|
|
3873
4332
|
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
@@ -3884,7 +4343,11 @@ declare module 'crypto' {
|
|
|
3884
4343
|
* - `'HMAC'`
|
|
3885
4344
|
* @since v15.0.0
|
|
3886
4345
|
*/
|
|
3887
|
-
sign(
|
|
4346
|
+
sign(
|
|
4347
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4348
|
+
key: CryptoKey,
|
|
4349
|
+
data: BufferSource,
|
|
4350
|
+
): Promise<ArrayBuffer>;
|
|
3888
4351
|
/**
|
|
3889
4352
|
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3890
4353
|
* The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
@@ -3925,9 +4388,14 @@ declare module 'crypto' {
|
|
|
3925
4388
|
wrappedKey: BufferSource,
|
|
3926
4389
|
unwrappingKey: CryptoKey,
|
|
3927
4390
|
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
3928
|
-
unwrappedKeyAlgorithm:
|
|
4391
|
+
unwrappedKeyAlgorithm:
|
|
4392
|
+
| AlgorithmIdentifier
|
|
4393
|
+
| RsaHashedImportParams
|
|
4394
|
+
| EcKeyImportParams
|
|
4395
|
+
| HmacImportParams
|
|
4396
|
+
| AesKeyAlgorithm,
|
|
3929
4397
|
extractable: boolean,
|
|
3930
|
-
keyUsages: KeyUsage[]
|
|
4398
|
+
keyUsages: KeyUsage[],
|
|
3931
4399
|
): Promise<CryptoKey>;
|
|
3932
4400
|
/**
|
|
3933
4401
|
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
@@ -3944,7 +4412,12 @@ declare module 'crypto' {
|
|
|
3944
4412
|
* - `'HMAC'`
|
|
3945
4413
|
* @since v15.0.0
|
|
3946
4414
|
*/
|
|
3947
|
-
verify(
|
|
4415
|
+
verify(
|
|
4416
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4417
|
+
key: CryptoKey,
|
|
4418
|
+
signature: BufferSource,
|
|
4419
|
+
data: BufferSource,
|
|
4420
|
+
): Promise<boolean>;
|
|
3948
4421
|
/**
|
|
3949
4422
|
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3950
4423
|
* The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
|
|
@@ -3963,10 +4436,15 @@ declare module 'crypto' {
|
|
|
3963
4436
|
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3964
4437
|
* @since v15.0.0
|
|
3965
4438
|
*/
|
|
3966
|
-
wrapKey(
|
|
4439
|
+
wrapKey(
|
|
4440
|
+
format: KeyFormat,
|
|
4441
|
+
key: CryptoKey,
|
|
4442
|
+
wrappingKey: CryptoKey,
|
|
4443
|
+
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4444
|
+
): Promise<ArrayBuffer>;
|
|
3967
4445
|
}
|
|
3968
4446
|
}
|
|
3969
4447
|
}
|
|
3970
|
-
declare module
|
|
3971
|
-
export * from
|
|
4448
|
+
declare module "node:crypto" {
|
|
4449
|
+
export * from "crypto";
|
|
3972
4450
|
}
|