mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:47:35 +00:00
LibWeb: Add the Web::Crypto namespace, built-in, and getRandomValues
Since we don't support IDL typedefs or unions yet, the responsibility of verifying the type of the argument is temporarily moved from the generated Wrapper to the implementation.
This commit is contained in:
parent
becbb0ea97
commit
2c6c9b73c8
12 changed files with 129 additions and 10 deletions
38
Userland/Libraries/LibWeb/Crypto/Crypto.h
Normal file
38
Userland/Libraries/LibWeb/Crypto/Crypto.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/Value.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
#include <LibWeb/DOM/ExceptionOr.h>
|
||||
|
||||
namespace Web::Crypto {
|
||||
|
||||
class Crypto : public Bindings::Wrappable
|
||||
, public RefCounted<Crypto>
|
||||
, public Weakable<Crypto> {
|
||||
public:
|
||||
using WrapperType = Bindings::CryptoWrapper;
|
||||
|
||||
static NonnullRefPtr<Crypto> create()
|
||||
{
|
||||
return adopt_ref(*new Crypto());
|
||||
}
|
||||
|
||||
DOM::ExceptionOr<JS::Value> get_random_values(JS::Value array) const;
|
||||
|
||||
private:
|
||||
Crypto() = default;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
CryptoWrapper* wrap(JS::GlobalObject&, Crypto::Crypto&);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue