@types/node 14.18.21 → 14.18.24

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, 07 Jun 2022 19:01:36 GMT
11
+ * Last updated: Mon, 15 Aug 2022 18:32:43 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';
@@ -1,21 +1,22 @@
1
1
  declare module 'fs/promises' {
2
2
  import {
3
- Stats,
3
+ BaseEncodingOptions,
4
4
  BigIntStats,
5
- StatOptions,
6
- WriteVResult,
7
- ReadVResult,
8
- PathLike,
9
- RmDirOptions,
10
- RmOptions,
11
- MakeDirectoryOptions,
5
+ BufferEncodingOption,
6
+ constants as fsConstants,
7
+ Dir,
12
8
  Dirent,
9
+ MakeDirectoryOptions,
10
+ Mode,
13
11
  OpenDirOptions,
14
- Dir,
15
- BaseEncodingOptions,
16
- BufferEncodingOption,
17
12
  OpenMode,
18
- Mode,
13
+ PathLike,
14
+ ReadVResult,
15
+ RmDirOptions,
16
+ RmOptions,
17
+ StatOptions,
18
+ Stats,
19
+ WriteVResult,
19
20
  } from 'fs';
20
21
 
21
22
  interface FileHandle {
@@ -161,6 +162,8 @@ declare module 'fs/promises' {
161
162
  close(): Promise<void>;
162
163
  }
163
164
 
165
+ const constants: typeof fsConstants;
166
+
164
167
  /**
165
168
  * Asynchronously tests a user's permissions for the file specified by path.
166
169
  * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "14.18.21",
3
+ "version": "14.18.24",
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": "0e120850d2efd3c212686946890a557c78b49f575a98e7575b49a55b2ddd9e90",
224
- "typeScriptVersion": "3.9"
223
+ "typesPublisherContentHash": "0d6282534ea851ab2bd3427dd6705c2353d9f3e55173f87ab76179d3deb892e9",
224
+ "typeScriptVersion": "4.0"
225
225
  }
node v14.18/path.d.ts CHANGED
@@ -54,18 +54,19 @@ declare module 'path' {
54
54
  * Normalize a string path, reducing '..' and '.' parts.
55
55
  * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
56
56
  *
57
- * @param p string path to normalize.
57
+ * @param path string path to normalize.
58
+ * @throws {TypeError} if `path` is not a string.
58
59
  */
59
- normalize(p: string): string;
60
+ normalize(path: string): string;
60
61
  /**
61
62
  * Join all arguments together and normalize the resulting path.
62
- * Arguments must be strings. In v0.8, non-string arguments were silently ignored. In v0.10 and up, an exception is thrown.
63
63
  *
64
64
  * @param paths paths to join.
65
+ * @throws {TypeError} if any of the path segments is not a string.
65
66
  */
66
67
  join(...paths: string[]): string;
67
68
  /**
68
- * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
69
+ * The right-most parameter is considered {to}. Other parameters are considered an array of {from}.
69
70
  *
70
71
  * Starting from leftmost {from} parameter, resolves {to} to an absolute path.
71
72
  *
@@ -74,41 +75,50 @@ declare module 'path' {
74
75
  * the current working directory is used as well. The resulting path is normalized,
75
76
  * and trailing slashes are removed unless the path gets resolved to the root directory.
76
77
  *
77
- * @param pathSegments string paths to join. Non-string arguments are ignored.
78
+ * @param paths A sequence of paths or path segments.
79
+ * @throws {TypeError} if any of the arguments is not a string.
78
80
  */
79
- resolve(...pathSegments: string[]): string;
81
+ resolve(...paths: string[]): string;
80
82
  /**
81
83
  * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.
82
84
  *
85
+ * If the given {path} is a zero-length string, `false` will be returned.
86
+ *
83
87
  * @param path path to test.
88
+ * @throws {TypeError} if `path` is not a string.
84
89
  */
85
- isAbsolute(p: string): boolean;
90
+ isAbsolute(path: string): boolean;
86
91
  /**
87
- * Solve the relative path from {from} to {to}.
92
+ * Solve the relative path from {from} to {to} based on the current working directory.
88
93
  * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.
94
+ *
95
+ * @throws {TypeError} if either `from` or `to` is not a string.
89
96
  */
90
97
  relative(from: string, to: string): string;
91
98
  /**
92
99
  * Return the directory name of a path. Similar to the Unix dirname command.
93
100
  *
94
- * @param p the path to evaluate.
101
+ * @param path the path to evaluate.
102
+ * @throws {TypeError} if `path` is not a string.
95
103
  */
96
- dirname(p: string): string;
104
+ dirname(path: string): string;
97
105
  /**
98
106
  * Return the last portion of a path. Similar to the Unix basename command.
99
107
  * Often used to extract the file name from a fully qualified path.
100
108
  *
101
- * @param p the path to evaluate.
109
+ * @param path the path to evaluate.
102
110
  * @param ext optionally, an extension to remove from the result.
111
+ * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string.
103
112
  */
104
- basename(p: string, ext?: string): string;
113
+ basename(path: string, ext?: string): string;
105
114
  /**
106
115
  * Return the extension of the path, from the last '.' to end of string in the last portion of the path.
107
- * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string
116
+ * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.
108
117
  *
109
- * @param p the path to evaluate.
118
+ * @param path the path to evaluate.
119
+ * @throws {TypeError} if `path` is not a string.
110
120
  */
111
- extname(p: string): string;
121
+ extname(path: string): string;
112
122
  /**
113
123
  * The platform-specific file separator. '\\' or '/'.
114
124
  */
@@ -120,15 +130,16 @@ declare module 'path' {
120
130
  /**
121
131
  * Returns an object from a path string - the opposite of format().
122
132
  *
123
- * @param pathString path to evaluate.
133
+ * @param path path to evaluate.
134
+ * @throws {TypeError} if `path` is not a string.
124
135
  */
125
- parse(p: string): ParsedPath;
136
+ parse(path: string): ParsedPath;
126
137
  /**
127
138
  * Returns a path string from an object - the opposite of parse().
128
139
  *
129
- * @param pathString path to evaluate.
140
+ * @param pathObject path to evaluate.
130
141
  */
131
- format(pP: FormatInputPathObject): string;
142
+ format(pathObject: FormatInputPathObject): string;
132
143
  /**
133
144
  * On Windows systems only, returns an equivalent namespace-prefixed path for the given path.
134
145
  * If path is not a string, path will be returned without modifications.