mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:27:42 +00:00
LibWeb: Add the CryptoKey interface
This commit is contained in:
parent
69ffdd5738
commit
a8ddf6c2a4
7 changed files with 104 additions and 0 deletions
40
Userland/Libraries/LibWeb/Crypto/CryptoKey.cpp
Normal file
40
Userland/Libraries/LibWeb/Crypto/CryptoKey.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2023, stelar7 <dudedbz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Crypto/CryptoKey.h>
|
||||
|
||||
namespace Web::Crypto {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(CryptoKey);
|
||||
|
||||
JS::NonnullGCPtr<CryptoKey> CryptoKey::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<CryptoKey>(realm, realm);
|
||||
}
|
||||
|
||||
CryptoKey::CryptoKey(JS::Realm& realm)
|
||||
: PlatformObject(realm)
|
||||
, m_algorithm(Object::create(realm, nullptr))
|
||||
, m_usages(Object::create(realm, nullptr))
|
||||
{
|
||||
}
|
||||
|
||||
CryptoKey::~CryptoKey() = default;
|
||||
|
||||
void CryptoKey::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CryptoKeyPrototype>(realm, "CryptoKey"_fly_string));
|
||||
}
|
||||
|
||||
void CryptoKey::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_algorithm);
|
||||
visitor.visit(m_usages);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue