Repository: nodejs/node
Pull request: quic: remove CryptoKey support from session keys option

Let's not spread any more uses of `CryptoKey` instances that would ignore its intended use properties such as algorithm and usages.

Refs: https://github.com/nodejs/node/issues/55293
Refs: https://github.com/nodejs/node/pull/62321

Changed files:
filename: doc/api/quic.md
patch: @@ -1197,9 +1197,13 @@ True to enable TLS keylogging output.
 
 <!-- YAML
 added: v23.8.0
+changes:
+  - version: REPLACEME
+    pr-url: https://github.com/nodejs/node/pull/62335
+    description: CryptoKey is no longer accepted.
 -->
 
-* Type: {KeyObject|CryptoKey|KeyObject\[]|CryptoKey\[]}
+* Type: {KeyObject|KeyObject\[]}
 
 The TLS crypto keys to use for sessions.
 

filename: lib/internal/quic/quic.js
patch: @@ -98,7 +98,6 @@ const {
 
 const {
   isKeyObject,
-  isCryptoKey,
 } = require('internal/crypto/keys');
 
 const {
@@ -143,7 +142,6 @@ const {
   kVersionNegotiation,
   kInspect,
   kKeyObjectHandle,
-  kKeyObjectInner,
   kWantsHeaders,
   kWantsTrailers,
 } = require('internal/quic/symbols');
@@ -187,7 +185,6 @@ const onSessionHandshakeChannel = dc.channel('quic.session.handshake');
 /**
  * @typedef {import('../socketaddress.js').SocketAddress} SocketAddress
  * @typedef {import('../crypto/keys.js').KeyObject} KeyObject
- * @typedef {import('../crypto/keys.js').CryptoKey} CryptoKey
  */
 
 /**
@@ -260,7 +257,7 @@ const onSessionHandshakeChannel = dc.channel('quic.session.handshake');
  * @property {boolean} [verifyClient] Verify the client
  * @property {boolean} [tlsTrace] Enable TLS tracing
  * @property {boolean} [verifyPrivateKey] Verify the private key
- * @property {KeyObject|CryptoKey|Array<KeyObject|CryptoKey>} [keys] The keys
+ * @property {KeyObject|KeyObject[]} [keys] The keys
  * @property {ArrayBuffer|ArrayBufferView|Array<ArrayBuffer|ArrayBufferView>} [certs] The certificates
  * @property {ArrayBuffer|ArrayBufferView|Array<ArrayBuffer|ArrayBufferView>} [ca] The certificate authority
  * @property {ArrayBuffer|ArrayBufferView|Array<ArrayBuffer|ArrayBufferView>} [crl] The certificate revocation list
@@ -2171,13 +2168,8 @@ function processTlsOptions(tls, forServer) {
           throw new ERR_INVALID_ARG_VALUE('options.keys', key, 'must be a private key');
         }
         ArrayPrototypePush(keyHandles, key[kKeyObjectHandle]);
-      } else if (isCryptoKey(key)) {
-        if (key.type !== 'private') {
-          throw new ERR_INVALID_ARG_VALUE('options.keys', key, 'must be a private key');
-        }
-        ArrayPrototypePush(keyHandles, key[kKeyObjectInner][kKeyObjectHandle]);
       } else {
-        throw new ERR_INVALID_ARG_TYPE('options.keys', ['KeyObject', 'CryptoKey'], key);
+        throw new ERR_INVALID_ARG_TYPE('options.keys', 'KeyObject', key);
       }
     }
   }

filename: lib/internal/quic/symbols.js
patch: @@ -18,7 +18,6 @@ const {
 
 const {
   kHandle: kKeyObjectHandle,
-  kKeyObject: kKeyObjectInner,
 } = require('internal/crypto/util');
 
 // Symbols used to hide various private properties and methods from the
@@ -61,7 +60,6 @@ module.exports = {
   kHeaders,
   kInspect,
   kKeyObjectHandle,
-  kKeyObjectInner,
   kListen,
   kNewSession,
   kNewStream,