diff --git a/types/node/crypto.d.ts b/types/node/crypto.d.ts index a048b2064c..2c81a6f4e9 100644 --- a/types/node/crypto.d.ts +++ b/types/node/crypto.d.ts @@ -398,6 +398,8 @@ declare module "crypto" { } function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; + function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; function getCiphers(): string[]; function getCurves(): string[]; function getHashes(): string[]; diff --git a/types/node/test/crypto.ts b/types/node/test/crypto.ts index 28051e3924..537a3c472e 100644 --- a/types/node/test/crypto.ts +++ b/types/node/test/crypto.ts @@ -648,9 +648,14 @@ import { promisify } from 'util'; } { - const buf: Buffer = crypto.publicEncrypt({ + const key = { key: 'test', oaepHash: 'sha1', oaepLabel: Buffer.from('asd'), - }, Buffer.from([])); + }; + const buf: Buffer = crypto.publicEncrypt(key, Buffer.from([])); + const dec: Buffer = crypto.publicDecrypt(key, buf); + + const bufP: Buffer = crypto.privateEncrypt(key, Buffer.from([])); + const decp: Buffer = crypto.privateDecrypt(key, bufP); }