Skip to content

Commit

Permalink
LibWeb: Rename EcdhKeyDerivePrams to EcdhKeyDeriveParams
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu authored and awesomekling committed Nov 27, 2024
1 parent 13c9874 commit 6ebc812
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Libraries/LibWeb/Crypto/CryptoAlgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,9 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> AesDerivedKeyParams::from_
return adopt_own<AlgorithmParams>(*new AesDerivedKeyParams { name, length });
}

EcdhKeyDerivePrams::~EcdhKeyDerivePrams() = default;
EcdhKeyDeriveParams::~EcdhKeyDeriveParams() = default;

JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcdhKeyDerivePrams::from_value(JS::VM& vm, JS::Value value)
JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcdhKeyDeriveParams::from_value(JS::VM& vm, JS::Value value)
{
auto& object = value.as_object();

Expand All @@ -606,7 +606,7 @@ JS::ThrowCompletionOr<NonnullOwnPtr<AlgorithmParams>> EcdhKeyDerivePrams::from_v

auto& key = verify_cast<CryptoKey>(*key_object);

return adopt_own<AlgorithmParams>(*new EcdhKeyDerivePrams { name, key });
return adopt_own<AlgorithmParams>(*new EcdhKeyDeriveParams { name, key });
}

EcKeyImportParams::~EcKeyImportParams() = default;
Expand Down Expand Up @@ -2648,7 +2648,7 @@ WebIDL::ExceptionOr<Variant<GC::Ref<CryptoKey>, GC::Ref<CryptoKeyPair>>> ECDH::g
WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> ECDH::derive_bits(AlgorithmParams const& params, GC::Ref<CryptoKey> key, Optional<u32> length_optional)
{
auto& realm = *m_realm;
auto const& normalized_algorithm = static_cast<EcdhKeyDerivePrams const&>(params);
auto const& normalized_algorithm = static_cast<EcdhKeyDeriveParams const&>(params);

// 1. If the [[type]] internal slot of key is not "private", then throw an InvalidAccessError.
if (key->type() != Bindings::KeyType::Private)
Expand Down Expand Up @@ -4121,7 +4121,7 @@ WebIDL::ExceptionOr<GC::Ref<CryptoKey>> PBKDF2::import_key(AlgorithmParams const
WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> X25519::derive_bits(AlgorithmParams const& params, GC::Ref<CryptoKey> key, Optional<u32> length_optional)
{
auto& realm = *m_realm;
auto const& normalized_algorithm = static_cast<EcdhKeyDerivePrams const&>(params);
auto const& normalized_algorithm = static_cast<EcdhKeyDeriveParams const&>(params);

// 1. If the [[type]] internal slot of key is not "private", then throw an InvalidAccessError.
if (key->type() != Bindings::KeyType::Private)
Expand Down Expand Up @@ -4620,7 +4620,7 @@ WebIDL::ExceptionOr<GC::Ref<JS::ArrayBuffer>> X448::derive_bits(
return WebIDL::InvalidAccessError::create(m_realm, "Key is not a private key"_string);

// 2. Let publicKey be the public member of normalizedAlgorithm.
auto& public_key = static_cast<EcdhKeyDerivePrams const&>(params).public_key;
auto& public_key = static_cast<EcdhKeyDeriveParams const&>(params).public_key;

// 3. If the [[type]] internal slot of publicKey is not "public", then throw an InvalidAccessError.
if (public_key->type() != Bindings::KeyType::Public)
Expand Down
6 changes: 3 additions & 3 deletions Libraries/LibWeb/Crypto/CryptoAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,10 @@ class HMAC : public AlgorithmMethods {
}
};

struct EcdhKeyDerivePrams : public AlgorithmParams {
virtual ~EcdhKeyDerivePrams() override;
struct EcdhKeyDeriveParams : public AlgorithmParams {
virtual ~EcdhKeyDeriveParams() override;

EcdhKeyDerivePrams(String name, CryptoKey& public_key)
EcdhKeyDeriveParams(String name, CryptoKey& public_key)
: AlgorithmParams(move(name))
, public_key(public_key)
{
Expand Down
6 changes: 3 additions & 3 deletions Libraries/LibWeb/Crypto/SubtleCrypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ SupportedAlgorithmsMap const& supported_algorithms()
// https://w3c.github.io/webcrypto/#ecdh-registration
define_an_algorithm<ECDH, EcKeyImportParams>("importKey"_string, "ECDH"_string);
define_an_algorithm<ECDH>("exportKey"_string, "ECDH"_string);
define_an_algorithm<ECDH, EcdhKeyDerivePrams>("deriveBits"_string, "ECDH"_string);
define_an_algorithm<ECDH, EcdhKeyDeriveParams>("deriveBits"_string, "ECDH"_string);
define_an_algorithm<ECDH, EcKeyGenParams>("generateKey"_string, "ECDH"_string);

// https://w3c.github.io/webcrypto/#aes-ctr-registration
Expand Down Expand Up @@ -867,13 +867,13 @@ SupportedAlgorithmsMap const& supported_algorithms()
define_an_algorithm<PBKDF2>("get key length"_string, "PBKDF2"_string);

// https://wicg.github.io/webcrypto-secure-curves/#x25519-registration
define_an_algorithm<X25519, EcdhKeyDerivePrams>("deriveBits"_string, "X25519"_string);
define_an_algorithm<X25519, EcdhKeyDeriveParams>("deriveBits"_string, "X25519"_string);
define_an_algorithm<X25519>("generateKey"_string, "X25519"_string);
define_an_algorithm<X25519>("importKey"_string, "X25519"_string);
define_an_algorithm<X25519>("exportKey"_string, "X25519"_string);

// https://wicg.github.io/webcrypto-secure-curves/#x448-registration
define_an_algorithm<X448, EcdhKeyDerivePrams>("deriveBits"_string, "X448"_string);
define_an_algorithm<X448, EcdhKeyDeriveParams>("deriveBits"_string, "X448"_string);
define_an_algorithm<X448>("generateKey"_string, "X448"_string);
define_an_algorithm<X448>("importKey"_string, "X448"_string);
define_an_algorithm<X448>("exportKey"_string, "X448"_string);
Expand Down

0 comments on commit 6ebc812

Please sign in to comment.