llarp/config/key_manager.hpp
Namespaces
| Name |
|---|
| llarp [crypto.hpp] |
Classes
| Name | |
|---|---|
| struct | llarp::KeyManager KeyManager manages the cryptographic keys stored on disk for the local node. |
Source code
#pragma once
#include <atomic>
#include "config.hpp"
#include <llarp/crypto/types.hpp>
#include <llarp/router_contact.hpp>
namespace llarp
{
struct KeyManager
{
static bool
backupFileByMoving(const fs::path& filepath);
KeyManager();
bool
initialize(const llarp::Config& config, bool genIfAbsent, bool isSNode);
bool
getRouterContact(llarp::RouterContact& rc) const;
bool
needBackup() const
{
return m_needBackup;
}
llarp::SecretKey identityKey;
llarp::SecretKey encryptionKey;
llarp::SecretKey transportKey;
fs::path m_rcPath;
fs::path m_idKeyPath;
fs::path m_encKeyPath;
fs::path m_transportKeyPath;
private:
std::atomic_bool m_initialized;
std::atomic_bool m_needBackup;
bool
backupKeyFilesByMoving() const;
static bool
loadOrCreateKey(
fs::path filepath,
llarp::SecretKey& key,
std::function<void(llarp::SecretKey& key)> keygen);
};
} // namespace llarp
Updated on 2026-01-10 at 22:49:45 +0000