2021-12-13 20:48:27 +00:00
|
|
|
/*
|
2022-08-22 18:31:08 +01:00
|
|
|
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
|
2021-12-13 20:48:27 +00:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-12-13 22:09:55 +00:00
|
|
|
#include <LibJS/Forward.h>
|
2022-09-03 19:59:53 +02:00
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
2021-12-13 20:48:27 +00:00
|
|
|
|
|
|
|
|
namespace Web::Crypto {
|
|
|
|
|
|
2022-09-03 19:59:53 +02:00
|
|
|
class SubtleCrypto final : public Bindings::PlatformObject {
|
|
|
|
|
WEB_PLATFORM_OBJECT(SubtleCrypto, Bindings::PlatformObject);
|
|
|
|
|
|
2021-12-13 20:48:27 +00:00
|
|
|
public:
|
2023-02-12 21:25:57 +01:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SubtleCrypto>> create(JS::Realm&);
|
2021-12-13 20:48:27 +00:00
|
|
|
|
2022-09-03 19:59:53 +02:00
|
|
|
virtual ~SubtleCrypto() override;
|
2021-12-13 20:48:27 +00:00
|
|
|
|
2023-02-24 12:18:43 +01:00
|
|
|
JS::NonnullGCPtr<JS::Promise> digest(String const& algorithm, JS::Handle<JS::Object> const& data);
|
2021-12-13 22:09:55 +00:00
|
|
|
|
2021-12-13 20:48:27 +00:00
|
|
|
private:
|
LibWeb: Remove unecessary dependence on Window from assorted classes
These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
2022-09-25 18:11:21 -06:00
|
|
|
explicit SubtleCrypto(JS::Realm&);
|
2023-01-28 12:33:35 -05:00
|
|
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
2021-12-13 20:48:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|