pub struct SessionBuilder { /* private fields */ }Expand description
Opt-in configuration for a fresh Session. Constructed via
Session::builder; finalized via SessionBuilder::build.
Defaults reproduce Session::new: random source_id + epoch,
DEFAULT_REKEY_GRACE grace, 64-slot replay window, and
consent_required = false (→ crate::consent::ConsentState::LegacyBypass
when the consent feature is on).
Implementations§
Source§impl SessionBuilder
impl SessionBuilder
Sourcepub fn with_source_id(self, source_id: [u8; 8], epoch: u8) -> Self
pub fn with_source_id(self, source_id: [u8; 8], epoch: u8) -> Self
Pin the source_id + epoch for deterministic test fixtures.
Normal callers SHOULD omit this and let the builder randomize.
Sourcepub fn with_rekey_grace(self, grace: Duration) -> Self
pub fn with_rekey_grace(self, grace: Duration) -> Self
Override the previous-key grace duration. See
DEFAULT_REKEY_GRACE.
Sourcepub fn require_consent(self, require: bool) -> Self
Available on crate feature consent only.
pub fn require_consent(self, require: bool) -> Self
consent only.Require the consent ceremony to complete before application
FRAME / INPUT / FRAME_LZ4 payloads are accepted.
require = false(default): initial state isLegacyBypass; consent is handled out-of-band by the application.require = true: initial state isAwaitingRequest; application payloads are blocked until aConsentRequest+ approvingConsentResponsetransition the session toApproved.
Only available with the consent feature.
Sourcepub fn with_replay_window_bits(self, bits: u32) -> Self
pub fn with_replay_window_bits(self, bits: u32) -> Self
Override the per-stream replay window size in bits. Must be a multiple of 64; valid values are 64 (default), 128, 256, 512, 1024.
Memory cost per (source_id, pld_type, key_epoch) stream is
bits / 8 bytes of bitmap plus a small constant. 1024-slot
windows cost 128 bytes per stream.
Panics at build() time if the value is out of range.