summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Crypto/Crypto.h
blob: d469b7a48f476a8542cf9a1719058efc2a0b02cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibJS/Runtime/Value.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/ExceptionOr.h>

namespace Web::Crypto {

class Crypto : public Bindings::Wrappable
    , public RefCounted<Crypto>
    , public Weakable<Crypto> {
public:
    using WrapperType = Bindings::CryptoWrapper;

    static NonnullRefPtr<Crypto> create()
    {
        return adopt_ref(*new Crypto());
    }

    DOM::ExceptionOr<JS::Value> get_random_values(JS::Value array) const;

private:
    Crypto() = default;
};

}

namespace Web::Bindings {

CryptoWrapper* wrap(JS::GlobalObject&, Crypto::Crypto&);

}