omegon 0.8.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extensions/cleave/dispatcher.ts +213 -20
- package/extensions/cleave/index.ts +24 -8
- package/extensions/cleave/rpc-child.ts +269 -0
- package/extensions/cleave/types.ts +52 -0
- package/extensions/openspec/spec.ts +3 -0
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +11 -5
- package/node_modules/@types/node/assert.d.ts +173 -50
- package/node_modules/@types/node/async_hooks.d.ts +8 -28
- package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/buffer.d.ts +168 -44
- package/node_modules/@types/node/child_process.d.ts +70 -27
- package/node_modules/@types/node/cluster.d.ts +332 -240
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
- package/node_modules/@types/node/console.d.ts +350 -49
- package/node_modules/@types/node/constants.d.ts +4 -3
- package/node_modules/@types/node/crypto.d.ts +1110 -630
- package/node_modules/@types/node/dgram.d.ts +51 -15
- package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
- package/node_modules/@types/node/dns/promises.d.ts +4 -4
- package/node_modules/@types/node/dns.d.ts +133 -132
- package/node_modules/@types/node/domain.d.ts +17 -13
- package/node_modules/@types/node/events.d.ts +663 -734
- package/node_modules/@types/node/fs/promises.d.ts +9 -43
- package/node_modules/@types/node/fs.d.ts +411 -628
- package/node_modules/@types/node/globals.d.ts +30 -8
- package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
- package/node_modules/@types/node/http.d.ts +265 -364
- package/node_modules/@types/node/http2.d.ts +715 -551
- package/node_modules/@types/node/https.d.ts +239 -65
- package/node_modules/@types/node/index.d.ts +6 -24
- package/node_modules/@types/node/inspector.d.ts +53 -69
- package/node_modules/@types/node/inspector.generated.d.ts +410 -759
- package/node_modules/@types/node/module.d.ts +186 -52
- package/node_modules/@types/node/net.d.ts +194 -70
- package/node_modules/@types/node/os.d.ts +11 -12
- package/node_modules/@types/node/package.json +3 -13
- package/node_modules/@types/node/path.d.ts +133 -120
- package/node_modules/@types/node/perf_hooks.d.ts +643 -318
- package/node_modules/@types/node/process.d.ts +132 -223
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +4 -4
- package/node_modules/@types/node/readline/promises.d.ts +3 -3
- package/node_modules/@types/node/readline.d.ts +120 -68
- package/node_modules/@types/node/repl.d.ts +100 -87
- package/node_modules/@types/node/sea.d.ts +1 -10
- package/node_modules/@types/node/sqlite.d.ts +19 -363
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +15 -136
- package/node_modules/@types/node/stream/web.d.ts +502 -176
- package/node_modules/@types/node/stream.d.ts +475 -581
- package/node_modules/@types/node/string_decoder.d.ts +4 -4
- package/node_modules/@types/node/test.d.ts +196 -308
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +132 -4
- package/node_modules/@types/node/tls.d.ts +226 -110
- package/node_modules/@types/node/trace_events.d.ts +9 -9
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
- package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
- package/node_modules/@types/node/tty.d.ts +16 -58
- package/node_modules/@types/node/url.d.ts +573 -130
- package/node_modules/@types/node/util.d.ts +1100 -181
- package/node_modules/@types/node/v8.d.ts +8 -76
- package/node_modules/@types/node/vm.d.ts +72 -280
- package/node_modules/@types/node/wasi.d.ts +4 -25
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
- package/node_modules/@types/node/web-globals/events.d.ts +0 -9
- package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
- package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
- package/node_modules/@types/node/worker_threads.d.ts +335 -268
- package/node_modules/@types/node/zlib.d.ts +74 -9
- package/node_modules/undici-types/agent.d.ts +12 -13
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +12 -13
- package/node_modules/undici-types/client.d.ts +19 -19
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
- package/node_modules/undici-types/dispatcher.d.ts +103 -123
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
- package/node_modules/undici-types/errors.d.ts +54 -66
- package/node_modules/undici-types/eventsource.d.ts +4 -9
- package/node_modules/undici-types/fetch.d.ts +20 -22
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +7 -7
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/handlers.d.ts +8 -8
- package/node_modules/undici-types/header.d.ts +1 -157
- package/node_modules/undici-types/index.d.ts +47 -64
- package/node_modules/undici-types/interceptors.d.ts +8 -64
- package/node_modules/undici-types/mock-agent.d.ts +18 -36
- package/node_modules/undici-types/mock-client.d.ts +4 -6
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
- package/node_modules/undici-types/mock-pool.d.ts +4 -6
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +4 -0
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +13 -15
- package/node_modules/undici-types/proxy-agent.d.ts +4 -5
- package/node_modules/undici-types/readable.d.ts +16 -19
- package/node_modules/undici-types/retry-agent.d.ts +1 -1
- package/node_modules/undici-types/retry-handler.d.ts +10 -19
- package/node_modules/undici-types/util.d.ts +3 -3
- package/node_modules/undici-types/webidl.d.ts +29 -142
- package/node_modules/undici-types/websocket.d.ts +10 -46
- package/package.json +2 -1
- package/skills/cleave/SKILL.md +62 -2
- package/node_modules/@types/node/inspector/promises.d.ts +0 -41
- package/node_modules/@types/node/path/posix.d.ts +0 -8
- package/node_modules/@types/node/path/win32.d.ts +0 -8
- package/node_modules/@types/node/quic.d.ts +0 -910
- package/node_modules/@types/node/test/reporters.d.ts +0 -96
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
- package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
- package/node_modules/@types/node/util/types.d.ts +0 -558
- package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
- package/node_modules/@types/node/web-globals/console.d.ts +0 -9
- package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
- package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
- package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
- package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
- package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
- package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
- package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
- package/node_modules/@types/node/web-globals/url.d.ts +0 -24
- package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
- package/node_modules/undici-types/client-stats.d.ts +0 -15
- package/node_modules/undici-types/h2c-client.d.ts +0 -73
- package/node_modules/undici-types/mock-call-history.d.ts +0 -111
- package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
- package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
- package/node_modules/undici-types/utility.d.ts +0 -7
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* // Prints:
|
|
15
15
|
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
|
|
16
16
|
* ```
|
|
17
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
17
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/crypto.js)
|
|
18
18
|
*/
|
|
19
|
-
declare module "
|
|
19
|
+
declare module "crypto" {
|
|
20
20
|
import { NonSharedBuffer } from "node:buffer";
|
|
21
21
|
import * as stream from "node:stream";
|
|
22
22
|
import { PeerCertificate } from "node:tls";
|
|
@@ -97,7 +97,7 @@ declare module "node:crypto" {
|
|
|
97
97
|
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
|
|
98
98
|
}
|
|
99
99
|
namespace constants {
|
|
100
|
-
// https://nodejs.org/dist/latest-
|
|
100
|
+
// https://nodejs.org/dist/latest-v22.x/docs/api/crypto.html#crypto-constants
|
|
101
101
|
const OPENSSL_VERSION_NUMBER: number;
|
|
102
102
|
/** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
|
|
103
103
|
const SSL_OP_ALL: number;
|
|
@@ -471,6 +471,7 @@ declare module "node:crypto" {
|
|
|
471
471
|
* // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
|
|
472
472
|
* ```
|
|
473
473
|
* @since v0.1.94
|
|
474
|
+
* @deprecated Since v20.13.0 Calling `Hmac` class directly with `Hmac()` or `new Hmac()` is deprecated due to being internals, not intended for public use. Please use the {@link createHmac} method to create Hmac instances.
|
|
474
475
|
*/
|
|
475
476
|
class Hmac extends stream.Transform {
|
|
476
477
|
private constructor();
|
|
@@ -499,66 +500,32 @@ declare module "node:crypto" {
|
|
|
499
500
|
digest(): NonSharedBuffer;
|
|
500
501
|
digest(encoding: BinaryToTextEncoding): string;
|
|
501
502
|
}
|
|
502
|
-
type KeyFormat = "pem" | "der" | "jwk";
|
|
503
503
|
type KeyObjectType = "secret" | "public" | "private";
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
| SymmetricKeyExportOptions
|
|
508
|
-
| PublicKeyExportOptions
|
|
509
|
-
| PrivateKeyExportOptions
|
|
510
|
-
| JwkKeyExportOptions;
|
|
511
|
-
interface SymmetricKeyExportOptions {
|
|
512
|
-
format?: "buffer" | undefined;
|
|
513
|
-
}
|
|
514
|
-
interface PublicKeyExportOptions<T extends PublicKeyExportType = PublicKeyExportType> {
|
|
515
|
-
type: T;
|
|
516
|
-
format: Exclude<KeyFormat, "jwk">;
|
|
517
|
-
}
|
|
518
|
-
interface PrivateKeyExportOptions<T extends PrivateKeyExportType = PrivateKeyExportType> {
|
|
519
|
-
type: T;
|
|
520
|
-
format: Exclude<KeyFormat, "jwk">;
|
|
504
|
+
interface KeyExportOptions<T extends KeyFormat> {
|
|
505
|
+
type: "pkcs1" | "spki" | "pkcs8" | "sec1";
|
|
506
|
+
format: T;
|
|
521
507
|
cipher?: string | undefined;
|
|
522
508
|
passphrase?: string | Buffer | undefined;
|
|
523
509
|
}
|
|
524
510
|
interface JwkKeyExportOptions {
|
|
525
511
|
format: "jwk";
|
|
526
512
|
}
|
|
527
|
-
interface
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
publicKey: KeyExportResult<T["publicKeyEncoding"], KeyObject>,
|
|
544
|
-
privateKey: KeyExportResult<T["privateKeyEncoding"], KeyObject>,
|
|
545
|
-
) => void;
|
|
546
|
-
type MLDSAKeyType = `ml-dsa-${44 | 65 | 87}`;
|
|
547
|
-
type MLKEMKeyType = `ml-kem-${1024 | 512 | 768}`;
|
|
548
|
-
type SLHDSAKeyType = `slh-dsa-${"sha2" | "shake"}-${128 | 192 | 256}${"f" | "s"}`;
|
|
549
|
-
type AsymmetricKeyType =
|
|
550
|
-
| "dh"
|
|
551
|
-
| "dsa"
|
|
552
|
-
| "ec"
|
|
553
|
-
| "ed25519"
|
|
554
|
-
| "ed448"
|
|
555
|
-
| MLDSAKeyType
|
|
556
|
-
| MLKEMKeyType
|
|
557
|
-
| "rsa-pss"
|
|
558
|
-
| "rsa"
|
|
559
|
-
| SLHDSAKeyType
|
|
560
|
-
| "x25519"
|
|
561
|
-
| "x448";
|
|
513
|
+
interface JsonWebKey {
|
|
514
|
+
crv?: string;
|
|
515
|
+
d?: string;
|
|
516
|
+
dp?: string;
|
|
517
|
+
dq?: string;
|
|
518
|
+
e?: string;
|
|
519
|
+
k?: string;
|
|
520
|
+
kty?: string;
|
|
521
|
+
n?: string;
|
|
522
|
+
p?: string;
|
|
523
|
+
q?: string;
|
|
524
|
+
qi?: string;
|
|
525
|
+
x?: string;
|
|
526
|
+
y?: string;
|
|
527
|
+
[key: string]: unknown;
|
|
528
|
+
}
|
|
562
529
|
interface AsymmetricKeyDetails {
|
|
563
530
|
/**
|
|
564
531
|
* Key size in bits (RSA, DSA).
|
|
@@ -625,14 +592,24 @@ declare module "node:crypto" {
|
|
|
625
592
|
*/
|
|
626
593
|
static from(key: webcrypto.CryptoKey): KeyObject;
|
|
627
594
|
/**
|
|
628
|
-
* For asymmetric keys, this property represents the type of the key.
|
|
629
|
-
*
|
|
595
|
+
* For asymmetric keys, this property represents the type of the key. Supported key
|
|
596
|
+
* types are:
|
|
597
|
+
*
|
|
598
|
+
* * `'rsa'` (OID 1.2.840.113549.1.1.1)
|
|
599
|
+
* * `'rsa-pss'` (OID 1.2.840.113549.1.1.10)
|
|
600
|
+
* * `'dsa'` (OID 1.2.840.10040.4.1)
|
|
601
|
+
* * `'ec'` (OID 1.2.840.10045.2.1)
|
|
602
|
+
* * `'x25519'` (OID 1.3.101.110)
|
|
603
|
+
* * `'x448'` (OID 1.3.101.111)
|
|
604
|
+
* * `'ed25519'` (OID 1.3.101.112)
|
|
605
|
+
* * `'ed448'` (OID 1.3.101.113)
|
|
606
|
+
* * `'dh'` (OID 1.2.840.113549.1.3.1)
|
|
630
607
|
*
|
|
631
608
|
* This property is `undefined` for unrecognized `KeyObject` types and symmetric
|
|
632
609
|
* keys.
|
|
633
610
|
* @since v11.6.0
|
|
634
611
|
*/
|
|
635
|
-
asymmetricKeyType?:
|
|
612
|
+
asymmetricKeyType?: KeyType;
|
|
636
613
|
/**
|
|
637
614
|
* This property exists only on asymmetric keys. Depending on the type of the key,
|
|
638
615
|
* this object contains information about the key. None of the information obtained
|
|
@@ -670,7 +647,9 @@ declare module "node:crypto" {
|
|
|
670
647
|
* PKCS#1 and SEC1 encryption.
|
|
671
648
|
* @since v11.6.0
|
|
672
649
|
*/
|
|
673
|
-
export
|
|
650
|
+
export(options: KeyExportOptions<"pem">): string | NonSharedBuffer;
|
|
651
|
+
export(options?: KeyExportOptions<"der">): NonSharedBuffer;
|
|
652
|
+
export(options?: JwkKeyExportOptions): JsonWebKey;
|
|
674
653
|
/**
|
|
675
654
|
* Returns `true` or `false` depending on whether the keys have exactly the same
|
|
676
655
|
* type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing_attack).
|
|
@@ -782,9 +761,9 @@ declare module "node:crypto" {
|
|
|
782
761
|
key: CipherKey,
|
|
783
762
|
iv: BinaryLike | null,
|
|
784
763
|
options?: stream.TransformOptions,
|
|
785
|
-
):
|
|
764
|
+
): Cipher;
|
|
786
765
|
/**
|
|
787
|
-
* Instances of the `
|
|
766
|
+
* Instances of the `Cipher` class are used to encrypt data. The class can be
|
|
788
767
|
* used in one of two ways:
|
|
789
768
|
*
|
|
790
769
|
* * As a `stream` that is both readable and writable, where plain unencrypted
|
|
@@ -793,10 +772,10 @@ declare module "node:crypto" {
|
|
|
793
772
|
* the encrypted data.
|
|
794
773
|
*
|
|
795
774
|
* The {@link createCipheriv} method is
|
|
796
|
-
* used to create `
|
|
775
|
+
* used to create `Cipher` instances. `Cipher` objects are not to be created
|
|
797
776
|
* directly using the `new` keyword.
|
|
798
777
|
*
|
|
799
|
-
* Example: Using `
|
|
778
|
+
* Example: Using `Cipher` objects as streams:
|
|
800
779
|
*
|
|
801
780
|
* ```js
|
|
802
781
|
* const {
|
|
@@ -831,7 +810,7 @@ declare module "node:crypto" {
|
|
|
831
810
|
* });
|
|
832
811
|
* ```
|
|
833
812
|
*
|
|
834
|
-
* Example: Using `
|
|
813
|
+
* Example: Using `Cipher` and piped streams:
|
|
835
814
|
*
|
|
836
815
|
* ```js
|
|
837
816
|
* import {
|
|
@@ -902,7 +881,7 @@ declare module "node:crypto" {
|
|
|
902
881
|
* ```
|
|
903
882
|
* @since v0.1.94
|
|
904
883
|
*/
|
|
905
|
-
class
|
|
884
|
+
class Cipher extends stream.Transform {
|
|
906
885
|
private constructor();
|
|
907
886
|
/**
|
|
908
887
|
* Updates the cipher with `data`. If the `inputEncoding` argument is given,
|
|
@@ -923,7 +902,7 @@ declare module "node:crypto" {
|
|
|
923
902
|
update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
|
|
924
903
|
update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
|
|
925
904
|
/**
|
|
926
|
-
* Once the `cipher.final()` method has been called, the `
|
|
905
|
+
* Once the `cipher.final()` method has been called, the `Cipher` object can no
|
|
927
906
|
* longer be used to encrypt data. Attempts to call `cipher.final()` more than
|
|
928
907
|
* once will result in an error being thrown.
|
|
929
908
|
* @since v0.1.94
|
|
@@ -933,7 +912,7 @@ declare module "node:crypto" {
|
|
|
933
912
|
final(): NonSharedBuffer;
|
|
934
913
|
final(outputEncoding: BufferEncoding): string;
|
|
935
914
|
/**
|
|
936
|
-
* When using block encryption algorithms, the `
|
|
915
|
+
* When using block encryption algorithms, the `Cipher` class will automatically
|
|
937
916
|
* add padding to the input data to the appropriate block size. To disable the
|
|
938
917
|
* default padding call `cipher.setAutoPadding(false)`.
|
|
939
918
|
*
|
|
@@ -949,7 +928,7 @@ declare module "node:crypto" {
|
|
|
949
928
|
*/
|
|
950
929
|
setAutoPadding(autoPadding?: boolean): this;
|
|
951
930
|
}
|
|
952
|
-
interface CipherCCM extends
|
|
931
|
+
interface CipherCCM extends Cipher {
|
|
953
932
|
setAAD(
|
|
954
933
|
buffer: NodeJS.ArrayBufferView,
|
|
955
934
|
options: {
|
|
@@ -958,7 +937,7 @@ declare module "node:crypto" {
|
|
|
958
937
|
): this;
|
|
959
938
|
getAuthTag(): NonSharedBuffer;
|
|
960
939
|
}
|
|
961
|
-
interface CipherGCM extends
|
|
940
|
+
interface CipherGCM extends Cipher {
|
|
962
941
|
setAAD(
|
|
963
942
|
buffer: NodeJS.ArrayBufferView,
|
|
964
943
|
options?: {
|
|
@@ -967,7 +946,7 @@ declare module "node:crypto" {
|
|
|
967
946
|
): this;
|
|
968
947
|
getAuthTag(): NonSharedBuffer;
|
|
969
948
|
}
|
|
970
|
-
interface CipherOCB extends
|
|
949
|
+
interface CipherOCB extends Cipher {
|
|
971
950
|
setAAD(
|
|
972
951
|
buffer: NodeJS.ArrayBufferView,
|
|
973
952
|
options?: {
|
|
@@ -976,7 +955,7 @@ declare module "node:crypto" {
|
|
|
976
955
|
): this;
|
|
977
956
|
getAuthTag(): NonSharedBuffer;
|
|
978
957
|
}
|
|
979
|
-
interface CipherChaCha20Poly1305 extends
|
|
958
|
+
interface CipherChaCha20Poly1305 extends Cipher {
|
|
980
959
|
setAAD(
|
|
981
960
|
buffer: NodeJS.ArrayBufferView,
|
|
982
961
|
options: {
|
|
@@ -986,7 +965,7 @@ declare module "node:crypto" {
|
|
|
986
965
|
getAuthTag(): NonSharedBuffer;
|
|
987
966
|
}
|
|
988
967
|
/**
|
|
989
|
-
* Creates and returns a `
|
|
968
|
+
* Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
|
|
990
969
|
*
|
|
991
970
|
* The `options` argument controls stream behavior and is optional except when a
|
|
992
971
|
* cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the
|
|
@@ -1043,9 +1022,9 @@ declare module "node:crypto" {
|
|
|
1043
1022
|
key: CipherKey,
|
|
1044
1023
|
iv: BinaryLike | null,
|
|
1045
1024
|
options?: stream.TransformOptions,
|
|
1046
|
-
):
|
|
1025
|
+
): Decipher;
|
|
1047
1026
|
/**
|
|
1048
|
-
* Instances of the `
|
|
1027
|
+
* Instances of the `Decipher` class are used to decrypt data. The class can be
|
|
1049
1028
|
* used in one of two ways:
|
|
1050
1029
|
*
|
|
1051
1030
|
* * As a `stream` that is both readable and writable, where plain encrypted
|
|
@@ -1054,10 +1033,10 @@ declare module "node:crypto" {
|
|
|
1054
1033
|
* produce the unencrypted data.
|
|
1055
1034
|
*
|
|
1056
1035
|
* The {@link createDecipheriv} method is
|
|
1057
|
-
* used to create `
|
|
1036
|
+
* used to create `Decipher` instances. `Decipher` objects are not to be created
|
|
1058
1037
|
* directly using the `new` keyword.
|
|
1059
1038
|
*
|
|
1060
|
-
* Example: Using `
|
|
1039
|
+
* Example: Using `Decipher` objects as streams:
|
|
1061
1040
|
*
|
|
1062
1041
|
* ```js
|
|
1063
1042
|
* import { Buffer } from 'node:buffer';
|
|
@@ -1096,7 +1075,7 @@ declare module "node:crypto" {
|
|
|
1096
1075
|
* decipher.end();
|
|
1097
1076
|
* ```
|
|
1098
1077
|
*
|
|
1099
|
-
* Example: Using `
|
|
1078
|
+
* Example: Using `Decipher` and piped streams:
|
|
1100
1079
|
*
|
|
1101
1080
|
* ```js
|
|
1102
1081
|
* import {
|
|
@@ -1152,7 +1131,7 @@ declare module "node:crypto" {
|
|
|
1152
1131
|
* ```
|
|
1153
1132
|
* @since v0.1.94
|
|
1154
1133
|
*/
|
|
1155
|
-
class
|
|
1134
|
+
class Decipher extends stream.Transform {
|
|
1156
1135
|
private constructor();
|
|
1157
1136
|
/**
|
|
1158
1137
|
* Updates the decipher with `data`. If the `inputEncoding` argument is given,
|
|
@@ -1173,7 +1152,7 @@ declare module "node:crypto" {
|
|
|
1173
1152
|
update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;
|
|
1174
1153
|
update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;
|
|
1175
1154
|
/**
|
|
1176
|
-
* Once the `decipher.final()` method has been called, the `
|
|
1155
|
+
* Once the `decipher.final()` method has been called, the `Decipher` object can
|
|
1177
1156
|
* no longer be used to decrypt data. Attempts to call `decipher.final()` more
|
|
1178
1157
|
* than once will result in an error being thrown.
|
|
1179
1158
|
* @since v0.1.94
|
|
@@ -1196,7 +1175,7 @@ declare module "node:crypto" {
|
|
|
1196
1175
|
*/
|
|
1197
1176
|
setAutoPadding(auto_padding?: boolean): this;
|
|
1198
1177
|
}
|
|
1199
|
-
interface DecipherCCM extends
|
|
1178
|
+
interface DecipherCCM extends Decipher {
|
|
1200
1179
|
setAuthTag(buffer: NodeJS.ArrayBufferView): this;
|
|
1201
1180
|
setAAD(
|
|
1202
1181
|
buffer: NodeJS.ArrayBufferView,
|
|
@@ -1205,7 +1184,7 @@ declare module "node:crypto" {
|
|
|
1205
1184
|
},
|
|
1206
1185
|
): this;
|
|
1207
1186
|
}
|
|
1208
|
-
interface DecipherGCM extends
|
|
1187
|
+
interface DecipherGCM extends Decipher {
|
|
1209
1188
|
setAuthTag(buffer: NodeJS.ArrayBufferView): this;
|
|
1210
1189
|
setAAD(
|
|
1211
1190
|
buffer: NodeJS.ArrayBufferView,
|
|
@@ -1214,7 +1193,7 @@ declare module "node:crypto" {
|
|
|
1214
1193
|
},
|
|
1215
1194
|
): this;
|
|
1216
1195
|
}
|
|
1217
|
-
interface DecipherOCB extends
|
|
1196
|
+
interface DecipherOCB extends Decipher {
|
|
1218
1197
|
setAuthTag(buffer: NodeJS.ArrayBufferView): this;
|
|
1219
1198
|
setAAD(
|
|
1220
1199
|
buffer: NodeJS.ArrayBufferView,
|
|
@@ -1223,7 +1202,7 @@ declare module "node:crypto" {
|
|
|
1223
1202
|
},
|
|
1224
1203
|
): this;
|
|
1225
1204
|
}
|
|
1226
|
-
interface DecipherChaCha20Poly1305 extends
|
|
1205
|
+
interface DecipherChaCha20Poly1305 extends Decipher {
|
|
1227
1206
|
setAuthTag(buffer: NodeJS.ArrayBufferView): this;
|
|
1228
1207
|
setAAD(
|
|
1229
1208
|
buffer: NodeJS.ArrayBufferView,
|
|
@@ -1235,14 +1214,14 @@ declare module "node:crypto" {
|
|
|
1235
1214
|
interface PrivateKeyInput {
|
|
1236
1215
|
key: string | Buffer;
|
|
1237
1216
|
format?: KeyFormat | undefined;
|
|
1238
|
-
type?:
|
|
1217
|
+
type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
|
|
1239
1218
|
passphrase?: string | Buffer | undefined;
|
|
1240
1219
|
encoding?: string | undefined;
|
|
1241
1220
|
}
|
|
1242
1221
|
interface PublicKeyInput {
|
|
1243
1222
|
key: string | Buffer;
|
|
1244
1223
|
format?: KeyFormat | undefined;
|
|
1245
|
-
type?:
|
|
1224
|
+
type?: "pkcs1" | "spki" | undefined;
|
|
1246
1225
|
encoding?: string | undefined;
|
|
1247
1226
|
}
|
|
1248
1227
|
/**
|
|
@@ -1295,7 +1274,7 @@ declare module "node:crypto" {
|
|
|
1295
1274
|
},
|
|
1296
1275
|
): KeyObject;
|
|
1297
1276
|
interface JsonWebKeyInput {
|
|
1298
|
-
key:
|
|
1277
|
+
key: JsonWebKey;
|
|
1299
1278
|
format: "jwk";
|
|
1300
1279
|
}
|
|
1301
1280
|
/**
|
|
@@ -1342,7 +1321,6 @@ declare module "node:crypto" {
|
|
|
1342
1321
|
* @since v0.1.92
|
|
1343
1322
|
* @param options `stream.Writable` options
|
|
1344
1323
|
*/
|
|
1345
|
-
// TODO: signing algorithm type
|
|
1346
1324
|
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
|
|
1347
1325
|
type DSAEncoding = "der" | "ieee-p1363";
|
|
1348
1326
|
interface SigningOptions {
|
|
@@ -1352,7 +1330,6 @@ declare module "node:crypto" {
|
|
|
1352
1330
|
padding?: number | undefined;
|
|
1353
1331
|
saltLength?: number | undefined;
|
|
1354
1332
|
dsaEncoding?: DSAEncoding | undefined;
|
|
1355
|
-
context?: ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
1356
1333
|
}
|
|
1357
1334
|
interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
|
|
1358
1335
|
interface SignKeyObjectInput extends SigningOptions {
|
|
@@ -2499,27 +2476,66 @@ declare module "node:crypto" {
|
|
|
2499
2476
|
* @since v6.6.0
|
|
2500
2477
|
*/
|
|
2501
2478
|
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
|
|
2502
|
-
|
|
2479
|
+
type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
|
|
2480
|
+
type KeyFormat = "pem" | "der" | "jwk";
|
|
2481
|
+
interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
|
|
2482
|
+
format: T;
|
|
2483
|
+
cipher?: string | undefined;
|
|
2484
|
+
passphrase?: string | undefined;
|
|
2485
|
+
}
|
|
2486
|
+
interface KeyPairKeyObjectResult {
|
|
2487
|
+
publicKey: KeyObject;
|
|
2488
|
+
privateKey: KeyObject;
|
|
2489
|
+
}
|
|
2490
|
+
interface ED25519KeyPairKeyObjectOptions {}
|
|
2491
|
+
interface ED448KeyPairKeyObjectOptions {}
|
|
2492
|
+
interface X25519KeyPairKeyObjectOptions {}
|
|
2493
|
+
interface X448KeyPairKeyObjectOptions {}
|
|
2494
|
+
interface ECKeyPairKeyObjectOptions {
|
|
2495
|
+
/**
|
|
2496
|
+
* Name of the curve to use
|
|
2497
|
+
*/
|
|
2498
|
+
namedCurve: string;
|
|
2499
|
+
/**
|
|
2500
|
+
* Must be `'named'` or `'explicit'`. Default: `'named'`.
|
|
2501
|
+
*/
|
|
2502
|
+
paramEncoding?: "explicit" | "named" | undefined;
|
|
2503
|
+
}
|
|
2504
|
+
interface RSAKeyPairKeyObjectOptions {
|
|
2505
|
+
/**
|
|
2506
|
+
* Key size in bits
|
|
2507
|
+
*/
|
|
2508
|
+
modulusLength: number;
|
|
2503
2509
|
/**
|
|
2504
|
-
*
|
|
2510
|
+
* Public exponent
|
|
2511
|
+
* @default 0x10001
|
|
2505
2512
|
*/
|
|
2506
|
-
|
|
2513
|
+
publicExponent?: number | undefined;
|
|
2514
|
+
}
|
|
2515
|
+
interface RSAPSSKeyPairKeyObjectOptions {
|
|
2507
2516
|
/**
|
|
2508
|
-
*
|
|
2517
|
+
* Key size in bits
|
|
2509
2518
|
*/
|
|
2510
|
-
|
|
2519
|
+
modulusLength: number;
|
|
2511
2520
|
/**
|
|
2512
|
-
*
|
|
2513
|
-
* @default
|
|
2521
|
+
* Public exponent
|
|
2522
|
+
* @default 0x10001
|
|
2514
2523
|
*/
|
|
2515
|
-
|
|
2524
|
+
publicExponent?: number | undefined;
|
|
2516
2525
|
/**
|
|
2517
|
-
*
|
|
2518
|
-
* @see {@link getDiffieHellman}
|
|
2526
|
+
* Name of the message digest
|
|
2519
2527
|
*/
|
|
2520
|
-
|
|
2528
|
+
hashAlgorithm?: string | undefined;
|
|
2529
|
+
/**
|
|
2530
|
+
* Name of the message digest used by MGF1
|
|
2531
|
+
*/
|
|
2532
|
+
mgf1HashAlgorithm?: string | undefined;
|
|
2533
|
+
/**
|
|
2534
|
+
* Minimal salt length in bytes
|
|
2535
|
+
*/
|
|
2536
|
+
saltLength?: string | undefined;
|
|
2521
2537
|
}
|
|
2522
|
-
interface
|
|
2538
|
+
interface DSAKeyPairKeyObjectOptions {
|
|
2523
2539
|
/**
|
|
2524
2540
|
* Key size in bits
|
|
2525
2541
|
*/
|
|
@@ -2529,22 +2545,25 @@ declare module "node:crypto" {
|
|
|
2529
2545
|
*/
|
|
2530
2546
|
divisorLength: number;
|
|
2531
2547
|
}
|
|
2532
|
-
interface
|
|
2548
|
+
interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2533
2549
|
/**
|
|
2534
|
-
*
|
|
2550
|
+
* Key size in bits
|
|
2535
2551
|
*/
|
|
2536
|
-
|
|
2552
|
+
modulusLength: number;
|
|
2537
2553
|
/**
|
|
2538
|
-
*
|
|
2539
|
-
* @default
|
|
2554
|
+
* Public exponent
|
|
2555
|
+
* @default 0x10001
|
|
2540
2556
|
*/
|
|
2541
|
-
|
|
2557
|
+
publicExponent?: number | undefined;
|
|
2558
|
+
publicKeyEncoding: {
|
|
2559
|
+
type: "pkcs1" | "spki";
|
|
2560
|
+
format: PubF;
|
|
2561
|
+
};
|
|
2562
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2563
|
+
type: "pkcs1" | "pkcs8";
|
|
2564
|
+
};
|
|
2542
2565
|
}
|
|
2543
|
-
interface
|
|
2544
|
-
interface ED448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2545
|
-
interface MLDSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2546
|
-
interface MLKEMKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2547
|
-
interface RSAPSSKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {
|
|
2566
|
+
interface RSAPSSKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2548
2567
|
/**
|
|
2549
2568
|
* Key size in bits
|
|
2550
2569
|
*/
|
|
@@ -2566,24 +2585,83 @@ declare module "node:crypto" {
|
|
|
2566
2585
|
* Minimal salt length in bytes
|
|
2567
2586
|
*/
|
|
2568
2587
|
saltLength?: string | undefined;
|
|
2588
|
+
publicKeyEncoding: {
|
|
2589
|
+
type: "spki";
|
|
2590
|
+
format: PubF;
|
|
2591
|
+
};
|
|
2592
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2593
|
+
type: "pkcs8";
|
|
2594
|
+
};
|
|
2569
2595
|
}
|
|
2570
|
-
interface
|
|
2596
|
+
interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2571
2597
|
/**
|
|
2572
2598
|
* Key size in bits
|
|
2573
2599
|
*/
|
|
2574
2600
|
modulusLength: number;
|
|
2575
2601
|
/**
|
|
2576
|
-
*
|
|
2577
|
-
* @default 0x10001
|
|
2602
|
+
* Size of q in bits
|
|
2578
2603
|
*/
|
|
2579
|
-
|
|
2604
|
+
divisorLength: number;
|
|
2605
|
+
publicKeyEncoding: {
|
|
2606
|
+
type: "spki";
|
|
2607
|
+
format: PubF;
|
|
2608
|
+
};
|
|
2609
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2610
|
+
type: "pkcs8";
|
|
2611
|
+
};
|
|
2612
|
+
}
|
|
2613
|
+
interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> extends ECKeyPairKeyObjectOptions {
|
|
2614
|
+
publicKeyEncoding: {
|
|
2615
|
+
type: "pkcs1" | "spki";
|
|
2616
|
+
format: PubF;
|
|
2617
|
+
};
|
|
2618
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2619
|
+
type: "sec1" | "pkcs8";
|
|
2620
|
+
};
|
|
2621
|
+
}
|
|
2622
|
+
interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2623
|
+
publicKeyEncoding: {
|
|
2624
|
+
type: "spki";
|
|
2625
|
+
format: PubF;
|
|
2626
|
+
};
|
|
2627
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2628
|
+
type: "pkcs8";
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2631
|
+
interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2632
|
+
publicKeyEncoding: {
|
|
2633
|
+
type: "spki";
|
|
2634
|
+
format: PubF;
|
|
2635
|
+
};
|
|
2636
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2637
|
+
type: "pkcs8";
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2641
|
+
publicKeyEncoding: {
|
|
2642
|
+
type: "spki";
|
|
2643
|
+
format: PubF;
|
|
2644
|
+
};
|
|
2645
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2646
|
+
type: "pkcs8";
|
|
2647
|
+
};
|
|
2648
|
+
}
|
|
2649
|
+
interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
|
|
2650
|
+
publicKeyEncoding: {
|
|
2651
|
+
type: "spki";
|
|
2652
|
+
format: PubF;
|
|
2653
|
+
};
|
|
2654
|
+
privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
|
|
2655
|
+
type: "pkcs8";
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
|
|
2659
|
+
publicKey: T1;
|
|
2660
|
+
privateKey: T2;
|
|
2580
2661
|
}
|
|
2581
|
-
interface SLHDSAKeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2582
|
-
interface X25519KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2583
|
-
interface X448KeyPairOptions extends KeyPairExportOptions<"spki", "pkcs8"> {}
|
|
2584
2662
|
/**
|
|
2585
|
-
* Generates a new asymmetric key pair of the given `type`.
|
|
2586
|
-
*
|
|
2663
|
+
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2664
|
+
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
2587
2665
|
*
|
|
2588
2666
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
2589
2667
|
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
@@ -2620,60 +2698,147 @@ declare module "node:crypto" {
|
|
|
2620
2698
|
* When PEM encoding was selected, the respective key will be a string, otherwise
|
|
2621
2699
|
* it will be a buffer containing the data encoded as DER.
|
|
2622
2700
|
* @since v10.12.0
|
|
2623
|
-
* @param type
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2701
|
+
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
|
|
2702
|
+
*/
|
|
2703
|
+
function generateKeyPairSync(
|
|
2704
|
+
type: "rsa",
|
|
2705
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2706
|
+
): KeyPairSyncResult<string, string>;
|
|
2707
|
+
function generateKeyPairSync(
|
|
2708
|
+
type: "rsa",
|
|
2709
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2710
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2711
|
+
function generateKeyPairSync(
|
|
2712
|
+
type: "rsa",
|
|
2713
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2714
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2715
|
+
function generateKeyPairSync(
|
|
2716
|
+
type: "rsa",
|
|
2717
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2718
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2719
|
+
function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2720
|
+
function generateKeyPairSync(
|
|
2721
|
+
type: "rsa-pss",
|
|
2722
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2723
|
+
): KeyPairSyncResult<string, string>;
|
|
2724
|
+
function generateKeyPairSync(
|
|
2725
|
+
type: "rsa-pss",
|
|
2726
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2727
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2728
|
+
function generateKeyPairSync(
|
|
2729
|
+
type: "rsa-pss",
|
|
2730
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2731
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2732
|
+
function generateKeyPairSync(
|
|
2733
|
+
type: "rsa-pss",
|
|
2734
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2735
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2736
|
+
function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2737
|
+
function generateKeyPairSync(
|
|
2738
|
+
type: "dsa",
|
|
2739
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2740
|
+
): KeyPairSyncResult<string, string>;
|
|
2741
|
+
function generateKeyPairSync(
|
|
2742
|
+
type: "dsa",
|
|
2743
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2744
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2745
|
+
function generateKeyPairSync(
|
|
2631
2746
|
type: "dsa",
|
|
2632
|
-
options:
|
|
2633
|
-
):
|
|
2634
|
-
function generateKeyPairSync
|
|
2747
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2748
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2749
|
+
function generateKeyPairSync(
|
|
2750
|
+
type: "dsa",
|
|
2751
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2752
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2753
|
+
function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2754
|
+
function generateKeyPairSync(
|
|
2755
|
+
type: "ec",
|
|
2756
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2757
|
+
): KeyPairSyncResult<string, string>;
|
|
2758
|
+
function generateKeyPairSync(
|
|
2635
2759
|
type: "ec",
|
|
2636
|
-
options:
|
|
2637
|
-
):
|
|
2638
|
-
function generateKeyPairSync
|
|
2760
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2761
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2762
|
+
function generateKeyPairSync(
|
|
2763
|
+
type: "ec",
|
|
2764
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2765
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2766
|
+
function generateKeyPairSync(
|
|
2767
|
+
type: "ec",
|
|
2768
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2769
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2770
|
+
function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2771
|
+
function generateKeyPairSync(
|
|
2772
|
+
type: "ed25519",
|
|
2773
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2774
|
+
): KeyPairSyncResult<string, string>;
|
|
2775
|
+
function generateKeyPairSync(
|
|
2776
|
+
type: "ed25519",
|
|
2777
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2778
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2779
|
+
function generateKeyPairSync(
|
|
2780
|
+
type: "ed25519",
|
|
2781
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2782
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2783
|
+
function generateKeyPairSync(
|
|
2639
2784
|
type: "ed25519",
|
|
2640
|
-
options
|
|
2641
|
-
):
|
|
2642
|
-
function generateKeyPairSync
|
|
2785
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2786
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2787
|
+
function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2788
|
+
function generateKeyPairSync(
|
|
2643
2789
|
type: "ed448",
|
|
2644
|
-
options
|
|
2645
|
-
):
|
|
2646
|
-
function generateKeyPairSync
|
|
2647
|
-
type:
|
|
2648
|
-
options
|
|
2649
|
-
):
|
|
2650
|
-
function generateKeyPairSync
|
|
2651
|
-
type:
|
|
2652
|
-
options
|
|
2653
|
-
):
|
|
2654
|
-
function generateKeyPairSync
|
|
2655
|
-
type: "
|
|
2656
|
-
options:
|
|
2657
|
-
):
|
|
2658
|
-
function generateKeyPairSync
|
|
2659
|
-
|
|
2660
|
-
options: T,
|
|
2661
|
-
): KeyPairExportResult<T>;
|
|
2662
|
-
function generateKeyPairSync<T extends SLHDSAKeyPairOptions = {}>(
|
|
2663
|
-
type: SLHDSAKeyType,
|
|
2664
|
-
options?: T,
|
|
2665
|
-
): KeyPairExportResult<T>;
|
|
2666
|
-
function generateKeyPairSync<T extends X25519KeyPairOptions = {}>(
|
|
2790
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
2791
|
+
): KeyPairSyncResult<string, string>;
|
|
2792
|
+
function generateKeyPairSync(
|
|
2793
|
+
type: "ed448",
|
|
2794
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
2795
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2796
|
+
function generateKeyPairSync(
|
|
2797
|
+
type: "ed448",
|
|
2798
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
2799
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2800
|
+
function generateKeyPairSync(
|
|
2801
|
+
type: "ed448",
|
|
2802
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
2803
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2804
|
+
function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2805
|
+
function generateKeyPairSync(
|
|
2667
2806
|
type: "x25519",
|
|
2668
|
-
options
|
|
2669
|
-
):
|
|
2670
|
-
function generateKeyPairSync
|
|
2807
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
2808
|
+
): KeyPairSyncResult<string, string>;
|
|
2809
|
+
function generateKeyPairSync(
|
|
2810
|
+
type: "x25519",
|
|
2811
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
2812
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2813
|
+
function generateKeyPairSync(
|
|
2814
|
+
type: "x25519",
|
|
2815
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
2816
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2817
|
+
function generateKeyPairSync(
|
|
2818
|
+
type: "x25519",
|
|
2819
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
2820
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2821
|
+
function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2822
|
+
function generateKeyPairSync(
|
|
2823
|
+
type: "x448",
|
|
2824
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
2825
|
+
): KeyPairSyncResult<string, string>;
|
|
2826
|
+
function generateKeyPairSync(
|
|
2827
|
+
type: "x448",
|
|
2828
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
2829
|
+
): KeyPairSyncResult<string, NonSharedBuffer>;
|
|
2830
|
+
function generateKeyPairSync(
|
|
2831
|
+
type: "x448",
|
|
2832
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
2833
|
+
): KeyPairSyncResult<NonSharedBuffer, string>;
|
|
2834
|
+
function generateKeyPairSync(
|
|
2671
2835
|
type: "x448",
|
|
2672
|
-
options
|
|
2673
|
-
):
|
|
2836
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
2837
|
+
): KeyPairSyncResult<NonSharedBuffer, NonSharedBuffer>;
|
|
2838
|
+
function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
|
|
2674
2839
|
/**
|
|
2675
|
-
* Generates a new asymmetric key pair of the given `type`.
|
|
2676
|
-
*
|
|
2840
|
+
* Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC,
|
|
2841
|
+
* Ed25519, Ed448, X25519, X448, and DH are currently supported.
|
|
2677
2842
|
*
|
|
2678
2843
|
* If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
|
|
2679
2844
|
* behaves as if `keyObject.export()` had been called on its result. Otherwise,
|
|
@@ -2708,126 +2873,455 @@ declare module "node:crypto" {
|
|
|
2708
2873
|
* If this method is invoked as its `util.promisify()` ed version, it returns
|
|
2709
2874
|
* a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
|
|
2710
2875
|
* @since v10.12.0
|
|
2711
|
-
* @param type
|
|
2712
|
-
* supported [asymmetric key types](https://nodejs.org/docs/latest-v25.x/api/crypto.html#asymmetric-key-types).
|
|
2876
|
+
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
|
|
2713
2877
|
*/
|
|
2714
|
-
function generateKeyPair
|
|
2715
|
-
type: "
|
|
2716
|
-
options:
|
|
2717
|
-
callback:
|
|
2878
|
+
function generateKeyPair(
|
|
2879
|
+
type: "rsa",
|
|
2880
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
2881
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2882
|
+
): void;
|
|
2883
|
+
function generateKeyPair(
|
|
2884
|
+
type: "rsa",
|
|
2885
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
2886
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2887
|
+
): void;
|
|
2888
|
+
function generateKeyPair(
|
|
2889
|
+
type: "rsa",
|
|
2890
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
2891
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2892
|
+
): void;
|
|
2893
|
+
function generateKeyPair(
|
|
2894
|
+
type: "rsa",
|
|
2895
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
2896
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2897
|
+
): void;
|
|
2898
|
+
function generateKeyPair(
|
|
2899
|
+
type: "rsa",
|
|
2900
|
+
options: RSAKeyPairKeyObjectOptions,
|
|
2901
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2902
|
+
): void;
|
|
2903
|
+
function generateKeyPair(
|
|
2904
|
+
type: "rsa-pss",
|
|
2905
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
2906
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2907
|
+
): void;
|
|
2908
|
+
function generateKeyPair(
|
|
2909
|
+
type: "rsa-pss",
|
|
2910
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
2911
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2912
|
+
): void;
|
|
2913
|
+
function generateKeyPair(
|
|
2914
|
+
type: "rsa-pss",
|
|
2915
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
2916
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2718
2917
|
): void;
|
|
2719
|
-
function generateKeyPair
|
|
2918
|
+
function generateKeyPair(
|
|
2919
|
+
type: "rsa-pss",
|
|
2920
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
2921
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2922
|
+
): void;
|
|
2923
|
+
function generateKeyPair(
|
|
2924
|
+
type: "rsa-pss",
|
|
2925
|
+
options: RSAPSSKeyPairKeyObjectOptions,
|
|
2926
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2927
|
+
): void;
|
|
2928
|
+
function generateKeyPair(
|
|
2929
|
+
type: "dsa",
|
|
2930
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
2931
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2932
|
+
): void;
|
|
2933
|
+
function generateKeyPair(
|
|
2934
|
+
type: "dsa",
|
|
2935
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
2936
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2937
|
+
): void;
|
|
2938
|
+
function generateKeyPair(
|
|
2939
|
+
type: "dsa",
|
|
2940
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
2941
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2942
|
+
): void;
|
|
2943
|
+
function generateKeyPair(
|
|
2720
2944
|
type: "dsa",
|
|
2721
|
-
options:
|
|
2722
|
-
callback:
|
|
2945
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
2946
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2947
|
+
): void;
|
|
2948
|
+
function generateKeyPair(
|
|
2949
|
+
type: "dsa",
|
|
2950
|
+
options: DSAKeyPairKeyObjectOptions,
|
|
2951
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2952
|
+
): void;
|
|
2953
|
+
function generateKeyPair(
|
|
2954
|
+
type: "ec",
|
|
2955
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
2956
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2957
|
+
): void;
|
|
2958
|
+
function generateKeyPair(
|
|
2959
|
+
type: "ec",
|
|
2960
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
2961
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2962
|
+
): void;
|
|
2963
|
+
function generateKeyPair(
|
|
2964
|
+
type: "ec",
|
|
2965
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
2966
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2967
|
+
): void;
|
|
2968
|
+
function generateKeyPair(
|
|
2969
|
+
type: "ec",
|
|
2970
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
2971
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2723
2972
|
): void;
|
|
2724
|
-
function generateKeyPair
|
|
2973
|
+
function generateKeyPair(
|
|
2725
2974
|
type: "ec",
|
|
2726
|
-
options:
|
|
2727
|
-
callback:
|
|
2975
|
+
options: ECKeyPairKeyObjectOptions,
|
|
2976
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2728
2977
|
): void;
|
|
2729
|
-
function generateKeyPair
|
|
2978
|
+
function generateKeyPair(
|
|
2730
2979
|
type: "ed25519",
|
|
2731
|
-
options:
|
|
2732
|
-
callback:
|
|
2980
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
2981
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2733
2982
|
): void;
|
|
2734
|
-
function generateKeyPair
|
|
2983
|
+
function generateKeyPair(
|
|
2984
|
+
type: "ed25519",
|
|
2985
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
2986
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2987
|
+
): void;
|
|
2988
|
+
function generateKeyPair(
|
|
2989
|
+
type: "ed25519",
|
|
2990
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
2991
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2992
|
+
): void;
|
|
2993
|
+
function generateKeyPair(
|
|
2994
|
+
type: "ed25519",
|
|
2995
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
2996
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2997
|
+
): void;
|
|
2998
|
+
function generateKeyPair(
|
|
2999
|
+
type: "ed25519",
|
|
3000
|
+
options: ED25519KeyPairKeyObjectOptions | undefined,
|
|
3001
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3002
|
+
): void;
|
|
3003
|
+
function generateKeyPair(
|
|
2735
3004
|
type: "ed448",
|
|
2736
|
-
options:
|
|
2737
|
-
callback:
|
|
3005
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
3006
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2738
3007
|
): void;
|
|
2739
|
-
function generateKeyPair
|
|
2740
|
-
type:
|
|
2741
|
-
options:
|
|
2742
|
-
callback:
|
|
3008
|
+
function generateKeyPair(
|
|
3009
|
+
type: "ed448",
|
|
3010
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
3011
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
2743
3012
|
): void;
|
|
2744
|
-
function generateKeyPair
|
|
2745
|
-
type:
|
|
2746
|
-
options:
|
|
2747
|
-
callback:
|
|
3013
|
+
function generateKeyPair(
|
|
3014
|
+
type: "ed448",
|
|
3015
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
3016
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
2748
3017
|
): void;
|
|
2749
|
-
function generateKeyPair
|
|
2750
|
-
type: "
|
|
2751
|
-
options:
|
|
2752
|
-
callback:
|
|
3018
|
+
function generateKeyPair(
|
|
3019
|
+
type: "ed448",
|
|
3020
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
3021
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2753
3022
|
): void;
|
|
2754
|
-
function generateKeyPair
|
|
2755
|
-
type: "
|
|
2756
|
-
options:
|
|
2757
|
-
callback:
|
|
3023
|
+
function generateKeyPair(
|
|
3024
|
+
type: "ed448",
|
|
3025
|
+
options: ED448KeyPairKeyObjectOptions | undefined,
|
|
3026
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
3027
|
+
): void;
|
|
3028
|
+
function generateKeyPair(
|
|
3029
|
+
type: "x25519",
|
|
3030
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
3031
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
2758
3032
|
): void;
|
|
2759
|
-
function generateKeyPair
|
|
2760
|
-
type:
|
|
2761
|
-
options:
|
|
2762
|
-
callback:
|
|
3033
|
+
function generateKeyPair(
|
|
3034
|
+
type: "x25519",
|
|
3035
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
3036
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
3037
|
+
): void;
|
|
3038
|
+
function generateKeyPair(
|
|
3039
|
+
type: "x25519",
|
|
3040
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
3041
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
3042
|
+
): void;
|
|
3043
|
+
function generateKeyPair(
|
|
3044
|
+
type: "x25519",
|
|
3045
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
3046
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
2763
3047
|
): void;
|
|
2764
|
-
function generateKeyPair
|
|
3048
|
+
function generateKeyPair(
|
|
2765
3049
|
type: "x25519",
|
|
2766
|
-
options:
|
|
2767
|
-
callback:
|
|
3050
|
+
options: X25519KeyPairKeyObjectOptions | undefined,
|
|
3051
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2768
3052
|
): void;
|
|
2769
|
-
function generateKeyPair
|
|
3053
|
+
function generateKeyPair(
|
|
2770
3054
|
type: "x448",
|
|
2771
|
-
options:
|
|
2772
|
-
callback:
|
|
3055
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
3056
|
+
callback: (err: Error | null, publicKey: string, privateKey: string) => void,
|
|
3057
|
+
): void;
|
|
3058
|
+
function generateKeyPair(
|
|
3059
|
+
type: "x448",
|
|
3060
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
3061
|
+
callback: (err: Error | null, publicKey: string, privateKey: NonSharedBuffer) => void,
|
|
3062
|
+
): void;
|
|
3063
|
+
function generateKeyPair(
|
|
3064
|
+
type: "x448",
|
|
3065
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
3066
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: string) => void,
|
|
3067
|
+
): void;
|
|
3068
|
+
function generateKeyPair(
|
|
3069
|
+
type: "x448",
|
|
3070
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
3071
|
+
callback: (err: Error | null, publicKey: NonSharedBuffer, privateKey: NonSharedBuffer) => void,
|
|
3072
|
+
): void;
|
|
3073
|
+
function generateKeyPair(
|
|
3074
|
+
type: "x448",
|
|
3075
|
+
options: X448KeyPairKeyObjectOptions | undefined,
|
|
3076
|
+
callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
|
|
2773
3077
|
): void;
|
|
2774
3078
|
namespace generateKeyPair {
|
|
2775
|
-
function __promisify__
|
|
2776
|
-
type: "
|
|
2777
|
-
options:
|
|
2778
|
-
): Promise<
|
|
2779
|
-
|
|
3079
|
+
function __promisify__(
|
|
3080
|
+
type: "rsa",
|
|
3081
|
+
options: RSAKeyPairOptions<"pem", "pem">,
|
|
3082
|
+
): Promise<{
|
|
3083
|
+
publicKey: string;
|
|
3084
|
+
privateKey: string;
|
|
3085
|
+
}>;
|
|
3086
|
+
function __promisify__(
|
|
3087
|
+
type: "rsa",
|
|
3088
|
+
options: RSAKeyPairOptions<"pem", "der">,
|
|
3089
|
+
): Promise<{
|
|
3090
|
+
publicKey: string;
|
|
3091
|
+
privateKey: NonSharedBuffer;
|
|
3092
|
+
}>;
|
|
3093
|
+
function __promisify__(
|
|
3094
|
+
type: "rsa",
|
|
3095
|
+
options: RSAKeyPairOptions<"der", "pem">,
|
|
3096
|
+
): Promise<{
|
|
3097
|
+
publicKey: NonSharedBuffer;
|
|
3098
|
+
privateKey: string;
|
|
3099
|
+
}>;
|
|
3100
|
+
function __promisify__(
|
|
3101
|
+
type: "rsa",
|
|
3102
|
+
options: RSAKeyPairOptions<"der", "der">,
|
|
3103
|
+
): Promise<{
|
|
3104
|
+
publicKey: NonSharedBuffer;
|
|
3105
|
+
privateKey: NonSharedBuffer;
|
|
3106
|
+
}>;
|
|
3107
|
+
function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3108
|
+
function __promisify__(
|
|
3109
|
+
type: "rsa-pss",
|
|
3110
|
+
options: RSAPSSKeyPairOptions<"pem", "pem">,
|
|
3111
|
+
): Promise<{
|
|
3112
|
+
publicKey: string;
|
|
3113
|
+
privateKey: string;
|
|
3114
|
+
}>;
|
|
3115
|
+
function __promisify__(
|
|
3116
|
+
type: "rsa-pss",
|
|
3117
|
+
options: RSAPSSKeyPairOptions<"pem", "der">,
|
|
3118
|
+
): Promise<{
|
|
3119
|
+
publicKey: string;
|
|
3120
|
+
privateKey: NonSharedBuffer;
|
|
3121
|
+
}>;
|
|
3122
|
+
function __promisify__(
|
|
3123
|
+
type: "rsa-pss",
|
|
3124
|
+
options: RSAPSSKeyPairOptions<"der", "pem">,
|
|
3125
|
+
): Promise<{
|
|
3126
|
+
publicKey: NonSharedBuffer;
|
|
3127
|
+
privateKey: string;
|
|
3128
|
+
}>;
|
|
3129
|
+
function __promisify__(
|
|
3130
|
+
type: "rsa-pss",
|
|
3131
|
+
options: RSAPSSKeyPairOptions<"der", "der">,
|
|
3132
|
+
): Promise<{
|
|
3133
|
+
publicKey: NonSharedBuffer;
|
|
3134
|
+
privateKey: NonSharedBuffer;
|
|
3135
|
+
}>;
|
|
3136
|
+
function __promisify__(
|
|
3137
|
+
type: "rsa-pss",
|
|
3138
|
+
options: RSAPSSKeyPairKeyObjectOptions,
|
|
3139
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3140
|
+
function __promisify__(
|
|
3141
|
+
type: "dsa",
|
|
3142
|
+
options: DSAKeyPairOptions<"pem", "pem">,
|
|
3143
|
+
): Promise<{
|
|
3144
|
+
publicKey: string;
|
|
3145
|
+
privateKey: string;
|
|
3146
|
+
}>;
|
|
3147
|
+
function __promisify__(
|
|
3148
|
+
type: "dsa",
|
|
3149
|
+
options: DSAKeyPairOptions<"pem", "der">,
|
|
3150
|
+
): Promise<{
|
|
3151
|
+
publicKey: string;
|
|
3152
|
+
privateKey: NonSharedBuffer;
|
|
3153
|
+
}>;
|
|
3154
|
+
function __promisify__(
|
|
3155
|
+
type: "dsa",
|
|
3156
|
+
options: DSAKeyPairOptions<"der", "pem">,
|
|
3157
|
+
): Promise<{
|
|
3158
|
+
publicKey: NonSharedBuffer;
|
|
3159
|
+
privateKey: string;
|
|
3160
|
+
}>;
|
|
3161
|
+
function __promisify__(
|
|
2780
3162
|
type: "dsa",
|
|
2781
|
-
options:
|
|
2782
|
-
): Promise<
|
|
2783
|
-
|
|
3163
|
+
options: DSAKeyPairOptions<"der", "der">,
|
|
3164
|
+
): Promise<{
|
|
3165
|
+
publicKey: NonSharedBuffer;
|
|
3166
|
+
privateKey: NonSharedBuffer;
|
|
3167
|
+
}>;
|
|
3168
|
+
function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3169
|
+
function __promisify__(
|
|
2784
3170
|
type: "ec",
|
|
2785
|
-
options:
|
|
2786
|
-
): Promise<
|
|
2787
|
-
|
|
3171
|
+
options: ECKeyPairOptions<"pem", "pem">,
|
|
3172
|
+
): Promise<{
|
|
3173
|
+
publicKey: string;
|
|
3174
|
+
privateKey: string;
|
|
3175
|
+
}>;
|
|
3176
|
+
function __promisify__(
|
|
3177
|
+
type: "ec",
|
|
3178
|
+
options: ECKeyPairOptions<"pem", "der">,
|
|
3179
|
+
): Promise<{
|
|
3180
|
+
publicKey: string;
|
|
3181
|
+
privateKey: NonSharedBuffer;
|
|
3182
|
+
}>;
|
|
3183
|
+
function __promisify__(
|
|
3184
|
+
type: "ec",
|
|
3185
|
+
options: ECKeyPairOptions<"der", "pem">,
|
|
3186
|
+
): Promise<{
|
|
3187
|
+
publicKey: NonSharedBuffer;
|
|
3188
|
+
privateKey: string;
|
|
3189
|
+
}>;
|
|
3190
|
+
function __promisify__(
|
|
3191
|
+
type: "ec",
|
|
3192
|
+
options: ECKeyPairOptions<"der", "der">,
|
|
3193
|
+
): Promise<{
|
|
3194
|
+
publicKey: NonSharedBuffer;
|
|
3195
|
+
privateKey: NonSharedBuffer;
|
|
3196
|
+
}>;
|
|
3197
|
+
function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3198
|
+
function __promisify__(
|
|
3199
|
+
type: "ed25519",
|
|
3200
|
+
options: ED25519KeyPairOptions<"pem", "pem">,
|
|
3201
|
+
): Promise<{
|
|
3202
|
+
publicKey: string;
|
|
3203
|
+
privateKey: string;
|
|
3204
|
+
}>;
|
|
3205
|
+
function __promisify__(
|
|
3206
|
+
type: "ed25519",
|
|
3207
|
+
options: ED25519KeyPairOptions<"pem", "der">,
|
|
3208
|
+
): Promise<{
|
|
3209
|
+
publicKey: string;
|
|
3210
|
+
privateKey: NonSharedBuffer;
|
|
3211
|
+
}>;
|
|
3212
|
+
function __promisify__(
|
|
3213
|
+
type: "ed25519",
|
|
3214
|
+
options: ED25519KeyPairOptions<"der", "pem">,
|
|
3215
|
+
): Promise<{
|
|
3216
|
+
publicKey: NonSharedBuffer;
|
|
3217
|
+
privateKey: string;
|
|
3218
|
+
}>;
|
|
3219
|
+
function __promisify__(
|
|
2788
3220
|
type: "ed25519",
|
|
2789
|
-
options
|
|
2790
|
-
): Promise<
|
|
2791
|
-
|
|
3221
|
+
options: ED25519KeyPairOptions<"der", "der">,
|
|
3222
|
+
): Promise<{
|
|
3223
|
+
publicKey: NonSharedBuffer;
|
|
3224
|
+
privateKey: NonSharedBuffer;
|
|
3225
|
+
}>;
|
|
3226
|
+
function __promisify__(
|
|
3227
|
+
type: "ed25519",
|
|
3228
|
+
options?: ED25519KeyPairKeyObjectOptions,
|
|
3229
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3230
|
+
function __promisify__(
|
|
2792
3231
|
type: "ed448",
|
|
2793
|
-
options
|
|
2794
|
-
): Promise<
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
3232
|
+
options: ED448KeyPairOptions<"pem", "pem">,
|
|
3233
|
+
): Promise<{
|
|
3234
|
+
publicKey: string;
|
|
3235
|
+
privateKey: string;
|
|
3236
|
+
}>;
|
|
3237
|
+
function __promisify__(
|
|
3238
|
+
type: "ed448",
|
|
3239
|
+
options: ED448KeyPairOptions<"pem", "der">,
|
|
3240
|
+
): Promise<{
|
|
3241
|
+
publicKey: string;
|
|
3242
|
+
privateKey: NonSharedBuffer;
|
|
3243
|
+
}>;
|
|
3244
|
+
function __promisify__(
|
|
3245
|
+
type: "ed448",
|
|
3246
|
+
options: ED448KeyPairOptions<"der", "pem">,
|
|
3247
|
+
): Promise<{
|
|
3248
|
+
publicKey: NonSharedBuffer;
|
|
3249
|
+
privateKey: string;
|
|
3250
|
+
}>;
|
|
3251
|
+
function __promisify__(
|
|
3252
|
+
type: "ed448",
|
|
3253
|
+
options: ED448KeyPairOptions<"der", "der">,
|
|
3254
|
+
): Promise<{
|
|
3255
|
+
publicKey: NonSharedBuffer;
|
|
3256
|
+
privateKey: NonSharedBuffer;
|
|
3257
|
+
}>;
|
|
3258
|
+
function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
3259
|
+
function __promisify__(
|
|
3260
|
+
type: "x25519",
|
|
3261
|
+
options: X25519KeyPairOptions<"pem", "pem">,
|
|
3262
|
+
): Promise<{
|
|
3263
|
+
publicKey: string;
|
|
3264
|
+
privateKey: string;
|
|
3265
|
+
}>;
|
|
3266
|
+
function __promisify__(
|
|
3267
|
+
type: "x25519",
|
|
3268
|
+
options: X25519KeyPairOptions<"pem", "der">,
|
|
3269
|
+
): Promise<{
|
|
3270
|
+
publicKey: string;
|
|
3271
|
+
privateKey: NonSharedBuffer;
|
|
3272
|
+
}>;
|
|
3273
|
+
function __promisify__(
|
|
3274
|
+
type: "x25519",
|
|
3275
|
+
options: X25519KeyPairOptions<"der", "pem">,
|
|
3276
|
+
): Promise<{
|
|
3277
|
+
publicKey: NonSharedBuffer;
|
|
3278
|
+
privateKey: string;
|
|
3279
|
+
}>;
|
|
3280
|
+
function __promisify__(
|
|
3281
|
+
type: "x25519",
|
|
3282
|
+
options: X25519KeyPairOptions<"der", "der">,
|
|
3283
|
+
): Promise<{
|
|
3284
|
+
publicKey: NonSharedBuffer;
|
|
3285
|
+
privateKey: NonSharedBuffer;
|
|
3286
|
+
}>;
|
|
3287
|
+
function __promisify__(
|
|
2816
3288
|
type: "x25519",
|
|
2817
|
-
options?:
|
|
2818
|
-
): Promise<
|
|
2819
|
-
function __promisify__
|
|
3289
|
+
options?: X25519KeyPairKeyObjectOptions,
|
|
3290
|
+
): Promise<KeyPairKeyObjectResult>;
|
|
3291
|
+
function __promisify__(
|
|
2820
3292
|
type: "x448",
|
|
2821
|
-
options
|
|
2822
|
-
): Promise<
|
|
3293
|
+
options: X448KeyPairOptions<"pem", "pem">,
|
|
3294
|
+
): Promise<{
|
|
3295
|
+
publicKey: string;
|
|
3296
|
+
privateKey: string;
|
|
3297
|
+
}>;
|
|
3298
|
+
function __promisify__(
|
|
3299
|
+
type: "x448",
|
|
3300
|
+
options: X448KeyPairOptions<"pem", "der">,
|
|
3301
|
+
): Promise<{
|
|
3302
|
+
publicKey: string;
|
|
3303
|
+
privateKey: NonSharedBuffer;
|
|
3304
|
+
}>;
|
|
3305
|
+
function __promisify__(
|
|
3306
|
+
type: "x448",
|
|
3307
|
+
options: X448KeyPairOptions<"der", "pem">,
|
|
3308
|
+
): Promise<{
|
|
3309
|
+
publicKey: NonSharedBuffer;
|
|
3310
|
+
privateKey: string;
|
|
3311
|
+
}>;
|
|
3312
|
+
function __promisify__(
|
|
3313
|
+
type: "x448",
|
|
3314
|
+
options: X448KeyPairOptions<"der", "der">,
|
|
3315
|
+
): Promise<{
|
|
3316
|
+
publicKey: NonSharedBuffer;
|
|
3317
|
+
privateKey: NonSharedBuffer;
|
|
3318
|
+
}>;
|
|
3319
|
+
function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
|
|
2823
3320
|
}
|
|
2824
3321
|
/**
|
|
2825
3322
|
* Calculates and returns the signature for `data` using the given private key and
|
|
2826
3323
|
* algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
|
|
2827
|
-
* dependent upon the key type.
|
|
2828
|
-
*
|
|
2829
|
-
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
2830
|
-
* ML-DSA.
|
|
3324
|
+
* dependent upon the key type (especially Ed25519 and Ed448).
|
|
2831
3325
|
*
|
|
2832
3326
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
2833
3327
|
* passed to {@link createPrivateKey}. If it is an object, the following
|
|
@@ -2848,12 +3342,8 @@ declare module "node:crypto" {
|
|
|
2848
3342
|
callback: (error: Error | null, data: NonSharedBuffer) => void,
|
|
2849
3343
|
): void;
|
|
2850
3344
|
/**
|
|
2851
|
-
* Verifies the given signature for `data` using the given key and algorithm. If
|
|
2852
|
-
*
|
|
2853
|
-
* key type.
|
|
2854
|
-
*
|
|
2855
|
-
* `algorithm` is required to be `null` or `undefined` for Ed25519, Ed448, and
|
|
2856
|
-
* ML-DSA.
|
|
3345
|
+
* Verifies the given signature for `data` using the given key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the
|
|
3346
|
+
* key type (especially Ed25519 and Ed448).
|
|
2857
3347
|
*
|
|
2858
3348
|
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
2859
3349
|
* passed to {@link createPublicKey}. If it is an object, the following
|
|
@@ -2881,102 +3371,16 @@ declare module "node:crypto" {
|
|
|
2881
3371
|
callback: (error: Error | null, result: boolean) => void,
|
|
2882
3372
|
): void;
|
|
2883
3373
|
/**
|
|
2884
|
-
*
|
|
2885
|
-
*
|
|
2886
|
-
* Supported key types and their KEM algorithms are:
|
|
2887
|
-
*
|
|
2888
|
-
* * `'rsa'` RSA Secret Value Encapsulation
|
|
2889
|
-
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
2890
|
-
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
2891
|
-
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
2892
|
-
* * `'ml-kem-512'` ML-KEM
|
|
2893
|
-
* * `'ml-kem-768'` ML-KEM
|
|
2894
|
-
* * `'ml-kem-1024'` ML-KEM
|
|
2895
|
-
*
|
|
2896
|
-
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
2897
|
-
* passed to `crypto.createPrivateKey()`.
|
|
2898
|
-
*
|
|
2899
|
-
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2900
|
-
* @since v24.7.0
|
|
2901
|
-
*/
|
|
2902
|
-
function decapsulate(
|
|
2903
|
-
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
2904
|
-
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
2905
|
-
): NonSharedBuffer;
|
|
2906
|
-
function decapsulate(
|
|
2907
|
-
key: KeyLike | PrivateKeyInput | JsonWebKeyInput,
|
|
2908
|
-
ciphertext: ArrayBuffer | NodeJS.ArrayBufferView,
|
|
2909
|
-
callback: (err: Error, sharedKey: NonSharedBuffer) => void,
|
|
2910
|
-
): void;
|
|
2911
|
-
/**
|
|
2912
|
-
* Computes the Diffie-Hellman shared secret based on a `privateKey` and a `publicKey`.
|
|
2913
|
-
* Both keys must have the same `asymmetricKeyType` and must support either the DH or
|
|
2914
|
-
* ECDH operation.
|
|
2915
|
-
*
|
|
2916
|
-
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
3374
|
+
* Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`.
|
|
3375
|
+
* Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'` (for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES).
|
|
2917
3376
|
* @since v13.9.0, v12.17.0
|
|
2918
3377
|
*/
|
|
2919
3378
|
function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): NonSharedBuffer;
|
|
2920
|
-
function diffieHellman(
|
|
2921
|
-
options: { privateKey: KeyObject; publicKey: KeyObject },
|
|
2922
|
-
callback: (err: Error | null, secret: NonSharedBuffer) => void,
|
|
2923
|
-
): void;
|
|
2924
|
-
/**
|
|
2925
|
-
* Key encapsulation using a KEM algorithm with a public key.
|
|
2926
|
-
*
|
|
2927
|
-
* Supported key types and their KEM algorithms are:
|
|
2928
|
-
*
|
|
2929
|
-
* * `'rsa'` RSA Secret Value Encapsulation
|
|
2930
|
-
* * `'ec'` DHKEM(P-256, HKDF-SHA256), DHKEM(P-384, HKDF-SHA256), DHKEM(P-521, HKDF-SHA256)
|
|
2931
|
-
* * `'x25519'` DHKEM(X25519, HKDF-SHA256)
|
|
2932
|
-
* * `'x448'` DHKEM(X448, HKDF-SHA512)
|
|
2933
|
-
* * `'ml-kem-512'` ML-KEM
|
|
2934
|
-
* * `'ml-kem-768'` ML-KEM
|
|
2935
|
-
* * `'ml-kem-1024'` ML-KEM
|
|
2936
|
-
*
|
|
2937
|
-
* If `key` is not a {@link KeyObject}, this function behaves as if `key` had been
|
|
2938
|
-
* passed to `crypto.createPublicKey()`.
|
|
2939
|
-
*
|
|
2940
|
-
* If the `callback` function is provided this function uses libuv's threadpool.
|
|
2941
|
-
* @since v24.7.0
|
|
2942
|
-
*/
|
|
2943
|
-
function encapsulate(
|
|
2944
|
-
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
2945
|
-
): { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer };
|
|
2946
|
-
function encapsulate(
|
|
2947
|
-
key: KeyLike | PublicKeyInput | JsonWebKeyInput,
|
|
2948
|
-
callback: (err: Error, result: { sharedKey: NonSharedBuffer; ciphertext: NonSharedBuffer }) => void,
|
|
2949
|
-
): void;
|
|
2950
|
-
interface OneShotDigestOptions {
|
|
2951
|
-
/**
|
|
2952
|
-
* Encoding used to encode the returned digest.
|
|
2953
|
-
* @default 'hex'
|
|
2954
|
-
*/
|
|
2955
|
-
outputEncoding?: BinaryToTextEncoding | "buffer" | undefined;
|
|
2956
|
-
/**
|
|
2957
|
-
* For XOF hash functions such as 'shake256', the outputLength option
|
|
2958
|
-
* can be used to specify the desired output length in bytes.
|
|
2959
|
-
*/
|
|
2960
|
-
outputLength?: number | undefined;
|
|
2961
|
-
}
|
|
2962
|
-
interface OneShotDigestOptionsWithStringEncoding extends OneShotDigestOptions {
|
|
2963
|
-
outputEncoding?: BinaryToTextEncoding | undefined;
|
|
2964
|
-
}
|
|
2965
|
-
interface OneShotDigestOptionsWithBufferEncoding extends OneShotDigestOptions {
|
|
2966
|
-
outputEncoding: "buffer";
|
|
2967
|
-
}
|
|
2968
3379
|
/**
|
|
2969
|
-
* A utility for creating one-shot hash digests of data. It can be faster than
|
|
2970
|
-
* the
|
|
2971
|
-
*
|
|
2972
|
-
*
|
|
2973
|
-
*
|
|
2974
|
-
* The `algorithm` is dependent on the available algorithms supported by the
|
|
2975
|
-
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
|
|
2976
|
-
* On recent releases of OpenSSL, `openssl list -digest-algorithms` will
|
|
2977
|
-
* display the available digest algorithms.
|
|
2978
|
-
*
|
|
2979
|
-
* If `options` is a string, then it specifies the `outputEncoding`.
|
|
3380
|
+
* A utility for creating one-shot hash digests of data. It can be faster than the object-based `crypto.createHash()` when hashing a smaller amount of data
|
|
3381
|
+
* (<= 5MB) that's readily available. If the data can be big or if it is streamed, it's still recommended to use `crypto.createHash()` instead. The `algorithm`
|
|
3382
|
+
* is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. On recent releases
|
|
3383
|
+
* of OpenSSL, `openssl list -digest-algorithms` will display the available digest algorithms.
|
|
2980
3384
|
*
|
|
2981
3385
|
* Example:
|
|
2982
3386
|
*
|
|
@@ -2996,25 +3400,16 @@ declare module "node:crypto" {
|
|
|
2996
3400
|
* console.log(crypto.hash('sha1', Buffer.from(base64, 'base64'), 'buffer'));
|
|
2997
3401
|
* ```
|
|
2998
3402
|
* @since v21.7.0, v20.12.0
|
|
2999
|
-
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different
|
|
3000
|
-
*
|
|
3001
|
-
*
|
|
3002
|
-
* the encoded `TypedArray` into this API instead.
|
|
3403
|
+
* @param data When `data` is a string, it will be encoded as UTF-8 before being hashed. If a different input encoding is desired for a string input, user
|
|
3404
|
+
* could encode the string into a `TypedArray` using either `TextEncoder` or `Buffer.from()` and passing the encoded `TypedArray` into this API instead.
|
|
3405
|
+
* @param [outputEncoding='hex'] [Encoding](https://nodejs.org/docs/latest-v22.x/api/buffer.html#buffers-and-character-encodings) used to encode the returned digest.
|
|
3003
3406
|
*/
|
|
3407
|
+
function hash(algorithm: string, data: BinaryLike, outputEncoding?: BinaryToTextEncoding): string;
|
|
3408
|
+
function hash(algorithm: string, data: BinaryLike, outputEncoding: "buffer"): NonSharedBuffer;
|
|
3004
3409
|
function hash(
|
|
3005
3410
|
algorithm: string,
|
|
3006
3411
|
data: BinaryLike,
|
|
3007
|
-
|
|
3008
|
-
): string;
|
|
3009
|
-
function hash(
|
|
3010
|
-
algorithm: string,
|
|
3011
|
-
data: BinaryLike,
|
|
3012
|
-
options: OneShotDigestOptionsWithBufferEncoding | "buffer",
|
|
3013
|
-
): NonSharedBuffer;
|
|
3014
|
-
function hash(
|
|
3015
|
-
algorithm: string,
|
|
3016
|
-
data: BinaryLike,
|
|
3017
|
-
options: OneShotDigestOptions | BinaryToTextEncoding | "buffer",
|
|
3412
|
+
outputEncoding?: BinaryToTextEncoding | "buffer",
|
|
3018
3413
|
): string | NonSharedBuffer;
|
|
3019
3414
|
type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts";
|
|
3020
3415
|
interface CipherInfoOptions {
|
|
@@ -3317,16 +3712,6 @@ declare module "node:crypto" {
|
|
|
3317
3712
|
* @since v15.6.0
|
|
3318
3713
|
*/
|
|
3319
3714
|
readonly serialNumber: string;
|
|
3320
|
-
/**
|
|
3321
|
-
* The algorithm used to sign the certificate or `undefined` if the signature algorithm is unknown by OpenSSL.
|
|
3322
|
-
* @since v24.9.0
|
|
3323
|
-
*/
|
|
3324
|
-
readonly signatureAlgorithm: string | undefined;
|
|
3325
|
-
/**
|
|
3326
|
-
* The OID of the algorithm used to sign the certificate.
|
|
3327
|
-
* @since v24.9.0
|
|
3328
|
-
*/
|
|
3329
|
-
readonly signatureAlgorithmOid: string;
|
|
3330
3715
|
/**
|
|
3331
3716
|
* The date/time from which this certificate is considered valid.
|
|
3332
3717
|
* @since v15.6.0
|
|
@@ -3598,136 +3983,7 @@ declare module "node:crypto" {
|
|
|
3598
3983
|
* @since v17.4.0
|
|
3599
3984
|
* @return Returns `typedArray`.
|
|
3600
3985
|
*/
|
|
3601
|
-
function getRandomValues<
|
|
3602
|
-
T extends Exclude<
|
|
3603
|
-
NodeJS.NonSharedTypedArray,
|
|
3604
|
-
NodeJS.NonSharedFloat16Array | NodeJS.NonSharedFloat32Array | NodeJS.NonSharedFloat64Array
|
|
3605
|
-
>,
|
|
3606
|
-
>(typedArray: T): T;
|
|
3607
|
-
type Argon2Algorithm = "argon2d" | "argon2i" | "argon2id";
|
|
3608
|
-
interface Argon2Parameters {
|
|
3609
|
-
/**
|
|
3610
|
-
* REQUIRED, this is the password for password hashing applications of Argon2.
|
|
3611
|
-
*/
|
|
3612
|
-
message: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
3613
|
-
/**
|
|
3614
|
-
* REQUIRED, must be at least 8 bytes long. This is the salt for password hashing applications of Argon2.
|
|
3615
|
-
*/
|
|
3616
|
-
nonce: string | ArrayBuffer | NodeJS.ArrayBufferView;
|
|
3617
|
-
/**
|
|
3618
|
-
* REQUIRED, degree of parallelism determines how many computational chains (lanes)
|
|
3619
|
-
* can be run. Must be greater than 1 and less than `2**24-1`.
|
|
3620
|
-
*/
|
|
3621
|
-
parallelism: number;
|
|
3622
|
-
/**
|
|
3623
|
-
* REQUIRED, the length of the key to generate. Must be greater than 4 and
|
|
3624
|
-
* less than `2**32-1`.
|
|
3625
|
-
*/
|
|
3626
|
-
tagLength: number;
|
|
3627
|
-
/**
|
|
3628
|
-
* REQUIRED, memory cost in 1KiB blocks. Must be greater than
|
|
3629
|
-
* `8 * parallelism` and less than `2**32-1`. The actual number of blocks is rounded
|
|
3630
|
-
* down to the nearest multiple of `4 * parallelism`.
|
|
3631
|
-
*/
|
|
3632
|
-
memory: number;
|
|
3633
|
-
/**
|
|
3634
|
-
* REQUIRED, number of passes (iterations). Must be greater than 1 and less
|
|
3635
|
-
* than `2**32-1`.
|
|
3636
|
-
*/
|
|
3637
|
-
passes: number;
|
|
3638
|
-
/**
|
|
3639
|
-
* OPTIONAL, Random additional input,
|
|
3640
|
-
* similar to the salt, that should **NOT** be stored with the derived key. This is known as pepper in
|
|
3641
|
-
* password hashing applications. If used, must have a length not greater than `2**32-1` bytes.
|
|
3642
|
-
*/
|
|
3643
|
-
secret?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
3644
|
-
/**
|
|
3645
|
-
* OPTIONAL, Additional data to
|
|
3646
|
-
* be added to the hash, functionally equivalent to salt or secret, but meant for
|
|
3647
|
-
* non-random data. If used, must have a length not greater than `2**32-1` bytes.
|
|
3648
|
-
*/
|
|
3649
|
-
associatedData?: string | ArrayBuffer | NodeJS.ArrayBufferView | undefined;
|
|
3650
|
-
}
|
|
3651
|
-
/**
|
|
3652
|
-
* Provides an asynchronous [Argon2](https://www.rfc-editor.org/rfc/rfc9106.html) implementation. Argon2 is a password-based
|
|
3653
|
-
* key derivation function that is designed to be expensive computationally and
|
|
3654
|
-
* memory-wise in order to make brute-force attacks unrewarding.
|
|
3655
|
-
*
|
|
3656
|
-
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
3657
|
-
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
3658
|
-
*
|
|
3659
|
-
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
3660
|
-
* consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v25.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
|
|
3661
|
-
*
|
|
3662
|
-
* The `callback` function is called with two arguments: `err` and `derivedKey`.
|
|
3663
|
-
* `err` is an exception object when key derivation fails, otherwise `err` is
|
|
3664
|
-
* `null`. `derivedKey` is passed to the callback as a `Buffer`.
|
|
3665
|
-
*
|
|
3666
|
-
* An exception is thrown when any of the input arguments specify invalid values
|
|
3667
|
-
* or types.
|
|
3668
|
-
*
|
|
3669
|
-
* ```js
|
|
3670
|
-
* const { argon2, randomBytes } = await import('node:crypto');
|
|
3671
|
-
*
|
|
3672
|
-
* const parameters = {
|
|
3673
|
-
* message: 'password',
|
|
3674
|
-
* nonce: randomBytes(16),
|
|
3675
|
-
* parallelism: 4,
|
|
3676
|
-
* tagLength: 64,
|
|
3677
|
-
* memory: 65536,
|
|
3678
|
-
* passes: 3,
|
|
3679
|
-
* };
|
|
3680
|
-
*
|
|
3681
|
-
* argon2('argon2id', parameters, (err, derivedKey) => {
|
|
3682
|
-
* if (err) throw err;
|
|
3683
|
-
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
3684
|
-
* });
|
|
3685
|
-
* ```
|
|
3686
|
-
* @since v24.7.0
|
|
3687
|
-
* @param algorithm Variant of Argon2, one of `"argon2d"`, `"argon2i"` or `"argon2id"`.
|
|
3688
|
-
* @experimental
|
|
3689
|
-
*/
|
|
3690
|
-
function argon2(
|
|
3691
|
-
algorithm: Argon2Algorithm,
|
|
3692
|
-
parameters: Argon2Parameters,
|
|
3693
|
-
callback: (err: Error | null, derivedKey: NonSharedBuffer) => void,
|
|
3694
|
-
): void;
|
|
3695
|
-
/**
|
|
3696
|
-
* Provides a synchronous [Argon2][] implementation. Argon2 is a password-based
|
|
3697
|
-
* key derivation function that is designed to be expensive computationally and
|
|
3698
|
-
* memory-wise in order to make brute-force attacks unrewarding.
|
|
3699
|
-
*
|
|
3700
|
-
* The `nonce` should be as unique as possible. It is recommended that a nonce is
|
|
3701
|
-
* random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details.
|
|
3702
|
-
*
|
|
3703
|
-
* When passing strings for `message`, `nonce`, `secret` or `associatedData`, please
|
|
3704
|
-
* consider [caveats when using strings as inputs to cryptographic APIs](https://nodejs.org/docs/latest-v25.x/api/crypto.html#using-strings-as-inputs-to-cryptographic-apis).
|
|
3705
|
-
*
|
|
3706
|
-
* An exception is thrown when key derivation fails, otherwise the derived key is
|
|
3707
|
-
* returned as a `Buffer`.
|
|
3708
|
-
*
|
|
3709
|
-
* An exception is thrown when any of the input arguments specify invalid values
|
|
3710
|
-
* or types.
|
|
3711
|
-
*
|
|
3712
|
-
* ```js
|
|
3713
|
-
* const { argon2Sync, randomBytes } = await import('node:crypto');
|
|
3714
|
-
*
|
|
3715
|
-
* const parameters = {
|
|
3716
|
-
* message: 'password',
|
|
3717
|
-
* nonce: randomBytes(16),
|
|
3718
|
-
* parallelism: 4,
|
|
3719
|
-
* tagLength: 64,
|
|
3720
|
-
* memory: 65536,
|
|
3721
|
-
* passes: 3,
|
|
3722
|
-
* };
|
|
3723
|
-
*
|
|
3724
|
-
* const derivedKey = argon2Sync('argon2id', parameters);
|
|
3725
|
-
* console.log(derivedKey.toString('hex')); // 'af91dad...9520f15'
|
|
3726
|
-
* ```
|
|
3727
|
-
* @since v24.7.0
|
|
3728
|
-
* @experimental
|
|
3729
|
-
*/
|
|
3730
|
-
function argon2Sync(algorithm: Argon2Algorithm, parameters: Argon2Parameters): NonSharedBuffer;
|
|
3986
|
+
function getRandomValues<T extends webcrypto.BufferSource>(typedArray: T): T;
|
|
3731
3987
|
/**
|
|
3732
3988
|
* A convenient alias for `crypto.webcrypto.subtle`.
|
|
3733
3989
|
* @since v17.4.0
|
|
@@ -3741,40 +3997,37 @@ declare module "node:crypto" {
|
|
|
3741
3997
|
*/
|
|
3742
3998
|
const webcrypto: webcrypto.Crypto;
|
|
3743
3999
|
namespace webcrypto {
|
|
3744
|
-
type
|
|
3745
|
-
type
|
|
3746
|
-
type KeyFormat = "jwk" | "pkcs8" | "raw" | "raw-public" | "raw-secret" | "raw-seed" | "spki";
|
|
4000
|
+
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
4001
|
+
type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
|
3747
4002
|
type KeyType = "private" | "public" | "secret";
|
|
3748
4003
|
type KeyUsage =
|
|
3749
|
-
| "decapsulateBits"
|
|
3750
|
-
| "decapsulateKey"
|
|
3751
4004
|
| "decrypt"
|
|
3752
4005
|
| "deriveBits"
|
|
3753
4006
|
| "deriveKey"
|
|
3754
|
-
| "encapsulateBits"
|
|
3755
|
-
| "encapsulateKey"
|
|
3756
4007
|
| "encrypt"
|
|
3757
4008
|
| "sign"
|
|
3758
4009
|
| "unwrapKey"
|
|
3759
4010
|
| "verify"
|
|
3760
4011
|
| "wrapKey";
|
|
4012
|
+
type AlgorithmIdentifier = Algorithm | string;
|
|
3761
4013
|
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
3762
4014
|
type NamedCurve = string;
|
|
3763
|
-
|
|
3764
|
-
additionalData?: NodeJS.BufferSource;
|
|
3765
|
-
iv: NodeJS.BufferSource;
|
|
3766
|
-
tagLength: number;
|
|
3767
|
-
}
|
|
4015
|
+
type BigInteger = Uint8Array;
|
|
3768
4016
|
interface AesCbcParams extends Algorithm {
|
|
3769
|
-
iv:
|
|
4017
|
+
iv: BufferSource;
|
|
3770
4018
|
}
|
|
3771
4019
|
interface AesCtrParams extends Algorithm {
|
|
3772
|
-
counter:
|
|
4020
|
+
counter: BufferSource;
|
|
3773
4021
|
length: number;
|
|
3774
4022
|
}
|
|
3775
4023
|
interface AesDerivedKeyParams extends Algorithm {
|
|
3776
4024
|
length: number;
|
|
3777
4025
|
}
|
|
4026
|
+
interface AesGcmParams extends Algorithm {
|
|
4027
|
+
additionalData?: BufferSource;
|
|
4028
|
+
iv: BufferSource;
|
|
4029
|
+
tagLength?: number;
|
|
4030
|
+
}
|
|
3778
4031
|
interface AesKeyAlgorithm extends KeyAlgorithm {
|
|
3779
4032
|
length: number;
|
|
3780
4033
|
}
|
|
@@ -3784,23 +4037,6 @@ declare module "node:crypto" {
|
|
|
3784
4037
|
interface Algorithm {
|
|
3785
4038
|
name: string;
|
|
3786
4039
|
}
|
|
3787
|
-
interface Argon2Params extends Algorithm {
|
|
3788
|
-
associatedData?: NodeJS.BufferSource;
|
|
3789
|
-
memory: number;
|
|
3790
|
-
nonce: NodeJS.BufferSource;
|
|
3791
|
-
parallelism: number;
|
|
3792
|
-
passes: number;
|
|
3793
|
-
secretValue?: NodeJS.BufferSource;
|
|
3794
|
-
version?: number;
|
|
3795
|
-
}
|
|
3796
|
-
interface CShakeParams extends Algorithm {
|
|
3797
|
-
customization?: NodeJS.BufferSource;
|
|
3798
|
-
functionName?: NodeJS.BufferSource;
|
|
3799
|
-
length: number;
|
|
3800
|
-
}
|
|
3801
|
-
interface ContextParams extends Algorithm {
|
|
3802
|
-
context?: NodeJS.BufferSource;
|
|
3803
|
-
}
|
|
3804
4040
|
interface EcKeyAlgorithm extends KeyAlgorithm {
|
|
3805
4041
|
namedCurve: NamedCurve;
|
|
3806
4042
|
}
|
|
@@ -3816,10 +4052,13 @@ declare module "node:crypto" {
|
|
|
3816
4052
|
interface EcdsaParams extends Algorithm {
|
|
3817
4053
|
hash: HashAlgorithmIdentifier;
|
|
3818
4054
|
}
|
|
4055
|
+
interface Ed448Params extends Algorithm {
|
|
4056
|
+
context?: BufferSource;
|
|
4057
|
+
}
|
|
3819
4058
|
interface HkdfParams extends Algorithm {
|
|
3820
4059
|
hash: HashAlgorithmIdentifier;
|
|
3821
|
-
info:
|
|
3822
|
-
salt:
|
|
4060
|
+
info: BufferSource;
|
|
4061
|
+
salt: BufferSource;
|
|
3823
4062
|
}
|
|
3824
4063
|
interface HmacImportParams extends Algorithm {
|
|
3825
4064
|
hash: HashAlgorithmIdentifier;
|
|
@@ -3856,23 +4095,10 @@ declare module "node:crypto" {
|
|
|
3856
4095
|
interface KeyAlgorithm {
|
|
3857
4096
|
name: string;
|
|
3858
4097
|
}
|
|
3859
|
-
interface KmacImportParams extends Algorithm {
|
|
3860
|
-
length?: number;
|
|
3861
|
-
}
|
|
3862
|
-
interface KmacKeyAlgorithm extends KeyAlgorithm {
|
|
3863
|
-
length: number;
|
|
3864
|
-
}
|
|
3865
|
-
interface KmacKeyGenParams extends Algorithm {
|
|
3866
|
-
length?: number;
|
|
3867
|
-
}
|
|
3868
|
-
interface KmacParams extends Algorithm {
|
|
3869
|
-
customization?: NodeJS.BufferSource;
|
|
3870
|
-
length: number;
|
|
3871
|
-
}
|
|
3872
4098
|
interface Pbkdf2Params extends Algorithm {
|
|
3873
4099
|
hash: HashAlgorithmIdentifier;
|
|
3874
4100
|
iterations: number;
|
|
3875
|
-
salt:
|
|
4101
|
+
salt: BufferSource;
|
|
3876
4102
|
}
|
|
3877
4103
|
interface RsaHashedImportParams extends Algorithm {
|
|
3878
4104
|
hash: HashAlgorithmIdentifier;
|
|
@@ -3892,7 +4118,7 @@ declare module "node:crypto" {
|
|
|
3892
4118
|
publicExponent: BigInteger;
|
|
3893
4119
|
}
|
|
3894
4120
|
interface RsaOaepParams extends Algorithm {
|
|
3895
|
-
label?:
|
|
4121
|
+
label?: BufferSource;
|
|
3896
4122
|
}
|
|
3897
4123
|
interface RsaOtherPrimesInfo {
|
|
3898
4124
|
d?: string;
|
|
@@ -3902,103 +4128,269 @@ declare module "node:crypto" {
|
|
|
3902
4128
|
interface RsaPssParams extends Algorithm {
|
|
3903
4129
|
saltLength: number;
|
|
3904
4130
|
}
|
|
4131
|
+
/**
|
|
4132
|
+
* Importing the `webcrypto` object (`import { webcrypto } from 'node:crypto'`) gives an instance of the `Crypto` class.
|
|
4133
|
+
* `Crypto` is a singleton that provides access to the remainder of the crypto API.
|
|
4134
|
+
* @since v15.0.0
|
|
4135
|
+
*/
|
|
3905
4136
|
interface Crypto {
|
|
4137
|
+
/**
|
|
4138
|
+
* Provides access to the `SubtleCrypto` API.
|
|
4139
|
+
* @since v15.0.0
|
|
4140
|
+
*/
|
|
3906
4141
|
readonly subtle: SubtleCrypto;
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
4142
|
+
/**
|
|
4143
|
+
* Generates cryptographically strong random values.
|
|
4144
|
+
* The given `typedArray` is filled with random values, and a reference to `typedArray` is returned.
|
|
4145
|
+
*
|
|
4146
|
+
* The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted.
|
|
4147
|
+
*
|
|
4148
|
+
* An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
|
|
4149
|
+
* @since v15.0.0
|
|
4150
|
+
*/
|
|
4151
|
+
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(typedArray: T): T;
|
|
4152
|
+
/**
|
|
4153
|
+
* Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
|
|
4154
|
+
* The UUID is generated using a cryptographic pseudorandom number generator.
|
|
4155
|
+
* @since v16.7.0
|
|
4156
|
+
*/
|
|
3915
4157
|
randomUUID(): UUID;
|
|
4158
|
+
CryptoKey: CryptoKeyConstructor;
|
|
4159
|
+
}
|
|
4160
|
+
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
|
|
4161
|
+
interface CryptoKeyConstructor {
|
|
4162
|
+
/** Illegal constructor */
|
|
4163
|
+
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
4164
|
+
readonly length: 0;
|
|
4165
|
+
readonly name: "CryptoKey";
|
|
4166
|
+
readonly prototype: CryptoKey;
|
|
3916
4167
|
}
|
|
4168
|
+
/**
|
|
4169
|
+
* @since v15.0.0
|
|
4170
|
+
*/
|
|
3917
4171
|
interface CryptoKey {
|
|
4172
|
+
/**
|
|
4173
|
+
* An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters.
|
|
4174
|
+
* @since v15.0.0
|
|
4175
|
+
*/
|
|
3918
4176
|
readonly algorithm: KeyAlgorithm;
|
|
4177
|
+
/**
|
|
4178
|
+
* When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`.
|
|
4179
|
+
* @since v15.0.0
|
|
4180
|
+
*/
|
|
3919
4181
|
readonly extractable: boolean;
|
|
4182
|
+
/**
|
|
4183
|
+
* A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key.
|
|
4184
|
+
* @since v15.0.0
|
|
4185
|
+
*/
|
|
3920
4186
|
readonly type: KeyType;
|
|
4187
|
+
/**
|
|
4188
|
+
* An array of strings identifying the operations for which the key may be used.
|
|
4189
|
+
*
|
|
4190
|
+
* The possible usages are:
|
|
4191
|
+
* - `'encrypt'` - The key may be used to encrypt data.
|
|
4192
|
+
* - `'decrypt'` - The key may be used to decrypt data.
|
|
4193
|
+
* - `'sign'` - The key may be used to generate digital signatures.
|
|
4194
|
+
* - `'verify'` - The key may be used to verify digital signatures.
|
|
4195
|
+
* - `'deriveKey'` - The key may be used to derive a new key.
|
|
4196
|
+
* - `'deriveBits'` - The key may be used to derive bits.
|
|
4197
|
+
* - `'wrapKey'` - The key may be used to wrap another key.
|
|
4198
|
+
* - `'unwrapKey'` - The key may be used to unwrap another key.
|
|
4199
|
+
*
|
|
4200
|
+
* Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`).
|
|
4201
|
+
* @since v15.0.0
|
|
4202
|
+
*/
|
|
3921
4203
|
readonly usages: KeyUsage[];
|
|
3922
4204
|
}
|
|
4205
|
+
/**
|
|
4206
|
+
* The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair.
|
|
4207
|
+
* @since v15.0.0
|
|
4208
|
+
*/
|
|
3923
4209
|
interface CryptoKeyPair {
|
|
4210
|
+
/**
|
|
4211
|
+
* A {@link CryptoKey} whose type will be `'private'`.
|
|
4212
|
+
* @since v15.0.0
|
|
4213
|
+
*/
|
|
3924
4214
|
privateKey: CryptoKey;
|
|
4215
|
+
/**
|
|
4216
|
+
* A {@link CryptoKey} whose type will be `'public'`.
|
|
4217
|
+
* @since v15.0.0
|
|
4218
|
+
*/
|
|
3925
4219
|
publicKey: CryptoKey;
|
|
3926
4220
|
}
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
}
|
|
3931
|
-
interface EncapsulatedKey {
|
|
3932
|
-
sharedKey: CryptoKey;
|
|
3933
|
-
ciphertext: ArrayBuffer;
|
|
3934
|
-
}
|
|
4221
|
+
/**
|
|
4222
|
+
* @since v15.0.0
|
|
4223
|
+
*/
|
|
3935
4224
|
interface SubtleCrypto {
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
4225
|
+
/**
|
|
4226
|
+
* Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
|
|
4227
|
+
* `subtle.decrypt()` attempts to decipher the provided `data`. If successful,
|
|
4228
|
+
* the returned promise will be resolved with an `<ArrayBuffer>` containing the plaintext result.
|
|
4229
|
+
*
|
|
4230
|
+
* The algorithms currently supported include:
|
|
4231
|
+
*
|
|
4232
|
+
* - `'RSA-OAEP'`
|
|
4233
|
+
* - `'AES-CTR'`
|
|
4234
|
+
* - `'AES-CBC'`
|
|
4235
|
+
* - `'AES-GCM'`
|
|
4236
|
+
* @since v15.0.0
|
|
4237
|
+
*/
|
|
3949
4238
|
decrypt(
|
|
3950
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4239
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
3951
4240
|
key: CryptoKey,
|
|
3952
|
-
data:
|
|
4241
|
+
data: BufferSource,
|
|
3953
4242
|
): Promise<ArrayBuffer>;
|
|
4243
|
+
/**
|
|
4244
|
+
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
4245
|
+
* `subtle.deriveBits()` attempts to generate `length` bits.
|
|
4246
|
+
* The Node.js implementation requires that when `length` is a number it must be multiple of `8`.
|
|
4247
|
+
* When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed
|
|
4248
|
+
* for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms.
|
|
4249
|
+
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
|
|
4250
|
+
*
|
|
4251
|
+
* The algorithms currently supported include:
|
|
4252
|
+
*
|
|
4253
|
+
* - `'ECDH'`
|
|
4254
|
+
* - `'X25519'`
|
|
4255
|
+
* - `'X448'`
|
|
4256
|
+
* - `'HKDF'`
|
|
4257
|
+
* - `'PBKDF2'`
|
|
4258
|
+
* @since v15.0.0
|
|
4259
|
+
*/
|
|
3954
4260
|
deriveBits(
|
|
3955
|
-
algorithm:
|
|
4261
|
+
algorithm: EcdhKeyDeriveParams,
|
|
3956
4262
|
baseKey: CryptoKey,
|
|
3957
4263
|
length?: number | null,
|
|
3958
4264
|
): Promise<ArrayBuffer>;
|
|
4265
|
+
deriveBits(
|
|
4266
|
+
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
4267
|
+
baseKey: CryptoKey,
|
|
4268
|
+
length: number,
|
|
4269
|
+
): Promise<ArrayBuffer>;
|
|
4270
|
+
/**
|
|
4271
|
+
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
4272
|
+
* `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
4273
|
+
*
|
|
4274
|
+
* Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
|
|
4275
|
+
* then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
|
|
4276
|
+
*
|
|
4277
|
+
* The algorithms currently supported include:
|
|
4278
|
+
*
|
|
4279
|
+
* - `'ECDH'`
|
|
4280
|
+
* - `'X25519'`
|
|
4281
|
+
* - `'X448'`
|
|
4282
|
+
* - `'HKDF'`
|
|
4283
|
+
* - `'PBKDF2'`
|
|
4284
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4285
|
+
* @since v15.0.0
|
|
4286
|
+
*/
|
|
3959
4287
|
deriveKey(
|
|
3960
|
-
algorithm:
|
|
4288
|
+
algorithm: EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
3961
4289
|
baseKey: CryptoKey,
|
|
3962
|
-
|
|
4290
|
+
derivedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | AesDerivedKeyParams,
|
|
3963
4291
|
extractable: boolean,
|
|
3964
4292
|
keyUsages: readonly KeyUsage[],
|
|
3965
4293
|
): Promise<CryptoKey>;
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
4294
|
+
/**
|
|
4295
|
+
* Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
|
|
4296
|
+
* If successful, the returned promise is resolved with an `<ArrayBuffer>` containing the computed digest.
|
|
4297
|
+
*
|
|
4298
|
+
* If `algorithm` is provided as a `<string>`, it must be one of:
|
|
4299
|
+
*
|
|
4300
|
+
* - `'SHA-1'`
|
|
4301
|
+
* - `'SHA-256'`
|
|
4302
|
+
* - `'SHA-384'`
|
|
4303
|
+
* - `'SHA-512'`
|
|
4304
|
+
*
|
|
4305
|
+
* If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
|
|
4306
|
+
* @since v15.0.0
|
|
4307
|
+
*/
|
|
4308
|
+
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
4309
|
+
/**
|
|
4310
|
+
* Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
|
|
4311
|
+
* `subtle.encrypt()` attempts to encipher `data`. If successful,
|
|
4312
|
+
* the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
|
|
4313
|
+
*
|
|
4314
|
+
* The algorithms currently supported include:
|
|
4315
|
+
*
|
|
4316
|
+
* - `'RSA-OAEP'`
|
|
4317
|
+
* - `'AES-CTR'`
|
|
4318
|
+
* - `'AES-CBC'`
|
|
4319
|
+
* - `'AES-GCM'`
|
|
4320
|
+
* @since v15.0.0
|
|
4321
|
+
*/
|
|
3978
4322
|
encrypt(
|
|
3979
|
-
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4323
|
+
algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
3980
4324
|
key: CryptoKey,
|
|
3981
|
-
data:
|
|
4325
|
+
data: BufferSource,
|
|
3982
4326
|
): Promise<ArrayBuffer>;
|
|
4327
|
+
/**
|
|
4328
|
+
* Exports the given key into the specified format, if supported.
|
|
4329
|
+
*
|
|
4330
|
+
* If the `<CryptoKey>` is not extractable, the returned promise will reject.
|
|
4331
|
+
*
|
|
4332
|
+
* When `format` is either `'pkcs8'` or `'spki'` and the export is successful,
|
|
4333
|
+
* the returned promise will be resolved with an `<ArrayBuffer>` containing the exported key data.
|
|
4334
|
+
*
|
|
4335
|
+
* When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
|
|
4336
|
+
* JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
|
|
4337
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4338
|
+
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
4339
|
+
* @since v15.0.0
|
|
4340
|
+
*/
|
|
3983
4341
|
exportKey(format: "jwk", key: CryptoKey): Promise<JsonWebKey>;
|
|
3984
4342
|
exportKey(format: Exclude<KeyFormat, "jwk">, key: CryptoKey): Promise<ArrayBuffer>;
|
|
3985
|
-
|
|
4343
|
+
/**
|
|
4344
|
+
* Using the method and parameters provided in `algorithm`,
|
|
4345
|
+
* `subtle.generateKey()` attempts to generate new keying material.
|
|
4346
|
+
* Depending the method used, the method may generate either a single `<CryptoKey>` or a `<CryptoKeyPair>`.
|
|
4347
|
+
*
|
|
4348
|
+
* The `<CryptoKeyPair>` (public and private key) generating algorithms supported include:
|
|
4349
|
+
*
|
|
4350
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
4351
|
+
* - `'RSA-PSS'`
|
|
4352
|
+
* - `'RSA-OAEP'`
|
|
4353
|
+
* - `'ECDSA'`
|
|
4354
|
+
* - `'Ed25519'`
|
|
4355
|
+
* - `'Ed448'`
|
|
4356
|
+
* - `'ECDH'`
|
|
4357
|
+
* - `'X25519'`
|
|
4358
|
+
* - `'X448'`
|
|
4359
|
+
* The `<CryptoKey>` (secret key) generating algorithms supported include:
|
|
4360
|
+
*
|
|
4361
|
+
* - `'HMAC'`
|
|
4362
|
+
* - `'AES-CTR'`
|
|
4363
|
+
* - `'AES-CBC'`
|
|
4364
|
+
* - `'AES-GCM'`
|
|
4365
|
+
* - `'AES-KW'`
|
|
4366
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4367
|
+
* @since v15.0.0
|
|
4368
|
+
*/
|
|
3986
4369
|
generateKey(
|
|
3987
4370
|
algorithm: RsaHashedKeyGenParams | EcKeyGenParams,
|
|
3988
4371
|
extractable: boolean,
|
|
3989
|
-
keyUsages: KeyUsage[],
|
|
4372
|
+
keyUsages: readonly KeyUsage[],
|
|
3990
4373
|
): Promise<CryptoKeyPair>;
|
|
3991
4374
|
generateKey(
|
|
3992
|
-
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params
|
|
4375
|
+
algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params,
|
|
3993
4376
|
extractable: boolean,
|
|
3994
|
-
keyUsages: KeyUsage[],
|
|
4377
|
+
keyUsages: readonly KeyUsage[],
|
|
3995
4378
|
): Promise<CryptoKey>;
|
|
3996
4379
|
generateKey(
|
|
3997
4380
|
algorithm: AlgorithmIdentifier,
|
|
3998
4381
|
extractable: boolean,
|
|
3999
4382
|
keyUsages: KeyUsage[],
|
|
4000
4383
|
): Promise<CryptoKeyPair | CryptoKey>;
|
|
4001
|
-
|
|
4384
|
+
/**
|
|
4385
|
+
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
4386
|
+
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
4387
|
+
* If the import is successful, the returned promise will be resolved with the created `<CryptoKey>`.
|
|
4388
|
+
*
|
|
4389
|
+
* If importing a `'PBKDF2'` key, `extractable` must be `false`.
|
|
4390
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4391
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4392
|
+
* @since v15.0.0
|
|
4393
|
+
*/
|
|
4002
4394
|
importKey(
|
|
4003
4395
|
format: "jwk",
|
|
4004
4396
|
keyData: JsonWebKey,
|
|
@@ -4007,59 +4399,147 @@ declare module "node:crypto" {
|
|
|
4007
4399
|
| RsaHashedImportParams
|
|
4008
4400
|
| EcKeyImportParams
|
|
4009
4401
|
| HmacImportParams
|
|
4010
|
-
| AesKeyAlgorithm
|
|
4011
|
-
| KmacImportParams,
|
|
4402
|
+
| AesKeyAlgorithm,
|
|
4012
4403
|
extractable: boolean,
|
|
4013
|
-
keyUsages: KeyUsage[],
|
|
4404
|
+
keyUsages: readonly KeyUsage[],
|
|
4014
4405
|
): Promise<CryptoKey>;
|
|
4015
4406
|
importKey(
|
|
4016
4407
|
format: Exclude<KeyFormat, "jwk">,
|
|
4017
|
-
keyData:
|
|
4408
|
+
keyData: BufferSource,
|
|
4018
4409
|
algorithm:
|
|
4019
4410
|
| AlgorithmIdentifier
|
|
4020
4411
|
| RsaHashedImportParams
|
|
4021
4412
|
| EcKeyImportParams
|
|
4022
4413
|
| HmacImportParams
|
|
4023
|
-
| AesKeyAlgorithm
|
|
4024
|
-
| KmacImportParams,
|
|
4414
|
+
| AesKeyAlgorithm,
|
|
4025
4415
|
extractable: boolean,
|
|
4026
4416
|
keyUsages: KeyUsage[],
|
|
4027
4417
|
): Promise<CryptoKey>;
|
|
4418
|
+
/**
|
|
4419
|
+
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
4420
|
+
* `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful,
|
|
4421
|
+
* the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
|
|
4422
|
+
*
|
|
4423
|
+
* The algorithms currently supported include:
|
|
4424
|
+
*
|
|
4425
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
4426
|
+
* - `'RSA-PSS'`
|
|
4427
|
+
* - `'ECDSA'`
|
|
4428
|
+
* - `'Ed25519'`
|
|
4429
|
+
* - `'Ed448'`
|
|
4430
|
+
* - `'HMAC'`
|
|
4431
|
+
* @since v15.0.0
|
|
4432
|
+
*/
|
|
4028
4433
|
sign(
|
|
4029
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams |
|
|
4434
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4030
4435
|
key: CryptoKey,
|
|
4031
|
-
data:
|
|
4436
|
+
data: BufferSource,
|
|
4032
4437
|
): Promise<ArrayBuffer>;
|
|
4438
|
+
/**
|
|
4439
|
+
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
4440
|
+
* The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
4441
|
+
* It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
|
|
4442
|
+
* then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
|
|
4443
|
+
* If successful, the returned promise is resolved with a `<CryptoKey>` object.
|
|
4444
|
+
*
|
|
4445
|
+
* The wrapping algorithms currently supported include:
|
|
4446
|
+
*
|
|
4447
|
+
* - `'RSA-OAEP'`
|
|
4448
|
+
* - `'AES-CTR'`
|
|
4449
|
+
* - `'AES-CBC'`
|
|
4450
|
+
* - `'AES-GCM'`
|
|
4451
|
+
* - `'AES-KW'`
|
|
4452
|
+
*
|
|
4453
|
+
* The unwrapped key algorithms supported include:
|
|
4454
|
+
*
|
|
4455
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
4456
|
+
* - `'RSA-PSS'`
|
|
4457
|
+
* - `'RSA-OAEP'`
|
|
4458
|
+
* - `'ECDSA'`
|
|
4459
|
+
* - `'Ed25519'`
|
|
4460
|
+
* - `'Ed448'`
|
|
4461
|
+
* - `'ECDH'`
|
|
4462
|
+
* - `'X25519'`
|
|
4463
|
+
* - `'X448'`
|
|
4464
|
+
* - `'HMAC'`
|
|
4465
|
+
* - `'AES-CTR'`
|
|
4466
|
+
* - `'AES-CBC'`
|
|
4467
|
+
* - `'AES-GCM'`
|
|
4468
|
+
* - `'AES-KW'`
|
|
4469
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4470
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
4471
|
+
* @since v15.0.0
|
|
4472
|
+
*/
|
|
4033
4473
|
unwrapKey(
|
|
4034
4474
|
format: KeyFormat,
|
|
4035
|
-
wrappedKey:
|
|
4475
|
+
wrappedKey: BufferSource,
|
|
4036
4476
|
unwrappingKey: CryptoKey,
|
|
4037
|
-
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4477
|
+
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4038
4478
|
unwrappedKeyAlgorithm:
|
|
4039
4479
|
| AlgorithmIdentifier
|
|
4040
4480
|
| RsaHashedImportParams
|
|
4041
4481
|
| EcKeyImportParams
|
|
4042
4482
|
| HmacImportParams
|
|
4043
|
-
| AesKeyAlgorithm
|
|
4044
|
-
| KmacImportParams,
|
|
4483
|
+
| AesKeyAlgorithm,
|
|
4045
4484
|
extractable: boolean,
|
|
4046
4485
|
keyUsages: KeyUsage[],
|
|
4047
4486
|
): Promise<CryptoKey>;
|
|
4487
|
+
/**
|
|
4488
|
+
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
4489
|
+
* `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`.
|
|
4490
|
+
* The returned promise is resolved with either `true` or `false`.
|
|
4491
|
+
*
|
|
4492
|
+
* The algorithms currently supported include:
|
|
4493
|
+
*
|
|
4494
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
4495
|
+
* - `'RSA-PSS'`
|
|
4496
|
+
* - `'ECDSA'`
|
|
4497
|
+
* - `'Ed25519'`
|
|
4498
|
+
* - `'Ed448'`
|
|
4499
|
+
* - `'HMAC'`
|
|
4500
|
+
* @since v15.0.0
|
|
4501
|
+
*/
|
|
4048
4502
|
verify(
|
|
4049
|
-
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams |
|
|
4503
|
+
algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params,
|
|
4050
4504
|
key: CryptoKey,
|
|
4051
|
-
signature:
|
|
4052
|
-
data:
|
|
4505
|
+
signature: BufferSource,
|
|
4506
|
+
data: BufferSource,
|
|
4053
4507
|
): Promise<boolean>;
|
|
4508
|
+
/**
|
|
4509
|
+
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
4510
|
+
* The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
|
|
4511
|
+
* then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
|
|
4512
|
+
* It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
|
|
4513
|
+
* then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
|
|
4514
|
+
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the encrypted key data.
|
|
4515
|
+
*
|
|
4516
|
+
* The wrapping algorithms currently supported include:
|
|
4517
|
+
*
|
|
4518
|
+
* - `'RSA-OAEP'`
|
|
4519
|
+
* - `'AES-CTR'`
|
|
4520
|
+
* - `'AES-CBC'`
|
|
4521
|
+
* - `'AES-GCM'`
|
|
4522
|
+
* - `'AES-KW'`
|
|
4523
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
4524
|
+
* @since v15.0.0
|
|
4525
|
+
*/
|
|
4054
4526
|
wrapKey(
|
|
4055
4527
|
format: KeyFormat,
|
|
4056
4528
|
key: CryptoKey,
|
|
4057
4529
|
wrappingKey: CryptoKey,
|
|
4058
|
-
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams |
|
|
4530
|
+
wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
4059
4531
|
): Promise<ArrayBuffer>;
|
|
4060
4532
|
}
|
|
4061
4533
|
}
|
|
4534
|
+
|
|
4535
|
+
global {
|
|
4536
|
+
var crypto: typeof globalThis extends {
|
|
4537
|
+
crypto: infer T;
|
|
4538
|
+
onmessage: any;
|
|
4539
|
+
} ? T
|
|
4540
|
+
: webcrypto.Crypto;
|
|
4541
|
+
}
|
|
4062
4542
|
}
|
|
4063
|
-
declare module "crypto" {
|
|
4064
|
-
export * from "
|
|
4543
|
+
declare module "node:crypto" {
|
|
4544
|
+
export * from "crypto";
|
|
4065
4545
|
}
|