mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 13:05:07 +00:00

Similar to create() in LibJS, wrap() et al. are on a low enough level to warrant passing a Realm directly instead of relying on the current realm from the VM, as a wrapper may need to be allocated while no JS is being executed.
37 lines
710 B
C++
37 lines
710 B
C++
/*
|
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Forward.h>
|
|
#include <LibWeb/Bindings/Wrappable.h>
|
|
|
|
namespace Web::Crypto {
|
|
|
|
class SubtleCrypto
|
|
: public Bindings::Wrappable
|
|
, public RefCounted<SubtleCrypto> {
|
|
public:
|
|
using WrapperType = Bindings::SubtleCryptoWrapper;
|
|
|
|
static NonnullRefPtr<SubtleCrypto> create()
|
|
{
|
|
return adopt_ref(*new SubtleCrypto());
|
|
}
|
|
|
|
JS::Promise* digest(String const& algorithm, JS::Handle<JS::Object> const& data);
|
|
|
|
private:
|
|
SubtleCrypto() = default;
|
|
};
|
|
|
|
}
|
|
|
|
namespace Web::Bindings {
|
|
|
|
SubtleCryptoWrapper* wrap(JS::Realm&, Crypto::SubtleCrypto&);
|
|
|
|
}
|