@@ -65,6 +65,26 @@ async function generateEcKey(namedCurve = 'P-521') {
6565}
6666```
6767
68+ #### ED25519/ED448/X25519/X448 Elliptic curve key pairs
69+
70+ ``` js
71+ const { subtle } = require (' crypto' ).webcrypto ;
72+
73+ async function generateEd25519Key () {
74+ return subtle .generateKey ({
75+ name: ' NODE-ED25519' ,
76+ namedCurve: ' NODE-ED25519' ,
77+ }, true , [' sign' , ' verify' ]);
78+ }
79+
80+ async function generateX25519Key () {
81+ return subtle .generateKey ({
82+ name: ' ECDH' ,
83+ namedCurve: ' NODE-X25519' ,
84+ }, true , [' deriveKey' ]);
85+ }
86+ ```
87+
6888#### HMAC keys
6989
7090``` js
@@ -305,6 +325,8 @@ implementation and the APIs supported for each:
305325| ` 'SHA-512' ` | | | | | | | | | | | | ✔ |
306326| ` 'NODE-DSA' ` <sup >1</sup > | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | |
307327| ` 'NODE-DH' ` <sup >1</sup > | ✔ | ✔ | ✔ | | | | | ✔ | ✔ | | | |
328+ | ` 'NODE-ED25519' ` <sup >1</sup > | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | |
329+ | ` 'NODE-ED448' ` <sup >1</sup > | ✔ | ✔ | ✔ | | | | | | | ✔ | ✔ | |
308330
309331<sup >1</sup > Node.js-specific extension
310332
@@ -420,6 +442,8 @@ Valid key usages depend on the key algorithm (identified by
420442| ` 'NODE-DSA' ` <sup >1</sup > | | | ✔ | ✔ | | | | |
421443| ` 'NODE-DH' ` <sup >1</sup > | | | | | ✔ | ✔ | | |
422444| ` 'NODE-SCRYPT' ` <sup >1</sup > | | | | | ✔ | ✔ | | |
445+ | ` 'NODE-ED25519' ` <sup >1</sup > | | | ✔ | ✔ | | | | |
446+ | ` 'NODE-ED448' ` <sup >1</sup > | | | ✔ | ✔ | | | | |
423447
424448<sup >1</sup > Node.js-specific extension.
425449
@@ -620,6 +644,8 @@ extension that allows converting a {CryptoKey} into a Node.js {KeyObject}.
620644| ` 'NODE-DSA' ` <sup >1</sup > | ✔ | ✔ | ✔ | |
621645| ` 'NODE-DH' ` <sup >1</sup > | ✔ | ✔ | | |
622646| ` 'NODE-SCRYPT' ` <sup >1</sup > | | | | |
647+ | ` 'NODE-ED25519' ` <sup >1</sup > | ✔ | ✔ | ✔ | ✔ |
648+ | ` 'NODE-ED448' ` <sup >1</sup > | ✔ | ✔ | ✔ | ✔ |
623649
624650<sup >1</sup > Node.js-specific extension
625651
@@ -629,7 +655,7 @@ added: v15.0.0
629655-->
630656
631657<!-- lint disable maximum-line-length remark-lint-->
632- * ` algorithm ` : {RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams|NodeDsaKeyGenParams|NodeDhKeyGenParams}
658+ * ` algorithm ` : {RsaHashedKeyGenParams|EcKeyGenParams|HmacKeyGenParams|AesKeyGenParams|NodeDsaKeyGenParams|NodeDhKeyGenParams|NodeEdKeyGenParams }
633659<!-- lint enable maximum-line-length remark-lint-->
634660* ` extractable ` : {boolean}
635661* ` keyUsages ` : {string[ ] } See [ Key usages] [ ] .
@@ -649,6 +675,8 @@ include:
649675* ` 'ECDH' `
650676* ` 'NODE-DSA' ` <sup >1</sup >
651677* ` 'NODE-DH' ` <sup >1</sup >
678+ * ` 'NODE-ED25519' ` <sup >1</sup >
679+ * ` 'NODE-ED448' ` <sup >1</sup >
652680
653681The {CryptoKey} (secret key) generating algorithms supported include:
654682
@@ -669,7 +697,7 @@ added: v15.0.0
669697 ` node.keyObject ` .
670698* ` keyData ` : {ArrayBuffer|TypedArray|DataView|Buffer|KeyObject}
671699<!-- lint disable maximum-line-length remark-lint-->
672- * ` algorithm ` : {RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesImportParams|Pbkdf2ImportParams|NodeDsaImportParams|NodeDhImportParams|NodeScryptImportParams}
700+ * ` algorithm ` : {RsaHashedImportParams|EcKeyImportParams|HmacImportParams|AesImportParams|Pbkdf2ImportParams|NodeDsaImportParams|NodeDhImportParams|NodeScryptImportParams|NodeEdKeyImportParams }
673701<!-- lint enable maximum-line-length remark-lint-->
674702* ` extractable ` : {boolean}
675703* ` keyUsages ` : {string[ ] } See [ Key usages] [ ] .
@@ -704,6 +732,8 @@ The algorithms currently supported include:
704732| ` 'NODE-DSA' ` <sup >1</sup > | ✔ | ✔ | ✔ | |
705733| ` 'NODE-DH' ` <sup >1</sup > | ✔ | ✔ | | |
706734| ` 'NODE-SCRYPT' ` <sup >1</sup > | | | | ✔ |
735+ | ` 'NODE-ED25519' ` <sup >1</sup > | ✔ | ✔ | ✔ | ✔ |
736+ | ` 'NODE-ED448' ` <sup >1</sup > | ✔ | ✔ | ✔ | ✔ |
707737
708738<sup >1</sup > Node.js-specific extension
709739
@@ -731,6 +761,8 @@ The algorithms currently supported include:
731761* ` 'ECDSA' `
732762* ` 'HMAC' `
733763* ` 'NODE-DSA' ` <sup >1</sup >
764+ * ` 'NODE-ED25519' ` <sup >1</sup >
765+ * ` 'NODE-ED448' ` <sup >1</sup >
734766
735767<sup >1</sup > Non-standadrd Node.js extension
736768
@@ -809,6 +841,8 @@ The algorithms currently supported include:
809841* ` 'ECDSA' `
810842* ` 'HMAC' `
811843* ` 'NODE-DSA' ` <sup >1</sup >
844+ * ` 'NODE-ED25519' ` <sup >1</sup >
845+ * ` 'NODE-ED448' ` <sup >1</sup >
812846
813847<sup >1</sup > Non-standard Node.js extension
814848
@@ -1062,7 +1096,8 @@ added: v15.0.0
10621096added: v15.0.0
10631097-->
10641098
1065- * Type: {string} Must be one of ` 'P-256' ` , ` 'P-384' ` or ` 'P-521' ` .
1099+ * Type: {string} Must be one of ` 'P-256' ` , ` 'P-384' ` , ` 'P-521' ` ,
1100+ ` 'NODE-ED25519' ` , ` 'NODE-ED448' ` , ` 'NODE-X25519' ` , or ` 'NODE-X448' ` .
10661101
10671102### Class: ` EcKeyImportParams `
10681103<!-- YAML
@@ -1081,7 +1116,8 @@ added: v15.0.0
10811116added: v15.0.0
10821117-->
10831118
1084- * Type: {string} Must be one of ` 'P-256' ` , ` 'P-384' ` or ` 'P-521' ` .
1119+ * Type: {string} Must be one of ` 'P-256' ` , ` 'P-384' ` , ` 'P-521' ` ,
1120+ ` 'NODE-ED25519' ` , ` 'NODE-ED448' ` , ` 'NODE-X25519' ` , or ` 'NODE-X448' ` .
10851121
10861122### Class: ` HkdfParams `
10871123<!-- YAML
@@ -1598,6 +1634,63 @@ added: v15.0.0
15981634
15991635* Type: {string} Must be ` 'NODE-DSA' `
16001636
1637+ ### ` NODE-ED25519 ` and ` NODE-ED448 ` Algorithms
1638+ <!-- YAML
1639+ added: REPLACEME
1640+ -->
1641+
1642+ #### Class: ` NodeEdKeyGenParams `
1643+ <!-- YAML
1644+ added: REPLACEME
1645+ -->
1646+
1647+ ##### ` nodeEdKeyGenParams.name `
1648+ <!-- YAML
1649+ added: REPLACEME
1650+ -->
1651+
1652+ * Type: {string} Must be one of ` 'NODE-ED25519' ` , ` 'NODE-ED448' ` or ` 'ECDH' ` .
1653+
1654+ ##### ` nodeEdKeyGenParams.namedCurve `
1655+ <!-- YAML
1656+ added: REPLACEME
1657+ -->
1658+
1659+ * Type: {string} Must be one of ` 'NODE-ED25519' ` , ` 'NODE-ED448' ` ,
1660+ ` 'NODE-X25519' ` , or ` 'NODE-X448' ` .
1661+
1662+ #### Class: ` NodeEdKeyImportParams `
1663+ <!-- YAML
1664+ added: REPLACEME
1665+ -->
1666+
1667+ ##### ` nodeEdKeyImportParams.name `
1668+ <!-- YAML
1669+ added: REPLACEME
1670+ -->
1671+
1672+ * Type: {string} Must be one of ` 'NODE-ED25519' ` or ` 'NODE-ED448' `
1673+ if importing an ` Ed25519 ` or ` Ed448 ` key, or ` 'ECDH' ` if importing
1674+ an ` X25519 ` or ` X448 ` key.
1675+
1676+ ##### ` nodeEdKeyImportParams.namedCurve `
1677+ <!-- YAML
1678+ added: REPLACEME
1679+ -->
1680+
1681+ * Type: {string} Must be one of ` 'NODE-ED25519' ` , ` 'NODE-ED448' ` ,
1682+ ` 'NODE-X25519' ` , or ` 'NODE-X448' ` .
1683+
1684+ ##### ` nodeEdKeyImportParams.public `
1685+ <!-- YAML
1686+ added: REPLACEME
1687+ -->
1688+
1689+ * Type: {boolean}
1690+
1691+ The ` public ` parameter is used to specify that the key is to be interpreted
1692+ as a public key.
1693+
16011694### ` NODE-SCRYPT ` Algorithm
16021695<!-- YAML
16031696added: v15.0.0
0 commit comments