Skip to main content

Session

Struct Session 

Source
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§

Source§

impl Session

Source

pub fn create(params: &SessionParams) -> Result<Self>

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

Source

pub fn scheme_name(&self) -> &str

Source

pub fn scheme_kind(&self) -> TcSchemeKind

Source

pub fn threshold(&self) -> u32

Source

pub fn this_party_idx(&self) -> usize

Source

pub fn party_count(&self) -> usize

Source

pub fn round(&self) -> u8

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

Source

pub fn is_complete(&self) -> bool

Source

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

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.

Source

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

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

Source

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

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.

Source

pub fn destroy(&mut self)

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

Trait Implementations§

Source§

impl Debug for Session

Source§

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

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
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.

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.