@@ -53,7 +53,7 @@ The `crypto` module provides the `Certificate` class for working with SPKAC
5353data. The most common usage is handling output generated by the HTML5
5454` <keygen> ` element. Node.js uses [ OpenSSL's SPKAC implementation] [ ] internally.
5555
56- ### ` Certificate.exportChallenge(spkac[, encoding]) `
56+ ### Static method: ` Certificate.exportChallenge(spkac[, encoding]) `
5757<!-- YAML
5858added: v9.0.0
5959changes:
@@ -76,7 +76,7 @@ console.log(challenge.toString('utf8'));
7676// Prints: the challenge as a UTF8 string
7777```
7878
79- ### ` Certificate.exportPublicKey(spkac[, encoding]) `
79+ ### Static method: ` Certificate.exportPublicKey(spkac[, encoding]) `
8080<!-- YAML
8181added: v9.0.0
8282changes:
@@ -99,7 +99,7 @@ console.log(publicKey);
9999// Prints: the public key as <Buffer ...>
100100```
101101
102- ### ` Certificate.verifySpkac(spkac[, encoding]) `
102+ ### Static method: ` Certificate.verifySpkac(spkac[, encoding]) `
103103<!-- YAML
104104added: v9.0.0
105105changes:
@@ -1284,6 +1284,32 @@ passing keys as strings or `Buffer`s due to improved security features.
12841284The receiver obtains a cloned ` KeyObject ` , and the ` KeyObject ` does not need to
12851285be listed in the ` transferList ` argument.
12861286
1287+ ### Static method: ` KeyObject.from(key) `
1288+ <!-- YAML
1289+ added: v15.0.0
1290+ -->
1291+
1292+ * ` key ` {CryptoKey}
1293+ * Returns: {KeyObject}
1294+
1295+ Example: Converting a ` CryptoKey ` instance to a ` KeyObject ` :
1296+
1297+ ``` js
1298+ const { webcrypto: { subtle }, KeyObject } = require (' crypto' );
1299+
1300+ (async function () {
1301+ const key = await subtle .generateKey ({
1302+ name: ' HMAC' ,
1303+ hash: ' SHA-256' ,
1304+ length: 256
1305+ }, true , [' sign' , ' verify' ]);
1306+
1307+ const keyObject = KeyObject .from (key);
1308+ console .log (keyObject .symmetricKeySize );
1309+ // Prints: 32 (symmetric key size in bytes)
1310+ })();
1311+ ```
1312+
12871313### ` keyObject.asymmetricKeyDetails `
12881314<!-- YAML
12891315added: v15.7.0
0 commit comments