#include <peer_id.h>
|
| static PeerId | from_public_key (const uint8_t *key, size_t len) |
| | Derive the PeerId from a raw static public key (SHA-256 of the key).
|
| |
| static PeerId | from_public_key (ByteView key) |
| |
| static std::optional< PeerId > | from_bytes (ByteView raw) |
| | Wrap raw 32 id-bytes verbatim (NOT hashed). nullopt unless exactly kSize.
|
| |
| static std::optional< PeerId > | from_hex (std::string_view hex) |
| | Parse a 64-char lowercase/uppercase hex string. nullopt if malformed.
|
| |
|
| static constexpr size_t | kSize = 32 |
| | SHA-256 digest length.
|
| |
Definition at line 26 of file peer_id.h.
◆ PeerId()
| librats::PeerId::PeerId |
( |
| ) |
|
|
default |
◆ bytes()
| const std::array< uint8_t, kSize > & librats::PeerId::bytes |
( |
| ) |
const |
|
inlinenoexcept |
◆ from_bytes()
| static std::optional< PeerId > librats::PeerId::from_bytes |
( |
ByteView |
raw | ) |
|
|
static |
Wrap raw 32 id-bytes verbatim (NOT hashed). nullopt unless exactly kSize.
◆ from_hex()
| static std::optional< PeerId > librats::PeerId::from_hex |
( |
std::string_view |
hex | ) |
|
|
static |
Parse a 64-char lowercase/uppercase hex string. nullopt if malformed.
◆ from_public_key() [1/2]
| static PeerId librats::PeerId::from_public_key |
( |
ByteView |
key | ) |
|
|
inlinestatic |
◆ from_public_key() [2/2]
| static PeerId librats::PeerId::from_public_key |
( |
const uint8_t * |
key, |
|
|
size_t |
len |
|
) |
| |
|
static |
Derive the PeerId from a raw static public key (SHA-256 of the key).
◆ is_zero()
| bool librats::PeerId::is_zero |
( |
| ) |
const |
|
noexcept |
◆ operator!=()
| bool librats::PeerId::operator!= |
( |
const PeerId & |
o | ) |
const |
|
inlinenoexcept |
◆ operator<()
| bool librats::PeerId::operator< |
( |
const PeerId & |
o | ) |
const |
|
inlinenoexcept |
◆ operator==()
| bool librats::PeerId::operator== |
( |
const PeerId & |
o | ) |
const |
|
inlinenoexcept |
◆ short_hex()
| std::string librats::PeerId::short_hex |
( |
| ) |
const |
first 8 hex chars, for logs
◆ to_hex()
| std::string librats::PeerId::to_hex |
( |
| ) |
const |
◆ kSize
| constexpr size_t librats::PeerId::kSize = 32 |
|
staticconstexpr |
SHA-256 digest length.
Definition at line 28 of file peer_id.h.
The documentation for this class was generated from the following file: