summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto/keygen.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal/crypto/keygen.ts')
-rw-r--r--ext/node/polyfills/internal/crypto/keygen.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/node/polyfills/internal/crypto/keygen.ts b/ext/node/polyfills/internal/crypto/keygen.ts
index f3263aecf..dd5d5ad7e 100644
--- a/ext/node/polyfills/internal/crypto/keygen.ts
+++ b/ext/node/polyfills/internal/crypto/keygen.ts
@@ -7,6 +7,8 @@
import { KeyObject } from "ext:deno_node/internal/crypto/keys.ts";
import { kAesKeyLengths } from "ext:deno_node/internal/crypto/util.ts";
import {
+ PrivateKeyObject,
+ PublicKeyObject,
SecretKeyObject,
setOwnedKey,
} from "ext:deno_node/internal/crypto/keys.ts";
@@ -564,8 +566,8 @@ export function generateKeyPair(
) => void,
) {
createJob(kAsync, type, options).then(([privateKey, publicKey]) => {
- privateKey = new KeyObject("private", setOwnedKey(privateKey));
- publicKey = new KeyObject("public", setOwnedKey(publicKey));
+ privateKey = new PrivateKeyObject(setOwnedKey(privateKey), { type });
+ publicKey = new PublicKeyObject(setOwnedKey(publicKey), { type });
if (typeof options === "object" && options !== null) {
const { publicKeyEncoding, privateKeyEncoding } = options as any;
@@ -766,8 +768,8 @@ export function generateKeyPairSync(
| KeyPairSyncResult<string | Buffer, string | Buffer> {
let [privateKey, publicKey] = createJob(kSync, type, options);
- privateKey = new KeyObject("private", setOwnedKey(privateKey));
- publicKey = new KeyObject("public", setOwnedKey(publicKey));
+ privateKey = new PrivateKeyObject(setOwnedKey(privateKey), { type });
+ publicKey = new PublicKeyObject(setOwnedKey(publicKey), { type });
if (typeof options === "object" && options !== null) {
const { publicKeyEncoding, privateKeyEncoding } = options as any;