UNPKG

24.4 kBTypeScriptView Raw
1declare module 'crypto' {
2 import * as stream from 'stream';
3
4 interface Certificate {
5 exportChallenge(spkac: string | Buffer | NodeJS.TypedArray | DataView): Buffer;
6 exportPublicKey(spkac: string | Buffer | NodeJS.TypedArray | DataView): Buffer;
7 verifySpkac(spkac: Buffer | NodeJS.TypedArray | DataView): boolean;
8 }
9 const Certificate: {
10 new (): Certificate;
11 (): Certificate;
12 };
13
14 /** @deprecated since v10.0.0 */
15 const fips: boolean;
16
17 interface CredentialDetails {
18 pfx: string;
19 key: string;
20 passphrase: string;
21 cert: string;
22 ca: string | string[];
23 crl: string | string[];
24 ciphers: string;
25 }
26 /** @deprecated since v0.11.13 - use tls.SecureContext instead. */
27 interface Credentials {
28 context?: any;
29 }
30 /** @deprecated since v0.11.13 - use tls.createSecureContext instead. */
31 function createCredentials(details: CredentialDetails): Credentials;
32 function createHash(algorithm: string, options?: stream.TransformOptions): Hash;
33 function createHmac(
34 algorithm: string,
35 key: string | Buffer | NodeJS.TypedArray | DataView,
36 options?: stream.TransformOptions,
37 ): Hmac;
38
39 type Utf8AsciiLatin1Encoding = 'utf8' | 'ascii' | 'latin1';
40 type HexBase64Latin1Encoding = 'latin1' | 'hex' | 'base64';
41 type Utf8AsciiBinaryEncoding = 'utf8' | 'ascii' | 'binary';
42 type HexBase64BinaryEncoding = 'binary' | 'base64' | 'hex';
43 type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
44
45 interface Hash extends stream.Transform {
46 update(data: string | Buffer | NodeJS.TypedArray | DataView): Hash;
47 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hash;
48 digest(): Buffer;
49 digest(encoding: HexBase64Latin1Encoding): string;
50 }
51 interface Hmac extends stream.Transform {
52 update(data: string | Buffer | NodeJS.TypedArray | DataView): Hmac;
53 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Hmac;
54 digest(): Buffer;
55 digest(encoding: HexBase64Latin1Encoding): string;
56 }
57 type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm';
58 type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
59 interface CipherCCMOptions extends stream.TransformOptions {
60 authTagLength: number;
61 }
62 interface CipherGCMOptions extends stream.TransformOptions {
63 authTagLength?: number;
64 }
65 /** @deprecated since v10.0.0 use createCipheriv() */
66 function createCipher(
67 algorithm: CipherCCMTypes,
68 password: string | Buffer | NodeJS.TypedArray | DataView,
69 options: CipherCCMOptions,
70 ): CipherCCM;
71 /** @deprecated since v10.0.0 use createCipheriv() */
72 function createCipher(
73 algorithm: CipherGCMTypes,
74 password: string | Buffer | NodeJS.TypedArray | DataView,
75 options?: CipherGCMOptions,
76 ): CipherGCM;
77 /** @deprecated since v10.0.0 use createCipheriv() */
78 function createCipher(
79 algorithm: string,
80 password: string | Buffer | NodeJS.TypedArray | DataView,
81 options?: stream.TransformOptions,
82 ): Cipher;
83
84 function createCipheriv(
85 algorithm: CipherCCMTypes,
86 key: string | Buffer | NodeJS.TypedArray | DataView,
87 iv: string | Buffer | NodeJS.TypedArray | DataView,
88 options: CipherCCMOptions,
89 ): CipherCCM;
90 function createCipheriv(
91 algorithm: CipherGCMTypes,
92 key: string | Buffer | NodeJS.TypedArray | DataView,
93 iv: string | Buffer | NodeJS.TypedArray | DataView,
94 options?: CipherGCMOptions,
95 ): CipherGCM;
96 function createCipheriv(
97 algorithm: string,
98 key: string | Buffer | NodeJS.TypedArray | DataView,
99 iv: string | Buffer | NodeJS.TypedArray | DataView,
100 options?: stream.TransformOptions,
101 ): Cipher;
102
103 interface Cipher extends stream.Transform {
104 update(data: string | Buffer | NodeJS.TypedArray | DataView): Buffer;
105 update(data: string, input_encoding: Utf8AsciiBinaryEncoding): Buffer;
106 update(data: Buffer | NodeJS.TypedArray | DataView, output_encoding: HexBase64BinaryEncoding): string;
107 update(
108 data: Buffer | NodeJS.TypedArray | DataView,
109 input_encoding: any,
110 output_encoding: HexBase64BinaryEncoding,
111 ): string;
112 // second arg ignored
113 update(data: string, input_encoding: Utf8AsciiBinaryEncoding, output_encoding: HexBase64BinaryEncoding): string;
114 final(): Buffer;
115 final(output_encoding: string): string;
116 setAutoPadding(auto_padding?: boolean): this;
117 // getAuthTag(): Buffer;
118 // setAAD(buffer: Buffer): this; // docs only say buffer
119 }
120 interface CipherCCM extends Cipher {
121 setAAD(buffer: Buffer, options: { plaintextLength: number }): this;
122 getAuthTag(): Buffer;
123 }
124 interface CipherGCM extends Cipher {
125 setAAD(buffer: Buffer, options?: { plaintextLength: number }): this;
126 getAuthTag(): Buffer;
127 }
128 /** @deprecated since v10.0.0 use createDecipheriv() */
129 function createDecipher(
130 algorithm: CipherCCMTypes,
131 password: string | Buffer | NodeJS.TypedArray | DataView,
132 options: CipherCCMOptions,
133 ): DecipherCCM;
134 /** @deprecated since v10.0.0 use createDecipheriv() */
135 function createDecipher(
136 algorithm: CipherGCMTypes,
137 password: string | Buffer | NodeJS.TypedArray | DataView,
138 options?: CipherGCMOptions,
139 ): DecipherGCM;
140 /** @deprecated since v10.0.0 use createDecipheriv() */
141 function createDecipher(
142 algorithm: string,
143 password: string | Buffer | NodeJS.TypedArray | DataView,
144 options?: stream.TransformOptions,
145 ): Decipher;
146
147 function createDecipheriv(
148 algorithm: CipherCCMTypes,
149 key: string | Buffer | NodeJS.TypedArray | DataView,
150 iv: string | Buffer | NodeJS.TypedArray | DataView,
151 options: CipherCCMOptions,
152 ): DecipherCCM;
153 function createDecipheriv(
154 algorithm: CipherGCMTypes,
155 key: string | Buffer | NodeJS.TypedArray | DataView,
156 iv: string | Buffer | NodeJS.TypedArray | DataView,
157 options?: CipherGCMOptions,
158 ): DecipherGCM;
159 function createDecipheriv(
160 algorithm: string,
161 key: string | Buffer | NodeJS.TypedArray | DataView,
162 iv: string | Buffer | NodeJS.TypedArray | DataView,
163 options?: stream.TransformOptions,
164 ): Decipher;
165
166 interface Decipher extends stream.Transform {
167 update(data: Buffer | NodeJS.TypedArray | DataView): Buffer;
168 update(data: string, input_encoding: HexBase64BinaryEncoding): Buffer;
169 update(
170 data: Buffer | NodeJS.TypedArray | DataView,
171 input_encoding: HexBase64BinaryEncoding | undefined,
172 output_encoding: Utf8AsciiBinaryEncoding,
173 ): string;
174 // second arg is ignored
175 update(data: string, input_encoding: HexBase64BinaryEncoding, output_encoding: Utf8AsciiBinaryEncoding): string;
176 final(): Buffer;
177 final(output_encoding: string): string;
178 setAutoPadding(auto_padding?: boolean): this;
179 // setAuthTag(tag: Buffer | NodeJS.TypedArray | DataView): this;
180 // setAAD(buffer: Buffer | NodeJS.TypedArray | DataView): this;
181 }
182 interface DecipherCCM extends Decipher {
183 setAuthTag(buffer: Buffer | NodeJS.TypedArray | DataView): this;
184 setAAD(buffer: Buffer | NodeJS.TypedArray | DataView, options: { plaintextLength: number }): this;
185 }
186 interface DecipherGCM extends Decipher {
187 setAuthTag(buffer: Buffer | NodeJS.TypedArray | DataView): this;
188 setAAD(buffer: Buffer | NodeJS.TypedArray | DataView, options?: { plaintextLength: number }): this;
189 }
190
191 function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
192 interface Signer extends NodeJS.WritableStream {
193 update(data: string | Buffer | NodeJS.TypedArray | DataView): Signer;
194 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Signer;
195 sign(private_key: string | { key: string; passphrase?: string; padding?: number; saltLength?: number }): Buffer;
196 sign(
197 private_key: string | { key: string; passphrase?: string; padding?: number; saltLength?: number },
198 output_format: HexBase64Latin1Encoding,
199 ): string;
200 }
201 function createVerify(algorith: string, options?: stream.WritableOptions): Verify;
202 interface Verify extends NodeJS.WritableStream {
203 update(data: string | Buffer | NodeJS.TypedArray | DataView): Verify;
204 update(data: string, input_encoding: Utf8AsciiLatin1Encoding): Verify;
205 verify(object: string | Object, signature: Buffer | NodeJS.TypedArray | DataView): boolean;
206 verify(object: string | Object, signature: string, signature_format: HexBase64Latin1Encoding): boolean;
207 // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format
208 // The signature field accepts a TypedArray type, but it is only available starting ES2017
209 }
210 function createDiffieHellman(
211 prime_length: number,
212 generator?: number | Buffer | NodeJS.TypedArray | DataView,
213 ): DiffieHellman;
214 function createDiffieHellman(prime: Buffer | NodeJS.TypedArray | DataView): DiffieHellman;
215 function createDiffieHellman(prime: string, prime_encoding: HexBase64Latin1Encoding): DiffieHellman;
216 function createDiffieHellman(
217 prime: string,
218 prime_encoding: HexBase64Latin1Encoding,
219 generator: number | Buffer | NodeJS.TypedArray | DataView,
220 ): DiffieHellman;
221 function createDiffieHellman(
222 prime: string,
223 prime_encoding: HexBase64Latin1Encoding,
224 generator: string,
225 generator_encoding: HexBase64Latin1Encoding,
226 ): DiffieHellman;
227 interface DiffieHellman {
228 generateKeys(): Buffer;
229 generateKeys(encoding: HexBase64Latin1Encoding): string;
230 computeSecret(other_public_key: Buffer | NodeJS.TypedArray | DataView): Buffer;
231 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
232 computeSecret(
233 other_public_key: Buffer | NodeJS.TypedArray | DataView,
234 output_encoding: HexBase64Latin1Encoding,
235 ): string;
236 computeSecret(
237 other_public_key: string,
238 input_encoding: HexBase64Latin1Encoding,
239 output_encoding: HexBase64Latin1Encoding,
240 ): string;
241 getPrime(): Buffer;
242 getPrime(encoding: HexBase64Latin1Encoding): string;
243 getGenerator(): Buffer;
244 getGenerator(encoding: HexBase64Latin1Encoding): string;
245 getPublicKey(): Buffer;
246 getPublicKey(encoding: HexBase64Latin1Encoding): string;
247 getPrivateKey(): Buffer;
248 getPrivateKey(encoding: HexBase64Latin1Encoding): string;
249 setPublicKey(public_key: Buffer | NodeJS.TypedArray | DataView): void;
250 setPublicKey(public_key: string, encoding: string): void;
251 setPrivateKey(private_key: Buffer | NodeJS.TypedArray | DataView): void;
252 setPrivateKey(private_key: string, encoding: string): void;
253 verifyError: number;
254 }
255 function getDiffieHellman(group_name: string): DiffieHellman;
256 function pbkdf2(
257 password: string | Buffer | NodeJS.TypedArray | DataView,
258 salt: string | Buffer | NodeJS.TypedArray | DataView,
259 iterations: number,
260 keylen: number,
261 digest: string,
262 callback: (err: Error | null, derivedKey: Buffer) => any,
263 ): void;
264 function pbkdf2Sync(
265 password: string | Buffer | NodeJS.TypedArray | DataView,
266 salt: string | Buffer | NodeJS.TypedArray | DataView,
267 iterations: number,
268 keylen: number,
269 digest: string,
270 ): Buffer;
271
272 function randomBytes(size: number): Buffer;
273 function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
274 function pseudoRandomBytes(size: number): Buffer;
275 function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
276
277 function randomFillSync<T extends Buffer | NodeJS.TypedArray | DataView>(
278 buffer: T,
279 offset?: number,
280 size?: number,
281 ): T;
282 function randomFill<T extends Buffer | NodeJS.TypedArray | DataView>(
283 buffer: T,
284 callback: (err: Error | null, buf: T) => void,
285 ): void;
286 function randomFill<T extends Buffer | NodeJS.TypedArray | DataView>(
287 buffer: T,
288 offset: number,
289 callback: (err: Error | null, buf: T) => void,
290 ): void;
291 function randomFill<T extends Buffer | NodeJS.TypedArray | DataView>(
292 buffer: T,
293 offset: number,
294 size: number,
295 callback: (err: Error | null, buf: T) => void,
296 ): void;
297
298 interface ScryptOptions {
299 cost?: number;
300 blockSize?: number;
301 parallelization?: number;
302 N?: number;
303 r?: number;
304 p?: number;
305 maxmem?: number;
306 }
307 function scrypt(
308 password: string | Buffer | NodeJS.TypedArray | DataView,
309 salt: string | Buffer | NodeJS.TypedArray | DataView,
310 keylen: number,
311 callback: (err: Error | null, derivedKey: Buffer) => void,
312 ): void;
313 function scrypt(
314 password: string | Buffer | NodeJS.TypedArray | DataView,
315 salt: string | Buffer | NodeJS.TypedArray | DataView,
316 keylen: number,
317 options: ScryptOptions,
318 callback: (err: Error | null, derivedKey: Buffer) => void,
319 ): void;
320 function scryptSync(
321 password: string | Buffer | NodeJS.TypedArray | DataView,
322 salt: string | Buffer | NodeJS.TypedArray | DataView,
323 keylen: number,
324 options?: ScryptOptions,
325 ): Buffer;
326
327 interface RsaPublicKey {
328 key: string;
329 padding?: number;
330 }
331 interface RsaPrivateKey {
332 key: string;
333 passphrase?: string;
334 padding?: number;
335 }
336 function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
337 function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
338 function privateEncrypt(private_key: string | RsaPrivateKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
339 function publicDecrypt(public_key: string | RsaPublicKey, buffer: Buffer | NodeJS.TypedArray | DataView): Buffer;
340 function getCiphers(): string[];
341 function getCurves(): string[];
342 function getFips(): 1 | 0;
343 function getHashes(): string[];
344 class ECDH {
345 static convertKey(
346 key: string | Buffer | NodeJS.TypedArray | DataView,
347 curve: string,
348 inputEncoding?: HexBase64Latin1Encoding,
349 outputEncoding?: 'latin1' | 'hex' | 'base64',
350 format?: 'uncompressed' | 'compressed' | 'hybrid',
351 ): Buffer | string;
352 generateKeys(): Buffer;
353 generateKeys(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
354 computeSecret(other_public_key: Buffer | NodeJS.TypedArray | DataView): Buffer;
355 computeSecret(other_public_key: string, input_encoding: HexBase64Latin1Encoding): Buffer;
356 computeSecret(
357 other_public_key: Buffer | NodeJS.TypedArray | DataView,
358 output_encoding: HexBase64Latin1Encoding,
359 ): string;
360 computeSecret(
361 other_public_key: string,
362 input_encoding: HexBase64Latin1Encoding,
363 output_encoding: HexBase64Latin1Encoding,
364 ): string;
365 getPrivateKey(): Buffer;
366 getPrivateKey(encoding: HexBase64Latin1Encoding): string;
367 getPublicKey(): Buffer;
368 getPublicKey(encoding: HexBase64Latin1Encoding, format?: ECDHKeyFormat): string;
369 setPrivateKey(private_key: Buffer | NodeJS.TypedArray | DataView): void;
370 setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void;
371 }
372 function createECDH(curve_name: string): ECDH;
373 function timingSafeEqual(
374 a: Buffer | NodeJS.TypedArray | DataView,
375 b: Buffer | NodeJS.TypedArray | DataView,
376 ): boolean;
377 /** @deprecated since v10.0.0 */
378 const DEFAULT_ENCODING: string;
379
380 export type KeyType = 'rsa' | 'dsa' | 'ec';
381 export type KeyFormat = 'pem' | 'der';
382
383 interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
384 format: T;
385 cipher?: string;
386 passphrase?: string;
387 }
388
389 interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
390 /**
391 * Key size in bits
392 */
393 modulusLength: number;
394 /**
395 * @default 0x10001
396 */
397 publicExponent?: number;
398
399 publicKeyEncoding: {
400 type: 'pkcs1' | 'spki';
401 format: PubF;
402 };
403 privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
404 type: 'pkcs1' | 'pkcs8';
405 };
406 }
407
408 interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
409 /**
410 * Key size in bits
411 */
412 modulusLength: number;
413 /**
414 * Size of q in bits
415 */
416 divisorLength: number;
417
418 publicKeyEncoding: {
419 type: 'spki';
420 format: PubF;
421 };
422 privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
423 type: 'pkcs8';
424 };
425 }
426
427 interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
428 /**
429 * Name of the curve to use.
430 */
431 namedCurve: string;
432
433 publicKeyEncoding: {
434 type: 'pkcs1' | 'spki';
435 format: PubF;
436 };
437 privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
438 type: 'sec1' | 'pkcs8';
439 };
440 }
441
442 interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
443 publicKey: T1;
444 privateKey: T2;
445 }
446
447 function generateKeyPairSync(
448 type: 'rsa',
449 options: RSAKeyPairOptions<'pem', 'pem'>,
450 ): KeyPairSyncResult<string, string>;
451 function generateKeyPairSync(
452 type: 'rsa',
453 options: RSAKeyPairOptions<'pem', 'der'>,
454 ): KeyPairSyncResult<string, Buffer>;
455 function generateKeyPairSync(
456 type: 'rsa',
457 options: RSAKeyPairOptions<'der', 'pem'>,
458 ): KeyPairSyncResult<Buffer, string>;
459 function generateKeyPairSync(
460 type: 'rsa',
461 options: RSAKeyPairOptions<'der', 'der'>,
462 ): KeyPairSyncResult<Buffer, Buffer>;
463
464 function generateKeyPairSync(
465 type: 'dsa',
466 options: DSAKeyPairOptions<'pem', 'pem'>,
467 ): KeyPairSyncResult<string, string>;
468 function generateKeyPairSync(
469 type: 'dsa',
470 options: DSAKeyPairOptions<'pem', 'der'>,
471 ): KeyPairSyncResult<string, Buffer>;
472 function generateKeyPairSync(
473 type: 'dsa',
474 options: DSAKeyPairOptions<'der', 'pem'>,
475 ): KeyPairSyncResult<Buffer, string>;
476 function generateKeyPairSync(
477 type: 'dsa',
478 options: DSAKeyPairOptions<'der', 'der'>,
479 ): KeyPairSyncResult<Buffer, Buffer>;
480
481 function generateKeyPairSync(
482 type: 'ec',
483 options: ECKeyPairOptions<'pem', 'pem'>,
484 ): KeyPairSyncResult<string, string>;
485 function generateKeyPairSync(
486 type: 'ec',
487 options: ECKeyPairOptions<'pem', 'der'>,
488 ): KeyPairSyncResult<string, Buffer>;
489 function generateKeyPairSync(
490 type: 'ec',
491 options: ECKeyPairOptions<'der', 'pem'>,
492 ): KeyPairSyncResult<Buffer, string>;
493 function generateKeyPairSync(
494 type: 'ec',
495 options: ECKeyPairOptions<'der', 'der'>,
496 ): KeyPairSyncResult<Buffer, Buffer>;
497
498 function generateKeyPair(
499 type: 'rsa',
500 options: RSAKeyPairOptions<'pem', 'pem'>,
501 callback: (err: Error | null, publicKey: string, privateKey: string) => void,
502 ): void;
503 function generateKeyPair(
504 type: 'rsa',
505 options: RSAKeyPairOptions<'pem', 'der'>,
506 callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
507 ): void;
508 function generateKeyPair(
509 type: 'rsa',
510 options: RSAKeyPairOptions<'der', 'pem'>,
511 callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
512 ): void;
513 function generateKeyPair(
514 type: 'rsa',
515 options: RSAKeyPairOptions<'der', 'der'>,
516 callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
517 ): void;
518
519 function generateKeyPair(
520 type: 'dsa',
521 options: DSAKeyPairOptions<'pem', 'pem'>,
522 callback: (err: Error | null, publicKey: string, privateKey: string) => void,
523 ): void;
524 function generateKeyPair(
525 type: 'dsa',
526 options: DSAKeyPairOptions<'pem', 'der'>,
527 callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
528 ): void;
529 function generateKeyPair(
530 type: 'dsa',
531 options: DSAKeyPairOptions<'der', 'pem'>,
532 callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
533 ): void;
534 function generateKeyPair(
535 type: 'dsa',
536 options: DSAKeyPairOptions<'der', 'der'>,
537 callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
538 ): void;
539
540 function generateKeyPair(
541 type: 'ec',
542 options: ECKeyPairOptions<'pem', 'pem'>,
543 callback: (err: Error | null, publicKey: string, privateKey: string) => void,
544 ): void;
545 function generateKeyPair(
546 type: 'ec',
547 options: ECKeyPairOptions<'pem', 'der'>,
548 callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
549 ): void;
550 function generateKeyPair(
551 type: 'ec',
552 options: ECKeyPairOptions<'der', 'pem'>,
553 callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
554 ): void;
555 function generateKeyPair(
556 type: 'ec',
557 options: ECKeyPairOptions<'der', 'der'>,
558 callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
559 ): void;
560
561 namespace generateKeyPair {
562 function __promisify__(
563 type: 'rsa',
564 options: RSAKeyPairOptions<'pem', 'pem'>,
565 ): Promise<{ publicKey: string; privateKey: string }>;
566 function __promisify__(
567 type: 'rsa',
568 options: RSAKeyPairOptions<'pem', 'der'>,
569 ): Promise<{ publicKey: string; privateKey: Buffer }>;
570 function __promisify__(
571 type: 'rsa',
572 options: RSAKeyPairOptions<'der', 'pem'>,
573 ): Promise<{ publicKey: Buffer; privateKey: string }>;
574 function __promisify__(
575 type: 'rsa',
576 options: RSAKeyPairOptions<'der', 'der'>,
577 ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
578
579 function __promisify__(
580 type: 'dsa',
581 options: DSAKeyPairOptions<'pem', 'pem'>,
582 ): Promise<{ publicKey: string; privateKey: string }>;
583 function __promisify__(
584 type: 'dsa',
585 options: DSAKeyPairOptions<'pem', 'der'>,
586 ): Promise<{ publicKey: string; privateKey: Buffer }>;
587 function __promisify__(
588 type: 'dsa',
589 options: DSAKeyPairOptions<'der', 'pem'>,
590 ): Promise<{ publicKey: Buffer; privateKey: string }>;
591 function __promisify__(
592 type: 'dsa',
593 options: DSAKeyPairOptions<'der', 'der'>,
594 ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
595
596 function __promisify__(
597 type: 'ec',
598 options: ECKeyPairOptions<'pem', 'pem'>,
599 ): Promise<{ publicKey: string; privateKey: string }>;
600 function __promisify__(
601 type: 'ec',
602 options: ECKeyPairOptions<'pem', 'der'>,
603 ): Promise<{ publicKey: string; privateKey: Buffer }>;
604 function __promisify__(
605 type: 'ec',
606 options: ECKeyPairOptions<'der', 'pem'>,
607 ): Promise<{ publicKey: Buffer; privateKey: string }>;
608 function __promisify__(
609 type: 'ec',
610 options: ECKeyPairOptions<'der', 'der'>,
611 ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
612 }
613}