@types/node 16.0.0 → 16.3.0

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/crypto.d.ts CHANGED
@@ -154,7 +154,7 @@ declare module 'crypto' {
154
154
  * For XOF hash functions such as `shake256`, the
155
155
  * outputLength option can be used to specify the desired output length in bytes.
156
156
  */
157
- outputLength?: number;
157
+ outputLength?: number | undefined;
158
158
  }
159
159
 
160
160
  /** @deprecated since v10.0.0 */
@@ -193,26 +193,26 @@ declare module 'crypto' {
193
193
  interface KeyExportOptions<T extends KeyFormat> {
194
194
  type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
195
195
  format: T;
196
- cipher?: string;
197
- passphrase?: string | Buffer;
196
+ cipher?: string | undefined;
197
+ passphrase?: string | Buffer | undefined;
198
198
  }
199
199
  interface JwkKeyExportOptions {
200
200
  format: 'jwk';
201
201
  }
202
202
  interface JsonWebKey {
203
- crv?: string;
204
- d?: string;
205
- dp?: string;
206
- dq?: string;
207
- e?: string;
208
- k?: string;
209
- kty?: string;
210
- n?: string;
211
- p?: string;
212
- q?: string;
213
- qi?: string;
214
- x?: string;
215
- y?: string;
203
+ crv?: string | undefined;
204
+ d?: string | undefined;
205
+ dp?: string | undefined;
206
+ dq?: string | undefined;
207
+ e?: string | undefined;
208
+ k?: string | undefined;
209
+ kty?: string | undefined;
210
+ n?: string | undefined;
211
+ p?: string | undefined;
212
+ q?: string | undefined;
213
+ qi?: string | undefined;
214
+ x?: string | undefined;
215
+ y?: string | undefined;
216
216
  [key: string]: unknown;
217
217
  }
218
218
 
@@ -220,19 +220,19 @@ declare module 'crypto' {
220
220
  /**
221
221
  * Key size in bits (RSA, DSA).
222
222
  */
223
- modulusLength?: number;
223
+ modulusLength?: number | undefined;
224
224
  /**
225
225
  * Public exponent (RSA).
226
226
  */
227
- publicExponent?: bigint;
227
+ publicExponent?: bigint | undefined;
228
228
  /**
229
229
  * Size of q in bits (DSA).
230
230
  */
231
- divisorLength?: number;
231
+ divisorLength?: number | undefined;
232
232
  /**
233
233
  * Name of the curve (EC).
234
234
  */
235
- namedCurve?: string;
235
+ namedCurve?: string | undefined;
236
236
  }
237
237
 
238
238
  interface JwkKeyExportOptions {
@@ -241,23 +241,23 @@ declare module 'crypto' {
241
241
 
242
242
  class KeyObject {
243
243
  private constructor();
244
- asymmetricKeyType?: KeyType;
244
+ asymmetricKeyType?: KeyType | undefined;
245
245
  /**
246
246
  * For asymmetric keys, this property represents the size of the embedded key in
247
247
  * bytes. This property is `undefined` for symmetric keys.
248
248
  */
249
- asymmetricKeySize?: number;
249
+ asymmetricKeySize?: number | undefined;
250
250
  /**
251
251
  * This property exists only on asymmetric keys. Depending on the type of the key,
252
252
  * this object contains information about the key. None of the information obtained
253
253
  * through this property can be used to uniquely identify a key or to compromise the
254
254
  * security of the key.
255
255
  */
256
- asymmetricKeyDetails?: AsymmetricKeyDetails;
256
+ asymmetricKeyDetails?: AsymmetricKeyDetails | undefined;
257
257
  export(options: KeyExportOptions<'pem'>): string | Buffer;
258
258
  export(options?: KeyExportOptions<'der'>): Buffer;
259
259
  export(options?: JwkKeyExportOptions): JsonWebKey;
260
- symmetricKeySize?: number;
260
+ symmetricKeySize?: number | undefined;
261
261
  type: KeyObjectType;
262
262
  }
263
263
 
@@ -272,7 +272,7 @@ declare module 'crypto' {
272
272
  authTagLength: number;
273
273
  }
274
274
  interface CipherGCMOptions extends stream.TransformOptions {
275
- authTagLength?: number;
275
+ authTagLength?: number | undefined;
276
276
  }
277
277
  /** @deprecated since v10.0.0 use `createCipheriv()` */
278
278
  function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM;
@@ -369,15 +369,15 @@ declare module 'crypto' {
369
369
 
370
370
  interface PrivateKeyInput {
371
371
  key: string | Buffer;
372
- format?: KeyFormat;
373
- type?: 'pkcs1' | 'pkcs8' | 'sec1';
374
- passphrase?: string | Buffer;
372
+ format?: KeyFormat | undefined;
373
+ type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
374
+ passphrase?: string | Buffer | undefined;
375
375
  }
376
376
 
377
377
  interface PublicKeyInput {
378
378
  key: string | Buffer;
379
- format?: KeyFormat;
380
- type?: 'pkcs1' | 'spki';
379
+ format?: KeyFormat | undefined;
380
+ type?: 'pkcs1' | 'spki' | undefined;
381
381
  }
382
382
 
383
383
  function generateKey(type: 'hmac' | 'aes', options: {length: number}, callback: (err: Error | null, key: KeyObject) => void): void;
@@ -391,7 +391,7 @@ declare module 'crypto' {
391
391
  function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject;
392
392
  function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
393
393
 
394
- function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
394
+ function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
395
395
 
396
396
  type DSAEncoding = 'der' | 'ieee-p1363';
397
397
 
@@ -399,9 +399,9 @@ declare module 'crypto' {
399
399
  /**
400
400
  * @See crypto.constants.RSA_PKCS1_PADDING
401
401
  */
402
- padding?: number;
403
- saltLength?: number;
404
- dsaEncoding?: DSAEncoding;
402
+ padding?: number | undefined;
403
+ saltLength?: number | undefined;
404
+ dsaEncoding?: DSAEncoding | undefined;
405
405
  }
406
406
 
407
407
  interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions { }
@@ -415,11 +415,11 @@ declare module 'crypto' {
415
415
 
416
416
  type KeyLike = string | Buffer | KeyObject;
417
417
 
418
- class Signer extends stream.Writable {
418
+ class Sign extends stream.Writable {
419
419
  private constructor();
420
420
 
421
- update(data: BinaryLike): Signer;
422
- update(data: string, input_encoding: Encoding): Signer;
421
+ update(data: BinaryLike): this;
422
+ update(data: string, input_encoding: Encoding): this;
423
423
  sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
424
424
  sign(
425
425
  private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
@@ -530,13 +530,13 @@ declare module 'crypto' {
530
530
  ): void;
531
531
 
532
532
  interface ScryptOptions {
533
- cost?: number;
534
- blockSize?: number;
535
- parallelization?: number;
536
- N?: number;
537
- r?: number;
538
- p?: number;
539
- maxmem?: number;
533
+ cost?: number | undefined;
534
+ blockSize?: number | undefined;
535
+ parallelization?: number | undefined;
536
+ N?: number | undefined;
537
+ r?: number | undefined;
538
+ p?: number | undefined;
539
+ maxmem?: number | undefined;
540
540
  }
541
541
  function scrypt(
542
542
  password: BinaryLike,
@@ -555,17 +555,17 @@ declare module 'crypto' {
555
555
 
556
556
  interface RsaPublicKey {
557
557
  key: KeyLike;
558
- padding?: number;
558
+ padding?: number | undefined;
559
559
  }
560
560
  interface RsaPrivateKey {
561
561
  key: KeyLike;
562
- passphrase?: string;
562
+ passphrase?: string | undefined;
563
563
  /**
564
564
  * @default 'sha1'
565
565
  */
566
- oaepHash?: string;
567
- oaepLabel?: NodeJS.TypedArray;
568
- padding?: number;
566
+ oaepHash?: string | undefined;
567
+ oaepLabel?: NodeJS.TypedArray | undefined;
568
+ padding?: number | undefined;
569
569
  }
570
570
  function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
571
571
  function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
@@ -611,8 +611,8 @@ declare module 'crypto' {
611
611
 
612
612
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
613
613
  format: T;
614
- cipher?: string;
615
- passphrase?: string;
614
+ cipher?: string | undefined;
615
+ passphrase?: string | undefined;
616
616
  }
617
617
 
618
618
  interface KeyPairKeyObjectResult {
@@ -660,7 +660,7 @@ declare module 'crypto' {
660
660
  /**
661
661
  * @default 0x10001
662
662
  */
663
- publicExponent?: number;
663
+ publicExponent?: number | undefined;
664
664
  }
665
665
 
666
666
  interface DSAKeyPairKeyObjectOptions {
@@ -683,7 +683,7 @@ declare module 'crypto' {
683
683
  /**
684
684
  * @default 0x10001
685
685
  */
686
- publicExponent?: number;
686
+ publicExponent?: number | undefined;
687
687
 
688
688
  publicKeyEncoding: {
689
689
  type: 'pkcs1' | 'spki';
@@ -1270,11 +1270,11 @@ declare module 'crypto' {
1270
1270
  /**
1271
1271
  * A test key length.
1272
1272
  */
1273
- keyLength?: number;
1273
+ keyLength?: number | undefined;
1274
1274
  /**
1275
1275
  * A test IV length.
1276
1276
  */
1277
- ivLength?: number;
1277
+ ivLength?: number | undefined;
1278
1278
  }
1279
1279
 
1280
1280
  interface CipherInfo {
@@ -1290,12 +1290,12 @@ declare module 'crypto' {
1290
1290
  * The block size of the cipher in bytes.
1291
1291
  * This property is omitted when mode is 'stream'.
1292
1292
  */
1293
- blockSize?: number;
1293
+ blockSize?: number | undefined;
1294
1294
  /**
1295
1295
  * The expected or default initialization vector length in bytes.
1296
1296
  * This property is omitted if the cipher does not use an initialization vector.
1297
1297
  */
1298
- ivLength?: number;
1298
+ ivLength?: number | undefined;
1299
1299
  /**
1300
1300
  * The expected or default key length in bytes.
1301
1301
  */
@@ -1363,8 +1363,6 @@ declare module 'crypto' {
1363
1363
 
1364
1364
  function secureHeapUsed(): SecureHeapUsage;
1365
1365
 
1366
- // TODO: X509Certificate
1367
-
1368
1366
  interface RandomUUIDOptions {
1369
1367
  /**
1370
1368
  * By default, to improve performance,
@@ -1374,7 +1372,7 @@ declare module 'crypto' {
1374
1372
  *
1375
1373
  * @default `false`
1376
1374
  */
1377
- disableEntropyCache?: boolean;
1375
+ disableEntropyCache?: boolean | undefined;
1378
1376
  }
1379
1377
 
1380
1378
  function randomUUID(options?: RandomUUIDOptions): string;
@@ -1450,7 +1448,7 @@ declare module 'crypto' {
1450
1448
  /**
1451
1449
  * The issuer certificate or `undefined` if the issuer certificate is not available.
1452
1450
  */
1453
- readonly issuerCertificate?: X509Certificate;
1451
+ readonly issuerCertificate?: X509Certificate | undefined;
1454
1452
 
1455
1453
  /**
1456
1454
  * The public key for this certificate.
@@ -1537,13 +1535,13 @@ declare module 'crypto' {
1537
1535
  type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint;
1538
1536
 
1539
1537
  interface GeneratePrimeOptions {
1540
- add?: LargeNumberLike;
1541
- rem?: LargeNumberLike;
1538
+ add?: LargeNumberLike | undefined;
1539
+ rem?: LargeNumberLike | undefined;
1542
1540
  /**
1543
1541
  * @default false
1544
1542
  */
1545
- safe?: boolean;
1546
- bigint?: boolean;
1543
+ safe?: boolean | undefined;
1544
+ bigint?: boolean | undefined;
1547
1545
  }
1548
1546
 
1549
1547
  interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions {
@@ -1551,7 +1549,7 @@ declare module 'crypto' {
1551
1549
  }
1552
1550
 
1553
1551
  interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions {
1554
- bigint?: false;
1552
+ bigint?: false | undefined;
1555
1553
  }
1556
1554
 
1557
1555
  function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
@@ -1573,7 +1571,7 @@ declare module 'crypto' {
1573
1571
  *
1574
1572
  * @default 0
1575
1573
  */
1576
- checks?: number;
1574
+ checks?: number | undefined;
1577
1575
  }
1578
1576
 
1579
1577
  /**
@@ -1586,6 +1584,10 @@ declare module 'crypto' {
1586
1584
  * Checks the primality of the candidate.
1587
1585
  */
1588
1586
  function checkPrimeSync(value: LargeNumberLike, options?: CheckPrimeOptions): boolean;
1587
+
1588
+ namespace webcrypto {
1589
+ class CryptoKey {} // placeholder
1590
+ }
1589
1591
  }
1590
1592
 
1591
1593
  declare module 'node:crypto' {
node/dgram.d.ts CHANGED
@@ -11,24 +11,24 @@ declare module 'dgram' {
11
11
  }
12
12
 
13
13
  interface BindOptions {
14
- port?: number;
15
- address?: string;
16
- exclusive?: boolean;
17
- fd?: number;
14
+ port?: number | undefined;
15
+ address?: string | undefined;
16
+ exclusive?: boolean | undefined;
17
+ fd?: number | undefined;
18
18
  }
19
19
 
20
20
  type SocketType = "udp4" | "udp6";
21
21
 
22
22
  interface SocketOptions extends Abortable {
23
23
  type: SocketType;
24
- reuseAddr?: boolean;
24
+ reuseAddr?: boolean | undefined;
25
25
  /**
26
26
  * @default false
27
27
  */
28
- ipv6Only?: boolean;
29
- recvBufferSize?: number;
30
- sendBufferSize?: number;
31
- lookup?: (hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void;
28
+ ipv6Only?: boolean | undefined;
29
+ recvBufferSize?: number | undefined;
30
+ sendBufferSize?: number | undefined;
31
+ lookup?: ((hostname: string, options: dns.LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void) => void) | undefined;
32
32
  }
33
33
 
34
34
  function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
node/dns.d.ts CHANGED
@@ -11,14 +11,14 @@ declare module 'dns' {
11
11
  export const ALL: number;
12
12
 
13
13
  export interface LookupOptions {
14
- family?: number;
15
- hints?: number;
16
- all?: boolean;
17
- verbatim?: boolean;
14
+ family?: number | undefined;
15
+ hints?: number | undefined;
16
+ all?: boolean | undefined;
17
+ verbatim?: boolean | undefined;
18
18
  }
19
19
 
20
20
  export interface LookupOneOptions extends LookupOptions {
21
- all?: false;
21
+ all?: false | undefined;
22
22
  }
23
23
 
24
24
  export interface LookupAllOptions extends LookupOptions {
@@ -75,11 +75,11 @@ declare module 'dns' {
75
75
 
76
76
  export interface CaaRecord {
77
77
  critial: number;
78
- issue?: string;
79
- issuewild?: string;
80
- iodef?: string;
81
- contactemail?: string;
82
- contactphone?: string;
78
+ issue?: string | undefined;
79
+ issuewild?: string | undefined;
80
+ iodef?: string | undefined;
81
+ contactemail?: string | undefined;
82
+ contactphone?: string | undefined;
83
83
  }
84
84
 
85
85
  export interface MxRecord {
@@ -293,7 +293,7 @@ declare module 'dns' {
293
293
  export const CANCELLED: string;
294
294
 
295
295
  export interface ResolverOptions {
296
- timeout?: number;
296
+ timeout?: number | undefined;
297
297
  }
298
298
 
299
299
  export class Resolver {
node/events.d.ts CHANGED
@@ -3,7 +3,7 @@ declare module 'events' {
3
3
  /**
4
4
  * Enables automatic capturing of promise rejection.
5
5
  */
6
- captureRejections?: boolean;
6
+ captureRejections?: boolean | undefined;
7
7
  }
8
8
 
9
9
  interface NodeEventTarget {
@@ -15,7 +15,7 @@ declare module 'events' {
15
15
  }
16
16
 
17
17
  interface StaticEventEmitterOptions {
18
- signal?: AbortSignal;
18
+ signal?: AbortSignal | undefined;
19
19
  }
20
20
 
21
21
  interface EventEmitter extends NodeJS.EventEmitter {}
@@ -62,7 +62,7 @@ declare module 'events' {
62
62
  /**
63
63
  * When provided the corresponding `AbortController` can be used to cancel an asynchronous action.
64
64
  */
65
- signal?: AbortSignal;
65
+ signal?: AbortSignal | undefined;
66
66
  }
67
67
  }
68
68