pub struct SFrameSession { /* private fields */ }Expand description
An SFrame session bound to one MLS epoch.
A new session must be created whenever the MLS group commits (epoch changes) — the old base key becomes unreachable and all per-sender keys are rotated automatically.
Implementations§
Source§impl SFrameSession
impl SFrameSession
Sourcepub fn new(base_key: [u8; 32], epoch: u64, suite: CipherSuite) -> Self
pub fn new(base_key: [u8; 32], epoch: u64, suite: CipherSuite) -> Self
Creates a session from a raw 32-byte base key.
Prefer from_mls when an MlsContext is
available; this constructor is mainly for testing.
Sourcepub fn from_mls(
mls: &MlsContext,
label: &str,
suite: CipherSuite,
) -> Result<Self, SFrameError>
pub fn from_mls( mls: &MlsContext, label: &str, suite: CipherSuite, ) -> Result<Self, SFrameError>
Derives a session from the current MLS group state.
Calls MLS.ExportSecret(label, context=epoch_be8, length=32) to
obtain the base key, then stores it alongside the current epoch and
ciphersuite.
label is application-defined (e.g. "gbp/sframe v1").
Sourcepub fn suite(&self) -> CipherSuite
pub fn suite(&self) -> CipherSuite
Returns the active ciphersuite.
Sourcepub fn encryptor(&self, leaf_index: u32) -> SFrameEncryptor
pub fn encryptor(&self, leaf_index: u32) -> SFrameEncryptor
Creates a sender-side encryptor for leaf_index.
The returned SFrameEncryptor owns the derived key+salt for this
sender and maintains an internal counter. Create one per sender; do
not share an encryptor across multiple goroutines/threads.
Sourcepub fn decryptor(&self) -> SFrameDecryptor
pub fn decryptor(&self) -> SFrameDecryptor
Creates a receiver-side decryptor for this epoch.
The SFrameDecryptor lazily derives per-sender keys as new KIDs
arrive, and maintains an independent 1024-entry replay window per sender.
Auto Trait Implementations§
impl Freeze for SFrameSession
impl RefUnwindSafe for SFrameSession
impl Send for SFrameSession
impl Sync for SFrameSession
impl Unpin for SFrameSession
impl UnsafeUnpin for SFrameSession
impl UnwindSafe for SFrameSession
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
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more