@types/node 24.9.0 → 24.9.2

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
@@ -17,6 +17,7 @@
17
17
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/crypto.js)
18
18
  */
19
19
  declare module "crypto" {
20
+ import { NonSharedBuffer } from "node:buffer";
20
21
  import * as stream from "node:stream";
21
22
  import { PeerCertificate } from "node:tls";
22
23
  /**
@@ -44,7 +45,7 @@ declare module "crypto" {
44
45
  * @param encoding The `encoding` of the `spkac` string.
45
46
  * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
46
47
  */
47
- static exportChallenge(spkac: BinaryLike): Buffer;
48
+ static exportChallenge(spkac: BinaryLike): NonSharedBuffer;
48
49
  /**
49
50
  * ```js
50
51
  * const { Certificate } = await import('node:crypto');
@@ -57,7 +58,7 @@ declare module "crypto" {
57
58
  * @param encoding The `encoding` of the `spkac` string.
58
59
  * @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
59
60
  */
60
- static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
61
+ static exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer;
61
62
  /**
62
63
  * ```js
63
64
  * import { Buffer } from 'node:buffer';
@@ -78,7 +79,7 @@ declare module "crypto" {
78
79
  * @returns The challenge component of the `spkac` data structure,
79
80
  * which includes a public key and a challenge.
80
81
  */
81
- exportChallenge(spkac: BinaryLike): Buffer;
82
+ exportChallenge(spkac: BinaryLike): NonSharedBuffer;
82
83
  /**
83
84
  * @deprecated
84
85
  * @param spkac
@@ -86,7 +87,7 @@ declare module "crypto" {
86
87
  * @returns The public key component of the `spkac` data structure,
87
88
  * which includes a public key and a challenge.
88
89
  */
89
- exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
90
+ exportPublicKey(spkac: BinaryLike, encoding?: string): NonSharedBuffer;
90
91
  /**
91
92
  * @deprecated
92
93
  * @param spkac
@@ -402,7 +403,7 @@ declare module "crypto" {
402
403
  * @since v0.1.92
403
404
  * @param encoding The `encoding` of the return value.
404
405
  */
405
- digest(): Buffer;
406
+ digest(): NonSharedBuffer;
406
407
  digest(encoding: BinaryToTextEncoding): string;
407
408
  }
408
409
  /**
@@ -496,7 +497,7 @@ declare module "crypto" {
496
497
  * @since v0.1.94
497
498
  * @param encoding The `encoding` of the return value.
498
499
  */
499
- digest(): Buffer;
500
+ digest(): NonSharedBuffer;
500
501
  digest(encoding: BinaryToTextEncoding): string;
501
502
  }
502
503
  type KeyObjectType = "secret" | "public" | "private";
@@ -636,8 +637,8 @@ declare module "crypto" {
636
637
  * PKCS#1 and SEC1 encryption.
637
638
  * @since v11.6.0
638
639
  */
639
- export(options: KeyExportOptions<"pem">): string | Buffer;
640
- export(options?: KeyExportOptions<"der">): Buffer;
640
+ export(options: KeyExportOptions<"pem">): string | NonSharedBuffer;
641
+ export(options?: KeyExportOptions<"der">): NonSharedBuffer;
641
642
  export(options?: JwkKeyExportOptions): JsonWebKey;
642
643
  /**
643
644
  * Returns `true` or `false` depending on whether the keys have exactly the same
@@ -886,8 +887,8 @@ declare module "crypto" {
886
887
  * @param inputEncoding The `encoding` of the data.
887
888
  * @param outputEncoding The `encoding` of the return value.
888
889
  */
889
- update(data: BinaryLike): Buffer;
890
- update(data: string, inputEncoding: Encoding): Buffer;
890
+ update(data: BinaryLike): NonSharedBuffer;
891
+ update(data: string, inputEncoding: Encoding): NonSharedBuffer;
891
892
  update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
892
893
  update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
893
894
  /**
@@ -898,7 +899,7 @@ declare module "crypto" {
898
899
  * @param outputEncoding The `encoding` of the return value.
899
900
  * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
900
901
  */
901
- final(): Buffer;
902
+ final(): NonSharedBuffer;
902
903
  final(outputEncoding: BufferEncoding): string;
903
904
  /**
904
905
  * When using block encryption algorithms, the `Cipheriv` class will automatically
@@ -924,7 +925,7 @@ declare module "crypto" {
924
925
  plaintextLength: number;
925
926
  },
926
927
  ): this;
927
- getAuthTag(): Buffer;
928
+ getAuthTag(): NonSharedBuffer;
928
929
  }
929
930
  interface CipherGCM extends Cipheriv {
930
931
  setAAD(
@@ -933,7 +934,7 @@ declare module "crypto" {
933
934
  plaintextLength: number;
934
935
  },
935
936
  ): this;
936
- getAuthTag(): Buffer;
937
+ getAuthTag(): NonSharedBuffer;
937
938
  }
938
939
  interface CipherOCB extends Cipheriv {
939
940
  setAAD(
@@ -942,7 +943,7 @@ declare module "crypto" {
942
943
  plaintextLength: number;
943
944
  },
944
945
  ): this;
945
- getAuthTag(): Buffer;
946
+ getAuthTag(): NonSharedBuffer;
946
947
  }
947
948
  interface CipherChaCha20Poly1305 extends Cipheriv {
948
949
  setAAD(
@@ -951,7 +952,7 @@ declare module "crypto" {
951
952
  plaintextLength: number;
952
953
  },
953
954
  ): this;
954
- getAuthTag(): Buffer;
955
+ getAuthTag(): NonSharedBuffer;
955
956
  }
956
957
  /**
957
958
  * Creates and returns a `Decipheriv` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
@@ -1136,8 +1137,8 @@ declare module "crypto" {
1136
1137
  * @param inputEncoding The `encoding` of the `data` string.
1137
1138
  * @param outputEncoding The `encoding` of the return value.
1138
1139
  */
1139
- update(data: NodeJS.ArrayBufferView): Buffer;
1140
- update(data: string, inputEncoding: Encoding): Buffer;
1140
+ update(data: NodeJS.ArrayBufferView): NonSharedBuffer;
1141
+ update(data: string, inputEncoding: Encoding): NonSharedBuffer;
1141
1142
  update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
1142
1143
  update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
1143
1144
  /**
@@ -1148,7 +1149,7 @@ declare module "crypto" {
1148
1149
  * @param outputEncoding The `encoding` of the return value.
1149
1150
  * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned.
1150
1151
  */
1151
- final(): Buffer;
1152
+ final(): NonSharedBuffer;
1152
1153
  final(outputEncoding: BufferEncoding): string;
1153
1154
  /**
1154
1155
  * When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and
@@ -1422,7 +1423,7 @@ declare module "crypto" {
1422
1423
  * called. Multiple calls to `sign.sign()` will result in an error being thrown.
1423
1424
  * @since v0.1.92
1424
1425
  */
1425
- sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): Buffer;
1426
+ sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): NonSharedBuffer;
1426
1427
  sign(
1427
1428
  privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
1428
1429
  outputFormat: BinaryToTextEncoding,
@@ -1581,7 +1582,7 @@ declare module "crypto" {
1581
1582
  * @since v0.5.0
1582
1583
  * @param encoding The `encoding` of the return value.
1583
1584
  */
1584
- generateKeys(): Buffer;
1585
+ generateKeys(): NonSharedBuffer;
1585
1586
  generateKeys(encoding: BinaryToTextEncoding): string;
1586
1587
  /**
1587
1588
  * Computes the shared secret using `otherPublicKey` as the other
@@ -1596,8 +1597,16 @@ declare module "crypto" {
1596
1597
  * @param inputEncoding The `encoding` of an `otherPublicKey` string.
1597
1598
  * @param outputEncoding The `encoding` of the return value.
1598
1599
  */
1599
- computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
1600
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
1600
+ computeSecret(
1601
+ otherPublicKey: NodeJS.ArrayBufferView,
1602
+ inputEncoding?: null,
1603
+ outputEncoding?: null,
1604
+ ): NonSharedBuffer;
1605
+ computeSecret(
1606
+ otherPublicKey: string,
1607
+ inputEncoding: BinaryToTextEncoding,
1608
+ outputEncoding?: null,
1609
+ ): NonSharedBuffer;
1601
1610
  computeSecret(
1602
1611
  otherPublicKey: NodeJS.ArrayBufferView,
1603
1612
  inputEncoding: null,
@@ -1615,7 +1624,7 @@ declare module "crypto" {
1615
1624
  * @since v0.5.0
1616
1625
  * @param encoding The `encoding` of the return value.
1617
1626
  */
1618
- getPrime(): Buffer;
1627
+ getPrime(): NonSharedBuffer;
1619
1628
  getPrime(encoding: BinaryToTextEncoding): string;
1620
1629
  /**
1621
1630
  * Returns the Diffie-Hellman generator in the specified `encoding`.
@@ -1624,7 +1633,7 @@ declare module "crypto" {
1624
1633
  * @since v0.5.0
1625
1634
  * @param encoding The `encoding` of the return value.
1626
1635
  */
1627
- getGenerator(): Buffer;
1636
+ getGenerator(): NonSharedBuffer;
1628
1637
  getGenerator(encoding: BinaryToTextEncoding): string;
1629
1638
  /**
1630
1639
  * Returns the Diffie-Hellman public key in the specified `encoding`.
@@ -1633,7 +1642,7 @@ declare module "crypto" {
1633
1642
  * @since v0.5.0
1634
1643
  * @param encoding The `encoding` of the return value.
1635
1644
  */
1636
- getPublicKey(): Buffer;
1645
+ getPublicKey(): NonSharedBuffer;
1637
1646
  getPublicKey(encoding: BinaryToTextEncoding): string;
1638
1647
  /**
1639
1648
  * Returns the Diffie-Hellman private key in the specified `encoding`.
@@ -1642,7 +1651,7 @@ declare module "crypto" {
1642
1651
  * @since v0.5.0
1643
1652
  * @param encoding The `encoding` of the return value.
1644
1653
  */
1645
- getPrivateKey(): Buffer;
1654
+ getPrivateKey(): NonSharedBuffer;
1646
1655
  getPrivateKey(encoding: BinaryToTextEncoding): string;
1647
1656
  /**
1648
1657
  * Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected
@@ -1786,7 +1795,7 @@ declare module "crypto" {
1786
1795
  iterations: number,
1787
1796
  keylen: number,
1788
1797
  digest: string,
1789
- callback: (err: Error | null, derivedKey: Buffer) => void,
1798
+ callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
1790
1799
  ): void;
1791
1800
  /**
1792
1801
  * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
@@ -1823,7 +1832,7 @@ declare module "crypto" {
1823
1832
  iterations: number,
1824
1833
  keylen: number,
1825
1834
  digest: string,
1826
- ): Buffer;
1835
+ ): NonSharedBuffer;
1827
1836
  /**
1828
1837
  * Generates cryptographically strong pseudorandom data. The `size` argument
1829
1838
  * is a number indicating the number of bytes to generate.
@@ -1876,10 +1885,10 @@ declare module "crypto" {
1876
1885
  * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`.
1877
1886
  * @return if the `callback` function is not provided.
1878
1887
  */
1879
- function randomBytes(size: number): Buffer;
1880
- function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
1881
- function pseudoRandomBytes(size: number): Buffer;
1882
- function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
1888
+ function randomBytes(size: number): NonSharedBuffer;
1889
+ function randomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void;
1890
+ function pseudoRandomBytes(size: number): NonSharedBuffer;
1891
+ function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: NonSharedBuffer) => void): void;
1883
1892
  /**
1884
1893
  * Return a random integer `n` such that `min <= n < max`. This
1885
1894
  * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
@@ -2109,14 +2118,14 @@ declare module "crypto" {
2109
2118
  password: BinaryLike,
2110
2119
  salt: BinaryLike,
2111
2120
  keylen: number,
2112
- callback: (err: Error | null, derivedKey: Buffer) => void,
2121
+ callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
2113
2122
  ): void;
2114
2123
  function scrypt(
2115
2124
  password: BinaryLike,
2116
2125
  salt: BinaryLike,
2117
2126
  keylen: number,
2118
2127
  options: ScryptOptions,
2119
- callback: (err: Error | null, derivedKey: Buffer) => void,
2128
+ callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
2120
2129
  ): void;
2121
2130
  /**
2122
2131
  * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
@@ -2148,7 +2157,12 @@ declare module "crypto" {
2148
2157
  * ```
2149
2158
  * @since v10.5.0
2150
2159
  */
2151
- function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer;
2160
+ function scryptSync(
2161
+ password: BinaryLike,
2162
+ salt: BinaryLike,
2163
+ keylen: number,
2164
+ options?: ScryptOptions,
2165
+ ): NonSharedBuffer;
2152
2166
  interface RsaPublicKey {
2153
2167
  key: KeyLike;
2154
2168
  padding?: number | undefined;
@@ -2177,7 +2191,7 @@ declare module "crypto" {
2177
2191
  function publicEncrypt(
2178
2192
  key: RsaPublicKey | RsaPrivateKey | KeyLike,
2179
2193
  buffer: NodeJS.ArrayBufferView | string,
2180
- ): Buffer;
2194
+ ): NonSharedBuffer;
2181
2195
  /**
2182
2196
  * Decrypts `buffer` with `key`.`buffer` was previously encrypted using
2183
2197
  * the corresponding private key, for example using {@link privateEncrypt}.
@@ -2192,7 +2206,7 @@ declare module "crypto" {
2192
2206
  function publicDecrypt(
2193
2207
  key: RsaPublicKey | RsaPrivateKey | KeyLike,
2194
2208
  buffer: NodeJS.ArrayBufferView | string,
2195
- ): Buffer;
2209
+ ): NonSharedBuffer;
2196
2210
  /**
2197
2211
  * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
2198
2212
  * the corresponding public key, for example using {@link publicEncrypt}.
@@ -2201,7 +2215,10 @@ declare module "crypto" {
2201
2215
  * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`.
2202
2216
  * @since v0.11.14
2203
2217
  */
2204
- function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView | string): Buffer;
2218
+ function privateDecrypt(
2219
+ privateKey: RsaPrivateKey | KeyLike,
2220
+ buffer: NodeJS.ArrayBufferView | string,
2221
+ ): NonSharedBuffer;
2205
2222
  /**
2206
2223
  * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
2207
2224
  * the corresponding public key, for example using {@link publicDecrypt}.
@@ -2210,7 +2227,10 @@ declare module "crypto" {
2210
2227
  * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`.
2211
2228
  * @since v1.1.0
2212
2229
  */
2213
- function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView | string): Buffer;
2230
+ function privateEncrypt(
2231
+ privateKey: RsaPrivateKey | KeyLike,
2232
+ buffer: NodeJS.ArrayBufferView | string,
2233
+ ): NonSharedBuffer;
2214
2234
  /**
2215
2235
  * ```js
2216
2236
  * const {
@@ -2339,7 +2359,7 @@ declare module "crypto" {
2339
2359
  inputEncoding?: BinaryToTextEncoding,
2340
2360
  outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
2341
2361
  format?: "uncompressed" | "compressed" | "hybrid",
2342
- ): Buffer | string;
2362
+ ): NonSharedBuffer | string;
2343
2363
  /**
2344
2364
  * Generates private and public EC Diffie-Hellman key values, and returns
2345
2365
  * the public key in the specified `format` and `encoding`. This key should be
@@ -2352,7 +2372,7 @@ declare module "crypto" {
2352
2372
  * @param encoding The `encoding` of the return value.
2353
2373
  * @param [format='uncompressed']
2354
2374
  */
2355
- generateKeys(): Buffer;
2375
+ generateKeys(): NonSharedBuffer;
2356
2376
  generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
2357
2377
  /**
2358
2378
  * Computes the shared secret using `otherPublicKey` as the other
@@ -2371,8 +2391,8 @@ declare module "crypto" {
2371
2391
  * @param inputEncoding The `encoding` of the `otherPublicKey` string.
2372
2392
  * @param outputEncoding The `encoding` of the return value.
2373
2393
  */
2374
- computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
2375
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
2394
+ computeSecret(otherPublicKey: NodeJS.ArrayBufferView): NonSharedBuffer;
2395
+ computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): NonSharedBuffer;
2376
2396
  computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
2377
2397
  computeSecret(
2378
2398
  otherPublicKey: string,
@@ -2386,7 +2406,7 @@ declare module "crypto" {
2386
2406
  * @param encoding The `encoding` of the return value.
2387
2407
  * @return The EC Diffie-Hellman in the specified `encoding`.
2388
2408
  */
2389
- getPrivateKey(): Buffer;
2409
+ getPrivateKey(): NonSharedBuffer;
2390
2410
  getPrivateKey(encoding: BinaryToTextEncoding): string;
2391
2411
  /**
2392
2412
  * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format.
@@ -2398,7 +2418,7 @@ declare module "crypto" {
2398
2418
  * @param [format='uncompressed']
2399
2419
  * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
2400
2420
  */
2401
- getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer;
2421
+ getPublicKey(encoding?: null, format?: ECDHKeyFormat): NonSharedBuffer;
2402
2422
  getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
2403
2423
  /**
2404
2424
  * Sets the EC Diffie-Hellman private key.
@@ -2737,15 +2757,15 @@ declare module "crypto" {
2737
2757
  function generateKeyPairSync(
2738
2758
  type: "rsa",
2739
2759
  options: RSAKeyPairOptions<"pem", "der">,
2740
- ): KeyPairSyncResult<string, Buffer>;
2760
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2741
2761
  function generateKeyPairSync(
2742
2762
  type: "rsa",
2743
2763
  options: RSAKeyPairOptions<"der", "pem">,
2744
- ): KeyPairSyncResult<Buffer, string>;
2764
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2745
2765
  function generateKeyPairSync(
2746
2766
  type: "rsa",
2747
2767
  options: RSAKeyPairOptions<"der", "der">,
2748
- ): KeyPairSyncResult<Buffer, Buffer>;
2768
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2749
2769
  function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2750
2770
  function generateKeyPairSync(
2751
2771
  type: "rsa-pss",
@@ -2754,15 +2774,15 @@ declare module "crypto" {
2754
2774
  function generateKeyPairSync(
2755
2775
  type: "rsa-pss",
2756
2776
  options: RSAPSSKeyPairOptions<"pem", "der">,
2757
- ): KeyPairSyncResult<string, Buffer>;
2777
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2758
2778
  function generateKeyPairSync(
2759
2779
  type: "rsa-pss",
2760
2780
  options: RSAPSSKeyPairOptions<"der", "pem">,
2761
- ): KeyPairSyncResult<Buffer, string>;
2781
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2762
2782
  function generateKeyPairSync(
2763
2783
  type: "rsa-pss",
2764
2784
  options: RSAPSSKeyPairOptions<"der", "der">,
2765
- ): KeyPairSyncResult<Buffer, Buffer>;
2785
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2766
2786
  function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2767
2787
  function generateKeyPairSync(
2768
2788
  type: "dsa",
@@ -2771,15 +2791,15 @@ declare module "crypto" {
2771
2791
  function generateKeyPairSync(
2772
2792
  type: "dsa",
2773
2793
  options: DSAKeyPairOptions<"pem", "der">,
2774
- ): KeyPairSyncResult<string, Buffer>;
2794
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2775
2795
  function generateKeyPairSync(
2776
2796
  type: "dsa",
2777
2797
  options: DSAKeyPairOptions<"der", "pem">,
2778
- ): KeyPairSyncResult<Buffer, string>;
2798
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2779
2799
  function generateKeyPairSync(
2780
2800
  type: "dsa",
2781
2801
  options: DSAKeyPairOptions<"der", "der">,
2782
- ): KeyPairSyncResult<Buffer, Buffer>;
2802
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2783
2803
  function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2784
2804
  function generateKeyPairSync(
2785
2805
  type: "ec",
@@ -2788,15 +2808,15 @@ declare module "crypto" {
2788
2808
  function generateKeyPairSync(
2789
2809
  type: "ec",
2790
2810
  options: ECKeyPairOptions<"pem", "der">,
2791
- ): KeyPairSyncResult<string, Buffer>;
2811
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2792
2812
  function generateKeyPairSync(
2793
2813
  type: "ec",
2794
2814
  options: ECKeyPairOptions<"der", "pem">,
2795
- ): KeyPairSyncResult<Buffer, string>;
2815
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2796
2816
  function generateKeyPairSync(
2797
2817
  type: "ec",
2798
2818
  options: ECKeyPairOptions<"der", "der">,
2799
- ): KeyPairSyncResult<Buffer, Buffer>;
2819
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2800
2820
  function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2801
2821
  function generateKeyPairSync(
2802
2822
  type: "ed25519",
@@ -2805,15 +2825,15 @@ declare module "crypto" {
2805
2825
  function generateKeyPairSync(
2806
2826
  type: "ed25519",
2807
2827
  options: ED25519KeyPairOptions<"pem", "der">,
2808
- ): KeyPairSyncResult<string, Buffer>;
2828
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2809
2829
  function generateKeyPairSync(
2810
2830
  type: "ed25519",
2811
2831
  options: ED25519KeyPairOptions<"der", "pem">,
2812
- ): KeyPairSyncResult<Buffer, string>;
2832
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2813
2833
  function generateKeyPairSync(
2814
2834
  type: "ed25519",
2815
2835
  options: ED25519KeyPairOptions<"der", "der">,
2816
- ): KeyPairSyncResult<Buffer, Buffer>;
2836
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2817
2837
  function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2818
2838
  function generateKeyPairSync(
2819
2839
  type: "ed448",
@@ -2822,15 +2842,15 @@ declare module "crypto" {
2822
2842
  function generateKeyPairSync(
2823
2843
  type: "ed448",
2824
2844
  options: ED448KeyPairOptions<"pem", "der">,
2825
- ): KeyPairSyncResult<string, Buffer>;
2845
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2826
2846
  function generateKeyPairSync(
2827
2847
  type: "ed448",
2828
2848
  options: ED448KeyPairOptions<"der", "pem">,
2829
- ): KeyPairSyncResult<Buffer, string>;
2849
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2830
2850
  function generateKeyPairSync(
2831
2851
  type: "ed448",
2832
2852
  options: ED448KeyPairOptions<"der", "der">,
2833
- ): KeyPairSyncResult<Buffer, Buffer>;
2853
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2834
2854
  function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2835
2855
  function generateKeyPairSync(
2836
2856
  type: "x25519",
@@ -2839,15 +2859,15 @@ declare module "crypto" {
2839
2859
  function generateKeyPairSync(
2840
2860
  type: "x25519",
2841
2861
  options: X25519KeyPairOptions<"pem", "der">,
2842
- ): KeyPairSyncResult<string, Buffer>;
2862
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2843
2863
  function generateKeyPairSync(
2844
2864
  type: "x25519",
2845
2865
  options: X25519KeyPairOptions<"der", "pem">,
2846
- ): KeyPairSyncResult<Buffer, string>;
2866
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2847
2867
  function generateKeyPairSync(
2848
2868
  type: "x25519",
2849
2869
  options: X25519KeyPairOptions<"der", "der">,
2850
- ): KeyPairSyncResult<Buffer, Buffer>;
2870
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2851
2871
  function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2852
2872
  function generateKeyPairSync(
2853
2873
  type: "x448",
@@ -2856,15 +2876,15 @@ declare module "crypto" {
2856
2876
  function generateKeyPairSync(
2857
2877
  type: "x448",
2858
2878
  options: X448KeyPairOptions<"pem", "der">,
2859
- ): KeyPairSyncResult<string, Buffer>;
2879
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2860
2880
  function generateKeyPairSync(
2861
2881
  type: "x448",
2862
2882
  options: X448KeyPairOptions<"der", "pem">,
2863
- ): KeyPairSyncResult<Buffer, string>;
2883
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2864
2884
  function generateKeyPairSync(
2865
2885
  type: "x448",
2866
2886
  options: X448KeyPairOptions<"der", "der">,
2867
- ): KeyPairSyncResult<Buffer, Buffer>;
2887
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2868
2888
  function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
2869
2889
  function generateKeyPairSync(
2870
2890
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
@@ -2873,15 +2893,15 @@ declare module "crypto" {
2873
2893
  function generateKeyPairSync(
2874
2894
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2875
2895
  options: MLDSAKeyPairOptions<"pem", "der">,
2876
- ): KeyPairSyncResult<string, Buffer>;
2896
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2877
2897
  function generateKeyPairSync(
2878
2898
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2879
2899
  options: MLDSAKeyPairOptions<"der", "pem">,
2880
- ): KeyPairSyncResult<Buffer, string>;
2900
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2881
2901
  function generateKeyPairSync(
2882
2902
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2883
2903
  options: MLDSAKeyPairOptions<"der", "der">,
2884
- ): KeyPairSyncResult<Buffer, Buffer>;
2904
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2885
2905
  function generateKeyPairSync(
2886
2906
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
2887
2907
  options?: MLDSAKeyPairKeyObjectOptions,
@@ -2893,15 +2913,15 @@ declare module "crypto" {
2893
2913
  function generateKeyPairSync(
2894
2914
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2895
2915
  options: MLKEMKeyPairOptions<"pem", "der">,
2896
- ): KeyPairSyncResult<string, Buffer>;
2916
+ ): KeyPairSyncResult<string, NonSharedBuffer>;
2897
2917
  function generateKeyPairSync(
2898
2918
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2899
2919
  options: MLKEMKeyPairOptions<"der", "pem">,
2900
- ): KeyPairSyncResult<Buffer, string>;
2920
+ ): KeyPairSyncResult<NonSharedBuffer, string>;
2901
2921
  function generateKeyPairSync(
2902
2922
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2903
2923
  options: MLKEMKeyPairOptions<"der", "der">,
2904
- ): KeyPairSyncResult<Buffer, Buffer>;
2924
+ ): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
2905
2925
  function generateKeyPairSync(
2906
2926
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
2907
2927
  options?: MLKEMKeyPairKeyObjectOptions,
@@ -3034,17 +3054,17 @@ declare module "crypto" {
3034
3054
  function generateKeyPair(
3035
3055
  type: "rsa",
3036
3056
  options: RSAKeyPairOptions<"pem", "der">,
3037
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3057
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3038
3058
  ): void;
3039
3059
  function generateKeyPair(
3040
3060
  type: "rsa",
3041
3061
  options: RSAKeyPairOptions<"der", "pem">,
3042
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3062
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3043
3063
  ): void;
3044
3064
  function generateKeyPair(
3045
3065
  type: "rsa",
3046
3066
  options: RSAKeyPairOptions<"der", "der">,
3047
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3067
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3048
3068
  ): void;
3049
3069
  function generateKeyPair(
3050
3070
  type: "rsa",
@@ -3059,17 +3079,17 @@ declare module "crypto" {
3059
3079
  function generateKeyPair(
3060
3080
  type: "rsa-pss",
3061
3081
  options: RSAPSSKeyPairOptions<"pem", "der">,
3062
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3082
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3063
3083
  ): void;
3064
3084
  function generateKeyPair(
3065
3085
  type: "rsa-pss",
3066
3086
  options: RSAPSSKeyPairOptions<"der", "pem">,
3067
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3087
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3068
3088
  ): void;
3069
3089
  function generateKeyPair(
3070
3090
  type: "rsa-pss",
3071
3091
  options: RSAPSSKeyPairOptions<"der", "der">,
3072
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3092
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3073
3093
  ): void;
3074
3094
  function generateKeyPair(
3075
3095
  type: "rsa-pss",
@@ -3084,17 +3104,17 @@ declare module "crypto" {
3084
3104
  function generateKeyPair(
3085
3105
  type: "dsa",
3086
3106
  options: DSAKeyPairOptions<"pem", "der">,
3087
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3107
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3088
3108
  ): void;
3089
3109
  function generateKeyPair(
3090
3110
  type: "dsa",
3091
3111
  options: DSAKeyPairOptions<"der", "pem">,
3092
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3112
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3093
3113
  ): void;
3094
3114
  function generateKeyPair(
3095
3115
  type: "dsa",
3096
3116
  options: DSAKeyPairOptions<"der", "der">,
3097
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3117
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3098
3118
  ): void;
3099
3119
  function generateKeyPair(
3100
3120
  type: "dsa",
@@ -3109,17 +3129,17 @@ declare module "crypto" {
3109
3129
  function generateKeyPair(
3110
3130
  type: "ec",
3111
3131
  options: ECKeyPairOptions<"pem", "der">,
3112
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3132
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3113
3133
  ): void;
3114
3134
  function generateKeyPair(
3115
3135
  type: "ec",
3116
3136
  options: ECKeyPairOptions<"der", "pem">,
3117
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3137
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3118
3138
  ): void;
3119
3139
  function generateKeyPair(
3120
3140
  type: "ec",
3121
3141
  options: ECKeyPairOptions<"der", "der">,
3122
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3142
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3123
3143
  ): void;
3124
3144
  function generateKeyPair(
3125
3145
  type: "ec",
@@ -3134,17 +3154,17 @@ declare module "crypto" {
3134
3154
  function generateKeyPair(
3135
3155
  type: "ed25519",
3136
3156
  options: ED25519KeyPairOptions<"pem", "der">,
3137
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3157
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3138
3158
  ): void;
3139
3159
  function generateKeyPair(
3140
3160
  type: "ed25519",
3141
3161
  options: ED25519KeyPairOptions<"der", "pem">,
3142
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3162
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3143
3163
  ): void;
3144
3164
  function generateKeyPair(
3145
3165
  type: "ed25519",
3146
3166
  options: ED25519KeyPairOptions<"der", "der">,
3147
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3167
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3148
3168
  ): void;
3149
3169
  function generateKeyPair(
3150
3170
  type: "ed25519",
@@ -3159,17 +3179,17 @@ declare module "crypto" {
3159
3179
  function generateKeyPair(
3160
3180
  type: "ed448",
3161
3181
  options: ED448KeyPairOptions<"pem", "der">,
3162
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3182
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3163
3183
  ): void;
3164
3184
  function generateKeyPair(
3165
3185
  type: "ed448",
3166
3186
  options: ED448KeyPairOptions<"der", "pem">,
3167
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3187
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3168
3188
  ): void;
3169
3189
  function generateKeyPair(
3170
3190
  type: "ed448",
3171
3191
  options: ED448KeyPairOptions<"der", "der">,
3172
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3192
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3173
3193
  ): void;
3174
3194
  function generateKeyPair(
3175
3195
  type: "ed448",
@@ -3184,17 +3204,17 @@ declare module "crypto" {
3184
3204
  function generateKeyPair(
3185
3205
  type: "x25519",
3186
3206
  options: X25519KeyPairOptions<"pem", "der">,
3187
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3207
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3188
3208
  ): void;
3189
3209
  function generateKeyPair(
3190
3210
  type: "x25519",
3191
3211
  options: X25519KeyPairOptions<"der", "pem">,
3192
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3212
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3193
3213
  ): void;
3194
3214
  function generateKeyPair(
3195
3215
  type: "x25519",
3196
3216
  options: X25519KeyPairOptions<"der", "der">,
3197
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3217
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3198
3218
  ): void;
3199
3219
  function generateKeyPair(
3200
3220
  type: "x25519",
@@ -3209,17 +3229,17 @@ declare module "crypto" {
3209
3229
  function generateKeyPair(
3210
3230
  type: "x448",
3211
3231
  options: X448KeyPairOptions<"pem", "der">,
3212
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3232
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3213
3233
  ): void;
3214
3234
  function generateKeyPair(
3215
3235
  type: "x448",
3216
3236
  options: X448KeyPairOptions<"der", "pem">,
3217
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3237
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3218
3238
  ): void;
3219
3239
  function generateKeyPair(
3220
3240
  type: "x448",
3221
3241
  options: X448KeyPairOptions<"der", "der">,
3222
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3242
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3223
3243
  ): void;
3224
3244
  function generateKeyPair(
3225
3245
  type: "x448",
@@ -3234,17 +3254,17 @@ declare module "crypto" {
3234
3254
  function generateKeyPair(
3235
3255
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3236
3256
  options: MLDSAKeyPairOptions<"pem", "der">,
3237
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3257
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3238
3258
  ): void;
3239
3259
  function generateKeyPair(
3240
3260
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3241
3261
  options: MLDSAKeyPairOptions<"der", "pem">,
3242
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3262
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3243
3263
  ): void;
3244
3264
  function generateKeyPair(
3245
3265
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3246
3266
  options: MLDSAKeyPairOptions<"der", "der">,
3247
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3267
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3248
3268
  ): void;
3249
3269
  function generateKeyPair(
3250
3270
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
@@ -3259,17 +3279,17 @@ declare module "crypto" {
3259
3279
  function generateKeyPair(
3260
3280
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3261
3281
  options: MLKEMKeyPairOptions<"pem", "der">,
3262
- callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
3282
+ callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
3263
3283
  ): void;
3264
3284
  function generateKeyPair(
3265
3285
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3266
3286
  options: MLKEMKeyPairOptions<"der", "pem">,
3267
- callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
3287
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
3268
3288
  ): void;
3269
3289
  function generateKeyPair(
3270
3290
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3271
3291
  options: MLKEMKeyPairOptions<"der", "der">,
3272
- callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
3292
+ callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
3273
3293
  ): void;
3274
3294
  function generateKeyPair(
3275
3295
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
@@ -3374,21 +3394,21 @@ declare module "crypto" {
3374
3394
  options: RSAKeyPairOptions<"pem", "der">,
3375
3395
  ): Promise<{
3376
3396
  publicKey: string;
3377
- privateKey: Buffer;
3397
+ privateKey: NonSharedBuffer;
3378
3398
  }>;
3379
3399
  function __promisify__(
3380
3400
  type: "rsa",
3381
3401
  options: RSAKeyPairOptions<"der", "pem">,
3382
3402
  ): Promise<{
3383
- publicKey: Buffer;
3403
+ publicKey: NonSharedBuffer;
3384
3404
  privateKey: string;
3385
3405
  }>;
3386
3406
  function __promisify__(
3387
3407
  type: "rsa",
3388
3408
  options: RSAKeyPairOptions<"der", "der">,
3389
3409
  ): Promise<{
3390
- publicKey: Buffer;
3391
- privateKey: Buffer;
3410
+ publicKey: NonSharedBuffer;
3411
+ privateKey: NonSharedBuffer;
3392
3412
  }>;
3393
3413
  function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3394
3414
  function __promisify__(
@@ -3403,21 +3423,21 @@ declare module "crypto" {
3403
3423
  options: RSAPSSKeyPairOptions<"pem", "der">,
3404
3424
  ): Promise<{
3405
3425
  publicKey: string;
3406
- privateKey: Buffer;
3426
+ privateKey: NonSharedBuffer;
3407
3427
  }>;
3408
3428
  function __promisify__(
3409
3429
  type: "rsa-pss",
3410
3430
  options: RSAPSSKeyPairOptions<"der", "pem">,
3411
3431
  ): Promise<{
3412
- publicKey: Buffer;
3432
+ publicKey: NonSharedBuffer;
3413
3433
  privateKey: string;
3414
3434
  }>;
3415
3435
  function __promisify__(
3416
3436
  type: "rsa-pss",
3417
3437
  options: RSAPSSKeyPairOptions<"der", "der">,
3418
3438
  ): Promise<{
3419
- publicKey: Buffer;
3420
- privateKey: Buffer;
3439
+ publicKey: NonSharedBuffer;
3440
+ privateKey: NonSharedBuffer;
3421
3441
  }>;
3422
3442
  function __promisify__(
3423
3443
  type: "rsa-pss",
@@ -3435,21 +3455,21 @@ declare module "crypto" {
3435
3455
  options: DSAKeyPairOptions<"pem", "der">,
3436
3456
  ): Promise<{
3437
3457
  publicKey: string;
3438
- privateKey: Buffer;
3458
+ privateKey: NonSharedBuffer;
3439
3459
  }>;
3440
3460
  function __promisify__(
3441
3461
  type: "dsa",
3442
3462
  options: DSAKeyPairOptions<"der", "pem">,
3443
3463
  ): Promise<{
3444
- publicKey: Buffer;
3464
+ publicKey: NonSharedBuffer;
3445
3465
  privateKey: string;
3446
3466
  }>;
3447
3467
  function __promisify__(
3448
3468
  type: "dsa",
3449
3469
  options: DSAKeyPairOptions<"der", "der">,
3450
3470
  ): Promise<{
3451
- publicKey: Buffer;
3452
- privateKey: Buffer;
3471
+ publicKey: NonSharedBuffer;
3472
+ privateKey: NonSharedBuffer;
3453
3473
  }>;
3454
3474
  function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3455
3475
  function __promisify__(
@@ -3464,21 +3484,21 @@ declare module "crypto" {
3464
3484
  options: ECKeyPairOptions<"pem", "der">,
3465
3485
  ): Promise<{
3466
3486
  publicKey: string;
3467
- privateKey: Buffer;
3487
+ privateKey: NonSharedBuffer;
3468
3488
  }>;
3469
3489
  function __promisify__(
3470
3490
  type: "ec",
3471
3491
  options: ECKeyPairOptions<"der", "pem">,
3472
3492
  ): Promise<{
3473
- publicKey: Buffer;
3493
+ publicKey: NonSharedBuffer;
3474
3494
  privateKey: string;
3475
3495
  }>;
3476
3496
  function __promisify__(
3477
3497
  type: "ec",
3478
3498
  options: ECKeyPairOptions<"der", "der">,
3479
3499
  ): Promise<{
3480
- publicKey: Buffer;
3481
- privateKey: Buffer;
3500
+ publicKey: NonSharedBuffer;
3501
+ privateKey: NonSharedBuffer;
3482
3502
  }>;
3483
3503
  function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3484
3504
  function __promisify__(
@@ -3493,21 +3513,21 @@ declare module "crypto" {
3493
3513
  options: ED25519KeyPairOptions<"pem", "der">,
3494
3514
  ): Promise<{
3495
3515
  publicKey: string;
3496
- privateKey: Buffer;
3516
+ privateKey: NonSharedBuffer;
3497
3517
  }>;
3498
3518
  function __promisify__(
3499
3519
  type: "ed25519",
3500
3520
  options: ED25519KeyPairOptions<"der", "pem">,
3501
3521
  ): Promise<{
3502
- publicKey: Buffer;
3522
+ publicKey: NonSharedBuffer;
3503
3523
  privateKey: string;
3504
3524
  }>;
3505
3525
  function __promisify__(
3506
3526
  type: "ed25519",
3507
3527
  options: ED25519KeyPairOptions<"der", "der">,
3508
3528
  ): Promise<{
3509
- publicKey: Buffer;
3510
- privateKey: Buffer;
3529
+ publicKey: NonSharedBuffer;
3530
+ privateKey: NonSharedBuffer;
3511
3531
  }>;
3512
3532
  function __promisify__(
3513
3533
  type: "ed25519",
@@ -3525,21 +3545,21 @@ declare module "crypto" {
3525
3545
  options: ED448KeyPairOptions<"pem", "der">,
3526
3546
  ): Promise<{
3527
3547
  publicKey: string;
3528
- privateKey: Buffer;
3548
+ privateKey: NonSharedBuffer;
3529
3549
  }>;
3530
3550
  function __promisify__(
3531
3551
  type: "ed448",
3532
3552
  options: ED448KeyPairOptions<"der", "pem">,
3533
3553
  ): Promise<{
3534
- publicKey: Buffer;
3554
+ publicKey: NonSharedBuffer;
3535
3555
  privateKey: string;
3536
3556
  }>;
3537
3557
  function __promisify__(
3538
3558
  type: "ed448",
3539
3559
  options: ED448KeyPairOptions<"der", "der">,
3540
3560
  ): Promise<{
3541
- publicKey: Buffer;
3542
- privateKey: Buffer;
3561
+ publicKey: NonSharedBuffer;
3562
+ privateKey: NonSharedBuffer;
3543
3563
  }>;
3544
3564
  function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3545
3565
  function __promisify__(
@@ -3554,21 +3574,21 @@ declare module "crypto" {
3554
3574
  options: X25519KeyPairOptions<"pem", "der">,
3555
3575
  ): Promise<{
3556
3576
  publicKey: string;
3557
- privateKey: Buffer;
3577
+ privateKey: NonSharedBuffer;
3558
3578
  }>;
3559
3579
  function __promisify__(
3560
3580
  type: "x25519",
3561
3581
  options: X25519KeyPairOptions<"der", "pem">,
3562
3582
  ): Promise<{
3563
- publicKey: Buffer;
3583
+ publicKey: NonSharedBuffer;
3564
3584
  privateKey: string;
3565
3585
  }>;
3566
3586
  function __promisify__(
3567
3587
  type: "x25519",
3568
3588
  options: X25519KeyPairOptions<"der", "der">,
3569
3589
  ): Promise<{
3570
- publicKey: Buffer;
3571
- privateKey: Buffer;
3590
+ publicKey: NonSharedBuffer;
3591
+ privateKey: NonSharedBuffer;
3572
3592
  }>;
3573
3593
  function __promisify__(
3574
3594
  type: "x25519",
@@ -3586,21 +3606,21 @@ declare module "crypto" {
3586
3606
  options: X448KeyPairOptions<"pem", "der">,
3587
3607
  ): Promise<{
3588
3608
  publicKey: string;
3589
- privateKey: Buffer;
3609
+ privateKey: NonSharedBuffer;
3590
3610
  }>;
3591
3611
  function __promisify__(
3592
3612
  type: "x448",
3593
3613
  options: X448KeyPairOptions<"der", "pem">,
3594
3614
  ): Promise<{
3595
- publicKey: Buffer;
3615
+ publicKey: NonSharedBuffer;
3596
3616
  privateKey: string;
3597
3617
  }>;
3598
3618
  function __promisify__(
3599
3619
  type: "x448",
3600
3620
  options: X448KeyPairOptions<"der", "der">,
3601
3621
  ): Promise<{
3602
- publicKey: Buffer;
3603
- privateKey: Buffer;
3622
+ publicKey: NonSharedBuffer;
3623
+ privateKey: NonSharedBuffer;
3604
3624
  }>;
3605
3625
  function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
3606
3626
  function __promisify__(
@@ -3615,21 +3635,21 @@ declare module "crypto" {
3615
3635
  options: MLDSAKeyPairOptions<"pem", "der">,
3616
3636
  ): Promise<{
3617
3637
  publicKey: string;
3618
- privateKey: Buffer;
3638
+ privateKey: NonSharedBuffer;
3619
3639
  }>;
3620
3640
  function __promisify__(
3621
3641
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3622
3642
  options: MLDSAKeyPairOptions<"der", "pem">,
3623
3643
  ): Promise<{
3624
- publicKey: Buffer;
3644
+ publicKey: NonSharedBuffer;
3625
3645
  privateKey: string;
3626
3646
  }>;
3627
3647
  function __promisify__(
3628
3648
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
3629
3649
  options: MLDSAKeyPairOptions<"der", "der">,
3630
3650
  ): Promise<{
3631
- publicKey: Buffer;
3632
- privateKey: Buffer;
3651
+ publicKey: NonSharedBuffer;
3652
+ privateKey: NonSharedBuffer;
3633
3653
  }>;
3634
3654
  function __promisify__(
3635
3655
  type: "ml-dsa-44" | "ml-dsa-65" | "ml-dsa-87",
@@ -3647,21 +3667,21 @@ declare module "crypto" {
3647
3667
  options: MLKEMKeyPairOptions<"pem", "der">,
3648
3668
  ): Promise<{
3649
3669
  publicKey: string;
3650
- privateKey: Buffer;
3670
+ privateKey: NonSharedBuffer;
3651
3671
  }>;
3652
3672
  function __promisify__(
3653
3673
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3654
3674
  options: MLKEMKeyPairOptions<"der", "pem">,
3655
3675
  ): Promise<{
3656
- publicKey: Buffer;
3676
+ publicKey: NonSharedBuffer;
3657
3677
  privateKey: string;
3658
3678
  }>;
3659
3679
  function __promisify__(
3660
3680
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
3661
3681
  options: MLKEMKeyPairOptions<"der", "der">,
3662
3682
  ): Promise<{
3663
- publicKey: Buffer;
3664
- privateKey: Buffer;
3683
+ publicKey: NonSharedBuffer;
3684
+ privateKey: NonSharedBuffer;
3665
3685
  }>;
3666
3686
  function __promisify__(
3667
3687
  type: "ml-kem-1024" | "ml-kem-512" | "ml-kem-768",
@@ -3779,12 +3799,12 @@ declare module "crypto" {
3779
3799
  algorithm: string | null | undefined,
3780
3800
  data: NodeJS.ArrayBufferView,
3781
3801
  key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
3782
- ): Buffer;
3802
+ ): NonSharedBuffer;
3783
3803
  function sign(
3784
3804
  algorithm: string | null | undefined,
3785
3805
  data: NodeJS.ArrayBufferView,
3786
3806
  key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
3787
- callback: (error: Error | null, data: Buffer) => void,
3807
+ callback: (error: Error | null, data: NonSharedBuffer) => void,
3788
3808
  ): void;
3789
3809
  /**
3790
3810
  * Verifies the given signature for `data` using the given key and algorithm. If
@@ -3841,11 +3861,11 @@ declare module "crypto" {
3841
3861
  function decapsulate(
3842
3862
  key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
3843
3863
  ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
3844
- ): Buffer;
3864
+ ): NonSharedBuffer;
3845
3865
  function decapsulate(
3846
3866
  key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
3847
3867
  ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
3848
- callback: (err: Error, sharedKey: Buffer) => void,
3868
+ callback: (err: Error, sharedKey: NonSharedBuffer) => void,
3849
3869
  ): void;
3850
3870
  /**
3851
3871
  * Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`.
@@ -3855,10 +3875,10 @@ declare module "crypto" {
3855
3875
  * If the `callback` function is provided this function uses libuv's threadpool.
3856
3876
  * @since v13.9.0, v12.17.0
3857
3877
  */
3858
- function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
3878
+ function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer;
3859
3879
  function diffieHellman(
3860
3880
  options: { privateKey: KeyObject; publicKey: KeyObject },
3861
- callback: (err: Error | null, secret: Buffer) => void,
3881
+ callback: (err: Error | null, secret: NonSharedBuffer) => void,
3862
3882
  ): void;
3863
3883
  /**
3864
3884
  * Key encapsulation using a KEM algorithm with a public key.
@@ -3879,10 +3899,12 @@ declare module "crypto" {
3879
3899
  * If the `callback` function is provided this function uses libuv's threadpool.
3880
3900
  * @since v24.7.0
3881
3901
  */
3882
- function encapsulate(key: KeyLike | PublicKeyInput | JsonWebKeyInput): { sharedKey: Buffer; ciphertext: Buffer };
3883
3902
  function encapsulate(
3884
3903
  key: KeyLike | PublicKeyInput | JsonWebKeyInput,
3885
- callback: (err: Error, result: { sharedKey: Buffer; ciphertext: Buffer }) => void,
3904
+ ): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer };
3905
+ function encapsulate(
3906
+ key: KeyLike | PublicKeyInput | JsonWebKeyInput,
3907
+ callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void,
3886
3908
  ): void;
3887
3909
  interface OneShotDigestOptions {
3888
3910
  /**
@@ -3947,12 +3969,12 @@ declare module "crypto" {
3947
3969
  algorithm: string,
3948
3970
  data: BinaryLike,
3949
3971
  options: OneShotDigestOptionsWithBufferEncoding | "buffer",
3950
- ): Buffer;
3972
+ ): NonSharedBuffer;
3951
3973
  function hash(
3952
3974
  algorithm: string,
3953
3975
  data: BinaryLike,
3954
3976
  options: OneShotDigestOptions | BinaryToTextEncoding | "buffer",
3955
- ): string | Buffer;
3977
+ ): string | NonSharedBuffer;
3956
3978
  type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
3957
3979
  interface CipherInfoOptions {
3958
3980
  /**
@@ -4244,7 +4266,7 @@ declare module "crypto" {
4244
4266
  * A `Buffer` containing the DER encoding of this certificate.
4245
4267
  * @since v15.6.0
4246
4268
  */
4247
- readonly raw: Buffer;
4269
+ readonly raw: NonSharedBuffer;
4248
4270
  /**
4249
4271
  * The serial number of this certificate.
4250
4272
  *
@@ -4622,7 +4644,7 @@ declare module "crypto" {
4622
4644
  function argon2(
4623
4645
  algorithm: Argon2Algorithm,
4624
4646
  parameters: Argon2Parameters,
4625
- callback: (err: Error | null, derivedKey: Buffer) => void,
4647
+ callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
4626
4648
  ): void;
4627
4649
  /**
4628
4650
  * Provides a synchronous [Argon2][] implementation. Argon2 is a password-based
@@ -4659,7 +4681,7 @@ declare module "crypto" {
4659
4681
  * @since v24.7.0
4660
4682
  * @experimental
4661
4683
  */
4662
- function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): Buffer;
4684
+ function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer;
4663
4685
  /**
4664
4686
  * A convenient alias for `crypto.webcrypto.subtle`.
4665
4687
  * @since v17.4.0