mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibWeb: Implement normalize_an_algorithm
This commit is contained in:
parent
635ad9e9b8
commit
b2b5297997
2 changed files with 172 additions and 22 deletions
|
@ -6,6 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
|
@ -15,7 +17,13 @@ class SubtleCrypto final : public Bindings::PlatformObject {
|
|||
WEB_PLATFORM_OBJECT(SubtleCrypto, Bindings::PlatformObject);
|
||||
JS_DECLARE_ALLOCATOR(SubtleCrypto);
|
||||
|
||||
using SupportedAlgorithmsMap = HashMap<String, HashMap<String, String, AK::ASCIICaseInsensitiveStringTraits>>;
|
||||
|
||||
public:
|
||||
struct Algorithm {
|
||||
String name;
|
||||
};
|
||||
|
||||
[[nodiscard]] static JS::NonnullGCPtr<SubtleCrypto> create(JS::Realm&);
|
||||
|
||||
virtual ~SubtleCrypto() override;
|
||||
|
@ -25,6 +33,12 @@ public:
|
|||
private:
|
||||
explicit SubtleCrypto(JS::Realm&);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
JS::ThrowCompletionOr<Algorithm> normalize_an_algorithm(Variant<JS::Handle<JS::Object>, String> const& algorithm, String operation);
|
||||
|
||||
static SubtleCrypto::SupportedAlgorithmsMap& supported_algorithms_internal();
|
||||
static SubtleCrypto::SupportedAlgorithmsMap supported_algorithms();
|
||||
static void define_an_algorithm(String op, String algorithm, String type);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue