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
impl Session
Sourcepub fn create(params: &SessionParams) -> Result<Self>
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.
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
Sourcepub fn round(&self) -> u8
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
Sourcepub fn round_step(&mut self, incoming: &[Message]) -> Result<RoundResult>
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.
Sourcepub fn result(&self) -> Result<Vec<u8>>
pub fn result(&self) -> Result<Vec<u8>>
Read the final cryptographic artifact. Errors until a round has signaled completion.
Sourcepub fn dkg_public_key(&self) -> Result<Vec<u8>>
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.