diff options
author | Filip Skokan <panva.ip@gmail.com> | 2023-08-31 14:56:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 18:26:26 +0530 |
commit | 9d58c896dc11be39727729b74ebe5d5d7bb58767 (patch) | |
tree | dfae181f7e321f163bc0496e75df84c2b7259479 | |
parent | 653e668c208cfdd940eb967ff884daca135bcfff (diff) |
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.
-rw-r--r-- | ext/crypto/00_crypto.js | 12 |
1 files changed, 3 insertions, 9 deletions
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, |