diff options
author | Rich Trott <rtrott@gmail.com> | 2021-10-11 07:55:04 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-10-20 12:59:11 +0300 |
commit | d0b58c0287e67a139137aa906819d95f8314b093 (patch) | |
tree | e9a92870138d89b608b1c6e6568611744c32c4f2 /doc/api/webcrypto.md | |
parent | a7c17e08de658cbc0beefd8e9583803b5a62ac7e (diff) |
doc: format doc/api/*.md with markdown formatter
PR-URL: https://github.com/nodejs/node/pull/40403
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'doc/api/webcrypto.md')
-rw-r--r-- | doc/api/webcrypto.md | 322 |
1 files changed, 238 insertions, 84 deletions
diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md index 2d89abbf1c1..0a860d74470 100644 --- a/doc/api/webcrypto.md +++ b/doc/api/webcrypto.md @@ -306,32 +306,33 @@ async function digest(data, algorithm = 'SHA-512') { The table details the algorithms supported by the Node.js Web Crypto API implementation and the APIs supported for each: -| Algorithm | `generateKey` | `exportKey` | `importKey` | `encrypt` | `decrypt` | `wrapKey` | `unwrapKey` | `deriveBits` | `deriveKey` | `sign` | `verify` | `digest` | -| --------------------- | ------------- | ----------- | ----------- | --------- | --------- | --------- | ----------- | ------------ | ----------- | ------ | -------- | -------- | -| `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | -| `'RSA-PSS'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | -| `'RSA-OAEP'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | -| `'ECDSA'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | -| `'ECDH'` | ✔ | ✔ | ✔ | | | | | ✔ | ✔ | | | | -| `'AES-CTR'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | -| `'AES-CBC'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | -| `'AES-GCM'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | -| `'AES-KW'` | ✔ | ✔ | ✔ | | | ✔ | ✔ | | | | | | -| `'HMAC'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | -| `'HKDF'` | | ✔ | ✔ | | | | | ✔ | ✔ | | | | -| `'PBKDF2'` | | ✔ | ✔ | | | | | ✔ | ✔ | | | | -| `'SHA-1'` | | | | | | | | | | | | ✔ | -| `'SHA-256'` | | | | | | | | | | | | ✔ | -| `'SHA-384'` | | | | | | | | | | | | ✔ | -| `'SHA-512'` | | | | | | | | | | | | ✔ | -| `'NODE-DSA'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | -| `'NODE-DH'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | ✔ | ✔ | | | | -| `'NODE-ED25519'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | -| `'NODE-ED448'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| Algorithm | `generateKey` | `exportKey` | `importKey` | `encrypt` | `decrypt` | `wrapKey` | `unwrapKey` | `deriveBits` | `deriveKey` | `sign` | `verify` | `digest` | +| ---------------------------- | ------------- | ----------- | ----------- | --------- | --------- | --------- | ----------- | ------------ | ----------- | ------ | -------- | -------- | +| `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| `'RSA-PSS'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| `'RSA-OAEP'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | +| `'ECDSA'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| `'ECDH'` | ✔ | ✔ | ✔ | | | | | ✔ | ✔ | | | | +| `'AES-CTR'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | +| `'AES-CBC'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | +| `'AES-GCM'` | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | | | | | +| `'AES-KW'` | ✔ | ✔ | ✔ | | | ✔ | ✔ | | | | | | +| `'HMAC'` | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| `'HKDF'` | | ✔ | ✔ | | | | | ✔ | ✔ | | | | +| `'PBKDF2'` | | ✔ | ✔ | | | | | ✔ | ✔ | | | | +| `'SHA-1'` | | | | | | | | | | | | ✔ | +| `'SHA-256'` | | | | | | | | | | | | ✔ | +| `'SHA-384'` | | | | | | | | | | | | ✔ | +| `'SHA-512'` | | | | | | | | | | | | ✔ | +| `'NODE-DSA'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| `'NODE-DH'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | ✔ | ✔ | | | | +| `'NODE-ED25519'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | +| `'NODE-ED448'`<sup>1</sup> | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | | <sup>1</sup> Node.js-specific extension ## Class: `Crypto` + <!-- YAML added: v15.0.0 --> @@ -340,6 +341,7 @@ Calling `require('crypto').webcrypto` returns an instance of the `Crypto` class. `Crypto` is a singleton that provides access to the remainder of the crypto API. ### `crypto.subtle` + <!-- YAML added: v15.0.0 --> @@ -349,6 +351,7 @@ added: v15.0.0 Provides access to the `SubtleCrypto` API. ### `crypto.getRandomValues(typedArray)` + <!-- YAML added: v15.0.0 --> @@ -362,6 +365,7 @@ filled with random values, and a reference to `typedArray` is returned. An error will be thrown if the given `typedArray` is larger than 65,536 bytes. ### `crypto.randomUUID()` + <!-- YAML added: v16.7.0 --> @@ -372,17 +376,21 @@ Generates a random [RFC 4122][] version 4 UUID. The UUID is generated using a cryptographic pseudorandom number generator. ## Class: `CryptoKey` + <!-- YAML added: v15.0.0 --> ### `cryptoKey.algorithm` + <!-- YAML added: v15.0.0 --> <!--lint disable maximum-line-length remark-lint--> + * Type: {AesKeyGenParams|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|NodeDsaKeyGenParams|NodeDhKeyGenParams} + <!--lint enable maximum-line-length remark-lint--> An object detailing the algorithm for which the key can be used along with @@ -391,6 +399,7 @@ additional algorithm-specific parameters. Read-only. ### `cryptoKey.extractable` + <!-- YAML added: v15.0.0 --> @@ -403,6 +412,7 @@ When `true`, the {CryptoKey} can be extracted using either Read-only. ### `cryptoKey.type` + <!-- YAML added: v15.0.0 --> @@ -413,11 +423,12 @@ A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. ### `cryptoKey.usages` + <!-- YAML added: v15.0.0 --> -* Type: {string[]} +* Type: {string\[]} An array of strings identifying the operations for which the key may be used. @@ -436,29 +447,30 @@ The possible usages are: Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). -| Key Type | `'encrypt'` | `'decrypt'` | `'sign'` | `'verify'` | `'deriveKey'` | `'deriveBits'` | `'wrapKey'` | `'unwrapKey'` | -| -------------------- | ----------- | ----------- | -------- | ---------- | ------------- | --------------- | ----------- | ------------- | -| `'AES-CBC'` | ✔ | ✔ | | | | | ✔ | ✔ | -| `'AES-CTR'` | ✔ | ✔ | | | | | ✔ | ✔ | -| `'AES-GCM'` | ✔ | ✔ | | | | | ✔ | ✔ | -| `'AES-KW'` | | | | | | | ✔ | ✔ | -| `'ECDH'` | | | | | ✔ | ✔ | | | -| `'ECDSA'` | | | ✔ | ✔ | | | | | -| `'HDKF'` | | | | | ✔ | ✔ | | | -| `'HMAC'` | | | ✔ | ✔ | | | | | -| `'PBKDF2'` | | | | | ✔ | ✔ | | | -| `'RSA-OAEP'` | ✔ | ✔ | | | | | ✔ | ✔ | -| `'RSA-PSS'` | | | ✔ | ✔ | | | | | -| `'RSASSA-PKCS1-v1_5'` | | | ✔ | ✔ | | | | | -| `'NODE-DSA'` <sup>1</sup> | | | ✔ | ✔ | | | | | -| `'NODE-DH'` <sup>1</sup> | | | | | ✔ | ✔ | | | -| `'NODE-SCRYPT'` <sup>1</sup> | | | | | ✔ | ✔ | | | -| `'NODE-ED25519'` <sup>1</sup> | | | ✔ | ✔ | | | | | -| `'NODE-ED448'` <sup>1</sup> | | | ✔ | ✔ | | | | | +| Key Type | `'encrypt'` | `'decrypt'` | `'sign'` | `'verify'` | `'deriveKey'` | `'deriveBits'` | `'wrapKey'` | `'unwrapKey'` | +| ----------------------------- | ----------- | ----------- | -------- | ---------- | ------------- | -------------- | ----------- | ------------- | +| `'AES-CBC'` | ✔ | ✔ | | | | | ✔ | ✔ | +| `'AES-CTR'` | ✔ | ✔ | | | | | ✔ | ✔ | +| `'AES-GCM'` | ✔ | ✔ | | | | | ✔ | ✔ | +| `'AES-KW'` | | | | | | | ✔ | ✔ | +| `'ECDH'` | | | | | ✔ | ✔ | | | +| `'ECDSA'` | | | ✔ | ✔ | | | | | +| `'HDKF'` | | | | | ✔ | ✔ | | | +| `'HMAC'` | | | ✔ | ✔ | | | | | +| `'PBKDF2'` | | | | | ✔ | ✔ | | | +| `'RSA-OAEP'` | ✔ | ✔ | | | | | ✔ | ✔ | +| `'RSA-PSS'` | | | ✔ | ✔ | | | | | +| `'RSASSA-PKCS1-v1_5'` | | | ✔ | ✔ | | | | | +| `'NODE-DSA'` <sup>1</sup> | | | ✔ | ✔ | | | | | +| `'NODE-DH'` <sup>1</sup> | | | | | ✔ | ✔ | | | +| `'NODE-SCRYPT'` <sup>1</sup> | | | | | ✔ | ✔ | | | +| `'NODE-ED25519'` <sup>1</sup> | | | ✔ | ✔ | | | | | +| `'NODE-ED448'` <sup>1</sup> | | | ✔ | ✔ | | | | | <sup>1</sup> Node.js-specific extension. ## Class: `CryptoKeyPair` + <!-- YAML added: v15.0.0 --> @@ -467,6 +479,7 @@ The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. ### `cryptoKeyPair.privateKey` + <!-- YAML added: v15.0.0 --> @@ -474,6 +487,7 @@ added: v15.0.0 * Type: {CryptoKey} A {CryptoKey} whose `type` will be `'private'`. ### `cryptoKeyPair.publicKey` + <!-- YAML added: v15.0.0 --> @@ -481,11 +495,13 @@ added: v15.0.0 * Type: {CryptoKey} A {CryptoKey} whose `type` will be `'public'`. ## Class: `SubtleCrypto` + <!-- YAML added: v15.0.0 --> ### `subtle.decrypt(algorithm, key, data)` + <!-- YAML added: v15.0.0 --> @@ -508,15 +524,18 @@ The algorithms currently supported include: * `'AES-GCM`' ### `subtle.deriveBits(algorithm, baseKey, length)` + <!-- YAML added: v15.0.0 --> <!--lint disable maximum-line-length remark-lint--> + * `algorithm`: {EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params|NodeDhDeriveBitsParams|NodeScryptParams} * `baseKey`: {CryptoKey} * `length`: {number} * Returns: {Promise} containing {ArrayBuffer} + <!--lint enable maximum-line-length remark-lint--> Using the method and parameters specified in `algorithm` and the keying @@ -536,17 +555,20 @@ The algorithms currently supported include: <sup>1</sup> Node.js-specific extension ### `subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)` + <!-- YAML added: v15.0.0 --> <!--lint disable maximum-line-length remark-lint--> + * `algorithm`: {EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params|NodeDhDeriveBitsParams|NodeScryptParams} * `baseKey`: {CryptoKey} * `derivedKeyAlgorithm`: {HmacKeyGenParams|AesKeyGenParams} * `extractable`: {boolean} -* `keyUsages`: {string[]} See [Key usages][]. +* `keyUsages`: {string\[]} See [Key usages][]. * Returns: {Promise} containing {CryptoKey} + <!--lint enable maximum-line-length remark-lint--> Using the method and parameters specified in `algorithm`, and the keying @@ -569,6 +591,7 @@ The algorithms currently supported include: <sup>1</sup> Node.js-specific extension ### `subtle.digest(algorithm, data)` + <!-- YAML added: v15.0.0 --> @@ -592,6 +615,7 @@ If `algorithm` is provided as an {Object}, it must have a `name` property whose value is one of the above. ### `subtle.encrypt(algorithm, key, data)` + <!-- YAML added: v15.0.0 --> @@ -613,6 +637,7 @@ The algorithms currently supported include: * `'AES-GCM`' ### `subtle.exportKey(format, key)` + <!-- YAML added: v15.0.0 changes: @@ -642,38 +667,42 @@ specification. The special `'node.keyObject'` value for `format` is a Node.js-specific extension that allows converting a {CryptoKey} into a Node.js {KeyObject}. -| Key Type | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` | -| --------------------- | -------- | --------- | ------- | ------- | -| `'AES-CBC'` | | | ✔ | ✔ | -| `'AES-CTR'` | | | ✔ | ✔ | -| `'AES-GCM'` | | | ✔ | ✔ | -| `'AES-KW'` | | | ✔ | ✔ | -| `'ECDH'` | ✔ | ✔ | ✔ | ✔ | -| `'ECDSA'` | ✔ | ✔ | ✔ | ✔ | -| `'HDKF'` | | | | | -| `'HMAC'` | | | ✔ | ✔ | -| `'PBKDF2'` | | | | | -| `'RSA-OAEP'` | ✔ | ✔ | ✔ | | -| `'RSA-PSS'` | ✔ | ✔ | ✔ | | -| `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | -| `'NODE-DSA'` <sup>1</sup> | ✔ | ✔ | | | -| `'NODE-DH'` <sup>1</sup> | ✔ | ✔ | | | -| `'NODE-SCRYPT'` <sup>1</sup> | | | | | -| `'NODE-ED25519'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | -| `'NODE-ED448'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | +| Key Type | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` | +| ----------------------------- | -------- | --------- | ------- | ------- | +| `'AES-CBC'` | | | ✔ | ✔ | +| `'AES-CTR'` | | | ✔ | ✔ | +| `'AES-GCM'` | | | ✔ | ✔ | +| `'AES-KW'` | | | ✔ | ✔ | +| `'ECDH'` | ✔ | ✔ | ✔ | ✔ | +| `'ECDSA'` | ✔ | ✔ | ✔ | ✔ | +| `'HDKF'` | | | | | +| `'HMAC'` | | | ✔ | ✔ | +| `'PBKDF2'` | | | | | +| `'RSA-OAEP'` | ✔ | ✔ | ✔ | | +| `'RSA-PSS'` | ✔ | ✔ | ✔ | | +| `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | +| `'NODE-DSA'` <sup>1</sup> | ✔ | ✔ | | | +| `'NODE-DH'` <sup>1</sup> | ✔ | ✔ | | | +| `'NODE-SCRYPT'` <sup>1</sup> | | | | | +| `'NODE-ED25519'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | +| `'NODE-ED448'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | <sup>1</sup> Node.js-specific extension ### `subtle.generateKey(algorithm, extractable, keyUsages)` + <!-- YAML added: v15.0.0 --> <!--lint disable maximum-line-length remark-lint--> + * `algorithm`: {RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams|NodeDsaKeyGenParams|NodeDhKeyGenParams|NodeEdKeyGenParams} + <!--lint enable maximum-line-length remark-lint--> + * `extractable`: {boolean} -* `keyUsages`: {string[]} See [Key usages][]. +* `keyUsages`: {string\[]} See [Key usages][]. * Returns: {Promise} containing {CryptoKey|CryptoKeyPair} Using the method and parameters provided in `algorithm`, `subtle.generateKey()` @@ -704,6 +733,7 @@ The {CryptoKey} (secret key) generating algorithms supported include: <sup>1</sup> Non-standard Node.js extension ### `subtle.importKey(format, keyData, algorithm, extractable, keyUsages)` + <!-- YAML added: v15.0.0 changes: @@ -715,11 +745,15 @@ changes: * `format`: {string} Must be one of `'raw'`, `'pkcs8'`, `'spki'`, `'jwk'`, or `'node.keyObject'`. * `keyData`: {ArrayBuffer|TypedArray|DataView|Buffer|KeyObject} + <!--lint disable maximum-line-length remark-lint--> + * `algorithm`: {RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesImportParams|Pbkdf2ImportParams|NodeDsaImportParams|NodeDhImportParams|NodeScryptImportParams|NodeEdKeyImportParams} + <!--lint enable maximum-line-length remark-lint--> + * `extractable`: {boolean} -* `keyUsages`: {string[]} See [Key usages][]. +* `keyUsages`: {string\[]} See [Key usages][]. * Returns: {Promise} containing {CryptoKey} The `subtle.importKey()` method attempts to interpret the provided `keyData` @@ -734,38 +768,41 @@ If importing a `'PBKDF2'` key, `extractable` must be `false`. The algorithms currently supported include: -| Key Type | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` | -| --------------------- | -------- | --------- | ------- | ------- | -| `'AES-CBC'` | | | ✔ | ✔ | -| `'AES-CTR'` | | | ✔ | ✔ | -| `'AES-GCM'` | | | ✔ | ✔ | -| `'AES-KW'` | | | ✔ | ✔ | -| `'ECDH'` | ✔ | ✔ | ✔ | ✔ | -| `'ECDSA'` | ✔ | ✔ | ✔ | ✔ | -| `'HDKF'` | | | | ✔ | -| `'HMAC'` | | | ✔ | ✔ | -| `'PBKDF2'` | | | | ✔ | -| `'RSA-OAEP'` | ✔ | ✔ | ✔ | | -| `'RSA-PSS'` | ✔ | ✔ | ✔ | | -| `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | -| `'NODE-DSA'` <sup>1</sup> | ✔ | ✔ | | | -| `'NODE-DH'` <sup>1</sup> | ✔ | ✔ | | | -| `'NODE-SCRYPT'` <sup>1</sup> | | | | ✔ | -| `'NODE-ED25519'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | -| `'NODE-ED448'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | +| Key Type | `'spki'` | `'pkcs8'` | `'jwk'` | `'raw'` | +| ----------------------------- | -------- | --------- | ------- | ------- | +| `'AES-CBC'` | | | ✔ | ✔ | +| `'AES-CTR'` | | | ✔ | ✔ | +| `'AES-GCM'` | | | ✔ | ✔ | +| `'AES-KW'` | | | ✔ | ✔ | +| `'ECDH'` | ✔ | ✔ | ✔ | ✔ | +| `'ECDSA'` | ✔ | ✔ | ✔ | ✔ | +| `'HDKF'` | | | | ✔ | +| `'HMAC'` | | | ✔ | ✔ | +| `'PBKDF2'` | | | | ✔ | +| `'RSA-OAEP'` | ✔ | ✔ | ✔ | | +| `'RSA-PSS'` | ✔ | ✔ | ✔ | | +| `'RSASSA-PKCS1-v1_5'` | ✔ | ✔ | ✔ | | +| `'NODE-DSA'` <sup>1</sup> | ✔ | ✔ | | | +| `'NODE-DH'` <sup>1</sup> | ✔ | ✔ | | | +| `'NODE-SCRYPT'` <sup>1</sup> | | | | ✔ | +| `'NODE-ED25519'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | +| `'NODE-ED448'` <sup>1</sup> | ✔ | ✔ | ✔ | ✔ | <sup>1</sup> Node.js-specific extension ### `subtle.sign(algorithm, key, data)` + <!-- YAML added: v15.0.0 --> <!--lint disable maximum-line-length remark-lint--> + * `algorithm`: {RsaSignParams|RsaPssParams|EcdsaParams|HmacParams|NodeDsaSignParams} * `key`: {CryptoKey} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} * Returns: {Promise} containing {ArrayBuffer} + <!--lint enable maximum-line-length remark-lint--> Using the method and parameters given by `algorithm` and the keying material @@ -786,6 +823,7 @@ The algorithms currently supported include: <sup>1</sup> Non-standard Node.js extension ### `subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)` + <!-- YAML added: v15.0.0 --> @@ -793,12 +831,16 @@ added: v15.0.0 * `format`: {string} Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * `wrappedKey`: {ArrayBuffer|TypedArray|DataView|Buffer} * `unwrappingKey`: {CryptoKey} + <!--lint disable maximum-line-length remark-lint--> + * `unwrapAlgo`: {RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams|AesKwParams} * `unwrappedKeyAlgo`: {RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesImportParams} + <!--lint enable maximum-line-length remark-lint--> + * `extractable`: {boolean} -* `keyUsages`: {string[]} See [Key usages][]. +* `keyUsages`: {string\[]} See [Key usages][]. * Returns: {Promise} containing {CryptoKey} In cryptography, "wrapping a key" refers to exporting and then encrypting the @@ -836,16 +878,19 @@ The unwrapped key algorithms supported include: <sup>1</sup> Non-standard Node.js extension ### `subtle.verify(algorithm, key, signature, data)` + <!-- YAML added: v15.0.0 --> <!--lint disable maximum-line-length remark-lint--> + * `algorithm`: {RsaSignParams|RsaPssParams|EcdsaParams|HmacParams|NodeDsaSignParams} * `key`: {CryptoKey} * `signature`: {ArrayBuffer|TypedArray|DataView|Buffer} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} * Returns: {Promise} containing {boolean} + <!--lint enable maximum-line-length remark-lint--> Using the method and parameters given in `algorithm` and the keying material @@ -866,6 +911,7 @@ The algorithms currently supported include: <sup>1</sup> Non-standard Node.js extension ### `subtle.wrapKey(format, key, wrappingKey, wrapAlgo)` + <!-- YAML added: v15.0.0 --> @@ -901,11 +947,13 @@ the various {SubtleCrypto} methods. While described here as "classes", they are simple JavaScript dictionary objects. ### Class: `AesCbcParams` + <!-- YAML added: v15.0.0 --> #### `aesCbcParams.iv` + <!-- YAML added: v15.0.0 --> @@ -916,6 +964,7 @@ Provides the initialization vector. It must be exactly 16-bytes in length and should be unpredictable and cryptographically random. #### `aesCbcParams.name` + <!-- YAML added: v15.0.0 --> @@ -923,11 +972,13 @@ added: v15.0.0 * Type: {string} Must be `'AES-CBC'`. ### Class: `AesCtrParams` + <!-- YAML added: v15.0.0 --> #### `aesCtrParams.counter` + <!-- YAML added: v15.0.0 --> @@ -940,6 +991,7 @@ The `AES-CTR` method uses the rightmost `length` bits of the block as the counter and the remaining bits as the nonce. #### `aesCtrParams.length` + <!-- YAML added: v15.0.0 --> @@ -948,6 +1000,7 @@ added: v15.0.0 to be used as the counter. #### `aesCtrParams.name` + <!-- YAML added: v15.0.0 --> @@ -955,11 +1008,13 @@ added: v15.0.0 * Type: {string} Must be `'AES-CTR'`. ### Class: `AesGcmParams` + <!-- YAML added: v15.0.0 --> #### `aesGcmParams.additionalData` + <!-- YAML added: v15.0.0 --> @@ -971,6 +1026,7 @@ encrypted but is included in the authentication of the data. The use of `additionalData` is optional. #### `aesGcmParams.iv` + <!-- YAML added: v15.0.0 --> @@ -982,6 +1038,7 @@ using a given key. It is recommended by the AES-GCM specification that this contain at least 12 random bytes. #### `aesGcmParams.name` + <!-- YAML added: v15.0.0 --> @@ -989,6 +1046,7 @@ added: v15.0.0 * Type: {string} Must be `'AES-GCM'`. #### `aesGcmParams.tagLength` + <!-- YAML added: v15.0.0 --> @@ -998,11 +1056,13 @@ added: v15.0.0 `128`. **Default:** `128`. ### Class: `AesImportParams` + <!-- YAML added: v15.0.0 --> #### `aesImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1011,11 +1071,13 @@ added: v15.0.0 `'AES-KW'`. ### Class: `AesKeyGenParams` + <!-- YAML added: v15.0.0 --> #### `aesKeyGenParams.length` + <!-- YAML added: v15.0.0 --> @@ -1026,6 +1088,7 @@ The length of the AES key to be generated. This must be either `128`, `192`, or `256`. #### `aesKeyGenParams.name` + <!-- YAML added: v15.0.0 --> @@ -1034,11 +1097,13 @@ added: v15.0.0 `'AES-KW'` ### Class: `AesKwParams` + <!-- YAML added: v15.0.0 --> #### `aesKwParams.name` + <!-- YAML added: v15.0.0 --> @@ -1046,11 +1111,13 @@ added: v15.0.0 * Type: {string} Must be `'AES-KW'`. ### Class: `EcdhKeyDeriveParams` + <!-- YAML added: v15.0.0 --> #### `ecdhKeyDeriveParams.name` + <!-- YAML added: v15.0.0 --> @@ -1058,6 +1125,7 @@ added: v15.0.0 * Type: {string} Must be `'ECDH'`. #### `ecdhKeyDeriveParams.public` + <!-- YAML added: v15.0.0 --> @@ -1070,11 +1138,13 @@ The `ecdhKeyDeriveParams.public` property is set to the other parties public key. ### Class: `EcdsaParams` + <!-- YAML added: v15.0.0 --> #### `ecdsaParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1092,6 +1162,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `ecdsaParams.name` + <!-- YAML added: v15.0.0 --> @@ -1099,11 +1170,13 @@ added: v15.0.0 * Type: {string} Must be `'ECDSA'`. ### Class: `EcKeyGenParams` + <!-- YAML added: v15.0.0 --> #### `ecKeyGenParams.name` + <!-- YAML added: v15.0.0 --> @@ -1111,6 +1184,7 @@ added: v15.0.0 * Type: {string} Must be one of `'ECDSA'` or `'ECDH'`. #### `ecKeyGenParams.namedCurve` + <!-- YAML added: v15.0.0 --> @@ -1119,11 +1193,13 @@ added: v15.0.0 `'NODE-ED25519'`, `'NODE-ED448'`, `'NODE-X25519'`, or `'NODE-X448'`. ### Class: `EcKeyImportParams` + <!-- YAML added: v15.0.0 --> #### `ecKeyImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1131,6 +1207,7 @@ added: v15.0.0 * Type: {string} Must be one of `'ECDSA'` or `'ECDH'`. #### `ecKeyImportParams.namedCurve` + <!-- YAML added: v15.0.0 --> @@ -1139,11 +1216,13 @@ added: v15.0.0 `'NODE-ED25519'`, `'NODE-ED448'`, `'NODE-X25519'`, or `'NODE-X448'`. ### Class: `HkdfParams` + <!-- YAML added: v15.0.0 --> #### `hkdfParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1161,6 +1240,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `hkdfParams.info` + <!-- YAML added: v15.0.0 --> @@ -1171,6 +1251,7 @@ Provides application-specific contextual input to the HKDF algorithm. This can be zero-length but must be provided. #### `hkdfParams.name` + <!-- YAML added: v15.0.0 --> @@ -1178,6 +1259,7 @@ added: v15.0.0 * Type: {string} Must be `'HKDF'`. #### `hkdfParams.salt` + <!-- YAML added: v15.0.0 --> @@ -1190,11 +1272,13 @@ output of the digest function (for instance, if using `'SHA-256'` as the digest, the salt should be 256-bits of random data). ### Class: `HmacImportParams` + <!-- YAML added: v15.0.0 --> #### `hmacImportParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1212,6 +1296,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `hmacImportParams.length` + <!-- YAML added: v15.0.0 --> @@ -1222,6 +1307,7 @@ The optional number of bits in the HMAC key. This is optional and should be omitted for most cases. #### `hmacImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1229,11 +1315,13 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. ### Class: `HmacKeyGenParams` + <!-- YAML added: v15.0.0 --> #### `hmacKeyGenParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1251,6 +1339,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `hmacKeyGenParams.length` + <!-- YAML added: v15.0.0 --> @@ -1262,6 +1351,7 @@ the length will be determined by the hash algorithm used. This is optional and should be omitted for most cases. #### `hmacKeyGenParams.name` + <!-- YAML added: v15.0.0 --> @@ -1269,11 +1359,13 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. ### Class: `HmacParams` + <!-- YAML added: v15.0.0 --> #### `hmacParams.name` + <!-- YAML added: v15.0.0 --> @@ -1281,11 +1373,13 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. ### Class: `Pbkdf2ImportParams` + <!-- YAML added: v15.0.0 --> #### `pbkdf2ImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1293,11 +1387,13 @@ added: v15.0.0 * Type: {string} Must be `'PBKDF2'` ### Class: `Pbkdf2Params` + <!-- YAML added: v15.0.0 --> #### `pbkdb2Params.hash` + <!-- YAML added: v15.0.0 --> @@ -1315,6 +1411,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `pbkdf2Params.iterations` + <!-- YAML added: v15.0.0 --> @@ -1324,6 +1421,7 @@ added: v15.0.0 The number of iterations the PBKDF2 algorithm should make when deriving bits. #### `pbkdf2Params.name` + <!-- YAML added: v15.0.0 --> @@ -1331,6 +1429,7 @@ added: v15.0.0 * Type: {string} Must be `'PBKDF2'`. #### `pbkdf2Params.salt` + <!-- YAML added: v15.0.0 --> @@ -1340,11 +1439,13 @@ added: v15.0.0 Should be at least 16 random or pseudorandom bytes. ### Class: `RsaHashedImportParams` + <!-- YAML added: v15.0.0 --> #### `rsaHashedImportParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1362,6 +1463,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `rsaHashedImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1370,11 +1472,13 @@ added: v15.0.0 `'RSA-OAEP'`. ### Class: `RsaHashedKeyGenParams` + <!-- YAML added: v15.0.0 --> #### `rsaHashedKeyGenParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1392,6 +1496,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. #### `rsaHashedKeyGenParams.modulusLength` + <!-- YAML added: v15.0.0 --> @@ -1402,6 +1507,7 @@ The length in bits of the RSA modulus. As a best practice, this should be at least `2048`. #### `rsaHashedKeyGenParams.name` + <!-- YAML added: v15.0.0 --> @@ -1410,6 +1516,7 @@ added: v15.0.0 `'RSA-OAEP'`. #### `rsaHashedKeyGenParams.publicExponent` + <!-- YAML added: v15.0.0 --> @@ -1423,11 +1530,13 @@ there is reason to use a different value, use `new Uint8Array([1, 0, 1])` (65537) as the public exponent. ### Class: `RsaOaepParams` + <!-- YAML added: v15.0.0 --> #### rsaOaepParams.label + <!-- YAML added: v15.0.0 --> @@ -1440,6 +1549,7 @@ to the generated ciphertext. The `rsaOaepParams.label` parameter is optional. #### rsaOaepParams.name + <!-- YAML added: v15.0.0 --> @@ -1447,11 +1557,13 @@ added: v15.0.0 * Type: {string} must be `'RSA-OAEP'`. ### Class: `RsaPssParams` + <!-- YAML added: v15.0.0 --> #### `rsaPssParams.name` + <!-- YAML added: v15.0.0 --> @@ -1459,6 +1571,7 @@ added: v15.0.0 * Type: {string} Must be `'RSA-PSS'`. #### `rsaPssParams.saltLength` + <!-- YAML added: v15.0.0 --> @@ -1468,11 +1581,13 @@ added: v15.0.0 The length (in bytes) of the random salt to use. ### Class: `RsaSignParams` + <!-- YAML added: v15.0.0 --> #### `rsaSignParams.name` + <!-- YAML added: v15.0.0 --> @@ -1492,6 +1607,7 @@ not supported by other WebCrypto implementations and reduce the portability of code to other environments. ### `NODE-DH` Algorithm + <!-- YAML added: v15.0.0 --> @@ -1500,11 +1616,13 @@ The `NODE-DH` algorithm is the common implementation of Diffie-Hellman key agreement. #### Class: `NodeDhImportParams` + <!-- YAML added: v15.0.0 --> ##### `nodeDhImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1512,11 +1630,13 @@ added: v15.0.0 * Type: {string} Must be `'NODE-DH'`. #### Class: `NodeDhKeyGenParams` + <!-- YAML added: v15.0.0 --> ##### `nodeDhKeyGenParams.generator` + <!-- YAML added: v15.0.0 --> @@ -1524,6 +1644,7 @@ added: v15.0.0 * Type: {number} A custom generator. ##### `nodeDhKeyGenParams.group` + <!-- YAML added: v15.0.0 --> @@ -1531,6 +1652,7 @@ added: v15.0.0 * Type: {string} The Diffie-Hellman group name. ##### `nodeDhKeyGenParams.prime` + <!-- YAML added: v15.0.0 --> @@ -1538,6 +1660,7 @@ added: v15.0.0 * Type: {Buffer} The prime parameter. ##### `nodeDhKeyGenParams.primeLength` + <!-- YAML added: v15.0.0 --> @@ -1545,11 +1668,13 @@ added: v15.0.0 * Type: {number} The length in bits of the prime. #### Class: NodeDhDeriveBitsParams + <!-- YAML added: v15.0.0 --> ##### `nodeDhDeriveBitsParams.public` + <!-- YAML added: v15.0.0 --> @@ -1557,6 +1682,7 @@ added: v15.0.0 * Type: {CryptoKey} The other parties public key. ### `NODE-DSA` Algorithm + <!-- YAML added: v15.0.0 --> @@ -1565,11 +1691,13 @@ The `NODE-DSA` algorithm is the common implementation of the DSA digital signature algorithm. #### Class: `NodeDsaImportParams` + <!-- YAML added: v15.0.0 --> ##### `nodeDsaImportParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1587,6 +1715,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. ##### `nodeDsaImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1594,11 +1723,13 @@ added: v15.0.0 * Type: {string} Must be `'NODE-DSA'`. #### Class: `NodeDsaKeyGenParams` + <!-- YAML added: v15.0.0 --> ##### `nodeDsaKeyGenParams.divisorLength` + <!-- YAML added: v15.0.0 --> @@ -1608,6 +1739,7 @@ added: v15.0.0 The optional length in bits of the DSA divisor. ##### `nodeDsaKeyGenParams.hash` + <!-- YAML added: v15.0.0 --> @@ -1625,6 +1757,7 @@ If represented as an {Object}, the object must have a `name` property whose value is one of the above listed values. ##### `nodeDsaKeyGenParams.modulusLength` + <!-- YAML added: v15.0.0 --> @@ -1635,6 +1768,7 @@ The length in bits of the DSA modulus. As a best practice, this should be at least `2048`. ##### `nodeDsaKeyGenParams.name` + <!-- YAML added: v15.0.0 --> @@ -1642,11 +1776,13 @@ added: v15.0.0 * Type: {string} Must be `'NODE-DSA'`. #### Class: `NodeDsaSignParams` + <!-- YAML added: v15.0.0 --> ##### `nodeDsaSignParams.name` + <!-- YAML added: v15.0.0 --> @@ -1654,16 +1790,19 @@ added: v15.0.0 * Type: {string} Must be `'NODE-DSA'` ### `NODE-ED25519` and `NODE-ED448` Algorithms + <!-- YAML added: v15.8.0 --> #### Class: `NodeEdKeyGenParams` + <!-- YAML added: v15.8.0 --> ##### `nodeEdKeyGenParams.name` + <!-- YAML added: v15.8.0 --> @@ -1671,6 +1810,7 @@ added: v15.8.0 * Type: {string} Must be one of `'NODE-ED25519'`, `'NODE-ED448'` or `'ECDH'`. ##### `nodeEdKeyGenParams.namedCurve` + <!-- YAML added: v15.8.0 --> @@ -1679,11 +1819,13 @@ added: v15.8.0 `'NODE-X25519'`, or `'NODE-X448'`. #### Class: `NodeEdKeyImportParams` + <!-- YAML added: v15.8.0 --> ##### `nodeEdKeyImportParams.name` + <!-- YAML added: v15.8.0 --> @@ -1693,6 +1835,7 @@ added: v15.8.0 an `X25519` or `X448` key. ##### `nodeEdKeyImportParams.namedCurve` + <!-- YAML added: v15.8.0 --> @@ -1701,6 +1844,7 @@ added: v15.8.0 `'NODE-X25519'`, or `'NODE-X448'`. ##### `nodeEdKeyImportParams.public` + <!-- YAML added: v15.8.0 --> @@ -1711,6 +1855,7 @@ The `public` parameter is used to specify that the `'raw'` format key is to be interpreted as a public key. **Default:** `false`. ### `NODE-SCRYPT` Algorithm + <!-- YAML added: v15.0.0 --> @@ -1719,11 +1864,13 @@ The `NODE-SCRYPT` algorithm is the common implementation of the scrypt key derivation algorithm. #### Class: `NodeScryptImportParams` + <!-- YAML added: v15.0.0 --> ##### `nodeScryptImportParams.name` + <!-- YAML added: v15.0.0 --> @@ -1731,11 +1878,13 @@ added: v15.0.0 * Type: {string} Must be `'NODE-SCRYPT'`. #### Class: `NodeScryptParams` + <!-- YAML added: v15.0.0 --> ##### `nodeScryptParams.encoding` + <!-- YAML added: v15.0.0 --> @@ -1743,6 +1892,7 @@ added: v15.0.0 * Type: {string} The string encoding when `salt` is a string. ##### `nodeScryptParams.maxmem` + <!-- YAML added: v15.0.0 --> @@ -1751,6 +1901,7 @@ added: v15.0.0 `127 * N * r > maxmem`. **Default:** `32 * 1024 * 1024`. ##### `nodeScryptParams.N` + <!-- YAML added: v15.0.0 --> @@ -1759,6 +1910,7 @@ added: v15.0.0 greater than 1. **Default:** `16384`. ##### `nodeScryptParams.p` + <!-- YAML added: v15.0.0 --> @@ -1766,6 +1918,7 @@ added: v15.0.0 * Type: {number} Parallelization parameter. **Default:** `1`. ##### `nodeScryptParams.r` + <!-- YAML added: v15.0.0 --> @@ -1773,6 +1926,7 @@ added: v15.0.0 * Type: {number} Block size parameter. **Default:** `8`. ##### `nodeScryptParams.salt` + <!-- YAML added: v15.0.0 --> |