Expand description
Strongly-typed 32-byte identity newtypes for the deCDN wire protocol.
NodeId (a 32-byte Ed25519 public key) and ContentHash (a 32-byte
BLAKE3 content address) are distinct types even though both wrap [u8; 32].
Keeping them distinct turns a class of confusion — passing a content hash
where a node id is expected, or treating a wire-provided id as an
authenticated one — into a compile error rather than a silent logic bug
(see the routing-table-poisoning class behind ADR 022 §STORE Flow).
§Wire compatibility
Both newtypes are #[repr(transparent)] + #[serde(transparent)], so they
lay out and (de)serialize byte-for-byte identically to a bare [u8; 32].
Postcard sees the same 32 raw bytes — no discriminant moves, no ALPN bump.
nodeid_postcard_identical_to_array pins this invariant.
§Trust boundary
A plain NodeId is freely constructible from wire bytes by design:
Kademlia legitimately learns peer ids from FindNode responses and inserts
them as probe candidates. The authenticated-identity boundary is enforced
one layer up by decdn_node::dht::AuthenticatedNodeId, which can only be
minted from a live QUIC connection’s remote_id().
Structs§
- Content
Hash - A 32-byte content address (BLAKE3 hash).
- NodeId
- A 32-byte node identifier (Ed25519 public key).
Constants§
- ID_LEN
- Length in bytes of a
NodeIdorContentHash— the size of both an Ed25519 public key and a BLAKE3 digest.