Skip to main content

Session

Struct Session 

pub struct Session { /* private fields */ }
Expand description

One party’s view of one threshold protocol run.

Owns the SessionImpl produced by the scheme and the bookkeeping the framework needs to validate round calls.

Implementations§

§

impl Session

pub fn create(params: &SessionParams) -> Result<Session, Error>

Resolve params.scheme against the link-time registry and build a fresh session. Validates the roster + threshold + index before handing control to the scheme.

pub fn scheme_name(&self) -> &str

pub fn scheme_kind(&self) -> TcSchemeKind

pub fn threshold(&self) -> u32

pub fn this_party_idx(&self) -> usize

pub fn party_count(&self) -> usize

pub fn round(&self) -> u8

Current round number. Starts at 0 (no rounds run yet); after the first Session::round call it is 1.

pub fn is_complete(&self) -> bool

pub fn round_step(&mut self, incoming: &[Message]) -> Result<RoundResult, Error>

Step the session forward one round.

incoming is the set of Messages this party received since the last round (from all peers). Returns the messages this party needs to send next. Once a round returns complete == true, Session::result is ready and further round calls error.

pub fn result(&self) -> Result<Vec<u8>, Error>

Read the final cryptographic artifact. Errors until a round has signaled completion.

pub fn dkg_public_key(&self) -> Result<Vec<u8>, Error>

For DKG sessions: extract the per-party share and the shared public key the protocol produced. The default implementation delegates to SessionImpl::result for the public-key bytes and returns None for the share unless the scheme overrides this via its own protocol — the framework reads the share through the scheme plugin’s DKG-specific entry point in a later iteration.

For the skeleton this is a thin wrapper: result() yields the shared public key; the share is produced by the scheme and read back via the FFI cfm_tc_dkg_output_share entry point.

pub fn destroy(&mut self)

Release scheme-owned resources. After destroy the session must not be used again.

Trait Implementations§

§

impl Debug for Session

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V