diff options
Diffstat (limited to 'ext/node/polyfills/internal/crypto')
-rw-r--r-- | ext/node/polyfills/internal/crypto/keys.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts index 74379015b..4ab8cac4f 100644 --- a/ext/node/polyfills/internal/crypto/keys.ts +++ b/ext/node/polyfills/internal/crypto/keys.ts @@ -215,6 +215,12 @@ export interface JsonWebKeyInput { export function prepareAsymmetricKey(key) { if (isStringOrBuffer(key)) { return { format: "pem", data: getArrayBufferOrView(key, "key") }; + } else if (isKeyObject(key)) { + return { + // Assumes that assymetric keys are stored as PEM. + format: "pem", + data: getKeyMaterial(key), + }; } else if (typeof key == "object") { const { key: data, encoding, format, type } = key; if (!isStringOrBuffer(data)) { |