Skip to content

sgns::networkregistry::NetworkMembershipPayload

ISignedCRDTData payload type carrying a private network's membership record. Serialization is an explicit line-based field layout (see NetworkRegistry.cpp); every field is non-secret metadata (D-03) – the raw pnet credential is NEVER stored. More...

#include <NetworkRegistry.hpp>

Inherits from sgns::securecrdt::ISignedCRDTData

Public Functions

Name
NetworkMembershipPayload() =default
NetworkMembershipPayload(std::vector< std::string > peers, std::vector< std::string > signers, uint32_t pnet_key_version =1, std::string pnet_key_fingerprint ={})
Constructs a payload directly from its fields (used by callers that need to serialize a proposed value).
virtual std::vector< uint8_t > SerializeToBytes() const override
Serializes this instance's payload to raw bytes (codec, encode side).
virtual bool DeserializeFromBytes(const std::vector< uint8_t > & bytes) override
virtual bool Verify(const std::vector< uint8_t > & payload) const override
Performs type-specific semantic validation of payload beyond signature/quorum checks (e.g. field-range checks).
virtual void Apply() override
No-op: cache overwrite happens in NetworkRegistry::TryConfirm (TrustedPeerListPayload::Apply convention – a standalone payload instance owns no registry state).
const std::vector< std::string > & GetNetworkPeers() const
const std::vector< std::string > & GetNetworkSigners() const
uint32_t GetPnetKeyVersion() const
const std::string & GetPnetKeyFingerprint() const
std::optional< NetworkMembershipPayload > FromBytes(const std::vector< uint8_t > & bytes)
Decodes a membership record into a fully-constructed payload.

Public Attributes

Name
constexpr std::string_view MAGIC
Wire-layout magic/version line every serialized record starts with.
std::vector< std::string > network_peers
libp2p PeerId base58 strings (gater allow-list).
std::vector< std::string > network_signers
Member account addresses (128-hex, self-governance signers).
uint32_t pnet_key_version
Offline credential version (informational).
std::string pnet_key_fingerprint
Short hex credential fingerprint (optional).

Additional inherited members

Public Functions inherited from sgns::securecrdt::ISignedCRDTData

Name
virtual ~ISignedCRDTData() =default

Detailed Description

class sgns::networkregistry::NetworkMembershipPayload;

ISignedCRDTData payload type carrying a private network's membership record. Serialization is an explicit line-based field layout (see NetworkRegistry.cpp); every field is non-secret metadata (D-03) – the raw pnet credential is NEVER stored.

Two peer-id views are carried because the two consumers need disjoint identity spaces: network_peers entries are libp2p PeerId base58 strings (so the 15-05 connection gater can compare remote_peer.toBase58() directly), while network_signers entries are 128-hex member account addresses (the only identity space SecureCrdt/multisig can verify signatures against – ResolveLegacySignerSnapshot rejects non-hex signer sets).

Verify() performs structural validation ONLY (non-empty unique PeerId-prefixed peer list, unique well-formed signer addresses, version >= 1) – it never diffs against any cached/mutable state (TrustedPeerListPayload convention).

Public Functions Documentation

function NetworkMembershipPayload

NetworkMembershipPayload() =default

function NetworkMembershipPayload

NetworkMembershipPayload(
    std::vector< std::string > peers,
    std::vector< std::string > signers,
    uint32_t pnet_key_version =1,
    std::string pnet_key_fingerprint ={}
)

Constructs a payload directly from its fields (used by callers that need to serialize a proposed value).

Parameters:

  • peers libp2p PeerId base58 membership list.
  • signers Member account addresses (128-hex).
  • pnet_key_version Offline credential version (informational).
  • pnet_key_fingerprint Short hex fingerprint of the credential (optional, never the credential itself).

function SerializeToBytes

virtual std::vector< uint8_t > SerializeToBytes() const override

Serializes this instance's payload to raw bytes (codec, encode side).

Return: Raw payload bytes representing this instance's current state.

Reimplements: sgns::securecrdt::ISignedCRDTData::SerializeToBytes

function DeserializeFromBytes

virtual bool DeserializeFromBytes(
    const std::vector< uint8_t > & bytes
) override

Note: Prefer FromBytes() in concrete call sites. This mutating override remains for ISignedCRDTData consumers.

Reimplements: sgns::securecrdt::ISignedCRDTData::DeserializeFromBytes

function Verify

virtual bool Verify(
    const std::vector< uint8_t > & payload
) const override

Performs type-specific semantic validation of payload beyond signature/quorum checks (e.g. field-range checks).

Parameters:

  • payload Raw payload bytes to validate.

Return: true if payload is semantically valid for this type.

Reimplements: sgns::securecrdt::ISignedCRDTData::Verify

function Apply

virtual void Apply() override

No-op: cache overwrite happens in NetworkRegistry::TryConfirm (TrustedPeerListPayload::Apply convention – a standalone payload instance owns no registry state).

Reimplements: sgns::securecrdt::ISignedCRDTData::Apply

function GetNetworkPeers

inline const std::vector< std::string > & GetNetworkPeers() const

Return: The libp2p PeerId base58 membership list.

function GetNetworkSigners

inline const std::vector< std::string > & GetNetworkSigners() const

Return: The 128-hex member signing-address list.

function GetPnetKeyVersion

inline uint32_t GetPnetKeyVersion() const

Return: The offline credential version (informational metadata).

function GetPnetKeyFingerprint

inline const std::string & GetPnetKeyFingerprint() const

Return: The short hex credential fingerprint ("" when absent).

function FromBytes

static std::optional< NetworkMembershipPayload > FromBytes(
    const std::vector< uint8_t > & bytes
)

Decodes a membership record into a fully-constructed payload.

Parameters:

  • bytes Raw record bytes.

Return: The decoded payload, or std::nullopt if bytes is malformed.

Public Attributes Documentation

variable MAGIC

static constexpr std::string_view MAGIC = "SGNS-NETREG-1";

Wire-layout magic/version line every serialized record starts with.

variable network_peers

std::vector< std::string > network_peers;

libp2p PeerId base58 strings (gater allow-list).

variable network_signers

std::vector< std::string > network_signers;

Member account addresses (128-hex, self-governance signers).

variable pnet_key_version

uint32_t pnet_key_version = 1;

Offline credential version (informational).

variable pnet_key_fingerprint

std::string pnet_key_fingerprint;

Short hex credential fingerprint (optional).


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