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
|
|
|
|
{
|
|
|
|
struct AsyncKeyExchange
|
2019-09-19 14:41:31 +00:00
|
|
|
: public std::enable_shared_from_this< AsyncKeyExchange >
|
2019-04-21 16:44:27 +00:00
|
|
|
{
|
2019-05-22 16:20:50 +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;
|
2019-09-19 14:41:31 +00:00
|
|
|
std::function< void(std::shared_ptr< ProtocolFrame >) > hook;
|
2019-04-21 16:44:27 +00:00
|
|
|
IDataHandler* handler;
|
|
|
|
ConvoTag tag;
|
|
|
|
|
2019-07-30 23:42:13 +00:00
|
|
|
AsyncKeyExchange(std::shared_ptr< Logic > l, ServiceInfo r,
|
2019-05-28 19:45:08 +00:00
|
|
|
const Identity& localident,
|
2019-04-21 16:44:27 +00:00
|
|
|
const PQPubKey& introsetPubKey,
|
|
|
|
const Introduction& remote, IDataHandler* h,
|
2019-06-11 16:44:05 +00:00
|
|
|
const ConvoTag& t, ProtocolType proto);
|
2019-04-21 16:44:27 +00:00
|
|
|
|
|
|
|
static void
|
2019-11-27 15:59:36 +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
|
2019-11-27 15:59:36 +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
|