LibWeb: Update the Key Usage enum to adapt for PostQuantum Algorithms

This commit is contained in:
Tete17 2025-11-27 02:44:01 +01:00 committed by Jelle Raaijmakers
parent b0c48b961e
commit 1d6a64b26c
Notes: github-actions[bot] 2025-11-27 20:51:29 +00:00
3 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,7 @@
enum KeyType { "public", "private", "secret" }; 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 // https://w3c.github.io/webcrypto/#cryptokey-interface
[SecureContext,Exposed=(Window,Worker),Serializable] [SecureContext,Exposed=(Window,Worker),Serializable]

View file

@ -365,7 +365,13 @@ JS::ThrowCompletionOr<GC::Ref<WebIDL::Promise>> SubtleCrypto::import_key(Binding
Variant<ByteBuffer, Bindings::JsonWebKey, Empty> real_key_data; Variant<ByteBuffer, Bindings::JsonWebKey, Empty> real_key_data;
// 2. If format is equal to the string "raw", "pkcs8", or "spki": // 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. // 1. If the keyData parameter passed to the importKey() method is a JsonWebKey dictionary, throw a TypeError.
if (key_data.has<Bindings::JsonWebKey>()) { if (key_data.has<Bindings::JsonWebKey>()) {
return realm.vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource"); return realm.vm().throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "BufferSource");

View file

@ -6,7 +6,8 @@ dictionary Algorithm {
required DOMString name; 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 { dictionary RsaOtherPrimesInfo {
// The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms