llarp::SecretKey

Stores a sodium "secret key" value, which is actually the seed concatenated with the public key. More...

#include <types.hpp>

Inherits from llarp::AlignedBuffer< SECKEYSIZE >

Public Functions

Name
SecretKey() =default
SecretKey(const byte_t * ptr)
SecretKey(const AlignedBuffer< SECKEYSIZE > & seed)
SecretKey(const AlignedBuffer< 32 > & seed)
bool Recalculate()
recalculate public component
std::string_view ToString() const
PubKey toPublic() const
bool toPrivate(PrivateKey & key) const
Computes the private key from the secret key (which is actually the seed)
template <typename fspath_t >
bool
LoadFromFile(const fspath_t & fname)
template <typename fspath_t >
bool
SaveToFile(const fspath_t & fname) const

Additional inherited members

Public Types inherited from llarp::AlignedBuffer< SECKEYSIZE >

Name
using std::array< byte_t, SIZE > Data

Public Functions inherited from llarp::AlignedBuffer< SECKEYSIZE >

Name
virtual ~AlignedBuffer() =default
AlignedBuffer()
AlignedBuffer(const byte_t * data)
AlignedBuffer(const Data & buf)
AlignedBuffer & operator=(const byte_t * data)
AlignedBuffer< sz > operator~() const
bitwise NOT
bool operator==(const AlignedBuffer & other) const
bool operator!=(const AlignedBuffer & other) const
bool operator<(const AlignedBuffer & other) const
bool operator>(const AlignedBuffer & other) const
bool operator<=(const AlignedBuffer & other) const
bool operator>=(const AlignedBuffer & other) const
AlignedBuffer operator^(const AlignedBuffer & other) const
AlignedBuffer & operator^=(const AlignedBuffer & other)
byte_t & operator[](size_t idx)
const byte_t & operator[](size_t idx) const
void Fill(byte_t f)
Data & as_array()
const Data & as_array() const
byte_t * data()
const byte_t * data() const
bool IsZero() const
void Zero()
virtual void Randomize()
Data::iterator begin()
Data::iterator end()
Data::const_iterator begin() const
Data::const_iterator end() const
bool FromBytestring(llarp_buffer_t * buf)
bool BEncode(llarp_buffer_t * buf) const
bool BDecode(llarp_buffer_t * buf)
std::string_view ToView() const
std::string ToHex() const
std::string ShortHex() const
bool FromHex(std::string_view str)
constexpr size_t size()

Public Attributes inherited from llarp::AlignedBuffer< SECKEYSIZE >

Name
constexpr size_t SIZE

Detailed Description

struct llarp::SecretKey;

Stores a sodium "secret key" value, which is actually the seed concatenated with the public key.

Note that the seed is not the private key value itself, but rather the seed from which it can be calculated.

Public Functions Documentation

function SecretKey

SecretKey() =default

function SecretKey

inline explicit SecretKey(
    const byte_t * ptr
)

function SecretKey

inline explicit SecretKey(
    const AlignedBuffer< SECKEYSIZE > & seed
)

function SecretKey

inline explicit SecretKey(
    const AlignedBuffer< 32 > & seed
)

function Recalculate

bool Recalculate()

recalculate public component

function ToString

inline std::string_view ToString() const

function toPublic

inline PubKey toPublic() const

function toPrivate

bool toPrivate(
    PrivateKey & key
) const

Computes the private key from the secret key (which is actually the seed)

function LoadFromFile

template <typename fspath_t >
bool LoadFromFile(
    const fspath_t & fname
)

function SaveToFile

template <typename fspath_t >
bool SaveToFile(
    const fspath_t & fname
) const

Updated on 2026-01-10 at 22:49:45 +0000