aboutsummaryrefslogtreecommitdiff
path: root/include/signer/signer.hpp
blob: 22a71c624d4b43d894b8814736803ccf41ec5d04 (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
39
40
41
#pragma once

#include <algorithm>
#include <random>

#include <plog/Init.h>
#include <plog/Log.h>

#include "data/data.hpp"

namespace nostr
{
namespace signer
{
/**
 * @brief An interface for Nostr event signing that implements NIP-46.
 */
class ISigner
{
public:
    /**
     * @brief Signs the given Nostr event.
     * @param event The event to sign.
     * @remark The event's `sig` field will be updated in-place with the signature.
     */
    virtual void sign(std::shared_ptr<nostr::data::Event> event) = 0;
};

class INostrConnectSigner : public ISigner
{
public:
    virtual void receiveConnection(std::string connectionToken) = 0;

    virtual void initiateConnection(
        std::string relay,
        std::string name,
        std::string url,
        std::string description) = 0;
};
} // namespace signer
} // namespace nostr