mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibWeb: Add and use new name() helper on HashAlgorithmIdentifier
This commit is contained in:
parent
48bd094712
commit
3b423f1852
Notes:
github-actions[bot]
2024-10-27 10:32:17 +00:00
Author: https://github.com/stelar7
Commit: 3b423f1852
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1976
2 changed files with 22 additions and 25 deletions
|
@ -20,10 +20,25 @@
|
|||
namespace Web::Crypto {
|
||||
|
||||
using AlgorithmIdentifier = Variant<JS::Handle<JS::Object>, String>;
|
||||
using HashAlgorithmIdentifier = AlgorithmIdentifier;
|
||||
using NamedCurve = String;
|
||||
using KeyDataType = Variant<JS::Handle<WebIDL::BufferSource>, Bindings::JsonWebKey>;
|
||||
|
||||
struct HashAlgorithmIdentifier : public AlgorithmIdentifier {
|
||||
using AlgorithmIdentifier::AlgorithmIdentifier;
|
||||
|
||||
JS::ThrowCompletionOr<String> name(JS::VM& vm) const
|
||||
{
|
||||
auto value = visit(
|
||||
[](String const& name) -> JS::ThrowCompletionOr<String> { return name; },
|
||||
[&](JS::Handle<JS::Object> const& obj) -> JS::ThrowCompletionOr<String> {
|
||||
auto name_property = TRY(obj->get("name"));
|
||||
return name_property.to_string(vm);
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#algorithm-overview
|
||||
struct AlgorithmParams {
|
||||
virtual ~AlgorithmParams();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue