/* * 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); GC_DECLARE_ALLOCATOR(Crypto); public: [[nodiscard]] static GC::Ref create(JS::Realm&); virtual ~Crypto() override; GC::Ref subtle() const; WebIDL::ExceptionOr> get_random_values(GC::Root) const; WebIDL::ExceptionOr random_uuid() const; protected: virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; private: explicit Crypto(JS::Realm&); GC::Ptr m_subtle; }; ErrorOr generate_random_uuid(); }