From 9d58c896dc11be39727729b74ebe5d5d7bb58767 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Thu, 31 Aug 2023 14:56:26 +0200 Subject: fix(ext/crypto): remove EdDSA alg key checks and export (#20331) As per https://github.com/WICG/webcrypto-secure-curves/pull/24 this removes the check for Ed25519 JWK `alg` during importKey and removes the `alg` for Ed25519 keys during JWK exportKey. --- ext/crypto/00_crypto.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'ext') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index dadbf4677..f262e43d9 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -2273,18 +2273,13 @@ function importKeyEd25519( } // 5. - if (jwk.alg !== undefined && jwk.alg !== "EdDSA") { - throw new DOMException("Invalid algorithm", "DataError"); - } - - // 6. if ( keyUsages.length > 0 && jwk.use !== undefined && jwk.use !== "sig" ) { throw new DOMException("Invalid key usage", "DataError"); } - // 7. + // 6. if (jwk.key_ops !== undefined) { if ( ArrayPrototypeFind( @@ -2311,12 +2306,12 @@ function importKeyEd25519( } } - // 8. + // 7. if (jwk.ext !== undefined && jwk.ext === false && extractable) { throw new DOMException("Invalid key extractability", "DataError"); } - // 9. + // 8. if (jwk.d !== undefined) { // https://www.rfc-editor.org/rfc/rfc8037#section-2 let privateKeyData; @@ -4089,7 +4084,6 @@ function exportKeyEd25519(format, key, innerKey) { : ops.op_crypto_base64url_encode(innerKey); const jwk = { kty: "OKP", - alg: "EdDSA", crv: "Ed25519", x, "key_ops": key.usages, -- cgit v1.2.3