@types/node 16.11.43 → 16.11.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node v16.11/README.md +1 -1
- node v16.11/crypto.d.ts +530 -5
- node v16.11/fs.d.ts +16 -7
- node v16.11/package.json +2 -2
node v16.11/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v16.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Thu, 28 Jul 2022 02:32:31 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
|
|
14
14
|
|
node v16.11/crypto.d.ts
CHANGED
|
@@ -1510,9 +1510,9 @@ declare module 'crypto' {
|
|
|
1510
1510
|
* @param inputEncoding The `encoding` of an `otherPublicKey` string.
|
|
1511
1511
|
* @param outputEncoding The `encoding` of the return value.
|
|
1512
1512
|
*/
|
|
1513
|
-
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
|
|
1514
|
-
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
|
|
1515
|
-
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
|
|
1513
|
+
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
|
|
1514
|
+
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
|
|
1515
|
+
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
|
|
1516
1516
|
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
|
|
1517
1517
|
/**
|
|
1518
1518
|
* Returns the Diffie-Hellman prime in the specified `encoding`.
|
|
@@ -1582,6 +1582,36 @@ declare module 'crypto' {
|
|
|
1582
1582
|
*/
|
|
1583
1583
|
verifyError: number;
|
|
1584
1584
|
}
|
|
1585
|
+
/**
|
|
1586
|
+
* The `DiffieHellmanGroup` class takes a well-known modp group as its argument.
|
|
1587
|
+
* It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation.
|
|
1588
|
+
* In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods.
|
|
1589
|
+
*
|
|
1590
|
+
* ```js
|
|
1591
|
+
* const { createDiffieHellmanGroup } = await import('node:crypto');
|
|
1592
|
+
* const dh = createDiffieHellmanGroup('modp1');
|
|
1593
|
+
* ```
|
|
1594
|
+
* The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt):
|
|
1595
|
+
* ```bash
|
|
1596
|
+
* $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
|
|
1597
|
+
* modp1 # 768 bits
|
|
1598
|
+
* modp2 # 1024 bits
|
|
1599
|
+
* modp5 # 1536 bits
|
|
1600
|
+
* modp14 # 2048 bits
|
|
1601
|
+
* modp15 # etc.
|
|
1602
|
+
* modp16
|
|
1603
|
+
* modp17
|
|
1604
|
+
* modp18
|
|
1605
|
+
* ```
|
|
1606
|
+
* @since v0.7.5
|
|
1607
|
+
*/
|
|
1608
|
+
const DiffieHellmanGroup: DiffieHellmanGroupConstructor;
|
|
1609
|
+
interface DiffieHellmanGroupConstructor {
|
|
1610
|
+
new(name: string): DiffieHellmanGroup;
|
|
1611
|
+
(name: string): DiffieHellmanGroup;
|
|
1612
|
+
readonly prototype: DiffieHellmanGroup;
|
|
1613
|
+
}
|
|
1614
|
+
type DiffieHellmanGroup = Omit<DiffieHellman, 'setPublicKey' | 'setPrivateKey'>;
|
|
1585
1615
|
/**
|
|
1586
1616
|
* Creates a predefined `DiffieHellmanGroup` key exchange object. The
|
|
1587
1617
|
* supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
|
|
@@ -1612,7 +1642,12 @@ declare module 'crypto' {
|
|
|
1612
1642
|
* ```
|
|
1613
1643
|
* @since v0.7.5
|
|
1614
1644
|
*/
|
|
1615
|
-
function getDiffieHellman(groupName: string):
|
|
1645
|
+
function getDiffieHellman(groupName: string): DiffieHellmanGroup;
|
|
1646
|
+
/**
|
|
1647
|
+
* An alias for {@link getDiffieHellman}
|
|
1648
|
+
* @since v0.9.3
|
|
1649
|
+
*/
|
|
1650
|
+
function createDiffieHellmanGroup(name: string): DiffieHellmanGroup;
|
|
1616
1651
|
/**
|
|
1617
1652
|
* Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
|
|
1618
1653
|
* implementation. A selected HMAC digest algorithm specified by `digest` is
|
|
@@ -2094,6 +2129,12 @@ declare module 'crypto' {
|
|
|
2094
2129
|
* @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}.
|
|
2095
2130
|
*/
|
|
2096
2131
|
function getFips(): 1 | 0;
|
|
2132
|
+
/**
|
|
2133
|
+
* Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. Throws an error if FIPS mode is not available.
|
|
2134
|
+
* @since v10.0.0
|
|
2135
|
+
* @param bool `true` to enable FIPS mode.
|
|
2136
|
+
*/
|
|
2137
|
+
function setFips(bool: boolean): void;
|
|
2097
2138
|
/**
|
|
2098
2139
|
* ```js
|
|
2099
2140
|
* const {
|
|
@@ -3329,8 +3370,492 @@ declare module 'crypto' {
|
|
|
3329
3370
|
* @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`.
|
|
3330
3371
|
*/
|
|
3331
3372
|
function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean;
|
|
3373
|
+
/**
|
|
3374
|
+
* Load and set the `engine` for some or all OpenSSL functions (selected by flags).
|
|
3375
|
+
*
|
|
3376
|
+
* `engine` could be either an id or a path to the engine's shared library.
|
|
3377
|
+
*
|
|
3378
|
+
* The optional `flags` argument uses `ENGINE_METHOD_ALL` by default.
|
|
3379
|
+
* The `flags` is a bit field taking one of or a mix of the following flags (defined in `crypto.constants`):
|
|
3380
|
+
*
|
|
3381
|
+
* - `crypto.constants.ENGINE_METHOD_RSA`
|
|
3382
|
+
* - `crypto.constants.ENGINE_METHOD_DSA`
|
|
3383
|
+
* - `crypto.constants.ENGINE_METHOD_DH`
|
|
3384
|
+
* - `crypto.constants.ENGINE_METHOD_RAND`
|
|
3385
|
+
* - `crypto.constants.ENGINE_METHOD_EC`
|
|
3386
|
+
* - `crypto.constants.ENGINE_METHOD_CIPHERS`
|
|
3387
|
+
* - `crypto.constants.ENGINE_METHOD_DIGESTS`
|
|
3388
|
+
* - `crypto.constants.ENGINE_METHOD_PKEY_METHS`
|
|
3389
|
+
* - `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS`
|
|
3390
|
+
* - `crypto.constants.ENGINE_METHOD_ALL`
|
|
3391
|
+
* - `crypto.constants.ENGINE_METHOD_NONE`
|
|
3392
|
+
*
|
|
3393
|
+
* The flags below are deprecated in OpenSSL-1.1.0.
|
|
3394
|
+
*
|
|
3395
|
+
* - `crypto.constants.ENGINE_METHOD_ECDH`
|
|
3396
|
+
* - `crypto.constants.ENGINE_METHOD_ECDSA`
|
|
3397
|
+
* - `crypto.constants.ENGINE_METHOD_STORE`
|
|
3398
|
+
* @since v0.11.11
|
|
3399
|
+
* @param [flags=crypto.constants.ENGINE_METHOD_ALL]
|
|
3400
|
+
*/
|
|
3401
|
+
function setEngine(engine: string, flags?: number): void;
|
|
3402
|
+
/**
|
|
3403
|
+
* An implementation of the Web Crypto API standard.
|
|
3404
|
+
*
|
|
3405
|
+
* See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details.
|
|
3406
|
+
* @since v15.0.0
|
|
3407
|
+
*/
|
|
3408
|
+
const webcrypto: webcrypto.Crypto;
|
|
3332
3409
|
namespace webcrypto {
|
|
3333
|
-
|
|
3410
|
+
type BufferSource = ArrayBufferView | ArrayBuffer;
|
|
3411
|
+
type KeyFormat = 'jwk' | 'pkcs8' | 'raw' | 'spki';
|
|
3412
|
+
type KeyType = 'private' | 'public' | 'secret';
|
|
3413
|
+
type KeyUsage = 'decrypt' | 'deriveBits' | 'deriveKey' | 'encrypt' | 'sign' | 'unwrapKey' | 'verify' | 'wrapKey';
|
|
3414
|
+
type AlgorithmIdentifier = Algorithm | string;
|
|
3415
|
+
type HashAlgorithmIdentifier = AlgorithmIdentifier;
|
|
3416
|
+
type NamedCurve = string;
|
|
3417
|
+
type BigInteger = Uint8Array;
|
|
3418
|
+
interface AesCbcParams extends Algorithm {
|
|
3419
|
+
iv: BufferSource;
|
|
3420
|
+
}
|
|
3421
|
+
interface AesCtrParams extends Algorithm {
|
|
3422
|
+
counter: BufferSource;
|
|
3423
|
+
length: number;
|
|
3424
|
+
}
|
|
3425
|
+
interface AesDerivedKeyParams extends Algorithm {
|
|
3426
|
+
length: number;
|
|
3427
|
+
}
|
|
3428
|
+
interface AesGcmParams extends Algorithm {
|
|
3429
|
+
additionalData?: BufferSource;
|
|
3430
|
+
iv: BufferSource;
|
|
3431
|
+
tagLength?: number;
|
|
3432
|
+
}
|
|
3433
|
+
interface AesKeyAlgorithm extends KeyAlgorithm {
|
|
3434
|
+
length: number;
|
|
3435
|
+
}
|
|
3436
|
+
interface AesKeyGenParams extends Algorithm {
|
|
3437
|
+
length: number;
|
|
3438
|
+
}
|
|
3439
|
+
interface Algorithm {
|
|
3440
|
+
name: string;
|
|
3441
|
+
}
|
|
3442
|
+
interface EcKeyAlgorithm extends KeyAlgorithm {
|
|
3443
|
+
namedCurve: NamedCurve;
|
|
3444
|
+
}
|
|
3445
|
+
interface EcKeyGenParams extends Algorithm {
|
|
3446
|
+
namedCurve: NamedCurve;
|
|
3447
|
+
}
|
|
3448
|
+
interface EcKeyImportParams extends Algorithm {
|
|
3449
|
+
namedCurve: NamedCurve;
|
|
3450
|
+
}
|
|
3451
|
+
interface EcdhKeyDeriveParams extends Algorithm {
|
|
3452
|
+
public: CryptoKey;
|
|
3453
|
+
}
|
|
3454
|
+
interface EcdsaParams extends Algorithm {
|
|
3455
|
+
hash: HashAlgorithmIdentifier;
|
|
3456
|
+
}
|
|
3457
|
+
interface Ed448Params extends Algorithm {
|
|
3458
|
+
context?: BufferSource;
|
|
3459
|
+
}
|
|
3460
|
+
interface HkdfParams extends Algorithm {
|
|
3461
|
+
hash: HashAlgorithmIdentifier;
|
|
3462
|
+
info: BufferSource;
|
|
3463
|
+
salt: BufferSource;
|
|
3464
|
+
}
|
|
3465
|
+
interface HmacImportParams extends Algorithm {
|
|
3466
|
+
hash: HashAlgorithmIdentifier;
|
|
3467
|
+
length?: number;
|
|
3468
|
+
}
|
|
3469
|
+
interface HmacKeyAlgorithm extends KeyAlgorithm {
|
|
3470
|
+
hash: KeyAlgorithm;
|
|
3471
|
+
length: number;
|
|
3472
|
+
}
|
|
3473
|
+
interface HmacKeyGenParams extends Algorithm {
|
|
3474
|
+
hash: HashAlgorithmIdentifier;
|
|
3475
|
+
length?: number;
|
|
3476
|
+
}
|
|
3477
|
+
interface JsonWebKey {
|
|
3478
|
+
alg?: string;
|
|
3479
|
+
crv?: string;
|
|
3480
|
+
d?: string;
|
|
3481
|
+
dp?: string;
|
|
3482
|
+
dq?: string;
|
|
3483
|
+
e?: string;
|
|
3484
|
+
ext?: boolean;
|
|
3485
|
+
k?: string;
|
|
3486
|
+
key_ops?: string[];
|
|
3487
|
+
kty?: string;
|
|
3488
|
+
n?: string;
|
|
3489
|
+
oth?: RsaOtherPrimesInfo[];
|
|
3490
|
+
p?: string;
|
|
3491
|
+
q?: string;
|
|
3492
|
+
qi?: string;
|
|
3493
|
+
use?: string;
|
|
3494
|
+
x?: string;
|
|
3495
|
+
y?: string;
|
|
3496
|
+
}
|
|
3497
|
+
interface KeyAlgorithm {
|
|
3498
|
+
name: string;
|
|
3499
|
+
}
|
|
3500
|
+
interface Pbkdf2Params extends Algorithm {
|
|
3501
|
+
hash: HashAlgorithmIdentifier;
|
|
3502
|
+
iterations: number;
|
|
3503
|
+
salt: BufferSource;
|
|
3504
|
+
}
|
|
3505
|
+
interface RsaHashedImportParams extends Algorithm {
|
|
3506
|
+
hash: HashAlgorithmIdentifier;
|
|
3507
|
+
}
|
|
3508
|
+
interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm {
|
|
3509
|
+
hash: KeyAlgorithm;
|
|
3510
|
+
}
|
|
3511
|
+
interface RsaHashedKeyGenParams extends RsaKeyGenParams {
|
|
3512
|
+
hash: HashAlgorithmIdentifier;
|
|
3513
|
+
}
|
|
3514
|
+
interface RsaKeyAlgorithm extends KeyAlgorithm {
|
|
3515
|
+
modulusLength: number;
|
|
3516
|
+
publicExponent: BigInteger;
|
|
3517
|
+
}
|
|
3518
|
+
interface RsaKeyGenParams extends Algorithm {
|
|
3519
|
+
modulusLength: number;
|
|
3520
|
+
publicExponent: BigInteger;
|
|
3521
|
+
}
|
|
3522
|
+
interface RsaOaepParams extends Algorithm {
|
|
3523
|
+
label?: BufferSource;
|
|
3524
|
+
}
|
|
3525
|
+
interface RsaOtherPrimesInfo {
|
|
3526
|
+
d?: string;
|
|
3527
|
+
r?: string;
|
|
3528
|
+
t?: string;
|
|
3529
|
+
}
|
|
3530
|
+
interface RsaPssParams extends Algorithm {
|
|
3531
|
+
saltLength: number;
|
|
3532
|
+
}
|
|
3533
|
+
/**
|
|
3534
|
+
* Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class.
|
|
3535
|
+
* `Crypto` is a singleton that provides access to the remainder of the crypto API.
|
|
3536
|
+
* @since v15.0.0
|
|
3537
|
+
*/
|
|
3538
|
+
interface Crypto {
|
|
3539
|
+
/**
|
|
3540
|
+
* Provides access to the `SubtleCrypto` API.
|
|
3541
|
+
* @since v15.0.0
|
|
3542
|
+
*/
|
|
3543
|
+
readonly subtle: SubtleCrypto;
|
|
3544
|
+
/**
|
|
3545
|
+
* Generates cryptographically strong random values.
|
|
3546
|
+
* The given `typedArray` is filled with random values, and a reference to `typedArray` is returned.
|
|
3547
|
+
*
|
|
3548
|
+
* The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted.
|
|
3549
|
+
*
|
|
3550
|
+
* An error will be thrown if the given `typedArray` is larger than 65,536 bytes.
|
|
3551
|
+
* @since v15.0.0
|
|
3552
|
+
*/
|
|
3553
|
+
getRandomValues<T extends Exclude<NodeJS.TypedArray, Float32Array | Float64Array>>(typedArray: T): T;
|
|
3554
|
+
/**
|
|
3555
|
+
* Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID.
|
|
3556
|
+
* The UUID is generated using a cryptographic pseudorandom number generator.
|
|
3557
|
+
* @since v16.7.0
|
|
3558
|
+
*/
|
|
3559
|
+
randomUUID(): string;
|
|
3560
|
+
CryptoKey: CryptoKeyConstructor;
|
|
3561
|
+
}
|
|
3562
|
+
// This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable.
|
|
3563
|
+
interface CryptoKeyConstructor {
|
|
3564
|
+
/** Illegal constructor */
|
|
3565
|
+
(_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user.
|
|
3566
|
+
readonly length: 0;
|
|
3567
|
+
readonly name: 'CryptoKey';
|
|
3568
|
+
readonly prototype: CryptoKey;
|
|
3569
|
+
}
|
|
3570
|
+
/**
|
|
3571
|
+
* @since v15.0.0
|
|
3572
|
+
*/
|
|
3573
|
+
interface CryptoKey {
|
|
3574
|
+
/**
|
|
3575
|
+
* An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters.
|
|
3576
|
+
* @since v15.0.0
|
|
3577
|
+
*/
|
|
3578
|
+
readonly algorithm: KeyAlgorithm;
|
|
3579
|
+
/**
|
|
3580
|
+
* When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`.
|
|
3581
|
+
* @since v15.0.0
|
|
3582
|
+
*/
|
|
3583
|
+
readonly extractable: boolean;
|
|
3584
|
+
/**
|
|
3585
|
+
* A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key.
|
|
3586
|
+
* @since v15.0.0
|
|
3587
|
+
*/
|
|
3588
|
+
readonly type: KeyType;
|
|
3589
|
+
/**
|
|
3590
|
+
* An array of strings identifying the operations for which the key may be used.
|
|
3591
|
+
*
|
|
3592
|
+
* The possible usages are:
|
|
3593
|
+
* - `'encrypt'` - The key may be used to encrypt data.
|
|
3594
|
+
* - `'decrypt'` - The key may be used to decrypt data.
|
|
3595
|
+
* - `'sign'` - The key may be used to generate digital signatures.
|
|
3596
|
+
* - `'verify'` - The key may be used to verify digital signatures.
|
|
3597
|
+
* - `'deriveKey'` - The key may be used to derive a new key.
|
|
3598
|
+
* - `'deriveBits'` - The key may be used to derive bits.
|
|
3599
|
+
* - `'wrapKey'` - The key may be used to wrap another key.
|
|
3600
|
+
* - `'unwrapKey'` - The key may be used to unwrap another key.
|
|
3601
|
+
*
|
|
3602
|
+
* Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`).
|
|
3603
|
+
* @since v15.0.0
|
|
3604
|
+
*/
|
|
3605
|
+
readonly usages: KeyUsage[];
|
|
3606
|
+
}
|
|
3607
|
+
/**
|
|
3608
|
+
* The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair.
|
|
3609
|
+
* @since v15.0.0
|
|
3610
|
+
*/
|
|
3611
|
+
interface CryptoKeyPair {
|
|
3612
|
+
/**
|
|
3613
|
+
* A {@link CryptoKey} whose type will be `'private'`.
|
|
3614
|
+
* @since v15.0.0
|
|
3615
|
+
*/
|
|
3616
|
+
privateKey: CryptoKey;
|
|
3617
|
+
/**
|
|
3618
|
+
* A {@link CryptoKey} whose type will be `'public'`.
|
|
3619
|
+
* @since v15.0.0
|
|
3620
|
+
*/
|
|
3621
|
+
publicKey: CryptoKey;
|
|
3622
|
+
}
|
|
3623
|
+
/**
|
|
3624
|
+
* @since v15.0.0
|
|
3625
|
+
*/
|
|
3626
|
+
interface SubtleCrypto {
|
|
3627
|
+
/**
|
|
3628
|
+
* Using the method and parameters specified in `algorithm` and the keying material provided by `key`,
|
|
3629
|
+
* `subtle.decrypt()` attempts to decipher the provided `data`. If successful,
|
|
3630
|
+
* the returned promise will be resolved with an `<ArrayBuffer>` containing the plaintext result.
|
|
3631
|
+
*
|
|
3632
|
+
* The algorithms currently supported include:
|
|
3633
|
+
*
|
|
3634
|
+
* - `'RSA-OAEP'`
|
|
3635
|
+
* - `'AES-CTR'`
|
|
3636
|
+
* - `'AES-CBC'`
|
|
3637
|
+
* - `'AES-GCM'`
|
|
3638
|
+
* @since v15.0.0
|
|
3639
|
+
*/
|
|
3640
|
+
decrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3641
|
+
/**
|
|
3642
|
+
* Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`,
|
|
3643
|
+
* `subtle.deriveBits()` attempts to generate `length` bits.
|
|
3644
|
+
* The Node.js implementation requires that `length` is a multiple of `8`.
|
|
3645
|
+
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the generated data.
|
|
3646
|
+
*
|
|
3647
|
+
* The algorithms currently supported include:
|
|
3648
|
+
*
|
|
3649
|
+
* - `'ECDH'`
|
|
3650
|
+
* - `'HKDF'`
|
|
3651
|
+
* - `'PBKDF2'`
|
|
3652
|
+
* @since v15.0.0
|
|
3653
|
+
*/
|
|
3654
|
+
deriveBits(algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, baseKey: CryptoKey, length: number): Promise<ArrayBuffer>;
|
|
3655
|
+
/**
|
|
3656
|
+
* Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`,
|
|
3657
|
+
* `subtle.deriveKey()` attempts to generate a new <CryptoKey>` based on the method and parameters in `derivedKeyAlgorithm`.
|
|
3658
|
+
*
|
|
3659
|
+
* Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material,
|
|
3660
|
+
* then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input.
|
|
3661
|
+
*
|
|
3662
|
+
* The algorithms currently supported include:
|
|
3663
|
+
*
|
|
3664
|
+
* - `'ECDH'`
|
|
3665
|
+
* - `'HKDF'`
|
|
3666
|
+
* - `'PBKDF2'`
|
|
3667
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3668
|
+
* @since v15.0.0
|
|
3669
|
+
*/
|
|
3670
|
+
deriveKey(
|
|
3671
|
+
algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params,
|
|
3672
|
+
baseKey: CryptoKey,
|
|
3673
|
+
derivedKeyAlgorithm: AlgorithmIdentifier | AesDerivedKeyParams | HmacImportParams | HkdfParams | Pbkdf2Params,
|
|
3674
|
+
extractable: boolean,
|
|
3675
|
+
keyUsages: ReadonlyArray<KeyUsage>
|
|
3676
|
+
): Promise<CryptoKey>;
|
|
3677
|
+
/**
|
|
3678
|
+
* Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`.
|
|
3679
|
+
* If successful, the returned promise is resolved with an `<ArrayBuffer>` containing the computed digest.
|
|
3680
|
+
*
|
|
3681
|
+
* If `algorithm` is provided as a `<string>`, it must be one of:
|
|
3682
|
+
*
|
|
3683
|
+
* - `'SHA-1'`
|
|
3684
|
+
* - `'SHA-256'`
|
|
3685
|
+
* - `'SHA-384'`
|
|
3686
|
+
* - `'SHA-512'`
|
|
3687
|
+
*
|
|
3688
|
+
* If `algorithm` is provided as an `<Object>`, it must have a `name` property whose value is one of the above.
|
|
3689
|
+
* @since v15.0.0
|
|
3690
|
+
*/
|
|
3691
|
+
digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise<ArrayBuffer>;
|
|
3692
|
+
/**
|
|
3693
|
+
* Using the method and parameters specified by `algorithm` and the keying material provided by `key`,
|
|
3694
|
+
* `subtle.encrypt()` attempts to encipher `data`. If successful,
|
|
3695
|
+
* the returned promise is resolved with an `<ArrayBuffer>` containing the encrypted result.
|
|
3696
|
+
*
|
|
3697
|
+
* The algorithms currently supported include:
|
|
3698
|
+
*
|
|
3699
|
+
* - `'RSA-OAEP'`
|
|
3700
|
+
* - `'AES-CTR'`
|
|
3701
|
+
* - `'AES-CBC'`
|
|
3702
|
+
* - `'AES-GCM'`
|
|
3703
|
+
* @since v15.0.0
|
|
3704
|
+
*/
|
|
3705
|
+
encrypt(algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3706
|
+
/**
|
|
3707
|
+
* Exports the given key into the specified format, if supported.
|
|
3708
|
+
*
|
|
3709
|
+
* If the `<CryptoKey>` is not extractable, the returned promise will reject.
|
|
3710
|
+
*
|
|
3711
|
+
* When `format` is either `'pkcs8'` or `'spki'` and the export is successful,
|
|
3712
|
+
* the returned promise will be resolved with an `<ArrayBuffer>` containing the exported key data.
|
|
3713
|
+
*
|
|
3714
|
+
* When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a
|
|
3715
|
+
* JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification.
|
|
3716
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3717
|
+
* @returns `<Promise>` containing `<ArrayBuffer>`.
|
|
3718
|
+
* @since v15.0.0
|
|
3719
|
+
*/
|
|
3720
|
+
exportKey(format: 'jwk', key: CryptoKey): Promise<JsonWebKey>;
|
|
3721
|
+
exportKey(format: Exclude<KeyFormat, 'jwk'>, key: CryptoKey): Promise<ArrayBuffer>;
|
|
3722
|
+
/**
|
|
3723
|
+
* Using the method and parameters provided in `algorithm`,
|
|
3724
|
+
* `subtle.generateKey()` attempts to generate new keying material.
|
|
3725
|
+
* Depending the method used, the method may generate either a single `<CryptoKey>` or a `<CryptoKeyPair>`.
|
|
3726
|
+
*
|
|
3727
|
+
* The `<CryptoKeyPair>` (public and private key) generating algorithms supported include:
|
|
3728
|
+
*
|
|
3729
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3730
|
+
* - `'RSA-PSS'`
|
|
3731
|
+
* - `'RSA-OAEP'`
|
|
3732
|
+
* - `'ECDSA'`
|
|
3733
|
+
* - `'ECDH'`
|
|
3734
|
+
* The `<CryptoKey>` (secret key) generating algorithms supported include:
|
|
3735
|
+
*
|
|
3736
|
+
* - `'HMAC'`
|
|
3737
|
+
* - `'AES-CTR'`
|
|
3738
|
+
* - `'AES-CBC'`
|
|
3739
|
+
* - `'AES-GCM'`
|
|
3740
|
+
* - `'AES-KW'`
|
|
3741
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3742
|
+
* @since v15.0.0
|
|
3743
|
+
*/
|
|
3744
|
+
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKeyPair>;
|
|
3745
|
+
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: ReadonlyArray<KeyUsage>): Promise<CryptoKey>;
|
|
3746
|
+
generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
|
|
3747
|
+
/**
|
|
3748
|
+
* The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format`
|
|
3749
|
+
* to create a `<CryptoKey>` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments.
|
|
3750
|
+
* If the import is successful, the returned promise will be resolved with the created `<CryptoKey>`.
|
|
3751
|
+
*
|
|
3752
|
+
* If importing a `'PBKDF2'` key, `extractable` must be `false`.
|
|
3753
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3754
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3755
|
+
* @since v15.0.0
|
|
3756
|
+
*/
|
|
3757
|
+
importKey(
|
|
3758
|
+
format: 'jwk',
|
|
3759
|
+
keyData: JsonWebKey,
|
|
3760
|
+
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
|
3761
|
+
extractable: boolean,
|
|
3762
|
+
keyUsages: ReadonlyArray<KeyUsage>
|
|
3763
|
+
): Promise<CryptoKey>;
|
|
3764
|
+
importKey(
|
|
3765
|
+
format: Exclude<KeyFormat, 'jwk'>,
|
|
3766
|
+
keyData: BufferSource,
|
|
3767
|
+
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
|
3768
|
+
extractable: boolean,
|
|
3769
|
+
keyUsages: KeyUsage[]
|
|
3770
|
+
): Promise<CryptoKey>;
|
|
3771
|
+
/**
|
|
3772
|
+
* Using the method and parameters given by `algorithm` and the keying material provided by `key`,
|
|
3773
|
+
* `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful,
|
|
3774
|
+
* the returned promise is resolved with an `<ArrayBuffer>` containing the generated signature.
|
|
3775
|
+
*
|
|
3776
|
+
* The algorithms currently supported include:
|
|
3777
|
+
*
|
|
3778
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3779
|
+
* - `'RSA-PSS'`
|
|
3780
|
+
* - `'ECDSA'`
|
|
3781
|
+
* - `'HMAC'`
|
|
3782
|
+
* @since v15.0.0
|
|
3783
|
+
*/
|
|
3784
|
+
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, data: BufferSource): Promise<ArrayBuffer>;
|
|
3785
|
+
/**
|
|
3786
|
+
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3787
|
+
* The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `<CryptoKey>` instance.
|
|
3788
|
+
* It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input)
|
|
3789
|
+
* then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs.
|
|
3790
|
+
* If successful, the returned promise is resolved with a `<CryptoKey>` object.
|
|
3791
|
+
*
|
|
3792
|
+
* The wrapping algorithms currently supported include:
|
|
3793
|
+
*
|
|
3794
|
+
* - `'RSA-OAEP'`
|
|
3795
|
+
* - `'AES-CTR'`
|
|
3796
|
+
* - `'AES-CBC'`
|
|
3797
|
+
* - `'AES-GCM'`
|
|
3798
|
+
* - `'AES-KW'`
|
|
3799
|
+
*
|
|
3800
|
+
* The unwrapped key algorithms supported include:
|
|
3801
|
+
*
|
|
3802
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3803
|
+
* - `'RSA-PSS'`
|
|
3804
|
+
* - `'RSA-OAEP'`
|
|
3805
|
+
* - `'ECDSA'`
|
|
3806
|
+
* - `'ECDH'`
|
|
3807
|
+
* - `'HMAC'`
|
|
3808
|
+
* - `'AES-CTR'`
|
|
3809
|
+
* - `'AES-CBC'`
|
|
3810
|
+
* - `'AES-GCM'`
|
|
3811
|
+
* - `'AES-KW'`
|
|
3812
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3813
|
+
* @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}.
|
|
3814
|
+
* @since v15.0.0
|
|
3815
|
+
*/
|
|
3816
|
+
unwrapKey(
|
|
3817
|
+
format: KeyFormat,
|
|
3818
|
+
wrappedKey: BufferSource,
|
|
3819
|
+
unwrappingKey: CryptoKey,
|
|
3820
|
+
unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams,
|
|
3821
|
+
unwrappedKeyAlgorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams | HmacImportParams | AesKeyAlgorithm,
|
|
3822
|
+
extractable: boolean,
|
|
3823
|
+
keyUsages: KeyUsage[]
|
|
3824
|
+
): Promise<CryptoKey>;
|
|
3825
|
+
/**
|
|
3826
|
+
* Using the method and parameters given in `algorithm` and the keying material provided by `key`,
|
|
3827
|
+
* `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`.
|
|
3828
|
+
* The returned promise is resolved with either `true` or `false`.
|
|
3829
|
+
*
|
|
3830
|
+
* The algorithms currently supported include:
|
|
3831
|
+
*
|
|
3832
|
+
* - `'RSASSA-PKCS1-v1_5'`
|
|
3833
|
+
* - `'RSA-PSS'`
|
|
3834
|
+
* - `'ECDSA'`
|
|
3835
|
+
* - `'HMAC'`
|
|
3836
|
+
* @since v15.0.0
|
|
3837
|
+
*/
|
|
3838
|
+
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, key: CryptoKey, signature: BufferSource, data: BufferSource): Promise<boolean>;
|
|
3839
|
+
/**
|
|
3840
|
+
* In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material.
|
|
3841
|
+
* The `subtle.wrapKey()` method exports the keying material into the format identified by `format`,
|
|
3842
|
+
* then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`.
|
|
3843
|
+
* It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments,
|
|
3844
|
+
* then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs.
|
|
3845
|
+
* If successful, the returned promise will be resolved with an `<ArrayBuffer>` containing the encrypted key data.
|
|
3846
|
+
*
|
|
3847
|
+
* The wrapping algorithms currently supported include:
|
|
3848
|
+
*
|
|
3849
|
+
* - `'RSA-OAEP'`
|
|
3850
|
+
* - `'AES-CTR'`
|
|
3851
|
+
* - `'AES-CBC'`
|
|
3852
|
+
* - `'AES-GCM'`
|
|
3853
|
+
* - `'AES-KW'`
|
|
3854
|
+
* @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.
|
|
3855
|
+
* @since v15.0.0
|
|
3856
|
+
*/
|
|
3857
|
+
wrapKey(format: KeyFormat, key: CryptoKey, wrappingKey: CryptoKey, wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams): Promise<ArrayBuffer>;
|
|
3858
|
+
}
|
|
3334
3859
|
}
|
|
3335
3860
|
}
|
|
3336
3861
|
declare module 'node:crypto' {
|
node v16.11/fs.d.ts
CHANGED
|
@@ -3723,7 +3723,7 @@ declare module 'fs' {
|
|
|
3723
3723
|
export interface StatSyncOptions extends StatOptions {
|
|
3724
3724
|
throwIfNoEntry?: boolean | undefined;
|
|
3725
3725
|
}
|
|
3726
|
-
|
|
3726
|
+
interface CopyOptionsBase {
|
|
3727
3727
|
/**
|
|
3728
3728
|
* Dereference symlinks
|
|
3729
3729
|
* @default false
|
|
@@ -3735,11 +3735,6 @@ declare module 'fs' {
|
|
|
3735
3735
|
* @default false
|
|
3736
3736
|
*/
|
|
3737
3737
|
errorOnExist?: boolean;
|
|
3738
|
-
/**
|
|
3739
|
-
* Function to filter copied files/directories. Return
|
|
3740
|
-
* `true` to copy the item, `false` to ignore it.
|
|
3741
|
-
*/
|
|
3742
|
-
filter?(source: string, destination: string): boolean;
|
|
3743
3738
|
/**
|
|
3744
3739
|
* Overwrite existing file or directory. _The copy
|
|
3745
3740
|
* operation will ignore errors if you set this to false and the destination
|
|
@@ -3759,6 +3754,20 @@ declare module 'fs' {
|
|
|
3759
3754
|
*/
|
|
3760
3755
|
recursive?: boolean;
|
|
3761
3756
|
}
|
|
3757
|
+
export interface CopyOptions extends CopyOptionsBase {
|
|
3758
|
+
/**
|
|
3759
|
+
* Function to filter copied files/directories. Return
|
|
3760
|
+
* `true` to copy the item, `false` to ignore it.
|
|
3761
|
+
*/
|
|
3762
|
+
filter?(source: string, destination: string): boolean | Promise<boolean>;
|
|
3763
|
+
}
|
|
3764
|
+
export interface CopySyncOptions extends CopyOptionsBase {
|
|
3765
|
+
/**
|
|
3766
|
+
* Function to filter copied files/directories. Return
|
|
3767
|
+
* `true` to copy the item, `false` to ignore it.
|
|
3768
|
+
*/
|
|
3769
|
+
filter?(source: string, destination: string): boolean;
|
|
3770
|
+
}
|
|
3762
3771
|
/**
|
|
3763
3772
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
3764
3773
|
* including subdirectories and files.
|
|
@@ -3783,7 +3792,7 @@ declare module 'fs' {
|
|
|
3783
3792
|
* @param src source path to copy.
|
|
3784
3793
|
* @param dest destination path to copy to.
|
|
3785
3794
|
*/
|
|
3786
|
-
export function cpSync(source: string | URL, destination: string | URL, opts?:
|
|
3795
|
+
export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
|
|
3787
3796
|
}
|
|
3788
3797
|
declare module 'node:fs' {
|
|
3789
3798
|
export * from 'fs';
|
node v16.11/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "16.11.
|
|
3
|
+
"version": "16.11.46",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -220,6 +220,6 @@
|
|
|
220
220
|
},
|
|
221
221
|
"scripts": {},
|
|
222
222
|
"dependencies": {},
|
|
223
|
-
"typesPublisherContentHash": "
|
|
223
|
+
"typesPublisherContentHash": "a01374ecbbe5be3634ac90736ebbe2bd343a2ecbc4a0c91def7e0c711bfc98dc",
|
|
224
224
|
"typeScriptVersion": "4.0"
|
|
225
225
|
}
|