From 4d3adfb84276c5c43daee02826c4c2cd56dad6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Mon, 27 Jul 2026 18:12:49 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#75244=20[node]=20c?= =?UTF-8?q?rypto:=20accept=20KeyObject=20to=20createPublicKey()=20by=20@Re?= =?UTF-8?q?negade334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node/crypto.d.ts | 2 +- types/node/node-tests/crypto.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/types/node/crypto.d.ts b/types/node/crypto.d.ts index 3d5aa3c5e582b4..e1ce8f327d142a 100644 --- a/types/node/crypto.d.ts +++ b/types/node/crypto.d.ts @@ -1185,7 +1185,7 @@ declare module "node:crypto" { * and it will be impossible to extract the private key from the returned object. * @since v11.6.0 */ - function createPublicKey(key: PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput | BinaryLike): KeyObject; + function createPublicKey(key: PublicKeyInput | RawPublicKeyInput | JsonWebKeyInput | KeyLike): KeyObject; /** * Creates and returns a new key object containing a secret key for symmetric * encryption or `Hmac`. diff --git a/types/node/node-tests/crypto.ts b/types/node/node-tests/crypto.ts index af883c1af8f2b3..bbcec96234d3ea 100644 --- a/types/node/node-tests/crypto.ts +++ b/types/node/node-tests/crypto.ts @@ -1189,6 +1189,11 @@ import { promisify } from "node:util"; }); } +{ + let privateKey!: crypto.KeyObject; + crypto.createPublicKey(privateKey); +} + { crypto.createSecretKey(Buffer.from("asdf")); crypto.createSecretKey(new Uint8Array(128));