summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/internal/crypto')
-rw-r--r--ext/node/polyfills/internal/crypto/keys.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts
index 97e565023..c2e9d95ee 100644
--- a/ext/node/polyfills/internal/crypto/keys.ts
+++ b/ext/node/polyfills/internal/crypto/keys.ts
@@ -12,6 +12,7 @@ const {
} = primordials;
import {
+ op_node_create_ec_jwk,
op_node_create_ed_raw,
op_node_create_private_key,
op_node_create_public_key,
@@ -311,7 +312,15 @@ function getKeyObjectHandleFromJwk(key, ctx) {
}
if (key.kty === "EC") {
- throw new TypeError("ec jwk imports not implemented");
+ validateString(key.crv, "key.crv");
+ validateString(key.x, "key.x");
+ validateString(key.y, "key.y");
+
+ if (!isPublic) {
+ validateString(key.d, "key.d");
+ }
+
+ return op_node_create_ec_jwk(key, isPublic);
}
throw new TypeError("rsa jwk imports not implemented");