mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
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.
This commit is contained in:
parent
653e668c20
commit
9d58c896dc
1 changed files with 3 additions and 9 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue