diff --git a/Libraries/LibWeb/Crypto/CryptoKey.idl b/Libraries/LibWeb/Crypto/CryptoKey.idl index ee6a108eacd..ea7cf9aa6f2 100644 --- a/Libraries/LibWeb/Crypto/CryptoKey.idl +++ b/Libraries/LibWeb/Crypto/CryptoKey.idl @@ -1,6 +1,7 @@ enum KeyType { "public", "private", "secret" }; -enum KeyUsage { "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey" }; +// https://wicg.github.io/webcrypto-modern-algos/#subtlecrypto-interface-keyusage +enum KeyUsage { "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey", "encapsulateKey", "encapsulateBits", "decapsulateKey", "decapsulateBits" }; // https://w3c.github.io/webcrypto/#cryptokey-interface [SecureContext,Exposed=(Window,Worker),Serializable] diff --git a/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index d77ac851769..3e8a51ca9b7 100644 --- a/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -365,7 +365,13 @@ JS::ThrowCompletionOr> SubtleCrypto::import_key(Binding Variant real_key_data; // 2. If format is equal to the string "raw", "pkcs8", or "spki": - if (format == Bindings::KeyFormat::Raw || format == Bindings::KeyFormat::Pkcs8 || format == Bindings::KeyFormat::Spki) { + if (format == Bindings::KeyFormat::Raw + || format == Bindings::KeyFormat::RawPublic + || format == Bindings::KeyFormat::RawPrivate + || format == Bindings::KeyFormat::RawSeed + || format == Bindings::KeyFormat::RawSecret + || format == Bindings::KeyFormat::Pkcs8 + || format == Bindings::KeyFormat::Spki) { // 1. If the keyData parameter passed to the importKey() method is a JsonWebKey dictionary, throw a TypeError. if (key_data.has()) { return realm.vm().throw_completion(JS::ErrorType::NotAnObjectOfType, "BufferSource"); diff --git a/Libraries/LibWeb/Crypto/SubtleCrypto.idl b/Libraries/LibWeb/Crypto/SubtleCrypto.idl index 18b141e002b..550c4b2acab 100644 --- a/Libraries/LibWeb/Crypto/SubtleCrypto.idl +++ b/Libraries/LibWeb/Crypto/SubtleCrypto.idl @@ -6,7 +6,8 @@ dictionary Algorithm { required DOMString name; }; -enum KeyFormat { "raw", "spki", "pkcs8", "jwk" }; +// https://wicg.github.io/webcrypto-modern-algos/#subtlecrypto-interface-keyformat +enum KeyFormat { "raw-public", "raw-private", "raw-seed", "raw-secret", "raw", "spki", "pkcs8", "jwk" }; dictionary RsaOtherPrimesInfo { // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms