@types/node 14.18.19 → 14.18.22

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 v14.18/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v14.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Tue, 31 May 2022 18:31:35 GMT
11
+ * Last updated: Wed, 13 Jul 2022 21:02:30 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node v14.18/crypto.d.ts CHANGED
@@ -406,9 +406,9 @@ declare module 'crypto' {
406
406
  private constructor();
407
407
  generateKeys(): Buffer;
408
408
  generateKeys(encoding: BinaryToTextEncoding): string;
409
- computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
410
- computeSecret(other_public_key: string, input_encoding: BinaryToTextEncoding): Buffer;
411
- computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: BinaryToTextEncoding): string;
409
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
410
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
411
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
412
412
  computeSecret(
413
413
  other_public_key: string,
414
414
  input_encoding: BinaryToTextEncoding,
@@ -428,7 +428,42 @@ declare module 'crypto' {
428
428
  setPrivateKey(private_key: string, encoding: BufferEncoding): void;
429
429
  verifyError: number;
430
430
  }
431
- function getDiffieHellman(group_name: string): DiffieHellman;
431
+ /**
432
+ * The `DiffieHellmanGroup` class takes a well-known modp group as its argument.
433
+ * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation.
434
+ * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods.
435
+ *
436
+ * ```js
437
+ * const { createDiffieHellmanGroup } = await import('node:crypto');
438
+ * const dh = createDiffieHellmanGroup('modp1');
439
+ * ```
440
+ * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt):
441
+ * ```bash
442
+ * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
443
+ * modp1 # 768 bits
444
+ * modp2 # 1024 bits
445
+ * modp5 # 1536 bits
446
+ * modp14 # 2048 bits
447
+ * modp15 # etc.
448
+ * modp16
449
+ * modp17
450
+ * modp18
451
+ * ```
452
+ * @since v0.7.5
453
+ */
454
+ const DiffieHellmanGroup: DiffieHellmanGroupConstructor;
455
+ interface DiffieHellmanGroupConstructor {
456
+ new(name: string): DiffieHellmanGroup;
457
+ (name: string): DiffieHellmanGroup;
458
+ readonly prototype: DiffieHellmanGroup;
459
+ }
460
+ type DiffieHellmanGroup = Omit<DiffieHellman, 'setPublicKey' | 'setPrivateKey'>;
461
+ function getDiffieHellman(groupName: string): DiffieHellmanGroup;
462
+ /**
463
+ * An alias for {@link getDiffieHellman}
464
+ * @since v0.9.3
465
+ */
466
+ function createDiffieHellmanGroup(name: string): DiffieHellmanGroup;
432
467
  function pbkdf2(
433
468
  password: BinaryLike,
434
469
  salt: BinaryLike,
@@ -531,6 +566,12 @@ declare module 'crypto' {
531
566
  function getCiphers(): string[];
532
567
  function getCurves(): string[];
533
568
  function getFips(): 1 | 0;
569
+ /**
570
+ * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. Throws an error if FIPS mode is not available.
571
+ * @since v10.0.0
572
+ * @param bool `true` to enable FIPS mode.
573
+ */
574
+ function setFips(bool: boolean): void;
534
575
  function getHashes(): string[];
535
576
  class ECDH {
536
577
  private constructor();
@@ -1207,6 +1248,35 @@ declare module 'crypto' {
1207
1248
  * 'dh' (for Diffie-Hellman), 'ec' (for ECDH), 'x448', or 'x25519' (for ECDH-ES).
1208
1249
  */
1209
1250
  function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
1251
+ /**
1252
+ * Load and set the `engine` for some or all OpenSSL functions (selected by flags).
1253
+ *
1254
+ * `engine` could be either an id or a path to the engine's shared library.
1255
+ *
1256
+ * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default.
1257
+ * The `flags` is a bit field taking one of or a mix of the following flags (defined in `crypto.constants`):
1258
+ *
1259
+ * - `crypto.constants.ENGINE_METHOD_RSA`
1260
+ * - `crypto.constants.ENGINE_METHOD_DSA`
1261
+ * - `crypto.constants.ENGINE_METHOD_DH`
1262
+ * - `crypto.constants.ENGINE_METHOD_RAND`
1263
+ * - `crypto.constants.ENGINE_METHOD_EC`
1264
+ * - `crypto.constants.ENGINE_METHOD_CIPHERS`
1265
+ * - `crypto.constants.ENGINE_METHOD_DIGESTS`
1266
+ * - `crypto.constants.ENGINE_METHOD_PKEY_METHS`
1267
+ * - `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS`
1268
+ * - `crypto.constants.ENGINE_METHOD_ALL`
1269
+ * - `crypto.constants.ENGINE_METHOD_NONE`
1270
+ *
1271
+ * The flags below are deprecated in OpenSSL-1.1.0.
1272
+ *
1273
+ * - `crypto.constants.ENGINE_METHOD_ECDH`
1274
+ * - `crypto.constants.ENGINE_METHOD_ECDSA`
1275
+ * - `crypto.constants.ENGINE_METHOD_STORE`
1276
+ * @since v0.11.11
1277
+ * @param [flags=crypto.constants.ENGINE_METHOD_ALL]
1278
+ */
1279
+ function setEngine(engine: string, flags?: number): void;
1210
1280
  }
1211
1281
  declare module 'node:crypto' {
1212
1282
  export * from 'crypto';
@@ -184,10 +184,11 @@ declare module 'fs/promises' {
184
184
  /**
185
185
  * Asynchronous open(2) - open and possibly create a file.
186
186
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
187
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not
187
+ * @param [flags='r'] See `support of file system `flags``.
188
+ * @param [mode] A file mode. If a string is passed, it is parsed as an octal integer. If not
188
189
  * supplied, defaults to `0o666`.
189
190
  */
190
- function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
191
+ function open(path: PathLike, flags?: string | number, mode?: string | number): Promise<FileHandle>;
191
192
 
192
193
  /**
193
194
  * Asynchronously reads data from the file referenced by the supplied `FileHandle`.
node v14.18/fs.d.ts CHANGED
@@ -1264,15 +1264,23 @@ declare module 'fs' {
1264
1264
  /**
1265
1265
  * Asynchronous open(2) - open and possibly create a file.
1266
1266
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1267
- * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
1267
+ * @param [flags='r'] See `support of file system `flags``.
1268
+ * @param [mode=0o666]
1269
+ */
1270
+ export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1271
+
1272
+ /**
1273
+ * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
1274
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1275
+ * @param [flags='r'] See `support of file system `flags``.
1268
1276
  */
1269
- export function open(path: PathLike, flags: OpenMode, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1277
+ export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1270
1278
 
1271
1279
  /**
1272
1280
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
1273
1281
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
1274
1282
  */
1275
- export function open(path: PathLike, flags: OpenMode, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1283
+ export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
1276
1284
 
1277
1285
  // NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
1278
1286
  export namespace open {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "14.18.19",
3
+ "version": "14.18.22",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  },
221
221
  "scripts": {},
222
222
  "dependencies": {},
223
- "typesPublisherContentHash": "f2a83d62b186cf7b4c1451fd034aa3558ae44d1cb44a4d9ec60d24be97b69d17",
224
- "typeScriptVersion": "3.9"
223
+ "typesPublisherContentHash": "b495f890b1a6f312d85381156410dad61b7c727726953839266da2804b5b1f4d",
224
+ "typeScriptVersion": "4.0"
225
225
  }
node v14.18/tls.d.ts CHANGED
@@ -147,7 +147,7 @@ declare module 'tls' {
147
147
  * Static boolean value, always true.
148
148
  * May be used to distinguish TLS sockets from regular ones.
149
149
  */
150
- encrypted: boolean;
150
+ encrypted: true;
151
151
 
152
152
  /**
153
153
  * String containing the selected ALPN protocol.