@types/node 20.6.3 → 20.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert/strict.d.ts +4 -4
- node/assert.d.ts +48 -24
- node/async_hooks.d.ts +13 -6
- node/buffer.d.ts +32 -34
- node/child_process.d.ts +262 -122
- node/cluster.d.ts +107 -89
- node/console.d.ts +7 -7
- node/constants.d.ts +12 -11
- node/crypto.d.ts +746 -268
- node/dgram.d.ts +81 -45
- node/diagnostics_channel.d.ts +3 -3
- node/dns/promises.d.ts +28 -25
- node/dns.d.ts +203 -62
- node/dom-events.d.ts +67 -71
- node/domain.d.ts +4 -4
- node/events.d.ts +15 -7
- node/fs/promises.d.ts +102 -73
- node/fs.d.ts +513 -311
- node/globals.d.ts +18 -20
- node/http.d.ts +238 -186
- node/http2.d.ts +628 -376
- node/https.d.ts +221 -112
- node/module.d.ts +16 -9
- node/net.d.ts +112 -93
- node/os.d.ts +7 -7
- node/package.json +2 -2
- node/path.d.ts +13 -13
- node/perf_hooks.d.ts +19 -18
- node/process.d.ts +155 -125
- node/punycode.d.ts +3 -3
- node/querystring.d.ts +14 -4
- node/readline/promises.d.ts +12 -7
- node/readline.d.ts +69 -56
- node/repl.d.ts +67 -61
- node/stream/consumers.d.ts +5 -5
- node/stream/promises.d.ts +56 -15
- node/stream/web.d.ts +26 -20
- node/stream.d.ts +361 -228
- node/string_decoder.d.ts +3 -3
- node/test.d.ts +78 -93
- node/timers/promises.d.ts +4 -4
- node/timers.d.ts +23 -8
- node/tls.d.ts +151 -71
- node/trace_events.d.ts +3 -3
- node/ts4.8/assert/strict.d.ts +4 -4
- node/ts4.8/assert.d.ts +48 -24
- node/ts4.8/async_hooks.d.ts +13 -6
- node/ts4.8/buffer.d.ts +32 -34
- node/ts4.8/child_process.d.ts +262 -122
- node/ts4.8/cluster.d.ts +107 -89
- node/ts4.8/console.d.ts +7 -7
- node/ts4.8/constants.d.ts +12 -11
- node/ts4.8/crypto.d.ts +746 -268
- node/ts4.8/dgram.d.ts +81 -45
- node/ts4.8/diagnostics_channel.d.ts +3 -3
- node/ts4.8/dns/promises.d.ts +28 -25
- node/ts4.8/dns.d.ts +203 -62
- node/ts4.8/dom-events.d.ts +67 -71
- node/ts4.8/domain.d.ts +4 -4
- node/ts4.8/events.d.ts +15 -7
- node/ts4.8/fs/promises.d.ts +102 -73
- node/ts4.8/fs.d.ts +513 -311
- node/ts4.8/globals.d.ts +18 -20
- node/ts4.8/http.d.ts +238 -186
- node/ts4.8/http2.d.ts +628 -376
- node/ts4.8/https.d.ts +221 -112
- node/ts4.8/module.d.ts +16 -9
- node/ts4.8/net.d.ts +112 -93
- node/ts4.8/os.d.ts +7 -7
- node/ts4.8/path.d.ts +13 -13
- node/ts4.8/perf_hooks.d.ts +19 -18
- node/ts4.8/process.d.ts +155 -125
- node/ts4.8/punycode.d.ts +3 -3
- node/ts4.8/querystring.d.ts +14 -4
- node/ts4.8/readline/promises.d.ts +12 -7
- node/ts4.8/readline.d.ts +69 -56
- node/ts4.8/repl.d.ts +67 -61
- node/ts4.8/stream/consumers.d.ts +5 -5
- node/ts4.8/stream/promises.d.ts +56 -15
- node/ts4.8/stream/web.d.ts +26 -20
- node/ts4.8/stream.d.ts +326 -219
- node/ts4.8/string_decoder.d.ts +3 -3
- node/ts4.8/test.d.ts +78 -93
- node/ts4.8/timers/promises.d.ts +4 -4
- node/ts4.8/timers.d.ts +23 -8
- node/ts4.8/tls.d.ts +151 -71
- node/ts4.8/trace_events.d.ts +3 -3
- node/ts4.8/tty.d.ts +10 -10
- node/ts4.8/url.d.ts +26 -14
- node/ts4.8/util.d.ts +178 -116
- node/ts4.8/v8.d.ts +4 -4
- node/ts4.8/vm.d.ts +52 -46
- node/ts4.8/wasi.d.ts +3 -3
- node/ts4.8/worker_threads.d.ts +81 -84
- node/ts4.8/zlib.d.ts +9 -9
- node/tty.d.ts +10 -10
- node/url.d.ts +26 -14
- node/util.d.ts +178 -116
- node/v8.d.ts +4 -4
- node/vm.d.ts +52 -46
- node/wasi.d.ts +3 -3
- node/worker_threads.d.ts +81 -84
- node/zlib.d.ts +9 -9
node/ts4.8/crypto.d.ts
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* ```
|
|
17
17
|
* @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js)
|
|
18
18
|
*/
|
|
19
|
-
declare module
|
|
20
|
-
import * as stream from
|
|
21
|
-
import { PeerCertificate } from
|
|
19
|
+
declare module "crypto" {
|
|
20
|
+
import * as stream from "node:stream";
|
|
21
|
+
import { PeerCertificate } from "node:tls";
|
|
22
22
|
/**
|
|
23
23
|
* SPKAC is a Certificate Signing Request mechanism originally implemented by
|
|
24
24
|
* Netscape and was specified formally as part of HTML5's `keygen` element.
|
|
@@ -259,11 +259,11 @@ declare module 'crypto' {
|
|
|
259
259
|
*/
|
|
260
260
|
function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
|
|
261
261
|
// https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
|
|
262
|
-
type BinaryToTextEncoding =
|
|
263
|
-
type CharacterEncoding =
|
|
264
|
-
type LegacyCharacterEncoding =
|
|
262
|
+
type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
|
|
263
|
+
type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
|
|
264
|
+
type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
|
|
265
265
|
type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
|
|
266
|
-
type ECDHKeyFormat =
|
|
266
|
+
type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
|
|
267
267
|
/**
|
|
268
268
|
* The `Hash` class is a utility for creating hash digests of data. It can be
|
|
269
269
|
* used in one of two ways:
|
|
@@ -482,15 +482,15 @@ declare module 'crypto' {
|
|
|
482
482
|
digest(): Buffer;
|
|
483
483
|
digest(encoding: BinaryToTextEncoding): string;
|
|
484
484
|
}
|
|
485
|
-
type KeyObjectType =
|
|
485
|
+
type KeyObjectType = "secret" | "public" | "private";
|
|
486
486
|
interface KeyExportOptions<T extends KeyFormat> {
|
|
487
|
-
type:
|
|
487
|
+
type: "pkcs1" | "spki" | "pkcs8" | "sec1";
|
|
488
488
|
format: T;
|
|
489
489
|
cipher?: string | undefined;
|
|
490
490
|
passphrase?: string | Buffer | undefined;
|
|
491
491
|
}
|
|
492
492
|
interface JwkKeyExportOptions {
|
|
493
|
-
format:
|
|
493
|
+
format: "jwk";
|
|
494
494
|
}
|
|
495
495
|
interface JsonWebKey {
|
|
496
496
|
crv?: string | undefined;
|
|
@@ -634,8 +634,8 @@ declare module 'crypto' {
|
|
|
634
634
|
* PKCS#1 and SEC1 encryption.
|
|
635
635
|
* @since v11.6.0
|
|
636
636
|
*/
|
|
637
|
-
export(options: KeyExportOptions<
|
|
638
|
-
export(options?: KeyExportOptions<
|
|
637
|
+
export(options: KeyExportOptions<"pem">): string | Buffer;
|
|
638
|
+
export(options?: KeyExportOptions<"der">): Buffer;
|
|
639
639
|
export(options?: JwkKeyExportOptions): JsonWebKey;
|
|
640
640
|
/**
|
|
641
641
|
* For secret keys, this property represents the size of the key in bytes. This
|
|
@@ -650,9 +650,9 @@ declare module 'crypto' {
|
|
|
650
650
|
*/
|
|
651
651
|
type: KeyObjectType;
|
|
652
652
|
}
|
|
653
|
-
type CipherCCMTypes =
|
|
654
|
-
type CipherGCMTypes =
|
|
655
|
-
type CipherOCBTypes =
|
|
653
|
+
type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
|
|
654
|
+
type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
|
|
655
|
+
type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
|
|
656
656
|
type BinaryLike = string | NodeJS.ArrayBufferView;
|
|
657
657
|
type CipherKey = BinaryLike | KeyObject;
|
|
658
658
|
interface CipherCCMOptions extends stream.TransformOptions {
|
|
@@ -736,10 +736,30 @@ declare module 'crypto' {
|
|
|
736
736
|
* @since v0.1.94
|
|
737
737
|
* @param options `stream.transform` options
|
|
738
738
|
*/
|
|
739
|
-
function createCipheriv(
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
739
|
+
function createCipheriv(
|
|
740
|
+
algorithm: CipherCCMTypes,
|
|
741
|
+
key: CipherKey,
|
|
742
|
+
iv: BinaryLike,
|
|
743
|
+
options: CipherCCMOptions,
|
|
744
|
+
): CipherCCM;
|
|
745
|
+
function createCipheriv(
|
|
746
|
+
algorithm: CipherOCBTypes,
|
|
747
|
+
key: CipherKey,
|
|
748
|
+
iv: BinaryLike,
|
|
749
|
+
options: CipherOCBOptions,
|
|
750
|
+
): CipherOCB;
|
|
751
|
+
function createCipheriv(
|
|
752
|
+
algorithm: CipherGCMTypes,
|
|
753
|
+
key: CipherKey,
|
|
754
|
+
iv: BinaryLike,
|
|
755
|
+
options?: CipherGCMOptions,
|
|
756
|
+
): CipherGCM;
|
|
757
|
+
function createCipheriv(
|
|
758
|
+
algorithm: string,
|
|
759
|
+
key: CipherKey,
|
|
760
|
+
iv: BinaryLike | null,
|
|
761
|
+
options?: stream.TransformOptions,
|
|
762
|
+
): Cipher;
|
|
743
763
|
/**
|
|
744
764
|
* Instances of the `Cipher` class are used to encrypt data. The class can be
|
|
745
765
|
* used in one of two ways:
|
|
@@ -911,7 +931,7 @@ declare module 'crypto' {
|
|
|
911
931
|
buffer: NodeJS.ArrayBufferView,
|
|
912
932
|
options: {
|
|
913
933
|
plaintextLength: number;
|
|
914
|
-
}
|
|
934
|
+
},
|
|
915
935
|
): this;
|
|
916
936
|
getAuthTag(): Buffer;
|
|
917
937
|
}
|
|
@@ -920,7 +940,7 @@ declare module 'crypto' {
|
|
|
920
940
|
buffer: NodeJS.ArrayBufferView,
|
|
921
941
|
options?: {
|
|
922
942
|
plaintextLength: number;
|
|
923
|
-
}
|
|
943
|
+
},
|
|
924
944
|
): this;
|
|
925
945
|
getAuthTag(): Buffer;
|
|
926
946
|
}
|
|
@@ -929,7 +949,7 @@ declare module 'crypto' {
|
|
|
929
949
|
buffer: NodeJS.ArrayBufferView,
|
|
930
950
|
options?: {
|
|
931
951
|
plaintextLength: number;
|
|
932
|
-
}
|
|
952
|
+
},
|
|
933
953
|
): this;
|
|
934
954
|
getAuthTag(): Buffer;
|
|
935
955
|
}
|
|
@@ -993,10 +1013,30 @@ declare module 'crypto' {
|
|
|
993
1013
|
* @since v0.1.94
|
|
994
1014
|
* @param options `stream.transform` options
|
|
995
1015
|
*/
|
|
996
|
-
function createDecipheriv(
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1016
|
+
function createDecipheriv(
|
|
1017
|
+
algorithm: CipherCCMTypes,
|
|
1018
|
+
key: CipherKey,
|
|
1019
|
+
iv: BinaryLike,
|
|
1020
|
+
options: CipherCCMOptions,
|
|
1021
|
+
): DecipherCCM;
|
|
1022
|
+
function createDecipheriv(
|
|
1023
|
+
algorithm: CipherOCBTypes,
|
|
1024
|
+
key: CipherKey,
|
|
1025
|
+
iv: BinaryLike,
|
|
1026
|
+
options: CipherOCBOptions,
|
|
1027
|
+
): DecipherOCB;
|
|
1028
|
+
function createDecipheriv(
|
|
1029
|
+
algorithm: CipherGCMTypes,
|
|
1030
|
+
key: CipherKey,
|
|
1031
|
+
iv: BinaryLike,
|
|
1032
|
+
options?: CipherGCMOptions,
|
|
1033
|
+
): DecipherGCM;
|
|
1034
|
+
function createDecipheriv(
|
|
1035
|
+
algorithm: string,
|
|
1036
|
+
key: CipherKey,
|
|
1037
|
+
iv: BinaryLike | null,
|
|
1038
|
+
options?: stream.TransformOptions,
|
|
1039
|
+
): Decipher;
|
|
1000
1040
|
/**
|
|
1001
1041
|
* Instances of the `Decipher` class are used to decrypt data. The class can be
|
|
1002
1042
|
* used in one of two ways:
|
|
@@ -1155,7 +1195,7 @@ declare module 'crypto' {
|
|
|
1155
1195
|
buffer: NodeJS.ArrayBufferView,
|
|
1156
1196
|
options: {
|
|
1157
1197
|
plaintextLength: number;
|
|
1158
|
-
}
|
|
1198
|
+
},
|
|
1159
1199
|
): this;
|
|
1160
1200
|
}
|
|
1161
1201
|
interface DecipherGCM extends Decipher {
|
|
@@ -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 DecipherOCB extends Decipher {
|
|
@@ -1173,20 +1213,20 @@ 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 PrivateKeyInput {
|
|
1180
1220
|
key: string | Buffer;
|
|
1181
1221
|
format?: KeyFormat | undefined;
|
|
1182
|
-
type?:
|
|
1222
|
+
type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
|
|
1183
1223
|
passphrase?: string | Buffer | undefined;
|
|
1184
1224
|
encoding?: string | undefined;
|
|
1185
1225
|
}
|
|
1186
1226
|
interface PublicKeyInput {
|
|
1187
1227
|
key: string | Buffer;
|
|
1188
1228
|
format?: KeyFormat | undefined;
|
|
1189
|
-
type?:
|
|
1229
|
+
type?: "pkcs1" | "spki" | undefined;
|
|
1190
1230
|
encoding?: string | undefined;
|
|
1191
1231
|
}
|
|
1192
1232
|
/**
|
|
@@ -1209,11 +1249,11 @@ declare module 'crypto' {
|
|
|
1209
1249
|
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1210
1250
|
*/
|
|
1211
1251
|
function generateKey(
|
|
1212
|
-
type:
|
|
1252
|
+
type: "hmac" | "aes",
|
|
1213
1253
|
options: {
|
|
1214
1254
|
length: number;
|
|
1215
1255
|
},
|
|
1216
|
-
callback: (err: Error | null, key: KeyObject) => void
|
|
1256
|
+
callback: (err: Error | null, key: KeyObject) => void,
|
|
1217
1257
|
): void;
|
|
1218
1258
|
/**
|
|
1219
1259
|
* Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
|
|
@@ -1233,14 +1273,14 @@ declare module 'crypto' {
|
|
|
1233
1273
|
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
|
|
1234
1274
|
*/
|
|
1235
1275
|
function generateKeySync(
|
|
1236
|
-
type:
|
|
1276
|
+
type: "hmac" | "aes",
|
|
1237
1277
|
options: {
|
|
1238
1278
|
length: number;
|
|
1239
|
-
}
|
|
1279
|
+
},
|
|
1240
1280
|
): KeyObject;
|
|
1241
1281
|
interface JsonWebKeyInput {
|
|
1242
1282
|
key: JsonWebKey;
|
|
1243
|
-
format:
|
|
1283
|
+
format: "jwk";
|
|
1244
1284
|
}
|
|
1245
1285
|
/**
|
|
1246
1286
|
* Creates and returns a new key object containing a private key. If `key` is a
|
|
@@ -1287,7 +1327,7 @@ declare module 'crypto' {
|
|
|
1287
1327
|
* @param options `stream.Writable` options
|
|
1288
1328
|
*/
|
|
1289
1329
|
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
|
|
1290
|
-
type DSAEncoding =
|
|
1330
|
+
type DSAEncoding = "der" | "ieee-p1363";
|
|
1291
1331
|
interface SigningOptions {
|
|
1292
1332
|
/**
|
|
1293
1333
|
* @see crypto.constants.RSA_PKCS1_PADDING
|
|
@@ -1396,7 +1436,10 @@ declare module 'crypto' {
|
|
|
1396
1436
|
* @since v0.1.92
|
|
1397
1437
|
*/
|
|
1398
1438
|
sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
|
1399
|
-
sign(
|
|
1439
|
+
sign(
|
|
1440
|
+
privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
1441
|
+
outputFormat: BinaryToTextEncoding,
|
|
1442
|
+
): string;
|
|
1400
1443
|
}
|
|
1401
1444
|
/**
|
|
1402
1445
|
* Creates and returns a `Verify` object that uses the given algorithm.
|
|
@@ -1459,8 +1502,15 @@ declare module 'crypto' {
|
|
|
1459
1502
|
* be passed instead of a public key.
|
|
1460
1503
|
* @since v0.1.92
|
|
1461
1504
|
*/
|
|
1462
|
-
verify(
|
|
1463
|
-
|
|
1505
|
+
verify(
|
|
1506
|
+
object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
1507
|
+
signature: NodeJS.ArrayBufferView,
|
|
1508
|
+
): boolean;
|
|
1509
|
+
verify(
|
|
1510
|
+
object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
1511
|
+
signature: string,
|
|
1512
|
+
signature_format?: BinaryToTextEncoding,
|
|
1513
|
+
): boolean;
|
|
1464
1514
|
}
|
|
1465
1515
|
/**
|
|
1466
1516
|
* Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
|
|
@@ -1479,10 +1529,26 @@ declare module 'crypto' {
|
|
|
1479
1529
|
* @param generatorEncoding The `encoding` of the `generator` string.
|
|
1480
1530
|
*/
|
|
1481
1531
|
function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
|
|
1482
|
-
function createDiffieHellman(
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1532
|
+
function createDiffieHellman(
|
|
1533
|
+
prime: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1534
|
+
generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1535
|
+
): DiffieHellman;
|
|
1536
|
+
function createDiffieHellman(
|
|
1537
|
+
prime: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1538
|
+
generator: string,
|
|
1539
|
+
generatorEncoding: BinaryToTextEncoding,
|
|
1540
|
+
): DiffieHellman;
|
|
1541
|
+
function createDiffieHellman(
|
|
1542
|
+
prime: string,
|
|
1543
|
+
primeEncoding: BinaryToTextEncoding,
|
|
1544
|
+
generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
|
|
1545
|
+
): DiffieHellman;
|
|
1546
|
+
function createDiffieHellman(
|
|
1547
|
+
prime: string,
|
|
1548
|
+
primeEncoding: BinaryToTextEncoding,
|
|
1549
|
+
generator: string,
|
|
1550
|
+
generatorEncoding: BinaryToTextEncoding,
|
|
1551
|
+
): DiffieHellman;
|
|
1486
1552
|
/**
|
|
1487
1553
|
* The `DiffieHellman` class is a utility for creating Diffie-Hellman key
|
|
1488
1554
|
* exchanges.
|
|
@@ -1545,8 +1611,16 @@ declare module 'crypto' {
|
|
|
1545
1611
|
*/
|
|
1546
1612
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
|
|
1547
1613
|
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
|
|
1548
|
-
computeSecret(
|
|
1549
|
-
|
|
1614
|
+
computeSecret(
|
|
1615
|
+
otherPublicKey: NodeJS.ArrayBufferView,
|
|
1616
|
+
inputEncoding: null,
|
|
1617
|
+
outputEncoding: BinaryToTextEncoding,
|
|
1618
|
+
): string;
|
|
1619
|
+
computeSecret(
|
|
1620
|
+
otherPublicKey: string,
|
|
1621
|
+
inputEncoding: BinaryToTextEncoding,
|
|
1622
|
+
outputEncoding: BinaryToTextEncoding,
|
|
1623
|
+
): string;
|
|
1550
1624
|
/**
|
|
1551
1625
|
* Returns the Diffie-Hellman prime in the specified `encoding`.
|
|
1552
1626
|
* If `encoding` is provided a string is
|
|
@@ -1643,11 +1717,11 @@ declare module 'crypto' {
|
|
|
1643
1717
|
*/
|
|
1644
1718
|
const DiffieHellmanGroup: DiffieHellmanGroupConstructor;
|
|
1645
1719
|
interface DiffieHellmanGroupConstructor {
|
|
1646
|
-
new
|
|
1720
|
+
new(name: string): DiffieHellmanGroup;
|
|
1647
1721
|
(name: string): DiffieHellmanGroup;
|
|
1648
1722
|
readonly prototype: DiffieHellmanGroup;
|
|
1649
1723
|
}
|
|
1650
|
-
type DiffieHellmanGroup = Omit<DiffieHellman,
|
|
1724
|
+
type DiffieHellmanGroup = Omit<DiffieHellman, "setPublicKey" | "setPrivateKey">;
|
|
1651
1725
|
/**
|
|
1652
1726
|
* Creates a predefined `DiffieHellmanGroup` key exchange object. The
|
|
1653
1727
|
* supported groups are listed in the documentation for `DiffieHellmanGroup`.
|
|
@@ -1719,7 +1793,14 @@ declare module 'crypto' {
|
|
|
1719
1793
|
* negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
|
|
1720
1794
|
* @since v0.5.5
|
|
1721
1795
|
*/
|
|
1722
|
-
function pbkdf2(
|
|
1796
|
+
function pbkdf2(
|
|
1797
|
+
password: BinaryLike,
|
|
1798
|
+
salt: BinaryLike,
|
|
1799
|
+
iterations: number,
|
|
1800
|
+
keylen: number,
|
|
1801
|
+
digest: string,
|
|
1802
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
1803
|
+
): void;
|
|
1723
1804
|
/**
|
|
1724
1805
|
* Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
|
|
1725
1806
|
* implementation. A selected HMAC digest algorithm specified by `digest` is
|
|
@@ -1749,7 +1830,13 @@ declare module 'crypto' {
|
|
|
1749
1830
|
* An array of supported digest functions can be retrieved using {@link getHashes}.
|
|
1750
1831
|
* @since v0.9.3
|
|
1751
1832
|
*/
|
|
1752
|
-
function pbkdf2Sync(
|
|
1833
|
+
function pbkdf2Sync(
|
|
1834
|
+
password: BinaryLike,
|
|
1835
|
+
salt: BinaryLike,
|
|
1836
|
+
iterations: number,
|
|
1837
|
+
keylen: number,
|
|
1838
|
+
digest: string,
|
|
1839
|
+
): Buffer;
|
|
1753
1840
|
/**
|
|
1754
1841
|
* Generates cryptographically strong pseudorandom data. The `size` argument
|
|
1755
1842
|
* is a number indicating the number of bytes to generate.
|
|
@@ -1973,9 +2060,21 @@ declare module 'crypto' {
|
|
|
1973
2060
|
* @param [size=buffer.length - offset]
|
|
1974
2061
|
* @param callback `function(err, buf) {}`.
|
|
1975
2062
|
*/
|
|
1976
|
-
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
1977
|
-
|
|
1978
|
-
|
|
2063
|
+
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2064
|
+
buffer: T,
|
|
2065
|
+
callback: (err: Error | null, buf: T) => void,
|
|
2066
|
+
): void;
|
|
2067
|
+
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2068
|
+
buffer: T,
|
|
2069
|
+
offset: number,
|
|
2070
|
+
callback: (err: Error | null, buf: T) => void,
|
|
2071
|
+
): void;
|
|
2072
|
+
function randomFill<T extends NodeJS.ArrayBufferView>(
|
|
2073
|
+
buffer: T,
|
|
2074
|
+
offset: number,
|
|
2075
|
+
size: number,
|
|
2076
|
+
callback: (err: Error | null, buf: T) => void,
|
|
2077
|
+
): void;
|
|
1979
2078
|
interface ScryptOptions {
|
|
1980
2079
|
cost?: number | undefined;
|
|
1981
2080
|
blockSize?: number | undefined;
|
|
@@ -2019,8 +2118,19 @@ declare module 'crypto' {
|
|
|
2019
2118
|
* ```
|
|
2020
2119
|
* @since v10.5.0
|
|
2021
2120
|
*/
|
|
2022
|
-
function scrypt(
|
|
2023
|
-
|
|
2121
|
+
function scrypt(
|
|
2122
|
+
password: BinaryLike,
|
|
2123
|
+
salt: BinaryLike,
|
|
2124
|
+
keylen: number,
|
|
2125
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
2126
|
+
): void;
|
|
2127
|
+
function scrypt(
|
|
2128
|
+
password: BinaryLike,
|
|
2129
|
+
salt: BinaryLike,
|
|
2130
|
+
keylen: number,
|
|
2131
|
+
options: ScryptOptions,
|
|
2132
|
+
callback: (err: Error | null, derivedKey: Buffer) => void,
|
|
2133
|
+
): void;
|
|
2024
2134
|
/**
|
|
2025
2135
|
* Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
|
|
2026
2136
|
* key derivation function that is designed to be expensive computationally and
|
|
@@ -2234,8 +2344,8 @@ declare module 'crypto' {
|
|
|
2234
2344
|
key: BinaryLike,
|
|
2235
2345
|
curve: string,
|
|
2236
2346
|
inputEncoding?: BinaryToTextEncoding,
|
|
2237
|
-
outputEncoding?:
|
|
2238
|
-
format?:
|
|
2347
|
+
outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
|
|
2348
|
+
format?: "uncompressed" | "compressed" | "hybrid",
|
|
2239
2349
|
): Buffer | string;
|
|
2240
2350
|
/**
|
|
2241
2351
|
* Generates private and public EC Diffie-Hellman key values, and returns
|
|
@@ -2271,7 +2381,11 @@ declare module 'crypto' {
|
|
|
2271
2381
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
|
|
2272
2382
|
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
|
|
2273
2383
|
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
|
|
2274
|
-
computeSecret(
|
|
2384
|
+
computeSecret(
|
|
2385
|
+
otherPublicKey: string,
|
|
2386
|
+
inputEncoding: BinaryToTextEncoding,
|
|
2387
|
+
outputEncoding: BinaryToTextEncoding,
|
|
2388
|
+
): string;
|
|
2275
2389
|
/**
|
|
2276
2390
|
* If `encoding` is specified, a string is returned; otherwise a `Buffer` is
|
|
2277
2391
|
* returned.
|
|
@@ -2341,8 +2455,8 @@ declare module 'crypto' {
|
|
|
2341
2455
|
* @since v6.6.0
|
|
2342
2456
|
*/
|
|
2343
2457
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2344
|
-
type KeyType =
|
|
2345
|
-
type KeyFormat =
|
|
2458
|
+
type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
|
|
2459
|
+
type KeyFormat = "pem" | "der" | "jwk";
|
|
2346
2460
|
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2347
2461
|
format: T;
|
|
2348
2462
|
cipher?: string | undefined;
|
|
@@ -2417,11 +2531,11 @@ declare module 'crypto' {
|
|
|
2417
2531
|
*/
|
|
2418
2532
|
publicExponent?: number | undefined;
|
|
2419
2533
|
publicKeyEncoding: {
|
|
2420
|
-
type:
|
|
2534
|
+
type: "pkcs1" | "spki";
|
|
2421
2535
|
format: PubF;
|
|
2422
2536
|
};
|
|
2423
2537
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2424
|
-
type:
|
|
2538
|
+
type: "pkcs1" | "pkcs8";
|
|
2425
2539
|
};
|
|
2426
2540
|
}
|
|
2427
2541
|
interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
@@ -2447,11 +2561,11 @@ declare module 'crypto' {
|
|
|
2447
2561
|
*/
|
|
2448
2562
|
saltLength?: string;
|
|
2449
2563
|
publicKeyEncoding: {
|
|
2450
|
-
type:
|
|
2564
|
+
type: "spki";
|
|
2451
2565
|
format: PubF;
|
|
2452
2566
|
};
|
|
2453
2567
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2454
|
-
type:
|
|
2568
|
+
type: "pkcs8";
|
|
2455
2569
|
};
|
|
2456
2570
|
}
|
|
2457
2571
|
interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
@@ -2464,11 +2578,11 @@ declare module 'crypto' {
|
|
|
2464
2578
|
*/
|
|
2465
2579
|
divisorLength: number;
|
|
2466
2580
|
publicKeyEncoding: {
|
|
2467
|
-
type:
|
|
2581
|
+
type: "spki";
|
|
2468
2582
|
format: PubF;
|
|
2469
2583
|
};
|
|
2470
2584
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2471
|
-
type:
|
|
2585
|
+
type: "pkcs8";
|
|
2472
2586
|
};
|
|
2473
2587
|
}
|
|
2474
2588
|
interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
@@ -2477,47 +2591,47 @@ declare module 'crypto' {
|
|
|
2477
2591
|
*/
|
|
2478
2592
|
namedCurve: string;
|
|
2479
2593
|
publicKeyEncoding: {
|
|
2480
|
-
type:
|
|
2594
|
+
type: "pkcs1" | "spki";
|
|
2481
2595
|
format: PubF;
|
|
2482
2596
|
};
|
|
2483
2597
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2484
|
-
type:
|
|
2598
|
+
type: "sec1" | "pkcs8";
|
|
2485
2599
|
};
|
|
2486
2600
|
}
|
|
2487
2601
|
interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2488
2602
|
publicKeyEncoding: {
|
|
2489
|
-
type:
|
|
2603
|
+
type: "spki";
|
|
2490
2604
|
format: PubF;
|
|
2491
2605
|
};
|
|
2492
2606
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2493
|
-
type:
|
|
2607
|
+
type: "pkcs8";
|
|
2494
2608
|
};
|
|
2495
2609
|
}
|
|
2496
2610
|
interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2497
2611
|
publicKeyEncoding: {
|
|
2498
|
-
type:
|
|
2612
|
+
type: "spki";
|
|
2499
2613
|
format: PubF;
|
|
2500
2614
|
};
|
|
2501
2615
|
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2502
|
-
type:
|
|
2616
|
+
type: "pkcs8";
|
|
2503
2617
|
};
|
|
2504
2618
|
}
|
|
2505
2619
|
interface X25519KeyPairOptions<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 X448KeyPairOptions<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 KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
|
@@ -2565,46 +2679,142 @@ declare module 'crypto' {
|
|
|
2565
2679
|
* @since v10.12.0
|
|
2566
2680
|
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
|
|
2567
2681
|
*/
|
|
2568
|
-
function generateKeyPairSync(
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
function generateKeyPairSync(
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
function generateKeyPairSync(
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
function generateKeyPairSync(
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
function generateKeyPairSync(type:
|
|
2585
|
-
function generateKeyPairSync(
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
function generateKeyPairSync(
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
function generateKeyPairSync(
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
function generateKeyPairSync(
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
function generateKeyPairSync(type:
|
|
2602
|
-
function generateKeyPairSync(
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
function generateKeyPairSync(
|
|
2607
|
-
|
|
2682
|
+
function generateKeyPairSync(
|
|
2683
|
+
type: "rsa",
|
|
2684
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2685
|
+
): KeyPairSyncResult<string, string>;
|
|
2686
|
+
function generateKeyPairSync(
|
|
2687
|
+
type: "rsa",
|
|
2688
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2689
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2690
|
+
function generateKeyPairSync(
|
|
2691
|
+
type: "rsa",
|
|
2692
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2693
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2694
|
+
function generateKeyPairSync(
|
|
2695
|
+
type: "rsa",
|
|
2696
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2697
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2698
|
+
function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2699
|
+
function generateKeyPairSync(
|
|
2700
|
+
type: "rsa-pss",
|
|
2701
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2702
|
+
): KeyPairSyncResult<string, string>;
|
|
2703
|
+
function generateKeyPairSync(
|
|
2704
|
+
type: "rsa-pss",
|
|
2705
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2706
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2707
|
+
function generateKeyPairSync(
|
|
2708
|
+
type: "rsa-pss",
|
|
2709
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2710
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2711
|
+
function generateKeyPairSync(
|
|
2712
|
+
type: "rsa-pss",
|
|
2713
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2714
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2715
|
+
function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2716
|
+
function generateKeyPairSync(
|
|
2717
|
+
type: "dsa",
|
|
2718
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2719
|
+
): KeyPairSyncResult<string, string>;
|
|
2720
|
+
function generateKeyPairSync(
|
|
2721
|
+
type: "dsa",
|
|
2722
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2723
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2724
|
+
function generateKeyPairSync(
|
|
2725
|
+
type: "dsa",
|
|
2726
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2727
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2728
|
+
function generateKeyPairSync(
|
|
2729
|
+
type: "dsa",
|
|
2730
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2731
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2732
|
+
function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2733
|
+
function generateKeyPairSync(
|
|
2734
|
+
type: "ec",
|
|
2735
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2736
|
+
): KeyPairSyncResult<string, string>;
|
|
2737
|
+
function generateKeyPairSync(
|
|
2738
|
+
type: "ec",
|
|
2739
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2740
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2741
|
+
function generateKeyPairSync(
|
|
2742
|
+
type: "ec",
|
|
2743
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2744
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2745
|
+
function generateKeyPairSync(
|
|
2746
|
+
type: "ec",
|
|
2747
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2748
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2749
|
+
function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2750
|
+
function generateKeyPairSync(
|
|
2751
|
+
type: "ed25519",
|
|
2752
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2753
|
+
): KeyPairSyncResult<string, string>;
|
|
2754
|
+
function generateKeyPairSync(
|
|
2755
|
+
type: "ed25519",
|
|
2756
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2757
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2758
|
+
function generateKeyPairSync(
|
|
2759
|
+
type: "ed25519",
|
|
2760
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2761
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2762
|
+
function generateKeyPairSync(
|
|
2763
|
+
type: "ed25519",
|
|
2764
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2765
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2766
|
+
function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2767
|
+
function generateKeyPairSync(
|
|
2768
|
+
type: "ed448",
|
|
2769
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
2770
|
+
): KeyPairSyncResult<string, string>;
|
|
2771
|
+
function generateKeyPairSync(
|
|
2772
|
+
type: "ed448",
|
|
2773
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
2774
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2775
|
+
function generateKeyPairSync(
|
|
2776
|
+
type: "ed448",
|
|
2777
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
2778
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2779
|
+
function generateKeyPairSync(
|
|
2780
|
+
type: "ed448",
|
|
2781
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
2782
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2783
|
+
function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2784
|
+
function generateKeyPairSync(
|
|
2785
|
+
type: "x25519",
|
|
2786
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
2787
|
+
): KeyPairSyncResult<string, string>;
|
|
2788
|
+
function generateKeyPairSync(
|
|
2789
|
+
type: "x25519",
|
|
2790
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
2791
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2792
|
+
function generateKeyPairSync(
|
|
2793
|
+
type: "x25519",
|
|
2794
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
2795
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2796
|
+
function generateKeyPairSync(
|
|
2797
|
+
type: "x25519",
|
|
2798
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
2799
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2800
|
+
function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2801
|
+
function generateKeyPairSync(
|
|
2802
|
+
type: "x448",
|
|
2803
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
2804
|
+
): KeyPairSyncResult<string, string>;
|
|
2805
|
+
function generateKeyPairSync(
|
|
2806
|
+
type: "x448",
|
|
2807
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
2808
|
+
): KeyPairSyncResult<string, Buffer>;
|
|
2809
|
+
function generateKeyPairSync(
|
|
2810
|
+
type: "x448",
|
|
2811
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
2812
|
+
): KeyPairSyncResult<Buffer, string>;
|
|
2813
|
+
function generateKeyPairSync(
|
|
2814
|
+
type: "x448",
|
|
2815
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
2816
|
+
): KeyPairSyncResult<Buffer, Buffer>;
|
|
2817
|
+
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2608
2818
|
/**
|
|
2609
2819
|
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2610
2820
|
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
@@ -2644,279 +2854,448 @@ declare module 'crypto' {
|
|
|
2644
2854
|
* @since v10.12.0
|
|
2645
2855
|
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
|
|
2646
2856
|
*/
|
|
2647
|
-
function generateKeyPair(
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
function generateKeyPair(
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
function generateKeyPair(
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
function generateKeyPair(
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
function generateKeyPair(
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
function generateKeyPair(
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
function generateKeyPair(
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
function generateKeyPair(
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2857
|
+
function generateKeyPair(
|
|
2858
|
+
type: "rsa",
|
|
2859
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2860
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2861
|
+
): void;
|
|
2862
|
+
function generateKeyPair(
|
|
2863
|
+
type: "rsa",
|
|
2864
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2865
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2866
|
+
): void;
|
|
2867
|
+
function generateKeyPair(
|
|
2868
|
+
type: "rsa",
|
|
2869
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2870
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2871
|
+
): void;
|
|
2872
|
+
function generateKeyPair(
|
|
2873
|
+
type: "rsa",
|
|
2874
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2875
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2876
|
+
): void;
|
|
2877
|
+
function generateKeyPair(
|
|
2878
|
+
type: "rsa",
|
|
2879
|
+
options: RSAKeyPairKeyObjectOptions,
|
|
2880
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2881
|
+
): void;
|
|
2882
|
+
function generateKeyPair(
|
|
2883
|
+
type: "rsa-pss",
|
|
2884
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2885
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2886
|
+
): void;
|
|
2887
|
+
function generateKeyPair(
|
|
2888
|
+
type: "rsa-pss",
|
|
2889
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2890
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2891
|
+
): void;
|
|
2892
|
+
function generateKeyPair(
|
|
2893
|
+
type: "rsa-pss",
|
|
2894
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2895
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2896
|
+
): void;
|
|
2897
|
+
function generateKeyPair(
|
|
2898
|
+
type: "rsa-pss",
|
|
2899
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2900
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2901
|
+
): void;
|
|
2902
|
+
function generateKeyPair(
|
|
2903
|
+
type: "rsa-pss",
|
|
2904
|
+
options: RSAPSSKeyPairKeyObjectOptions,
|
|
2905
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2906
|
+
): void;
|
|
2907
|
+
function generateKeyPair(
|
|
2908
|
+
type: "dsa",
|
|
2909
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2910
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2911
|
+
): void;
|
|
2912
|
+
function generateKeyPair(
|
|
2913
|
+
type: "dsa",
|
|
2914
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2915
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2916
|
+
): void;
|
|
2917
|
+
function generateKeyPair(
|
|
2918
|
+
type: "dsa",
|
|
2919
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2920
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2921
|
+
): void;
|
|
2922
|
+
function generateKeyPair(
|
|
2923
|
+
type: "dsa",
|
|
2924
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2925
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2926
|
+
): void;
|
|
2927
|
+
function generateKeyPair(
|
|
2928
|
+
type: "dsa",
|
|
2929
|
+
options: DSAKeyPairKeyObjectOptions,
|
|
2930
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2931
|
+
): void;
|
|
2932
|
+
function generateKeyPair(
|
|
2933
|
+
type: "ec",
|
|
2934
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2935
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2936
|
+
): void;
|
|
2937
|
+
function generateKeyPair(
|
|
2938
|
+
type: "ec",
|
|
2939
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2940
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2941
|
+
): void;
|
|
2942
|
+
function generateKeyPair(
|
|
2943
|
+
type: "ec",
|
|
2944
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2945
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2946
|
+
): void;
|
|
2947
|
+
function generateKeyPair(
|
|
2948
|
+
type: "ec",
|
|
2949
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2950
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2951
|
+
): void;
|
|
2952
|
+
function generateKeyPair(
|
|
2953
|
+
type: "ec",
|
|
2954
|
+
options: ECKeyPairKeyObjectOptions,
|
|
2955
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2956
|
+
): void;
|
|
2957
|
+
function generateKeyPair(
|
|
2958
|
+
type: "ed25519",
|
|
2959
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2960
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2961
|
+
): void;
|
|
2962
|
+
function generateKeyPair(
|
|
2963
|
+
type: "ed25519",
|
|
2964
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2965
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2966
|
+
): void;
|
|
2967
|
+
function generateKeyPair(
|
|
2968
|
+
type: "ed25519",
|
|
2969
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2970
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2971
|
+
): void;
|
|
2972
|
+
function generateKeyPair(
|
|
2973
|
+
type: "ed25519",
|
|
2974
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2975
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
2976
|
+
): void;
|
|
2977
|
+
function generateKeyPair(
|
|
2978
|
+
type: "ed25519",
|
|
2979
|
+
options: ED25519KeyPairKeyObjectOptions | undefined,
|
|
2980
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2981
|
+
): void;
|
|
2982
|
+
function generateKeyPair(
|
|
2983
|
+
type: "ed448",
|
|
2984
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
2985
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2986
|
+
): void;
|
|
2987
|
+
function generateKeyPair(
|
|
2988
|
+
type: "ed448",
|
|
2989
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
2990
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
2991
|
+
): void;
|
|
2992
|
+
function generateKeyPair(
|
|
2993
|
+
type: "ed448",
|
|
2994
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
2995
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
2996
|
+
): void;
|
|
2997
|
+
function generateKeyPair(
|
|
2998
|
+
type: "ed448",
|
|
2999
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
3000
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3001
|
+
): void;
|
|
3002
|
+
function generateKeyPair(
|
|
3003
|
+
type: "ed448",
|
|
3004
|
+
options: ED448KeyPairKeyObjectOptions | undefined,
|
|
3005
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3006
|
+
): void;
|
|
3007
|
+
function generateKeyPair(
|
|
3008
|
+
type: "x25519",
|
|
3009
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
3010
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3011
|
+
): void;
|
|
3012
|
+
function generateKeyPair(
|
|
3013
|
+
type: "x25519",
|
|
3014
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
3015
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3016
|
+
): void;
|
|
3017
|
+
function generateKeyPair(
|
|
3018
|
+
type: "x25519",
|
|
3019
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
3020
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3021
|
+
): void;
|
|
3022
|
+
function generateKeyPair(
|
|
3023
|
+
type: "x25519",
|
|
3024
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
3025
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3026
|
+
): void;
|
|
3027
|
+
function generateKeyPair(
|
|
3028
|
+
type: "x25519",
|
|
3029
|
+
options: X25519KeyPairKeyObjectOptions | undefined,
|
|
3030
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3031
|
+
): void;
|
|
3032
|
+
function generateKeyPair(
|
|
3033
|
+
type: "x448",
|
|
3034
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
3035
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3036
|
+
): void;
|
|
3037
|
+
function generateKeyPair(
|
|
3038
|
+
type: "x448",
|
|
3039
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
3040
|
+
callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
|
|
3041
|
+
): void;
|
|
3042
|
+
function generateKeyPair(
|
|
3043
|
+
type: "x448",
|
|
3044
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
3045
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
|
|
3046
|
+
): void;
|
|
3047
|
+
function generateKeyPair(
|
|
3048
|
+
type: "x448",
|
|
3049
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
3050
|
+
callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
|
|
3051
|
+
): void;
|
|
3052
|
+
function generateKeyPair(
|
|
3053
|
+
type: "x448",
|
|
3054
|
+
options: X448KeyPairKeyObjectOptions | undefined,
|
|
3055
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3056
|
+
): void;
|
|
2687
3057
|
namespace generateKeyPair {
|
|
2688
3058
|
function __promisify__(
|
|
2689
|
-
type:
|
|
2690
|
-
options: RSAKeyPairOptions<
|
|
3059
|
+
type: "rsa",
|
|
3060
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2691
3061
|
): Promise<{
|
|
2692
3062
|
publicKey: string;
|
|
2693
3063
|
privateKey: string;
|
|
2694
3064
|
}>;
|
|
2695
3065
|
function __promisify__(
|
|
2696
|
-
type:
|
|
2697
|
-
options: RSAKeyPairOptions<
|
|
3066
|
+
type: "rsa",
|
|
3067
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2698
3068
|
): Promise<{
|
|
2699
3069
|
publicKey: string;
|
|
2700
3070
|
privateKey: Buffer;
|
|
2701
3071
|
}>;
|
|
2702
3072
|
function __promisify__(
|
|
2703
|
-
type:
|
|
2704
|
-
options: RSAKeyPairOptions<
|
|
3073
|
+
type: "rsa",
|
|
3074
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2705
3075
|
): Promise<{
|
|
2706
3076
|
publicKey: Buffer;
|
|
2707
3077
|
privateKey: string;
|
|
2708
3078
|
}>;
|
|
2709
3079
|
function __promisify__(
|
|
2710
|
-
type:
|
|
2711
|
-
options: RSAKeyPairOptions<
|
|
3080
|
+
type: "rsa",
|
|
3081
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2712
3082
|
): Promise<{
|
|
2713
3083
|
publicKey: Buffer;
|
|
2714
3084
|
privateKey: Buffer;
|
|
2715
3085
|
}>;
|
|
2716
|
-
function __promisify__(type:
|
|
3086
|
+
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2717
3087
|
function __promisify__(
|
|
2718
|
-
type:
|
|
2719
|
-
options: RSAPSSKeyPairOptions<
|
|
3088
|
+
type: "rsa-pss",
|
|
3089
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2720
3090
|
): Promise<{
|
|
2721
3091
|
publicKey: string;
|
|
2722
3092
|
privateKey: string;
|
|
2723
3093
|
}>;
|
|
2724
3094
|
function __promisify__(
|
|
2725
|
-
type:
|
|
2726
|
-
options: RSAPSSKeyPairOptions<
|
|
3095
|
+
type: "rsa-pss",
|
|
3096
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2727
3097
|
): Promise<{
|
|
2728
3098
|
publicKey: string;
|
|
2729
3099
|
privateKey: Buffer;
|
|
2730
3100
|
}>;
|
|
2731
3101
|
function __promisify__(
|
|
2732
|
-
type:
|
|
2733
|
-
options: RSAPSSKeyPairOptions<
|
|
3102
|
+
type: "rsa-pss",
|
|
3103
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2734
3104
|
): Promise<{
|
|
2735
3105
|
publicKey: Buffer;
|
|
2736
3106
|
privateKey: string;
|
|
2737
3107
|
}>;
|
|
2738
3108
|
function __promisify__(
|
|
2739
|
-
type:
|
|
2740
|
-
options: RSAPSSKeyPairOptions<
|
|
3109
|
+
type: "rsa-pss",
|
|
3110
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2741
3111
|
): Promise<{
|
|
2742
3112
|
publicKey: Buffer;
|
|
2743
3113
|
privateKey: Buffer;
|
|
2744
3114
|
}>;
|
|
2745
|
-
function __promisify__(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2746
3115
|
function __promisify__(
|
|
2747
|
-
type:
|
|
2748
|
-
options:
|
|
3116
|
+
type: "rsa-pss",
|
|
3117
|
+
options: RSAPSSKeyPairKeyObjectOptions,
|
|
3118
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3119
|
+
function __promisify__(
|
|
3120
|
+
type: "dsa",
|
|
3121
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2749
3122
|
): Promise<{
|
|
2750
3123
|
publicKey: string;
|
|
2751
3124
|
privateKey: string;
|
|
2752
3125
|
}>;
|
|
2753
3126
|
function __promisify__(
|
|
2754
|
-
type:
|
|
2755
|
-
options: DSAKeyPairOptions<
|
|
3127
|
+
type: "dsa",
|
|
3128
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2756
3129
|
): Promise<{
|
|
2757
3130
|
publicKey: string;
|
|
2758
3131
|
privateKey: Buffer;
|
|
2759
3132
|
}>;
|
|
2760
3133
|
function __promisify__(
|
|
2761
|
-
type:
|
|
2762
|
-
options: DSAKeyPairOptions<
|
|
3134
|
+
type: "dsa",
|
|
3135
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2763
3136
|
): Promise<{
|
|
2764
3137
|
publicKey: Buffer;
|
|
2765
3138
|
privateKey: string;
|
|
2766
3139
|
}>;
|
|
2767
3140
|
function __promisify__(
|
|
2768
|
-
type:
|
|
2769
|
-
options: DSAKeyPairOptions<
|
|
3141
|
+
type: "dsa",
|
|
3142
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2770
3143
|
): Promise<{
|
|
2771
3144
|
publicKey: Buffer;
|
|
2772
3145
|
privateKey: Buffer;
|
|
2773
3146
|
}>;
|
|
2774
|
-
function __promisify__(type:
|
|
3147
|
+
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2775
3148
|
function __promisify__(
|
|
2776
|
-
type:
|
|
2777
|
-
options: ECKeyPairOptions<
|
|
3149
|
+
type: "ec",
|
|
3150
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2778
3151
|
): Promise<{
|
|
2779
3152
|
publicKey: string;
|
|
2780
3153
|
privateKey: string;
|
|
2781
3154
|
}>;
|
|
2782
3155
|
function __promisify__(
|
|
2783
|
-
type:
|
|
2784
|
-
options: ECKeyPairOptions<
|
|
3156
|
+
type: "ec",
|
|
3157
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2785
3158
|
): Promise<{
|
|
2786
3159
|
publicKey: string;
|
|
2787
3160
|
privateKey: Buffer;
|
|
2788
3161
|
}>;
|
|
2789
3162
|
function __promisify__(
|
|
2790
|
-
type:
|
|
2791
|
-
options: ECKeyPairOptions<
|
|
3163
|
+
type: "ec",
|
|
3164
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2792
3165
|
): Promise<{
|
|
2793
3166
|
publicKey: Buffer;
|
|
2794
3167
|
privateKey: string;
|
|
2795
3168
|
}>;
|
|
2796
3169
|
function __promisify__(
|
|
2797
|
-
type:
|
|
2798
|
-
options: ECKeyPairOptions<
|
|
3170
|
+
type: "ec",
|
|
3171
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2799
3172
|
): Promise<{
|
|
2800
3173
|
publicKey: Buffer;
|
|
2801
3174
|
privateKey: Buffer;
|
|
2802
3175
|
}>;
|
|
2803
|
-
function __promisify__(type:
|
|
3176
|
+
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2804
3177
|
function __promisify__(
|
|
2805
|
-
type:
|
|
2806
|
-
options: ED25519KeyPairOptions<
|
|
3178
|
+
type: "ed25519",
|
|
3179
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2807
3180
|
): Promise<{
|
|
2808
3181
|
publicKey: string;
|
|
2809
3182
|
privateKey: string;
|
|
2810
3183
|
}>;
|
|
2811
3184
|
function __promisify__(
|
|
2812
|
-
type:
|
|
2813
|
-
options: ED25519KeyPairOptions<
|
|
3185
|
+
type: "ed25519",
|
|
3186
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2814
3187
|
): Promise<{
|
|
2815
3188
|
publicKey: string;
|
|
2816
3189
|
privateKey: Buffer;
|
|
2817
3190
|
}>;
|
|
2818
3191
|
function __promisify__(
|
|
2819
|
-
type:
|
|
2820
|
-
options: ED25519KeyPairOptions<
|
|
3192
|
+
type: "ed25519",
|
|
3193
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2821
3194
|
): Promise<{
|
|
2822
3195
|
publicKey: Buffer;
|
|
2823
3196
|
privateKey: string;
|
|
2824
3197
|
}>;
|
|
2825
3198
|
function __promisify__(
|
|
2826
|
-
type:
|
|
2827
|
-
options: ED25519KeyPairOptions<
|
|
3199
|
+
type: "ed25519",
|
|
3200
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2828
3201
|
): Promise<{
|
|
2829
3202
|
publicKey: Buffer;
|
|
2830
3203
|
privateKey: Buffer;
|
|
2831
3204
|
}>;
|
|
2832
|
-
function __promisify__(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2833
3205
|
function __promisify__(
|
|
2834
|
-
type:
|
|
2835
|
-
options
|
|
3206
|
+
type: "ed25519",
|
|
3207
|
+
options?: ED25519KeyPairKeyObjectOptions,
|
|
3208
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3209
|
+
function __promisify__(
|
|
3210
|
+
type: "ed448",
|
|
3211
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
2836
3212
|
): Promise<{
|
|
2837
3213
|
publicKey: string;
|
|
2838
3214
|
privateKey: string;
|
|
2839
3215
|
}>;
|
|
2840
3216
|
function __promisify__(
|
|
2841
|
-
type:
|
|
2842
|
-
options: ED448KeyPairOptions<
|
|
3217
|
+
type: "ed448",
|
|
3218
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
2843
3219
|
): Promise<{
|
|
2844
3220
|
publicKey: string;
|
|
2845
3221
|
privateKey: Buffer;
|
|
2846
3222
|
}>;
|
|
2847
3223
|
function __promisify__(
|
|
2848
|
-
type:
|
|
2849
|
-
options: ED448KeyPairOptions<
|
|
3224
|
+
type: "ed448",
|
|
3225
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
2850
3226
|
): Promise<{
|
|
2851
3227
|
publicKey: Buffer;
|
|
2852
3228
|
privateKey: string;
|
|
2853
3229
|
}>;
|
|
2854
3230
|
function __promisify__(
|
|
2855
|
-
type:
|
|
2856
|
-
options: ED448KeyPairOptions<
|
|
3231
|
+
type: "ed448",
|
|
3232
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
2857
3233
|
): Promise<{
|
|
2858
3234
|
publicKey: Buffer;
|
|
2859
3235
|
privateKey: Buffer;
|
|
2860
3236
|
}>;
|
|
2861
|
-
function __promisify__(type:
|
|
3237
|
+
function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2862
3238
|
function __promisify__(
|
|
2863
|
-
type:
|
|
2864
|
-
options: X25519KeyPairOptions<
|
|
3239
|
+
type: "x25519",
|
|
3240
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
2865
3241
|
): Promise<{
|
|
2866
3242
|
publicKey: string;
|
|
2867
3243
|
privateKey: string;
|
|
2868
3244
|
}>;
|
|
2869
3245
|
function __promisify__(
|
|
2870
|
-
type:
|
|
2871
|
-
options: X25519KeyPairOptions<
|
|
3246
|
+
type: "x25519",
|
|
3247
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
2872
3248
|
): Promise<{
|
|
2873
3249
|
publicKey: string;
|
|
2874
3250
|
privateKey: Buffer;
|
|
2875
3251
|
}>;
|
|
2876
3252
|
function __promisify__(
|
|
2877
|
-
type:
|
|
2878
|
-
options: X25519KeyPairOptions<
|
|
3253
|
+
type: "x25519",
|
|
3254
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
2879
3255
|
): Promise<{
|
|
2880
3256
|
publicKey: Buffer;
|
|
2881
3257
|
privateKey: string;
|
|
2882
3258
|
}>;
|
|
2883
3259
|
function __promisify__(
|
|
2884
|
-
type:
|
|
2885
|
-
options: X25519KeyPairOptions<
|
|
3260
|
+
type: "x25519",
|
|
3261
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
2886
3262
|
): Promise<{
|
|
2887
3263
|
publicKey: Buffer;
|
|
2888
3264
|
privateKey: Buffer;
|
|
2889
3265
|
}>;
|
|
2890
|
-
function __promisify__(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2891
3266
|
function __promisify__(
|
|
2892
|
-
type:
|
|
2893
|
-
options
|
|
3267
|
+
type: "x25519",
|
|
3268
|
+
options?: X25519KeyPairKeyObjectOptions,
|
|
3269
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3270
|
+
function __promisify__(
|
|
3271
|
+
type: "x448",
|
|
3272
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
2894
3273
|
): Promise<{
|
|
2895
3274
|
publicKey: string;
|
|
2896
3275
|
privateKey: string;
|
|
2897
3276
|
}>;
|
|
2898
3277
|
function __promisify__(
|
|
2899
|
-
type:
|
|
2900
|
-
options: X448KeyPairOptions<
|
|
3278
|
+
type: "x448",
|
|
3279
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
2901
3280
|
): Promise<{
|
|
2902
3281
|
publicKey: string;
|
|
2903
3282
|
privateKey: Buffer;
|
|
2904
3283
|
}>;
|
|
2905
3284
|
function __promisify__(
|
|
2906
|
-
type:
|
|
2907
|
-
options: X448KeyPairOptions<
|
|
3285
|
+
type: "x448",
|
|
3286
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
2908
3287
|
): Promise<{
|
|
2909
3288
|
publicKey: Buffer;
|
|
2910
3289
|
privateKey: string;
|
|
2911
3290
|
}>;
|
|
2912
3291
|
function __promisify__(
|
|
2913
|
-
type:
|
|
2914
|
-
options: X448KeyPairOptions<
|
|
3292
|
+
type: "x448",
|
|
3293
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
2915
3294
|
): Promise<{
|
|
2916
3295
|
publicKey: Buffer;
|
|
2917
3296
|
privateKey: Buffer;
|
|
2918
3297
|
}>;
|
|
2919
|
-
function __promisify__(type:
|
|
3298
|
+
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2920
3299
|
}
|
|
2921
3300
|
/**
|
|
2922
3301
|
* Calculates and returns the signature for `data` using the given private key and
|
|
@@ -2930,12 +3309,16 @@ declare module 'crypto' {
|
|
|
2930
3309
|
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2931
3310
|
* @since v12.0.0
|
|
2932
3311
|
*/
|
|
2933
|
-
function sign(algorithm: string | null | undefined, data: NodeJS.ArrayBufferView, key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
|
2934
3312
|
function sign(
|
|
2935
3313
|
algorithm: string | null | undefined,
|
|
2936
3314
|
data: NodeJS.ArrayBufferView,
|
|
2937
3315
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
2938
|
-
|
|
3316
|
+
): Buffer;
|
|
3317
|
+
function sign(
|
|
3318
|
+
algorithm: string | null | undefined,
|
|
3319
|
+
data: NodeJS.ArrayBufferView,
|
|
3320
|
+
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
3321
|
+
callback: (error: Error | null, data: Buffer) => void,
|
|
2939
3322
|
): void;
|
|
2940
3323
|
/**
|
|
2941
3324
|
* 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
|
|
@@ -2957,14 +3340,14 @@ declare module 'crypto' {
|
|
|
2957
3340
|
algorithm: string | null | undefined,
|
|
2958
3341
|
data: NodeJS.ArrayBufferView,
|
|
2959
3342
|
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
2960
|
-
signature: NodeJS.ArrayBufferView
|
|
3343
|
+
signature: NodeJS.ArrayBufferView,
|
|
2961
3344
|
): boolean;
|
|
2962
3345
|
function verify(
|
|
2963
3346
|
algorithm: string | null | undefined,
|
|
2964
3347
|
data: NodeJS.ArrayBufferView,
|
|
2965
3348
|
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
|
|
2966
3349
|
signature: NodeJS.ArrayBufferView,
|
|
2967
|
-
callback: (error: Error | null, result: boolean) => void
|
|
3350
|
+
callback: (error: Error | null, result: boolean) => void,
|
|
2968
3351
|
): void;
|
|
2969
3352
|
/**
|
|
2970
3353
|
* Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
|
|
@@ -2972,7 +3355,7 @@ declare module 'crypto' {
|
|
|
2972
3355
|
* @since v13.9.0, v12.17.0
|
|
2973
3356
|
*/
|
|
2974
3357
|
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
|
|
2975
|
-
type CipherMode =
|
|
3358
|
+
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
|
2976
3359
|
interface CipherInfoOptions {
|
|
2977
3360
|
/**
|
|
2978
3361
|
* A test key length.
|
|
@@ -3050,7 +3433,14 @@ declare module 'crypto' {
|
|
|
3050
3433
|
* @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512`
|
|
3051
3434
|
* generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
|
|
3052
3435
|
*/
|
|
3053
|
-
function hkdf(
|
|
3436
|
+
function hkdf(
|
|
3437
|
+
digest: string,
|
|
3438
|
+
irm: BinaryLike | KeyObject,
|
|
3439
|
+
salt: BinaryLike,
|
|
3440
|
+
info: BinaryLike,
|
|
3441
|
+
keylen: number,
|
|
3442
|
+
callback: (err: Error | null, derivedKey: ArrayBuffer) => void,
|
|
3443
|
+
): void;
|
|
3054
3444
|
/**
|
|
3055
3445
|
* Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The
|
|
3056
3446
|
* given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes.
|
|
@@ -3077,7 +3467,13 @@ declare module 'crypto' {
|
|
|
3077
3467
|
* @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`
|
|
3078
3468
|
* generates 64-byte hashes, making the maximum HKDF output 16320 bytes).
|
|
3079
3469
|
*/
|
|
3080
|
-
function hkdfSync(
|
|
3470
|
+
function hkdfSync(
|
|
3471
|
+
digest: string,
|
|
3472
|
+
ikm: BinaryLike | KeyObject,
|
|
3473
|
+
salt: BinaryLike,
|
|
3474
|
+
info: BinaryLike,
|
|
3475
|
+
keylen: number,
|
|
3476
|
+
): ArrayBuffer;
|
|
3081
3477
|
interface SecureHeapUsage {
|
|
3082
3478
|
/**
|
|
3083
3479
|
* The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag.
|
|
@@ -3121,7 +3517,7 @@ declare module 'crypto' {
|
|
|
3121
3517
|
/**
|
|
3122
3518
|
* @default 'always'
|
|
3123
3519
|
*/
|
|
3124
|
-
subject?:
|
|
3520
|
+
subject?: "always" | "default" | "never";
|
|
3125
3521
|
/**
|
|
3126
3522
|
* @default true
|
|
3127
3523
|
*/
|
|
@@ -3286,7 +3682,7 @@ declare module 'crypto' {
|
|
|
3286
3682
|
* @since v15.6.0
|
|
3287
3683
|
* @return Returns `email` if the certificate matches, `undefined` if it does not.
|
|
3288
3684
|
*/
|
|
3289
|
-
checkEmail(email: string, options?: Pick<X509CheckOptions,
|
|
3685
|
+
checkEmail(email: string, options?: Pick<X509CheckOptions, "subject">): string | undefined;
|
|
3290
3686
|
/**
|
|
3291
3687
|
* Checks whether the certificate matches the given host name.
|
|
3292
3688
|
*
|
|
@@ -3400,9 +3796,21 @@ declare module 'crypto' {
|
|
|
3400
3796
|
* @param size The size (in bits) of the prime to generate.
|
|
3401
3797
|
*/
|
|
3402
3798
|
function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
|
|
3403
|
-
function generatePrime(
|
|
3404
|
-
|
|
3405
|
-
|
|
3799
|
+
function generatePrime(
|
|
3800
|
+
size: number,
|
|
3801
|
+
options: GeneratePrimeOptionsBigInt,
|
|
3802
|
+
callback: (err: Error | null, prime: bigint) => void,
|
|
3803
|
+
): void;
|
|
3804
|
+
function generatePrime(
|
|
3805
|
+
size: number,
|
|
3806
|
+
options: GeneratePrimeOptionsArrayBuffer,
|
|
3807
|
+
callback: (err: Error | null, prime: ArrayBuffer) => void,
|
|
3808
|
+
): void;
|
|
3809
|
+
function generatePrime(
|
|
3810
|
+
size: number,
|
|
3811
|
+
options: GeneratePrimeOptions,
|
|
3812
|
+
callback: (err: Error | null, prime: ArrayBuffer | bigint) => void,
|
|
3813
|
+
): void;
|
|
3406
3814
|
/**
|
|
3407
3815
|
* Generates a pseudorandom prime of `size` bits.
|
|
3408
3816
|
*
|
|
@@ -3451,7 +3859,11 @@ declare module 'crypto' {
|
|
|
3451
3859
|
* @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length.
|
|
3452
3860
|
*/
|
|
3453
3861
|
function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
|
|
3454
|
-
function checkPrime(
|
|
3862
|
+
function checkPrime(
|
|
3863
|
+
value: LargeNumberLike,
|
|
3864
|
+
options: CheckPrimeOptions,
|
|
3865
|
+
callback: (err: Error | null, result: boolean) => void,
|
|
3866
|
+
): void;
|
|
3455
3867
|
/**
|
|
3456
3868
|
* Checks the primality of the `candidate`.
|
|
3457
3869
|
* @since v15.8.0
|
|
@@ -3503,9 +3915,17 @@ declare module 'crypto' {
|
|
|
3503
3915
|
const webcrypto: webcrypto.Crypto;
|
|
3504
3916
|
namespace webcrypto {
|
|
3505
3917
|
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
3506
|
-
type KeyFormat =
|
|
3507
|
-
type KeyType =
|
|
3508
|
-
type KeyUsage =
|
|
3918
|
+
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
|
3919
|
+
type KeyType = "private" | "public" | "secret";
|
|
3920
|
+
type KeyUsage =
|
|
3921
|
+
| "decrypt"
|
|
3922
|
+
| "deriveBits"
|
|
3923
|
+
| "deriveKey"
|
|
3924
|
+
| "encrypt"
|
|
3925
|
+
| "sign"
|
|
3926
|
+
| "unwrapKey"
|
|
3927
|
+
| "verify"
|
|
3928
|
+
| "wrapKey";
|
|
3509
3929
|
type AlgorithmIdentifier = Algorithm | string;
|
|
3510
3930
|
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
3511
3931
|
type NamedCurve = string;
|
|
@@ -3659,7 +4079,7 @@ declare module 'crypto' {
|
|
|
3659
4079
|
/** Illegal constructor */
|
|
3660
4080
|
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
3661
4081
|
readonly length: 0;
|
|
3662
|
-
readonly name:
|
|
4082
|
+
readonly name: "CryptoKey";
|
|
3663
4083
|
readonly prototype: CryptoKey;
|
|
3664
4084
|
}
|
|
3665
4085
|
/**
|
|
@@ -3732,7 +4152,11 @@ declare module 'crypto' {
|
|
|
3732
4152
|
* - `'AES-GCM'`
|
|
3733
4153
|
* @since v15.0.0
|
|
3734
4154
|
*/
|
|
3735
|
-
decrypt(
|
|
4155
|
+
decrypt(
|
|
4156
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4157
|
+
key: CryptoKey,
|
|
4158
|
+
data: BufferSource,
|
|
4159
|
+
): Promise<ArrayBuffer>;
|
|
3736
4160
|
/**
|
|
3737
4161
|
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
3738
4162
|
* `subtle.deriveBits()` attempts to generate `length` bits.
|
|
@@ -3751,7 +4175,11 @@ declare module 'crypto' {
|
|
|
3751
4175
|
* @since v15.0.0
|
|
3752
4176
|
*/
|
|
3753
4177
|
deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise<ArrayBuffer>;
|
|
3754
|
-
deriveBits(
|
|
4178
|
+
deriveBits(
|
|
4179
|
+
algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params,
|
|
4180
|
+
baseKey: CryptoKey,
|
|
4181
|
+
length: number,
|
|
4182
|
+
): Promise<ArrayBuffer>;
|
|
3755
4183
|
/**
|
|
3756
4184
|
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
3757
4185
|
* `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
@@ -3772,9 +4200,14 @@ declare module 'crypto' {
|
|
|
3772
4200
|
deriveKey(
|
|
3773
4201
|
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
3774
4202
|
baseKey: CryptoKey,
|
|
3775
|
-
derivedKeyAlgorithm:
|
|
4203
|
+
derivedKeyAlgorithm:
|
|
4204
|
+
| AlgorithmIdentifier
|
|
4205
|
+
| AesDerivedKeyParams
|
|
4206
|
+
| HmacImportParams
|
|
4207
|
+
| HkdfParams
|
|
4208
|
+
| Pbkdf2Params,
|
|
3776
4209
|
extractable: boolean,
|
|
3777
|
-
keyUsages: ReadonlyArray<KeyUsage
|
|
4210
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
3778
4211
|
): Promise<CryptoKey>;
|
|
3779
4212
|
/**
|
|
3780
4213
|
* Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
|
|
@@ -3804,7 +4237,11 @@ declare module 'crypto' {
|
|
|
3804
4237
|
* - `'AES-GCM'`
|
|
3805
4238
|
* @since v15.0.0
|
|
3806
4239
|
*/
|
|
3807
|
-
encrypt(
|
|
4240
|
+
encrypt(
|
|
4241
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4242
|
+
key: CryptoKey,
|
|
4243
|
+
data: BufferSource,
|
|
4244
|
+
): Promise<ArrayBuffer>;
|
|
3808
4245
|
/**
|
|
3809
4246
|
* Exports the given key into the specified format, if supported.
|
|
3810
4247
|
*
|
|
@@ -3819,8 +4256,8 @@ declare module 'crypto' {
|
|
|
3819
4256
|
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
3820
4257
|
* @since v15.0.0
|
|
3821
4258
|
*/
|
|
3822
|
-
exportKey(format:
|
|
3823
|
-
exportKey(format: Exclude<KeyFormat,
|
|
4259
|
+
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
4260
|
+
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
3824
4261
|
/**
|
|
3825
4262
|
* Using the method and parameters provided in `algorithm`,
|
|
3826
4263
|
* `subtle.generateKey()` attempts to generate new keying material.
|
|
@@ -3847,9 +4284,21 @@ declare module 'crypto' {
|
|
|
3847
4284
|
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3848
4285
|
* @since v15.0.0
|
|
3849
4286
|
*/
|
|
3850
|
-
generateKey(
|
|
3851
|
-
|
|
3852
|
-
|
|
4287
|
+
generateKey(
|
|
4288
|
+
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
|
4289
|
+
extractable: boolean,
|
|
4290
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
4291
|
+
): Promise<CryptoKeyPair>;
|
|
4292
|
+
generateKey(
|
|
4293
|
+
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
|
|
4294
|
+
extractable: boolean,
|
|
4295
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
4296
|
+
): Promise<CryptoKey>;
|
|
4297
|
+
generateKey(
|
|
4298
|
+
algorithm: AlgorithmIdentifier,
|
|
4299
|
+
extractable: boolean,
|
|
4300
|
+
keyUsages: KeyUsage[],
|
|
4301
|
+
): Promise<CryptoKeyPair | CryptoKey>;
|
|
3853
4302
|
/**
|
|
3854
4303
|
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
3855
4304
|
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
@@ -3861,18 +4310,28 @@ declare module 'crypto' {
|
|
|
3861
4310
|
* @since v15.0.0
|
|
3862
4311
|
*/
|
|
3863
4312
|
importKey(
|
|
3864
|
-
format:
|
|
4313
|
+
format: "jwk",
|
|
3865
4314
|
keyData: JsonWebKey,
|
|
3866
|
-
algorithm:
|
|
4315
|
+
algorithm:
|
|
4316
|
+
| AlgorithmIdentifier
|
|
4317
|
+
| RsaHashedImportParams
|
|
4318
|
+
| EcKeyImportParams
|
|
4319
|
+
| HmacImportParams
|
|
4320
|
+
| AesKeyAlgorithm,
|
|
3867
4321
|
extractable: boolean,
|
|
3868
|
-
keyUsages: ReadonlyArray<KeyUsage
|
|
4322
|
+
keyUsages: ReadonlyArray<KeyUsage>,
|
|
3869
4323
|
): Promise<CryptoKey>;
|
|
3870
4324
|
importKey(
|
|
3871
|
-
format: Exclude<KeyFormat,
|
|
4325
|
+
format: Exclude<KeyFormat, "jwk">,
|
|
3872
4326
|
keyData: BufferSource,
|
|
3873
|
-
algorithm:
|
|
4327
|
+
algorithm:
|
|
4328
|
+
| AlgorithmIdentifier
|
|
4329
|
+
| RsaHashedImportParams
|
|
4330
|
+
| EcKeyImportParams
|
|
4331
|
+
| HmacImportParams
|
|
4332
|
+
| AesKeyAlgorithm,
|
|
3874
4333
|
extractable: boolean,
|
|
3875
|
-
keyUsages: KeyUsage[]
|
|
4334
|
+
keyUsages: KeyUsage[],
|
|
3876
4335
|
): Promise<CryptoKey>;
|
|
3877
4336
|
/**
|
|
3878
4337
|
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
@@ -3889,7 +4348,11 @@ declare module 'crypto' {
|
|
|
3889
4348
|
* - `'HMAC'`
|
|
3890
4349
|
* @since v15.0.0
|
|
3891
4350
|
*/
|
|
3892
|
-
sign(
|
|
4351
|
+
sign(
|
|
4352
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4353
|
+
key: CryptoKey,
|
|
4354
|
+
data: BufferSource,
|
|
4355
|
+
): Promise<ArrayBuffer>;
|
|
3893
4356
|
/**
|
|
3894
4357
|
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3895
4358
|
* The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
@@ -3930,9 +4393,14 @@ declare module 'crypto' {
|
|
|
3930
4393
|
wrappedKey: BufferSource,
|
|
3931
4394
|
unwrappingKey: CryptoKey,
|
|
3932
4395
|
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
3933
|
-
unwrappedKeyAlgorithm:
|
|
4396
|
+
unwrappedKeyAlgorithm:
|
|
4397
|
+
| AlgorithmIdentifier
|
|
4398
|
+
| RsaHashedImportParams
|
|
4399
|
+
| EcKeyImportParams
|
|
4400
|
+
| HmacImportParams
|
|
4401
|
+
| AesKeyAlgorithm,
|
|
3934
4402
|
extractable: boolean,
|
|
3935
|
-
keyUsages: KeyUsage[]
|
|
4403
|
+
keyUsages: KeyUsage[],
|
|
3936
4404
|
): Promise<CryptoKey>;
|
|
3937
4405
|
/**
|
|
3938
4406
|
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
@@ -3949,7 +4417,12 @@ declare module 'crypto' {
|
|
|
3949
4417
|
* - `'HMAC'`
|
|
3950
4418
|
* @since v15.0.0
|
|
3951
4419
|
*/
|
|
3952
|
-
verify(
|
|
4420
|
+
verify(
|
|
4421
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4422
|
+
key: CryptoKey,
|
|
4423
|
+
signature: BufferSource,
|
|
4424
|
+
data: BufferSource,
|
|
4425
|
+
): Promise<boolean>;
|
|
3953
4426
|
/**
|
|
3954
4427
|
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3955
4428
|
* The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
|
|
@@ -3968,10 +4441,15 @@ declare module 'crypto' {
|
|
|
3968
4441
|
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3969
4442
|
* @since v15.0.0
|
|
3970
4443
|
*/
|
|
3971
|
-
wrapKey(
|
|
4444
|
+
wrapKey(
|
|
4445
|
+
format: KeyFormat,
|
|
4446
|
+
key: CryptoKey,
|
|
4447
|
+
wrappingKey: CryptoKey,
|
|
4448
|
+
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4449
|
+
): Promise<ArrayBuffer>;
|
|
3972
4450
|
}
|
|
3973
4451
|
}
|
|
3974
4452
|
}
|
|
3975
|
-
declare module
|
|
3976
|
-
export * from
|
|
4453
|
+
declare module "node:crypto" {
|
|
4454
|
+
export * from "crypto";
|
|
3977
4455
|
}
|