mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
6 years ago
|
#ifndef LLARP_SERVICE_IDENTITY_HPP
|
||
|
#define LLARP_SERVICE_IDENTITY_HPP
|
||
6 years ago
|
|
||
6 years ago
|
#include <crypto.hpp>
|
||
6 years ago
|
#include <llarp/bencode.hpp>
|
||
|
#include <service/Info.hpp>
|
||
|
#include <service/IntroSet.hpp>
|
||
|
#include <service/types.hpp>
|
||
6 years ago
|
|
||
|
namespace llarp
|
||
|
{
|
||
|
namespace service
|
||
|
{
|
||
|
// private keys
|
||
6 years ago
|
struct Identity final : public llarp::IBEncodeMessage
|
||
6 years ago
|
{
|
||
|
llarp::SecretKey enckey;
|
||
|
llarp::SecretKey signkey;
|
||
6 years ago
|
llarp::PQKeyPair pq;
|
||
6 years ago
|
uint64_t version = 0;
|
||
|
VanityNonce vanity;
|
||
|
|
||
|
// public service info
|
||
|
ServiceInfo pub;
|
||
|
|
||
|
~Identity();
|
||
|
|
||
|
// regenerate secret keys
|
||
|
void
|
||
6 years ago
|
RegenerateKeys(llarp::Crypto* c);
|
||
6 years ago
|
|
||
|
// load from file
|
||
|
bool
|
||
|
LoadFromFile(const std::string& fpath);
|
||
|
|
||
|
bool
|
||
6 years ago
|
BEncode(llarp_buffer_t* buf) const override;
|
||
6 years ago
|
|
||
|
bool
|
||
6 years ago
|
EnsureKeys(const std::string& fpath, llarp::Crypto* c);
|
||
6 years ago
|
|
||
6 years ago
|
bool
|
||
6 years ago
|
KeyExchange(llarp::path_dh_func dh, byte_t* sharedkey,
|
||
6 years ago
|
const ServiceInfo& other, const byte_t* N) const;
|
||
|
|
||
6 years ago
|
bool
|
||
6 years ago
|
DecodeKey(llarp_buffer_t key, llarp_buffer_t* buf) override;
|
||
6 years ago
|
|
||
|
bool
|
||
6 years ago
|
SignIntroSet(IntroSet& i, llarp::Crypto* c, llarp_time_t now) const;
|
||
6 years ago
|
|
||
|
bool
|
||
6 years ago
|
Sign(llarp::Crypto*, byte_t* sig, llarp_buffer_t buf) const;
|
||
6 years ago
|
};
|
||
|
} // namespace service
|
||
|
} // namespace llarp
|
||
|
|
||
6 years ago
|
#endif
|