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));