pub struct EnvelopeSession { /* private fields */ }Expand description
Session-local envelope state. Holds the envelope key (HKDF-derived from
the TransportKey), the per-session IV, the last-seen counter, and a
message budget. Consumed via &mut self so nonce reuse within a
session is structurally prevented.
Implementations§
Source§impl EnvelopeSession
impl EnvelopeSession
Sourcepub async fn new(
transport_key: &TransportKey,
session_id: String,
iv: [u8; 12],
) -> Result<Self, EnvelopeError>
pub async fn new( transport_key: &TransportKey, session_id: String, iv: [u8; 12], ) -> Result<Self, EnvelopeError>
Derive a fresh envelope session from a TransportKey.
Args:
transport_key: the session’s transport key fromcrate::sas::derive_transport_key.session_id: the pairing session id (part of every AAD).iv: per-session 96-bit IV. Produce viaOsRngat session start; transmit out-of-band to the peer.
Usage:
ⓘ
let session = EnvelopeSession::new(&transport_key, session_id, iv).await?;
let env = session.seal("/v1/pairing/sessions/x/response", pt).await?;Trait Implementations§
Source§impl Drop for EnvelopeSession
impl Drop for EnvelopeSession
Auto Trait Implementations§
impl Freeze for EnvelopeSession
impl RefUnwindSafe for EnvelopeSession
impl Send for EnvelopeSession
impl Sync for EnvelopeSession
impl Unpin for EnvelopeSession
impl UnsafeUnpin for EnvelopeSession
impl UnwindSafe for EnvelopeSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more