diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 7761b4fdcc6555..5d745809dad3ce 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -2146,7 +2146,7 @@ added: -* `algorithm`: {AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} +* `algorithm`: {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md index 71cff91b2bc87b..4db5b84842c5d4 100644 --- a/doc/api/webcrypto.md +++ b/doc/api/webcrypto.md @@ -441,7 +441,7 @@ added: v15.0.0 -* Type: {AesKeyGenParams|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams} +* Type: {KeyAlgorithm|RsaHashedKeyAlgorithm|EcKeyAlgorithm|AesKeyAlgorithm|HmacKeyAlgorithm} @@ -635,7 +635,7 @@ changes: * `algorithm`: {EcdhKeyDeriveParams|HkdfParams|Pbkdf2Params} * `baseKey`: {CryptoKey} -* `derivedKeyAlgorithm`: {string|AlgorithmIdentifier|HmacImportParams|AesDerivedKeyParams} +* `derivedKeyAlgorithm`: {string|Algorithm|HmacImportParams|AesDerivedKeyParams} * `extractable`: {boolean} * `keyUsages`: {string\[]} See [Key usages][]. * Returns: {Promise} Fulfills with a {CryptoKey} upon success. @@ -665,7 +665,7 @@ The algorithms currently supported include: added: v15.0.0 --> -* `algorithm`: {string|AlgorithmIdentifier} +* `algorithm`: {string|Algorithm} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. @@ -761,7 +761,7 @@ added: v15.0.0 -* `algorithm`: {string|AlgorithmIdentifier|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams} +* `algorithm`: {string|Algorithm|RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams} @@ -815,7 +815,7 @@ changes: -* `algorithm`: {string|AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} +* `algorithm`: {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} @@ -865,7 +865,7 @@ changes: -* `algorithm`: {string|AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params} +* `algorithm`: {string|Algorithm|RsaPssParams|EcdsaParams|Ed448Params} * `key`: {CryptoKey} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. @@ -898,8 +898,8 @@ added: v15.0.0 -* `unwrapAlgo`: {string|AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} -* `unwrappedKeyAlgo`: {string|AlgorithmIdentifier|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} +* `unwrapAlgo`: {string|Algorithm|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} +* `unwrappedKeyAlgo`: {string|Algorithm|RsaHashedImportParams|EcKeyImportParams|HmacImportParams} @@ -955,7 +955,7 @@ changes: -* `algorithm`: {string|AlgorithmIdentifier|RsaPssParams|EcdsaParams|Ed448Params} +* `algorithm`: {string|Algorithm|RsaPssParams|EcdsaParams|Ed448Params} * `key`: {CryptoKey} * `signature`: {ArrayBuffer|TypedArray|DataView|Buffer} * `data`: {ArrayBuffer|TypedArray|DataView|Buffer} @@ -988,7 +988,7 @@ added: v15.0.0 * `format`: {string} Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. * `key`: {CryptoKey} * `wrappingKey`: {CryptoKey} -* `wrapAlgo`: {string|AlgorithmIdentifier|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} +* `wrapAlgo`: {string|Algorithm|RsaOaepParams|AesCtrParams|AesCbcParams|AesGcmParams} * Returns: {Promise} Fulfills with an {ArrayBuffer} upon success. @@ -1017,13 +1017,13 @@ The algorithm parameter objects define the methods and parameters used by the various {SubtleCrypto} methods. While described here as "classes", they are simple JavaScript dictionary objects. -### Class: `AlgorithmIdentifier` +### Class: `Algorithm` -#### `algorithmIdentifier.name` +#### `Algorithm.name` + +#### `aesKeyAlgorithm.length` + + + +* Type: {number} + +The length of the AES key in bits. + +#### `aesKeyAlgorithm.name` + + + +* Type: {string} + ### Class: `AesKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1245,8 +1269,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `ecdsaParams.name` @@ -1256,6 +1280,28 @@ added: v15.0.0 * Type: {string} Must be `'ECDSA'`. +### Class: `EcKeyAlgorithm` + + + +#### `ecKeyAlgorithm.name` + + + +* Type: {string} + +#### `ecKeyAlgorithm.namedCurve` + + + +* Type: {string} + ### Class: `EcKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1352,8 +1398,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `hkdfParams.info` @@ -1399,7 +1445,7 @@ added: v15.0.0 added: v15.0.0 --> -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1408,8 +1454,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `hmacImportParams.length` @@ -1430,6 +1476,38 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. +### Class: `HmacKeyAlgorithm` + + + +#### `hmacKeyAlgorithm.hash` + + + +* Type: {Algorithm} + +#### `hmacKeyAlgorithm.length` + + + +* Type: {number} + +The length of the HMAC key in bits. + +#### `hmacKeyAlgorithm.name` + + + +* Type: {string} + ### Class: `HmacKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1451,8 +1529,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `hmacKeyGenParams.length` @@ -1474,6 +1552,20 @@ added: v15.0.0 * Type: {string} Must be `'HMAC'`. +### Class: `KeyAlgorithm` + + + +#### `keyAlgorithm.name` + + + +* Type: {string} + ### Class: `Pbkdf2Params` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1495,8 +1587,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `pbkdf2Params.iterations` @@ -1538,7 +1630,7 @@ added: v15.0.0 added: v15.0.0 --> -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1547,8 +1639,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `rsaHashedImportParams.name` @@ -1559,6 +1651,48 @@ added: v15.0.0 * Type: {string} Must be one of `'RSASSA-PKCS1-v1_5'`, `'RSA-PSS'`, or `'RSA-OAEP'`. +### Class: `RsaHashedKeyAlgorithm` + + + +#### `rsaHashedKeyAlgorithm.hash` + + + +* Type: {Algorithm} + +#### `rsaHashedKeyAlgorithm.modulusLength` + + + +* Type: {number} + +The length in bits of the RSA modulus. + +#### `rsaHashedKeyAlgorithm.name` + + + +* Type: {string} + +#### `rsaHashedKeyAlgorithm.publicExponent` + + + +* Type: {Uint8Array} + +The RSA public exponent. + ### Class: `RsaHashedKeyGenParams` -* Type: {string|Object} +* Type: {string|Algorithm} If represented as a {string}, the value must be one of: @@ -1580,8 +1714,8 @@ If represented as a {string}, the value must be one of: * `'SHA-384'` * `'SHA-512'` -If represented as an {Object}, the object must have a `name` property -whose value is one of the above listed values. +If represented as an {Algorithm}, the object's `name` property +must be one of the above listed values. #### `rsaHashedKeyGenParams.modulusLength` diff --git a/tools/doc/type-parser.mjs b/tools/doc/type-parser.mjs index 9485a85e4bbb70..adf320af6e1989 100644 --- a/tools/doc/type-parser.mjs +++ b/tools/doc/type-parser.mjs @@ -87,23 +87,29 @@ const customTypesMap = { 'Verify': 'crypto.html#class-verify', 'crypto.constants': 'crypto.html#cryptoconstants', + 'Algorithm': 'webcrypto.html#class-algorithm', 'CryptoKey': 'webcrypto.html#class-cryptokey', 'CryptoKeyPair': 'webcrypto.html#class-cryptokeypair', 'Crypto': 'webcrypto.html#class-crypto', 'SubtleCrypto': 'webcrypto.html#class-subtlecrypto', 'RsaOaepParams': 'webcrypto.html#class-rsaoaepparams', - 'AlgorithmIdentifier': 'webcrypto.html#class-algorithmidentifier', 'AesCtrParams': 'webcrypto.html#class-aesctrparams', 'AesCbcParams': 'webcrypto.html#class-aescbcparams', 'AesDerivedKeyParams': 'webcrypto.html#class-aesderivedkeyparams', 'AesGcmParams': 'webcrypto.html#class-aesgcmparams', 'EcdhKeyDeriveParams': 'webcrypto.html#class-ecdhkeyderiveparams', 'HkdfParams': 'webcrypto.html#class-hkdfparams', + 'KeyAlgorithm': 'webcrypto.html#class-keyalgorithm', 'Pbkdf2Params': 'webcrypto.html#class-pbkdf2params', + 'HmacKeyAlgorithm': 'webcrypto.html#class-hmackeyalgorithm', 'HmacKeyGenParams': 'webcrypto.html#class-hmackeygenparams', + 'AesKeyAlgorithm': 'webcrypto.html#class-aeskeyalgorithm', 'AesKeyGenParams': 'webcrypto.html#class-aeskeygenparams', + 'RsaHashedKeyAlgorithm': + 'webcrypto.html#class-rsahashedkeyalgorithm', 'RsaHashedKeyGenParams': 'webcrypto.html#class-rsahashedkeygenparams', + 'EcKeyAlgorithm': 'webcrypto.html#class-eckeyalgorithm', 'EcKeyGenParams': 'webcrypto.html#class-eckeygenparams', 'RsaHashedImportParams': 'webcrypto.html#class-rsahashedimportparams',