llarp::PrivateKey

PrivateKey is similar to SecretKey except that it only stores the private key value and a hash, unlike SecretKey which stores the seed from which the private key and hash value are generated. More...

#include <types.hpp>

Inherits from llarp::AlignedBuffer< 64 >

Public Functions

Name
PrivateKey() =default
PrivateKey(const byte_t * ptr)
PrivateKey(const AlignedBuffer< 64 > & key_and_hash)
const byte_t * signingHash() const
Returns a pointer to the beginning of the 32-byte hash which is used for pseudorandomness when signing with this private key.
byte_t * signingHash()
Returns a pointer to the beginning of the 32-byte hash which is used for pseudorandomness when signing with this private key.
std::string_view ToString() const
bool toPublic(PubKey & pubkey) const
Computes the public key.

Additional inherited members

Public Types inherited from llarp::AlignedBuffer< 64 >

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

Public Functions inherited from llarp::AlignedBuffer< 64 >

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< 64 >

Name
constexpr size_t SIZE

Detailed Description

struct llarp::PrivateKey;

PrivateKey is similar to SecretKey except that it only stores the private key value and a hash, unlike SecretKey which stores the seed from which the private key and hash value are generated.

This is primarily intended for use with derived keys, where we can derive the private key but not the seed.

Public Functions Documentation

function PrivateKey

PrivateKey() =default

function PrivateKey

inline explicit PrivateKey(
    const byte_t * ptr
)

function PrivateKey

inline explicit PrivateKey(
    const AlignedBuffer< 64 > & key_and_hash
)

function signingHash

inline const byte_t * signingHash() const

Returns a pointer to the beginning of the 32-byte hash which is used for pseudorandomness when signing with this private key.

function signingHash

inline byte_t * signingHash()

Returns a pointer to the beginning of the 32-byte hash which is used for pseudorandomness when signing with this private key.

function ToString

inline std::string_view ToString() const

function toPublic

bool toPublic(
    PubKey & pubkey
) const

Computes the public key.


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