SubtleCrypto.h 712 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibJS/Forward.h>
  8. #include <LibWeb/Bindings/Wrappable.h>
  9. namespace Web::Crypto {
  10. class SubtleCrypto
  11. : public Bindings::Wrappable
  12. , public RefCounted<SubtleCrypto> {
  13. public:
  14. using WrapperType = Bindings::SubtleCryptoWrapper;
  15. static NonnullRefPtr<SubtleCrypto> create()
  16. {
  17. return adopt_ref(*new SubtleCrypto());
  18. }
  19. JS::Promise* digest(String const& algorithm, JS::Handle<JS::Object> const& data);
  20. private:
  21. SubtleCrypto() = default;
  22. };
  23. }
  24. namespace Web::Bindings {
  25. SubtleCryptoWrapper* wrap(JS::GlobalObject&, Crypto::SubtleCrypto&);
  26. }