lokinet/llarp/service/async_key_exchange.hpp
dr7ana 11e54f6552 More message refactoring
- routing messages and surrounding code
- shim code in place for iteration and optimization after deciding what to do with buffer, string handling, and subsequent function calls
2023-08-31 09:28:16 -07:00

42 lines
1.1 KiB
C++

#pragma once
#include <llarp/crypto/types.hpp>
#include "identity.hpp"
#include "protocol.hpp"
namespace llarp::service
{
struct AsyncKeyExchange : public std::enable_shared_from_this<AsyncKeyExchange>
{
EventLoop_ptr loop;
SharedSecret sharedKey;
ServiceInfo m_remote;
const Identity& m_LocalIdentity;
ProtocolMessage msg;
Introduction intro;
const PQPubKey introPubKey;
Introduction remoteIntro;
std::function<void(std::shared_ptr<ProtocolFrameMessage>)> hook;
IDataHandler* handler;
ConvoTag tag;
AsyncKeyExchange(
EventLoop_ptr l,
ServiceInfo r,
const Identity& localident,
const PQPubKey& introsetPubKey,
const Introduction& remote,
IDataHandler* h,
const ConvoTag& t,
ProtocolType proto);
static void
Result(std::shared_ptr<AsyncKeyExchange> user, std::shared_ptr<ProtocolFrameMessage> frame);
/// given protocol message make protocol frame
static void
Encrypt(std::shared_ptr<AsyncKeyExchange> user, std::shared_ptr<ProtocolFrameMessage> frame);
};
} // namespace llarp::service