pub struct CidChain { /* private fields */ }Expand description
Per-direction, session-stable rotating-CID chain secrets. outbound_secret
is the chain this peer stamps its outbound ConnId from (the peer routes on
it); inbound_secret is the chain this peer routes inbound ConnIds on.
Derived once from the initial session secret; zeroized on drop.
Implementations§
Source§impl CidChain
impl CidChain
Sourcepub fn derive(initial_secret: &[u8; 32], is_server: bool) -> Self
pub fn derive(initial_secret: &[u8; 32], is_server: bool) -> Self
Derive the per-direction CID-chain secrets from the initial session
secret. is_server swaps outbound/inbound so one peer’s outbound chain
equals the other peer’s inbound chain (mirrors HeaderProtector::derive).
Sourcepub fn outbound_cid(&self, i: u64) -> [u8; 8]
pub fn outbound_cid(&self, i: u64) -> [u8; 8]
The CID this peer stamps on its outbound envelope at migration index i.
Sourcepub fn inbound_cid(&self, i: u64) -> [u8; 8]
pub fn inbound_cid(&self, i: u64) -> [u8; 8]
The CID this peer routes an inbound envelope on at migration index i.
Sourcepub fn inbound_window(
&self,
highest_seen: u64,
trailing: u64,
leading: u64,
) -> impl Iterator<Item = (u64, [u8; 8])> + '_
pub fn inbound_window( &self, highest_seen: u64, trailing: u64, leading: u64, ) -> impl Iterator<Item = (u64, [u8; 8])> + '_
The inbound demux window [highest_seen − trailing, highest_seen + leading] (saturating at index 0), each index paired with the CID it
routes on. Pure — the stateful slide lives in the demux (P4).