mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Implement Web Crypto HMAC algorithm
This commit is contained in:
parent
884a4163a0
commit
329cd946ac
Notes:
github-actions[bot]
2024-11-14 10:53:12 +00:00
Author: https://github.com/gmta
Commit: 329cd946ac
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2331
10 changed files with 1064 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2023, stelar7 <dudedbz@gmail.com>
|
||||
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
||||
* Copyright (c) 2024, Jelle Raaijmakers <jelle@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -145,4 +146,34 @@ private:
|
|||
u16 m_length;
|
||||
};
|
||||
|
||||
// https://w3c.github.io/webcrypto/#HmacKeyAlgorithm-dictionary
|
||||
struct HmacKeyAlgorithm : public KeyAlgorithm {
|
||||
JS_OBJECT(HmacKeyAlgorithm, KeyAlgorithm);
|
||||
JS_DECLARE_ALLOCATOR(HmacKeyAlgorithm);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<HmacKeyAlgorithm> create(JS::Realm&);
|
||||
|
||||
virtual ~HmacKeyAlgorithm() override = default;
|
||||
|
||||
JS::GCPtr<KeyAlgorithm> hash() const { return m_hash; }
|
||||
void set_hash(JS::GCPtr<KeyAlgorithm> hash) { m_hash = hash; }
|
||||
|
||||
WebIDL::UnsignedLong length() const { return m_length; }
|
||||
void set_length(WebIDL::UnsignedLong length) { m_length = length; }
|
||||
|
||||
protected:
|
||||
HmacKeyAlgorithm(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
|
||||
private:
|
||||
JS_DECLARE_NATIVE_FUNCTION(hash_getter);
|
||||
JS_DECLARE_NATIVE_FUNCTION(length_getter);
|
||||
|
||||
JS::GCPtr<KeyAlgorithm> m_hash;
|
||||
WebIDL::UnsignedLong m_length;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue