/* * Copyright (c) 2021, Idan Horowitz * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Web::Crypto { class Crypto : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(Crypto, Bindings::PlatformObject); public: static WebIDL::ExceptionOr> create(JS::Realm&); virtual ~Crypto() override; JS::NonnullGCPtr subtle() const; WebIDL::ExceptionOr get_random_values(JS::Value array) const; WebIDL::ExceptionOr random_uuid() const; protected: virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: explicit Crypto(JS::Realm&); JS::GCPtr m_subtle; }; ErrorOr generate_random_uuid(); }