◐ Shell
clean mode source ↗

doc: revise webcrypto.md types, interfaces, and added versions · nodejs/node@d44ccb3

@@ -497,7 +497,7 @@ The possible usages are:

497497

Valid key usages depend on the key algorithm (identified by

498498

`cryptokey.algorithm.name`).

499499500-

| Key Type | `'encrypt'` | `'decrypt'` | `'sign'` | `'verify'` | `'deriveKey'` | `'deriveBits'` | `'wrapKey'` | `'unwrapKey'` |

500+

| Supported Key Algorithm | `'encrypt'` | `'decrypt'` | `'sign'` | `'verify'` | `'deriveKey'` | `'deriveBits'` | `'wrapKey'` | `'unwrapKey'` |

501501

| ------------------------------------------------------- | ----------- | ----------- | -------- | ---------- | ------------- | -------------- | ----------- | ------------- |

502502

| `'AES-CBC'` ||| | | | |||

503503

| `'AES-CTR'` ||| | | | |||

@@ -556,7 +556,7 @@ added: v15.0.0

556556

* `algorithm`: {RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams}

557557

* `key`: {CryptoKey}

558558

* `data`: {ArrayBuffer|TypedArray|DataView|Buffer}

559-

* Returns: {Promise} Fulfills with an {ArrayBuffer}

559+

* Returns: {Promise} Fulfills with an {ArrayBuffer} upon success.

560560561561

Using the method and parameters specified in `algorithm` and the keying

562562

material provided by `key`, `subtle.decrypt()` attempts to decipher the

@@ -590,10 +590,10 @@ changes:

590590591591

<!--lint disable maximum-line-length remark-lint-->

592592593-

* `algorithm`: {AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}

593+

* `algorithm`: {EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}

594594

* `baseKey`: {CryptoKey}

595595

* `length`: {number|null} **Default:** `null`

596-

* Returns: {Promise} Fulfills with an {ArrayBuffer}

596+

* Returns: {Promise} Fulfills with an {ArrayBuffer} upon success.

597597598598

<!--lint enable maximum-line-length remark-lint-->

599599

@@ -630,12 +630,12 @@ changes:

630630631631

<!--lint disable maximum-line-length remark-lint-->

632632633-

* `algorithm`: {AlgorithmIdentifier|EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}

633+

* `algorithm`: {EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params}

634634

* `baseKey`: {CryptoKey}

635-

* `derivedKeyAlgorithm`: {HmacKeyGenParams|AesKeyGenParams}

635+

* `derivedKeyAlgorithm`: {string|AlgorithmIdentifier|HmacImportParams|AesDerivedKeyParams}

636636

* `extractable`: {boolean}

637637

* `keyUsages`: {string\[]} See [Key usages][].

638-

* Returns: {Promise} Fulfills with a {CryptoKey}

638+

* Returns: {Promise} Fulfills with a {CryptoKey} upon success.

639639640640

<!--lint enable maximum-line-length remark-lint-->

641641

@@ -662,9 +662,9 @@ The algorithms currently supported include:

662662

added: v15.0.0

663663

-->

664664665-

* `algorithm`: {string|Object}

665+

* `algorithm`: {string|AlgorithmIdentifier}

666666

* `data`: {ArrayBuffer|TypedArray|DataView|Buffer}

667-

* Returns: {Promise} Fulfills with an {ArrayBuffer}

667+

* Returns: {Promise} Fulfills with an {ArrayBuffer} upon success.

668668669669

Using the method identified by `algorithm`, `subtle.digest()` attempts to

670670

generate a digest of `data`. If successful, the returned promise is resolved

@@ -689,7 +689,7 @@ added: v15.0.0

689689

* `algorithm`: {RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams}

690690

* `key`: {CryptoKey}

691691

* `data`: {ArrayBuffer|TypedArray|DataView|Buffer}

692-

* Returns: {Promise} Fulfills with an {ArrayBuffer}

692+

* Returns: {Promise} Fulfills with an {ArrayBuffer} upon success.

693693694694

Using the method and parameters specified by `algorithm` and the keying

695695

material provided by `key`, `subtle.encrypt()` attempts to encipher `data`.

@@ -721,7 +721,7 @@ changes:

721721722722

* `format`: {string} Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.

723723

* `key`: {CryptoKey}

724-

* Returns: {Promise} Fulfills with an {ArrayBuffer|Object}.

724+

* Returns: {Promise} Fulfills with an {ArrayBuffer|Object} upon success.

725725726726

Exports the given key into the specified format, if supported.

727727

@@ -735,7 +735,7 @@ When `format` is `'jwk'` and the export is successful, the returned promise

735735

will be resolved with a JavaScript object conforming to the [JSON Web Key][]

736736

specification.

737737738-

| Key Type | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` |

738+

| Supported Key Algorithm | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` |

739739

| ------------------------------------------------------- | -------- | --------- | ------- | ------- |

740740

| `'AES-CBC'` | | |||

741741

| `'AES-CTR'` | | |||

@@ -745,9 +745,7 @@ specification.

745745

| `'ECDSA'` |||||

746746

| `'Ed25519'` |||||

747747

| `'Ed448'` <span class="experimental-inline"></span>[^1] |||||

748-

| `'HDKF'` | | | | |

749748

| `'HMAC'` | | |||

750-

| `'PBKDF2'` | | | | |

751749

| `'RSA-OAEP'` |||| |

752750

| `'RSA-PSS'` |||| |

753751

| `'RSASSA-PKCS1-v1_5'` |||| |

@@ -760,13 +758,13 @@ added: v15.0.0

760758761759

<!--lint disable maximum-line-length remark-lint-->

762760763-

* `algorithm`: {AlgorithmIdentifier|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams}

761+

* `algorithm`: {string|AlgorithmIdentifier|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams}

764762765763

<!--lint enable maximum-line-length remark-lint-->

766764767765

* `extractable`: {boolean}

768766

* `keyUsages`: {string\[]} See [Key usages][].

769-

* Returns: {Promise} Fulfills with a {CryptoKey|CryptoKeyPair}

767+

* Returns: {Promise} Fulfills with a {CryptoKey|CryptoKeyPair} upon success.

770768771769

Using the method and parameters provided in `algorithm`, `subtle.generateKey()`

772770

attempts to generate new keying material. Depending the method used, the method

@@ -814,13 +812,13 @@ changes:

814812815813

<!--lint disable maximum-line-length remark-lint-->

816814817-

* `algorithm`: {AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams}

815+

* `algorithm`: {string|AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams}

818816819817

<!--lint enable maximum-line-length remark-lint-->

820818821819

* `extractable`: {boolean}

822820

* `keyUsages`: {string\[]} See [Key usages][].

823-

* Returns: {Promise} Fulfills with a {CryptoKey}

821+

* Returns: {Promise} Fulfills with a {CryptoKey} upon success.

824822825823

The `subtle.importKey()` method attempts to interpret the provided `keyData`

826824

as the given `format` to create a {CryptoKey} instance using the provided

@@ -831,7 +829,7 @@ If importing a `'PBKDF2'` key, `extractable` must be `false`.

831829832830

The algorithms currently supported include:

833831834-

| Key Type | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` |

832+

| Supported Key Algorithm | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` |

835833

| ------------------------------------------------------- | -------- | --------- | ------- | ------- |

836834

| `'AES-CBC'` | | |||

837835

| `'AES-CTR'` | | |||

@@ -864,10 +862,10 @@ changes:

864862865863

<!--lint disable maximum-line-length remark-lint-->

866864867-

* `algorithm`: {AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params}

865+

* `algorithm`: {string|AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params}

868866

* `key`: {CryptoKey}

869867

* `data`: {ArrayBuffer|TypedArray|DataView|Buffer}

870-

* Returns: {Promise} Fulfills with an {ArrayBuffer}

868+

* Returns: {Promise} Fulfills with an {ArrayBuffer} upon success.

871869872870

<!--lint enable maximum-line-length remark-lint-->

873871

@@ -897,14 +895,14 @@ added: v15.0.0

897895898896

<!--lint disable maximum-line-length remark-lint-->

899897900-

* `unwrapAlgo`: {AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams}

901-

* `unwrappedKeyAlgo`: {AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams}

898+

* `unwrapAlgo`: {string|AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams}

899+

* `unwrappedKeyAlgo`: {string|AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams}

902900903901

<!--lint enable maximum-line-length remark-lint-->

904902905903

* `extractable`: {boolean}

906904

* `keyUsages`: {string\[]} See [Key usages][].

907-

* Returns: {Promise} Fulfills with a {CryptoKey}

905+

* Returns: {Promise} Fulfills with a {CryptoKey} upon success.

908906909907

In cryptography, "wrapping a key" refers to exporting and then encrypting the

910908

keying material. The `subtle.unwrapKey()` method attempts to decrypt a wrapped

@@ -954,11 +952,11 @@ changes:

954952955953

<!--lint disable maximum-line-length remark-lint-->

956954957-

* `algorithm`: {AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params}

955+

* `algorithm`: {string|AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params}

958956

* `key`: {CryptoKey}

959957

* `signature`: {ArrayBuffer|TypedArray|DataView|Buffer}

960958

* `data`: {ArrayBuffer|TypedArray|DataView|Buffer}

961-

* Returns: {Promise} Fulfills with a {boolean}

959+

* Returns: {Promise} Fulfills with a {boolean} upon success.

962960963961

<!--lint enable maximum-line-length remark-lint-->

964962

@@ -987,8 +985,8 @@ added: v15.0.0

987985

* `format`: {string} Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`.

988986

* `key`: {CryptoKey}

989987

* `wrappingKey`: {CryptoKey}

990-

* `wrapAlgo`: {AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams}

991-

* Returns: {Promise} Fulfills with an {ArrayBuffer}

988+

* `wrapAlgo`: {string|AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams}

989+

* Returns: {Promise} Fulfills with an {ArrayBuffer} upon success.

992990993991

<!--lint enable maximum-line-length remark-lint-->

994992

@@ -1019,21 +1017,43 @@ are simple JavaScript dictionary objects.

10191017

### Class: `AlgorithmIdentifier`

1020101810211019

<!-- YAML

1022-

added:

1023-

- v18.4.0

1024-

- v16.17.0

1020+

added: v15.0.0

10251021

-->

1026102210271023

#### `algorithmIdentifier.name`

1028102410291025

<!-- YAML

1030-

added:

1031-

- v18.4.0

1032-

- v16.17.0

1026+

added: v15.0.0

10331027

-->

1034102810351029

* Type: {string}

103610301031+

### Class: `AesDerivedKeyParams`

1032+1033+

<!-- YAML

1034+

added: v15.0.0

1035+

-->

1036+1037+

#### `aesDerivedKeyParams.name`

1038+1039+

<!-- YAML

1040+

added: v15.0.0

1041+

-->

1042+1043+

* Type: {string} Must be one of `'AES-CBC'`, `'AES-CTR'`, `'AES-GCM'`, or

1044+

`'AES-KW'`

1045+1046+

#### `aesDerivedKeyParams.length`

1047+1048+

<!-- YAML

1049+

added: v15.0.0

1050+

-->

1051+1052+

* Type: {number}

1053+1054+

The length of the AES key to be derived. This must be either `128`, `192`,

1055+

or `256`.

1056+10371057

### Class: `AesCbcParams`

1038105810391059

<!-- YAML