@types/node 24.13.6 → 24.19.1

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.
Files changed (75) hide show
  1. {node v24.13 → node v24.19}/README.md +1 -1
  2. {node v24.13 → node v24.19}/async_hooks.d.ts +18 -22
  3. {node v24.13 → node v24.19}/buffer.buffer.d.ts +10 -5
  4. {node v24.13 → node v24.19}/buffer.d.ts +7 -0
  5. {node v24.13 → node v24.19}/child_process.d.ts +5 -1
  6. {node v24.13 → node v24.19}/crypto.d.ts +114 -47
  7. {node v24.13 → node v24.19}/dgram.d.ts +119 -4
  8. {node v24.13 → node v24.19}/dns/promises.d.ts +5 -5
  9. {node v24.13 → node v24.19}/dns.d.ts +6 -6
  10. {node v24.13 → node v24.19}/events.d.ts +13 -22
  11. {node v24.13 → node v24.19}/fs/promises.d.ts +79 -66
  12. {node v24.13 → node v24.19}/fs.d.ts +153 -90
  13. {node v24.13 → node v24.19}/http.d.ts +94 -2
  14. {node v24.13 → node v24.19}/http2.d.ts +65 -18
  15. {node v24.13 → node v24.19}/inspector.d.ts +47 -1
  16. {node v24.13 → node v24.19}/inspector.generated.d.ts +167 -0
  17. {node v24.13 → node v24.19}/module.d.ts +1 -0
  18. {node v24.13 → node v24.19}/net.d.ts +139 -15
  19. {node v24.13 → node v24.19}/os.d.ts +30 -30
  20. {node v24.13 → node v24.19}/package.json +3 -3
  21. {node v24.13 → node v24.19}/perf_hooks.d.ts +31 -19
  22. {node v24.13 → node v24.19}/process.d.ts +42 -43
  23. {node v24.13 → node v24.19}/sqlite.d.ts +153 -11
  24. {node v24.13 → node v24.19}/stream/consumers.d.ts +7 -0
  25. {node v24.13 → node v24.19}/stream/web.d.ts +19 -0
  26. {node v24.13 → node v24.19}/stream.d.ts +2 -1
  27. {node v24.13 → node v24.19}/test.d.ts +320 -13
  28. {node v24.13 → node v24.19}/tls.d.ts +50 -15
  29. {node v24.13 → node v24.19}/ts5.6/buffer.buffer.d.ts +5 -0
  30. {node v24.13 → node v24.19}/tty.d.ts +4 -3
  31. {node v24.13 → node v24.19}/url.d.ts +27 -3
  32. {node v24.13 → node v24.19}/util.d.ts +42 -2
  33. {node v24.13 → node v24.19}/v8.d.ts +51 -23
  34. {node v24.13 → node v24.19}/vm.d.ts +52 -87
  35. {node v24.13 → node v24.19}/zlib.d.ts +23 -0
  36. {node v24.13 → node v24.19}/LICENSE +0 -0
  37. {node v24.13 → node v24.19}/assert/strict.d.ts +0 -0
  38. {node v24.13 → node v24.19}/assert.d.ts +0 -0
  39. {node v24.13 → node v24.19}/cluster.d.ts +0 -0
  40. {node v24.13 → node v24.19}/compatibility/iterators.d.ts +0 -0
  41. {node v24.13 → node v24.19}/console.d.ts +0 -0
  42. {node v24.13 → node v24.19}/constants.d.ts +0 -0
  43. {node v24.13 → node v24.19}/diagnostics_channel.d.ts +0 -0
  44. {node v24.13 → node v24.19}/domain.d.ts +0 -0
  45. {node v24.13 → node v24.19}/globals.d.ts +0 -0
  46. {node v24.13 → node v24.19}/globals.typedarray.d.ts +0 -0
  47. {node v24.13 → node v24.19}/https.d.ts +0 -0
  48. {node v24.13 → node v24.19}/index.d.ts +0 -0
  49. {node v24.13 → node v24.19}/path.d.ts +0 -0
  50. {node v24.13 → node v24.19}/punycode.d.ts +0 -0
  51. {node v24.13 → node v24.19}/querystring.d.ts +0 -0
  52. {node v24.13 → node v24.19}/readline/promises.d.ts +0 -0
  53. {node v24.13 → node v24.19}/readline.d.ts +0 -0
  54. {node v24.13 → node v24.19}/repl.d.ts +0 -0
  55. {node v24.13 → node v24.19}/sea.d.ts +0 -0
  56. {node v24.13 → node v24.19}/stream/promises.d.ts +0 -0
  57. {node v24.13 → node v24.19}/string_decoder.d.ts +0 -0
  58. {node v24.13 → node v24.19}/timers/promises.d.ts +0 -0
  59. {node v24.13 → node v24.19}/timers.d.ts +0 -0
  60. {node v24.13 → node v24.19}/trace_events.d.ts +0 -0
  61. {node v24.13 → node v24.19}/ts5.6/compatibility/float16array.d.ts +0 -0
  62. {node v24.13 → node v24.19}/ts5.6/globals.typedarray.d.ts +0 -0
  63. {node v24.13 → node v24.19}/ts5.6/index.d.ts +0 -0
  64. {node v24.13 → node v24.19}/ts5.7/compatibility/float16array.d.ts +0 -0
  65. {node v24.13 → node v24.19}/ts5.7/index.d.ts +0 -0
  66. {node v24.13 → node v24.19}/wasi.d.ts +0 -0
  67. {node v24.13 → node v24.19}/web-globals/abortcontroller.d.ts +0 -0
  68. {node v24.13 → node v24.19}/web-globals/crypto.d.ts +0 -0
  69. {node v24.13 → node v24.19}/web-globals/domexception.d.ts +0 -0
  70. {node v24.13 → node v24.19}/web-globals/events.d.ts +0 -0
  71. {node v24.13 → node v24.19}/web-globals/fetch.d.ts +0 -0
  72. {node v24.13 → node v24.19}/web-globals/navigator.d.ts +0 -0
  73. {node v24.13 → node v24.19}/web-globals/storage.d.ts +0 -0
  74. {node v24.13 → node v24.19}/web-globals/streams.d.ts +0 -0
  75. {node v24.13 → node v24.19}/worker_threads.d.ts +0 -0
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v24.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 19 Sep 2026 00:09:37 GMT
11
+ * Last updated: Thu, 01 Oct 2026 22:35:12 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -123,37 +123,31 @@ declare module "async_hooks" {
123
123
  function triggerAsyncId(): number;
124
124
  interface HookCallbacks {
125
125
  /**
126
- * Called when a class is constructed that has the possibility to emit an asynchronous event.
127
- * @param asyncId A unique ID for the async resource
128
- * @param type The type of the async resource
129
- * @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
130
- * @param resource Reference to the resource representing the async operation, needs to be released during destroy
126
+ * The [`init` callback](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#initasyncid-type-triggerasyncid-resource).
131
127
  */
132
128
  init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
133
129
  /**
134
- * When an asynchronous operation is initiated or completes a callback is called to notify the user.
135
- * The before callback is called just before said callback is executed.
136
- * @param asyncId the unique identifier assigned to the resource about to execute the callback.
130
+ * The [`before` callback](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#beforeasyncid).
137
131
  */
138
132
  before?(asyncId: number): void;
139
133
  /**
140
- * Called immediately after the callback specified in `before` is completed.
141
- *
142
- * If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
143
- * @param asyncId the unique identifier assigned to the resource which has executed the callback.
134
+ * The [`after` callback](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#afterasyncid).
144
135
  */
145
136
  after?(asyncId: number): void;
146
137
  /**
147
- * Called when a promise has resolve() called. This may not be in the same execution id
148
- * as the promise itself.
149
- * @param asyncId the unique id for the promise that was resolve()d.
138
+ * The [`promiseResolve` callback](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#promiseresolveasyncid).
150
139
  */
151
140
  promiseResolve?(asyncId: number): void;
152
141
  /**
153
- * Called after the resource corresponding to asyncId is destroyed
154
- * @param asyncId a unique ID for the async resource
142
+ * The [`destroy` callback](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#destroyasyncid).
155
143
  */
156
144
  destroy?(asyncId: number): void;
145
+ /**
146
+ * Whether the hook should track `Promise`s. Cannot be `false` if
147
+ * `promiseResolve` is set.
148
+ * @default true
149
+ */
150
+ trackPromises?: boolean | undefined;
157
151
  }
158
152
  interface AsyncHook {
159
153
  /**
@@ -174,7 +168,8 @@ declare module "async_hooks" {
174
168
  *
175
169
  * All callbacks are optional. For example, if only resource cleanup needs to
176
170
  * be tracked, then only the `destroy` callback needs to be passed. The
177
- * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
171
+ * specifics of all functions that can be passed to `callbacks` is in the
172
+ * [Hook Callbacks](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#hook-callbacks) section.
178
173
  *
179
174
  * ```js
180
175
  * import { createHook } from 'node:async_hooks';
@@ -202,12 +197,13 @@ declare module "async_hooks" {
202
197
  * ```
203
198
  *
204
199
  * Because promises are asynchronous resources whose lifecycle is tracked
205
- * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises.
200
+ * via the async hooks mechanism, the `init()`, `before()`, `after()`, and
201
+ * `destroy()` callbacks _must not_ be async functions that return promises.
206
202
  * @since v8.1.0
207
- * @param callbacks The `Hook Callbacks` to register
208
- * @return Instance used for disabling and enabling hooks
203
+ * @param options The [Hook Callbacks](https://nodejs.org/docs/latest-v24.x/api/async_hooks.html#hook-callbacks) to register
204
+ * @returns Instance used for disabling and enabling hooks
209
205
  */
210
- function createHook(callbacks: HookCallbacks): AsyncHook;
206
+ function createHook(options: HookCallbacks): AsyncHook;
211
207
  interface AsyncResourceOptions {
212
208
  /**
213
209
  * The ID of the execution context that created this async event.
@@ -316,11 +316,11 @@ declare module "buffer" {
316
316
  * such `Buffer` instances with zeroes.
317
317
  *
318
318
  * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
319
- * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
320
- * allows applications to avoid the garbage collection overhead of creating many
321
- * individually allocated `Buffer` instances. This approach improves both
322
- * performance and memory usage by eliminating the need to track and clean up as
323
- * many individual `ArrayBuffer` objects.
319
+ * allocations less than `Buffer.poolSize >>> 1` (32KiB when default poolSize is used) are sliced
320
+ * from a single pre-allocated `Buffer`. This allows applications to avoid the
321
+ * garbage collection overhead of creating many individually allocated `Buffer`
322
+ * instances. This approach improves both performance and memory usage by
323
+ * eliminating the need to track and clean up as many individual `ArrayBuffer` objects.
324
324
  *
325
325
  * However, in the case where a developer may need to retain a small chunk of
326
326
  * memory from a pool for an indeterminate amount of time, it may be appropriate
@@ -469,4 +469,9 @@ declare module "buffer" {
469
469
  new(size: number): Buffer<ArrayBuffer>;
470
470
  prototype: Buffer;
471
471
  };
472
+ /**
473
+ * @deprecated This is intended for internal use, and will be removed once `@types/node` no longer supports
474
+ * TypeScript versions earlier than 5.7.
475
+ */
476
+ type BufferView<T extends NodeJS.ArrayBufferView> = T extends NodeJS.ArrayBufferView<infer B> ? Buffer<B> : never;
472
477
  }
@@ -204,6 +204,13 @@ declare module "buffer" {
204
204
  * @since v16.7.0
205
205
  */
206
206
  stream(): WebReadableStream;
207
+ /**
208
+ * Returns a new `ReadableStream` that allows the content of the `Blob` to be read
209
+ * as a stream of UTF-8 decoded strings. It is equivalent to piping
210
+ * `blob.stream()` through a `TextDecoderStream` set up with UTF-8.
211
+ * @since v24.19.0
212
+ */
213
+ textStream(): WebReadableStream<string>;
207
214
  }
208
215
  export interface FileOptions {
209
216
  /**
@@ -220,6 +220,11 @@ declare module "child_process" {
220
220
  /**
221
221
  * The `subprocess.exitCode` property indicates the exit code of the child process.
222
222
  * If the child process is still running, the field will be `null`.
223
+ *
224
+ * When the child process is terminated by a signal, `subprocess.exitCode` will be
225
+ * `null` and `subprocess.signalCode` will be set. To get the corresponding
226
+ * POSIX exit code, use
227
+ * `util.convertProcessSignalToExitCode(subprocess.signalCode)`.
223
228
  */
224
229
  readonly exitCode: number | null;
225
230
  /**
@@ -281,7 +286,6 @@ declare module "child_process" {
281
286
  * new process in a shell or with the use of the `shell` option of `ChildProcess`:
282
287
  *
283
288
  * ```js
284
- * 'use strict';
285
289
  * import { spawn } from 'node:child_process';
286
290
  *
287
291
  * const subprocess = spawn(
@@ -615,30 +615,24 @@ declare module "crypto" {
615
615
  */
616
616
  asymmetricKeyDetails?: AsymmetricKeyDetails;
617
617
  /**
618
- * For symmetric keys, the following encoding options can be used:
619
- *
620
- * For public keys, the following encoding options can be used:
621
- *
622
- * For private keys, the following encoding options can be used:
623
- *
624
618
  * The result type depends on the selected encoding format, when PEM the
625
619
  * result is a string, when DER it will be a buffer containing the data
626
- * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object.
627
- *
628
- * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are
629
- * ignored.
620
+ * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. Raw formats return a
621
+ * `Buffer` containing the raw key material.
630
622
  *
631
- * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of
632
- * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be
633
- * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for
634
- * encrypted private keys. Since PKCS#8 defines its own
635
- * encryption mechanism, PEM-level encryption is not supported when encrypting
636
- * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for
637
- * PKCS#1 and SEC1 encryption.
623
+ * Private keys can be encrypted by specifying a `cipher` and `passphrase`.
624
+ * The PKCS#8 `type` supports encryption with both PEM and DER `format` for any
625
+ * key algorithm. PKCS#1 and SEC1 can only be encrypted when the PEM `format` is
626
+ * used. For maximum compatibility, use PKCS#8 for encrypted private keys. Since
627
+ * PKCS#8 defines its own encryption mechanism, PEM-level encryption is not
628
+ * supported when encrypting a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption
629
+ * and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for PKCS#1 and SEC1 encryption.
638
630
  * @since v11.6.0
639
631
  */
640
632
  export(options: KeyExportOptions<"pem">): string | NonSharedBuffer;
641
- export(options?: KeyExportOptions<"der">): NonSharedBuffer;
633
+ export(
634
+ options?: KeyExportOptions<"der"> | { format: "raw-public" | "raw-private" | "raw-seed" },
635
+ ): NonSharedBuffer;
642
636
  export(options?: JwkKeyExportOptions): JsonWebKey;
643
637
  /**
644
638
  * Returns `true` or `false` depending on whether the keys have exactly the same
@@ -1203,17 +1197,29 @@ declare module "crypto" {
1203
1197
  }
1204
1198
  interface PrivateKeyInput {
1205
1199
  key: string | Buffer;
1206
- format?: KeyFormat | undefined;
1200
+ format?: "pem" | "der" | undefined;
1207
1201
  type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
1208
1202
  passphrase?: string | Buffer | undefined;
1209
1203
  encoding?: string | undefined;
1210
1204
  }
1205
+ interface RawPrivateKeyInput {
1206
+ key: Buffer;
1207
+ format: "raw-private" | "raw-seed";
1208
+ asymmetricKeyType: KeyType;
1209
+ namedCurve?: string | undefined;
1210
+ }
1211
1211
  interface PublicKeyInput {
1212
1212
  key: string | Buffer;
1213
- format?: KeyFormat | undefined;
1213
+ format?: "pem" | "der" | undefined;
1214
1214
  type?: "pkcs1" | "spki" | undefined;
1215
1215
  encoding?: string | undefined;
1216
1216
  }
1217
+ interface RawPublicKeyInput {
1218
+ key: Buffer;
1219
+ format: "raw-public";
1220
+ asymmetricKeyType: KeyType;
1221
+ namedCurve?: string | undefined;
1222
+ }
1217
1223
  /**
1218
1224
  * Asynchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`.
1219
1225
  *
@@ -1275,7 +1281,14 @@ declare module "crypto" {
1275
1281
  * of the passphrase is limited to 1024 bytes.
1276
1282
  * @since v11.6.0
1277
1283
  */
1278
- function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject;
1284
+ function createPrivateKey(
1285
+ key:
1286
+ | PrivateKeyInput
1287
+ | RawPrivateKeyInput
1288
+ | JsonWebKeyInput
1289
+ | string
1290
+ | NodeJS.ArrayBufferView,
1291
+ ): KeyObject;
1279
1292
  /**
1280
1293
  * Creates and returns a new key object containing a public key. If `key` is a
1281
1294
  * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject` with type `'private'`, the public key is derived from the given private key;
@@ -1290,7 +1303,15 @@ declare module "crypto" {
1290
1303
  * and it will be impossible to extract the private key from the returned object.
1291
1304
  * @since v11.6.0
1292
1305
  */
1293
- function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject;
1306
+ function createPublicKey(
1307
+ key:
1308
+ | PublicKeyInput
1309
+ | RawPublicKeyInput
1310
+ | JsonWebKeyInput
1311
+ | string
1312
+ | NodeJS.ArrayBufferView
1313
+ | KeyObject,
1314
+ ): KeyObject;
1294
1315
  /**
1295
1316
  * Creates and returns a new key object containing a secret key for symmetric
1296
1317
  * encryption or `Hmac`.
@@ -1324,15 +1345,17 @@ declare module "crypto" {
1324
1345
  context?: ArrayBuffer | NodeJS.ArrayBufferView | undefined;
1325
1346
  }
1326
1347
  interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
1348
+ interface SignRawPrivateKeyInput extends RawPrivateKeyInput, SigningOptions {}
1349
+ interface SignJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
1327
1350
  interface SignKeyObjectInput extends SigningOptions {
1328
1351
  key: KeyObject;
1329
1352
  }
1330
- interface SignJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
1331
1353
  interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {}
1354
+ interface VerifyRawPublicKeyInput extends RawPublicKeyInput, SigningOptions {}
1355
+ interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
1332
1356
  interface VerifyKeyObjectInput extends SigningOptions {
1333
1357
  key: KeyObject;
1334
1358
  }
1335
- interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
1336
1359
  type KeyLike = string | Buffer | KeyObject;
1337
1360
  /**
1338
1361
  * The `Sign` class is a utility for generating signatures. It can be used in one
@@ -1423,9 +1446,21 @@ declare module "crypto" {
1423
1446
  * called. Multiple calls to `sign.sign()` will result in an error being thrown.
1424
1447
  * @since v0.1.92
1425
1448
  */
1426
- sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): NonSharedBuffer;
1427
1449
  sign(
1428
- privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
1450
+ privateKey:
1451
+ | KeyLike
1452
+ | SignKeyObjectInput
1453
+ | SignPrivateKeyInput
1454
+ | SignRawPrivateKeyInput
1455
+ | SignJsonWebKeyInput,
1456
+ ): NonSharedBuffer;
1457
+ sign(
1458
+ privateKey:
1459
+ | KeyLike
1460
+ | SignKeyObjectInput
1461
+ | SignPrivateKeyInput
1462
+ | SignRawPrivateKeyInput
1463
+ | SignJsonWebKeyInput,
1429
1464
  outputFormat: BinaryToTextEncoding,
1430
1465
  ): string;
1431
1466
  }
@@ -1472,9 +1507,9 @@ declare module "crypto" {
1472
1507
  update(data: BinaryLike): Verify;
1473
1508
  update(data: string, inputEncoding: Encoding): Verify;
1474
1509
  /**
1475
- * Verifies the provided data using the given `object` and `signature`.
1510
+ * Verifies the provided data using the given `key` and `signature`.
1476
1511
  *
1477
- * If `object` is not a `KeyObject`, this function behaves as if `object` had been passed to {@link createPublicKey}. If it is an
1512
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an
1478
1513
  * object, the following additional properties can be passed:
1479
1514
  *
1480
1515
  * The `signature` argument is the previously calculated signature for the data, in
@@ -1491,13 +1526,23 @@ declare module "crypto" {
1491
1526
  * @since v0.1.92
1492
1527
  */
1493
1528
  verify(
1494
- object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
1529
+ key:
1530
+ | KeyLike
1531
+ | VerifyKeyObjectInput
1532
+ | VerifyPublicKeyInput
1533
+ | VerifyRawPublicKeyInput
1534
+ | VerifyJsonWebKeyInput,
1495
1535
  signature: NodeJS.ArrayBufferView,
1496
1536
  ): boolean;
1497
1537
  verify(
1498
- object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
1538
+ object:
1539
+ | KeyLike
1540
+ | VerifyKeyObjectInput
1541
+ | VerifyPublicKeyInput
1542
+ | VerifyRawPublicKeyInput
1543
+ | VerifyJsonWebKeyInput,
1499
1544
  signature: string,
1500
- signature_format?: BinaryToTextEncoding,
1545
+ signatureEncoding?: BinaryToTextEncoding,
1501
1546
  ): boolean;
1502
1547
  }
1503
1548
  /**
@@ -1577,8 +1622,10 @@ declare module "crypto" {
1577
1622
  * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
1578
1623
  *
1579
1624
  * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular,
1580
- * once a private key has been generated or set, calling this function only updates
1581
- * the public key but does not generate a new private key.
1625
+ * once a private key has been generated or set, calling this function only
1626
+ * recomputes the public key from the existing private key. Since the public key is
1627
+ * determined by the private key, the result will be the same unless the private key
1628
+ * has been changed via `diffieHellman.setPrivateKey()`.
1582
1629
  * @since v0.5.0
1583
1630
  * @param encoding The `encoding` of the return value.
1584
1631
  */
@@ -2496,7 +2543,7 @@ declare module "crypto" {
2496
2543
  | "slh-dsa-shake-256s"
2497
2544
  | "x25519"
2498
2545
  | "x448";
2499
- type KeyFormat = "pem" | "der" | "jwk";
2546
+ type KeyFormat = "pem" | "der" | "jwk" | "raw-public" | "raw-private" | "raw-seed";
2500
2547
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
2501
2548
  format: T;
2502
2549
  cipher?: string | undefined;
@@ -3859,11 +3906,11 @@ declare module "crypto" {
3859
3906
  * @since v24.7.0
3860
3907
  */
3861
3908
  function decapsulate(
3862
- key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
3909
+ key: KeyLike | PrivateKeyInput | RawPrivateKeyInput | JsonWebKeyInput,
3863
3910
  ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
3864
3911
  ): NonSharedBuffer;
3865
3912
  function decapsulate(
3866
- key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
3913
+ key: KeyLike | PrivateKeyInput | RawPrivateKeyInput | JsonWebKeyInput,
3867
3914
  ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
3868
3915
  callback: (err: Error, sharedKey: NonSharedBuffer) => void,
3869
3916
  ): void;
@@ -3875,9 +3922,11 @@ declare module "crypto" {
3875
3922
  * If the `callback` function is provided this function uses libuv's threadpool.
3876
3923
  * @since v13.9.0, v12.17.0
3877
3924
  */
3878
- function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer;
3879
3925
  function diffieHellman(
3880
- options: { privateKey: KeyObject; publicKey: KeyObject },
3926
+ options: { privateKey: KeyLike | PrivateKeyInput; publicKey: KeyLike | PublicKeyInput },
3927
+ ): NonSharedBuffer;
3928
+ function diffieHellman(
3929
+ options: { privateKey: KeyLike | PrivateKeyInput; publicKey: KeyLike | PublicKeyInput },
3881
3930
  callback: (err: Error | null, secret: NonSharedBuffer) => void,
3882
3931
  ): void;
3883
3932
  /**
@@ -3900,10 +3949,10 @@ declare module "crypto" {
3900
3949
  * @since v24.7.0
3901
3950
  */
3902
3951
  function encapsulate(
3903
- key: KeyLike | PublicKeyInput | JsonWebKeyInput,
3952
+ key: KeyLike | PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput,
3904
3953
  ): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer };
3905
3954
  function encapsulate(
3906
- key: KeyLike | PublicKeyInput | JsonWebKeyInput,
3955
+ key: KeyLike | PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput,
3907
3956
  callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void,
3908
3957
  ): void;
3909
3958
  interface OneShotDigestOptions {
@@ -4127,6 +4176,7 @@ declare module "crypto" {
4127
4176
  */
4128
4177
  disableEntropyCache?: boolean | undefined;
4129
4178
  }
4179
+ interface RandomUUIDV7Options extends RandomUUIDOptions {}
4130
4180
  type UUID = `${string}-${string}-${string}-${string}-${string}`;
4131
4181
  /**
4132
4182
  * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a
@@ -4134,6 +4184,14 @@ declare module "crypto" {
4134
4184
  * @since v15.6.0, v14.17.0
4135
4185
  */
4136
4186
  function randomUUID(options?: RandomUUIDOptions): UUID;
4187
+ /**
4188
+ * Generates a random [RFC 9562](https://www.rfc-editor.org/rfc/rfc9562.txt) version 7 UUID. The UUID contains a millisecond
4189
+ * precision Unix timestamp in the most significant 48 bits, followed by
4190
+ * cryptographically secure random bits for the remaining fields, making it
4191
+ * suitable for use as a database key with time-based sorting.
4192
+ * @since v24.16.0
4193
+ */
4194
+ function randomUUIDv7(options?: RandomUUIDV7Options): UUID;
4137
4195
  interface X509CheckOptions {
4138
4196
  /**
4139
4197
  * @default 'always'
@@ -4639,7 +4697,6 @@ declare module "crypto" {
4639
4697
  * ```
4640
4698
  * @since v24.7.0
4641
4699
  * @param algorithm Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`.
4642
- * @experimental
4643
4700
  */
4644
4701
  function argon2(
4645
4702
  algorithm: Argon2Algorithm,
@@ -4679,7 +4736,6 @@ declare module "crypto" {
4679
4736
  * console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
4680
4737
  * ```
4681
4738
  * @since v24.7.0
4682
- * @experimental
4683
4739
  */
4684
4740
  function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer;
4685
4741
  /**
@@ -4758,7 +4814,7 @@ declare module "crypto" {
4758
4814
  interface CShakeParams extends Algorithm {
4759
4815
  customization?: BufferSource;
4760
4816
  functionName?: BufferSource;
4761
- length: number;
4817
+ outputLength: number;
4762
4818
  }
4763
4819
  interface ContextParams extends Algorithm {
4764
4820
  context?: BufferSource;
@@ -4795,6 +4851,10 @@ declare module "crypto" {
4795
4851
  hash: HashAlgorithmIdentifier;
4796
4852
  length?: number;
4797
4853
  }
4854
+ interface KangarooTwelveParams extends Algorithm {
4855
+ customization?: BufferSource;
4856
+ outputLength: number;
4857
+ }
4798
4858
  interface JsonWebKey {
4799
4859
  alg?: string;
4800
4860
  crv?: string;
@@ -4829,7 +4889,7 @@ declare module "crypto" {
4829
4889
  }
4830
4890
  interface KmacParams extends Algorithm {
4831
4891
  customization?: BufferSource;
4832
- length: number;
4892
+ outputLength: number;
4833
4893
  }
4834
4894
  interface Pbkdf2Params extends Algorithm {
4835
4895
  hash: HashAlgorithmIdentifier;
@@ -4864,6 +4924,10 @@ declare module "crypto" {
4864
4924
  interface RsaPssParams extends Algorithm {
4865
4925
  saltLength: number;
4866
4926
  }
4927
+ interface TurboShakeParams extends Algorithm {
4928
+ domainSeparation?: number;
4929
+ outputLength: number;
4930
+ }
4867
4931
  /**
4868
4932
  * Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class.
4869
4933
  * `Crypto` is a singleton that provides access to the remainder of the crypto API.
@@ -4997,7 +5061,7 @@ declare module "crypto" {
4997
5061
  ciphertext: BufferSource,
4998
5062
  sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
4999
5063
  extractable: boolean,
5000
- usages: KeyUsage[],
5064
+ keyUsages: KeyUsage[],
5001
5065
  ): Promise<CryptoKey>;
5002
5066
  /**
5003
5067
  * Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
@@ -5095,7 +5159,10 @@ declare module "crypto" {
5095
5159
  * If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
5096
5160
  * @since v15.0.0
5097
5161
  */
5098
- digest(algorithm: AlgorithmIdentifier | CShakeParams, data: BufferSource): Promise<ArrayBuffer>;
5162
+ digest(
5163
+ algorithm: AlgorithmIdentifier | CShakeParams | TurboShakeParams | KangarooTwelveParams,
5164
+ data: BufferSource,
5165
+ ): Promise<ArrayBuffer>;
5099
5166
  /**
5100
5167
  * Uses a message recipient's asymmetric public key to encrypt a temporary symmetric key.
5101
5168
  * This encrypted key is the "encapsulated key" represented as `EncapsulatedBits`.
@@ -5130,7 +5197,7 @@ declare module "crypto" {
5130
5197
  encapsulationKey: CryptoKey,
5131
5198
  sharedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams | KmacImportParams,
5132
5199
  extractable: boolean,
5133
- usages: KeyUsage[],
5200
+ keyUsages: KeyUsage[],
5134
5201
  ): Promise<EncapsulatedKey>;
5135
5202
  /**
5136
5203
  * Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
@@ -42,6 +42,10 @@ declare module "dgram" {
42
42
  exclusive?: boolean | undefined;
43
43
  fd?: number | undefined;
44
44
  }
45
+ interface BindSyncOptions {
46
+ port?: number | undefined;
47
+ address?: string | undefined;
48
+ }
45
49
  type SocketType = "udp4" | "udp6";
46
50
  interface SocketOptions extends Abortable {
47
51
  type: SocketType;
@@ -137,10 +141,12 @@ declare module "dgram" {
137
141
  * messages on a named `port` and optional `address`. If `port` is not
138
142
  * specified or is `0`, the operating system will attempt to bind to a
139
143
  * random port. If `address` is not specified, the operating system will
140
- * attempt to listen on all addresses. Once binding is complete, a `'listening'` event is emitted and the optional `callback` function is
144
+ * attempt to listen on all addresses. Once binding is complete, a
145
+ * `'listening'` event is emitted and the optional `callback` function is
141
146
  * called.
142
147
  *
143
- * Specifying both a `'listening'` event listener and passing a `callback` to the `socket.bind()` method is not harmful but not very
148
+ * Specifying both a `'listening'` event listener and passing a
149
+ * `callback` to the `socket.bind()` method is not harmful but not very
144
150
  * useful.
145
151
  *
146
152
  * A bound datagram socket keeps the Node.js process running to receive
@@ -177,9 +183,82 @@ declare module "dgram" {
177
183
  * @param callback with no parameters. Called when binding is complete.
178
184
  */
179
185
  bind(port?: number, address?: string, callback?: () => void): this;
180
- bind(port?: number, callback?: () => void): this;
181
- bind(callback?: () => void): this;
186
+ bind(port: number, callback: () => void): this;
187
+ bind(callback: () => void): this;
188
+ /**
189
+ * For UDP sockets, causes the `dgram.Socket` to listen for datagram
190
+ * messages on a named `port` and optional `address` that are passed as
191
+ * properties of an `options` object passed as the first argument. If
192
+ * `port` is not specified or is `0`, the operating system will attempt
193
+ * to bind to a random port. If `address` is not specified, the operating
194
+ * system will attempt to listen on all addresses. Once binding is
195
+ * complete, a `'listening'` event is emitted and the optional `callback`
196
+ * function is called.
197
+ *
198
+ * The `options` object may contain a `fd` property. When a `fd` greater
199
+ * than `0` is set, it will wrap around an existing socket with the given
200
+ * file descriptor. In this case, the properties of `port` and `address`
201
+ * will be ignored.
202
+ *
203
+ * Specifying both a `'listening'` event listener and passing a
204
+ * `callback` to the `socket.bind()` method is not harmful but not very
205
+ * useful.
206
+ *
207
+ * The `options` object may contain an additional `exclusive` property that is
208
+ * used when using `dgram.Socket` objects with the [`cluster`](https://nodejs.org/docs/latest-v24.x/api/cluster.html) module. When
209
+ * `exclusive` is set to `false` (the default), cluster workers will use the same
210
+ * underlying socket handle allowing connection handling duties to be shared.
211
+ * When `exclusive` is `true`, however, the handle is not shared and attempted
212
+ * port sharing results in an error. Creating a `dgram.Socket` with the `reusePort`
213
+ * option set to `true` causes `exclusive` to always be `true` when `socket.bind()`
214
+ * is called.
215
+ *
216
+ * A bound datagram socket keeps the Node.js process running to receive
217
+ * datagram messages.
218
+ *
219
+ * If binding fails, an `'error'` event is generated. In rare case (e.g.
220
+ * attempting to bind with a closed socket), an `Error` may be thrown.
221
+ *
222
+ * An example socket listening on an exclusive port is shown below.
223
+ *
224
+ * ```js
225
+ * socket.bind({
226
+ * address: 'localhost',
227
+ * port: 8000,
228
+ * exclusive: true,
229
+ * });
230
+ * ```
231
+ * @since v0.11.14
232
+ * @param options Required. Supports the following properties:
233
+ */
182
234
  bind(options: BindOptions, callback?: () => void): this;
235
+ /**
236
+ * The synchronous counterpart of `socket.bind()`. `bind(2)` is a local,
237
+ * non-blocking system call, so the bind is performed inline and the resolved
238
+ * address is returned immediately, including the operating-system-assigned
239
+ * ephemeral port when `port` is `0`:
240
+ *
241
+ * ```js
242
+ * const dgram = require('node:dgram');
243
+ *
244
+ * const socket = dgram.createSocket('udp4');
245
+ * const address = socket.bindSync({ address: '0.0.0.0', port: 0 });
246
+ * console.log(address); // e.g. { address: '0.0.0.0', family: 'IPv4', port: 53124 }
247
+ * ```
248
+ *
249
+ * A bind failure such as `EADDRINUSE` is thrown synchronously rather than emitted
250
+ * as an `'error'` event. After `bindSync()` returns, `socket.address()` is
251
+ * valid synchronously and the `'listening'` event is emitted on the next tick.
252
+ *
253
+ * `address` must be a numeric IP literal; `bindSync()` never performs DNS
254
+ * resolution (asynchronous name resolution being the only genuinely blocking part
255
+ * of binding). Incoming datagrams continue to be delivered asynchronously via the
256
+ * `'message'` event. `bindSync()` always binds the socket's own handle and
257
+ * does not participate in [`cluster`](https://nodejs.org/docs/latest-v24.x/api/cluster.html) handle sharing.
258
+ * @since v24.19.0
259
+ * @returns The bound address as returned by `socket.address()`.
260
+ */
261
+ bindSync(options?: BindSyncOptions): AddressInfo;
183
262
  /**
184
263
  * Close the underlying socket and stop listening for data on it. If a callback is
185
264
  * provided, it is added as a listener for the `'close'` event.
@@ -202,6 +281,42 @@ declare module "dgram" {
202
281
  */
203
282
  connect(port: number, address?: string, callback?: () => void): void;
204
283
  connect(port: number, callback: () => void): void;
284
+ /**
285
+ * The synchronous counterpart of `socket.connect()`. For a UDP socket
286
+ * `connect(2)` only records the default peer address and is a local, non-blocking
287
+ * system call, so the association is performed inline. Any error raised by the
288
+ * call itself (for example `EAFNOSUPPORT` for a mismatched address family) is
289
+ * thrown synchronously rather than reported via the `'error'` event. Because
290
+ * `connect(2)` does not probe reachability, errors such as `ECONNREFUSED` are
291
+ * still surfaced asynchronously on a later send or receive, exactly as for
292
+ * `socket.connect()`:
293
+ *
294
+ * ```js
295
+ * const dgram = require('node:dgram');
296
+ *
297
+ * const socket = dgram.createSocket('udp4');
298
+ * socket.connectSync(41234, '127.0.0.1');
299
+ * console.log(socket.remoteAddress()); // { address: '127.0.0.1', family: 'IPv4', port: 41234 }
300
+ * ```
301
+ *
302
+ * If the socket is still unbound it is bound synchronously first. After
303
+ * `connectSync()` returns, `socket.remoteAddress()` is valid synchronously
304
+ * and the `'connect'` event is emitted on the next tick. Trying to call
305
+ * `connectSync()` on an already connected socket throws an
306
+ * `ERR_SOCKET_DGRAM_IS_CONNECTED` exception, and calling it while an
307
+ * asynchronous `socket.bind()` is still in progress throws an
308
+ * `ERR_SOCKET_ALREADY_BOUND` exception.
309
+ *
310
+ * `address` must be a numeric IP literal; `connectSync()` never performs DNS
311
+ * resolution (asynchronous name resolution being the only genuinely blocking part
312
+ * of connecting).
313
+ * @since v24.19.0
314
+ * @param address A numeric IP address to connect to. Unlike
315
+ * `socket.connect()`, no DNS resolution is performed, so a host name is not
316
+ * accepted. If omitted, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for
317
+ * `udp6` sockets) is used.
318
+ */
319
+ connectSync(port: number, address?: string): void;
205
320
  /**
206
321
  * A synchronous function that disassociates a connected `dgram.Socket` from
207
322
  * its remote address. Trying to call `disconnect()` on an unbound or already