2019-04-21 16:44:27 +00:00
|
|
|
#ifndef LLARP_SERVICE_ASYNC_KEY_EXCHANGE_HPP
|
|
|
|
#define LLARP_SERVICE_ASYNC_KEY_EXCHANGE_HPP
|
|
|
|
|
|
|
|
#include <crypto/types.hpp>
|
2019-04-22 18:35:19 +00:00
|
|
|
#include <service/identity.hpp>
|
2019-04-21 16:44:27 +00:00
|
|
|
#include <service/protocol.hpp>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
class Logic;
|
|
|
|
|
|
|
|
namespace service
|
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
struct AsyncKeyExchange : public std::enable_shared_from_this<AsyncKeyExchange>
|
2019-04-21 16:44:27 +00:00
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
std::shared_ptr<Logic> logic;
|
2019-04-21 16:44:27 +00:00
|
|
|
SharedSecret sharedKey;
|
2019-08-02 09:27:27 +00:00
|
|
|
ServiceInfo m_remote;
|
2019-04-21 16:44:27 +00:00
|
|
|
const Identity& m_LocalIdentity;
|
|
|
|
ProtocolMessage msg;
|
|
|
|
Introduction intro;
|
|
|
|
const PQPubKey introPubKey;
|
|
|
|
Introduction remoteIntro;
|
2020-04-07 18:38:56 +00:00
|
|
|
std::function<void(std::shared_ptr<ProtocolFrame>)> hook;
|
2019-04-21 16:44:27 +00:00
|
|
|
IDataHandler* handler;
|
|
|
|
ConvoTag tag;
|
|
|
|
|
2020-04-07 18:38:56 +00:00
|
|
|
AsyncKeyExchange(
|
|
|
|
std::shared_ptr<Logic> l,
|
|
|
|
ServiceInfo r,
|
|
|
|
const Identity& localident,
|
|
|
|
const PQPubKey& introsetPubKey,
|
|
|
|
const Introduction& remote,
|
|
|
|
IDataHandler* h,
|
|
|
|
const ConvoTag& t,
|
|
|
|
ProtocolType proto);
|
2019-04-21 16:44:27 +00:00
|
|
|
|
|
|
|
static void
|
2020-04-07 18:38:56 +00:00
|
|
|
Result(std::shared_ptr<AsyncKeyExchange> user, std::shared_ptr<ProtocolFrame> frame);
|
2019-04-21 16:44:27 +00:00
|
|
|
|
|
|
|
/// given protocol message make protocol frame
|
|
|
|
static void
|
2020-04-07 18:38:56 +00:00
|
|
|
Encrypt(std::shared_ptr<AsyncKeyExchange> user, std::shared_ptr<ProtocolFrame> frame);
|
2019-04-21 16:44:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|
|
|
|
|
|
|
|
#endif
|