Skip to content

sgns::base::detail

Functions

Name
gsl::span< const uint8_t > StringSpan(const std::string & s)
std::shared_ptr< libp2p::crypto::CryptoProviderImpl > MakeGossipAuthProvider()
libp2p::crypto::CryptoProvider & GossipAuthCryptoProvider()
libp2p::crypto::marshaller::KeyMarshaller & GossipAuthKeyMarshaller()
void AppendU32Be(std::vector< uint8_t > & out, uint32_t value)
bool ReadU32Be(gsl::span< const uint8_t > data, size_t & offset, uint32_t & value)
std::vector< uint8_t > BuildSignableBytes(gsl::span< const uint8_t > from_bytes, gsl::span< const uint8_t > payload)
Canonical signable bytes: magic + u32be(from length) + from + payload.

Functions Documentation

function StringSpan

inline gsl::span< const uint8_t > StringSpan(
    const std::string & s
)

std::string -> byte-span convenience for string-serialized protobuf payloads handed to SealGossipPayload.

function MakeGossipAuthProvider

inline std::shared_ptr< libp2p::crypto::CryptoProviderImpl > MakeGossipAuthProvider()

Crypto provider instantiation recipe copied from crdt/globaldb/keypair_file_storage.cpp:20-52.

function GossipAuthCryptoProvider

inline libp2p::crypto::CryptoProvider & GossipAuthCryptoProvider()

Function-local singletons (thread-safe magic statics); sign/verify/marshal are const operations on the underlying providers.

function GossipAuthKeyMarshaller

inline libp2p::crypto::marshaller::KeyMarshaller & GossipAuthKeyMarshaller()

function AppendU32Be

inline void AppendU32Be(
    std::vector< uint8_t > & out,
    uint32_t value
)

function ReadU32Be

inline bool ReadU32Be(
    gsl::span< const uint8_t > data,
    size_t & offset,
    uint32_t & value
)

Reads a u32 big-endian at offset, advancing it by 4. Fails when fewer than 4 bytes remain.

function BuildSignableBytes

inline std::vector< uint8_t > BuildSignableBytes(
    gsl::span< const uint8_t > from_bytes,
    gsl::span< const uint8_t > payload
)

Canonical signable bytes: magic + u32be(from length) + from + payload.


Updated on 2026-10-06 at 13:34:20 +0000