diff --git a/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp b/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp index e501127acfa..f21b0ca2339 100644 --- a/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp +++ b/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp @@ -1397,4 +1397,10 @@ WebIDL::ExceptionOr> PBKDF2::derive_bits(Algor return JS::ArrayBuffer::create(realm, result.release_value()); } +WebIDL::ExceptionOr PBKDF2::get_key_length(AlgorithmParams const&) +{ + // 1. Return null. + return JS::js_null(); +} + } diff --git a/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h b/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h index ffcd20aa638..61ad32bacf3 100644 --- a/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h +++ b/Userland/Libraries/LibWeb/Crypto/CryptoAlgorithms.h @@ -197,6 +197,11 @@ public: return WebIDL::NotSupportedError::create(m_realm, "exportKey is not supported"_fly_string); } + virtual WebIDL::ExceptionOr get_key_length(AlgorithmParams const&) + { + return WebIDL::NotSupportedError::create(m_realm, "getKeyLength is not supported"_fly_string); + } + static NonnullOwnPtr create(JS::Realm& realm) { return adopt_own(*new AlgorithmMethods(realm)); } protected: @@ -231,6 +236,7 @@ class PBKDF2 : public AlgorithmMethods { public: virtual WebIDL::ExceptionOr> import_key(AlgorithmParams const&, Bindings::KeyFormat, CryptoKey::InternalKeyData, bool, Vector const&) override; virtual WebIDL::ExceptionOr> derive_bits(AlgorithmParams const&, JS::NonnullGCPtr, u32) override; + virtual WebIDL::ExceptionOr get_key_length(AlgorithmParams const&) override; static NonnullOwnPtr create(JS::Realm& realm) { return adopt_own(*new PBKDF2(realm)); } diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 074f97e04c2..3fddbdfc777 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -677,7 +677,7 @@ SupportedAlgorithmsMap supported_algorithms() // https://w3c.github.io/webcrypto/#pbkdf2 define_an_algorithm("importKey"_string, "PBKDF2"_string); define_an_algorithm("deriveBits"_string, "PBKDF2"_string); - // FIXME: define_an_algorithm("get key length"_string, "PBKDF2"_string, ""_string); + define_an_algorithm("get key length"_string, "PBKDF2"_string); // https://w3c.github.io/webcrypto/#rsa-oaep define_an_algorithm("generateKey"_string, "RSA-OAEP"_string);