summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2024-08-28 19:54:49 +0530
committerGitHub <noreply@github.com>2024-08-28 19:54:49 +0530
commit553bd7dec328884785da805d8ef4f9c4510e1366 (patch)
treef44d1dac915305bfae9d1b9cdbfcf310f6103c8a /ext/node/polyfills/internal
parent14a34a0cd76b1d5e4c19b583a3b6aad7db8a6187 (diff)
fix(ext/node): import EC JWK keys (#25266)
Diffstat (limited to 'ext/node/polyfills/internal')
-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");