Crypto.h 856 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. #include <LibWeb/Crypto/SubtleCrypto.h>
  9. #include <LibWeb/WebIDL/ExceptionOr.h>
  10. namespace Web::Crypto {
  11. class Crypto : public Bindings::PlatformObject {
  12. WEB_PLATFORM_OBJECT(Crypto, Bindings::PlatformObject);
  13. public:
  14. static JS::NonnullGCPtr<Crypto> create(JS::Realm&);
  15. virtual ~Crypto() override;
  16. JS::NonnullGCPtr<SubtleCrypto> subtle() const;
  17. WebIDL::ExceptionOr<JS::Value> get_random_values(JS::Value array) const;
  18. String random_uuid() const;
  19. protected:
  20. virtual void visit_edges(Cell::Visitor&) override;
  21. private:
  22. explicit Crypto(JS::Realm&);
  23. virtual void initialize(JS::Realm&) override;
  24. JS::GCPtr<SubtleCrypto> m_subtle;
  25. };
  26. }