pub(crate) trait Scheme {
// Required methods
fn new(host_url: String) -> Self;
fn host_url(&self) -> &str;
// Provided methods
fn with_default_host() -> Self
where Self: Sized { ... }
fn init_keygen(&self) -> Result<(KeygenId, KeygenPrivateKey), SodotError> { ... }
fn create_room(
&self,
num_parties: NonZeroU16,
api_key: &str,
) -> impl Future<Output = Result<RoomUUID, SodotError>> { ... }
}Expand description
The core trait for implementing cryptographic schemes using threshold signatures.
The Scheme trait provides the foundational functionality for multi-party computation
protocols, including key generation initialization and room creation. Concrete
implementations of this trait will provide specific cryptographic schemes like
ECDSA, Ed25519, BIP340, and SR25519.
§Key Concepts
- Threshold Cryptography: Multiple parties collaborate to generate keys and sign messages
- MPC (Multi-Party Computation): Secure protocols that don’t require a trusted dealer
- Rooms: Communication channels that coordinate the MPC protocols between parties
- Host URL: The Sodot relay server that facilitates communication between parties
§Basic Workflow
- Initialize the scheme with a host URL
- Generate keygen initialization material using
init_keygen() - Create a room using
create_room() - Coordinate with other parties to perform MPC operations
This trait defines the common interface for all cryptographic schemes supported by the Sodot SDK. It provides methods for key generation initialization and room creation for multi-party computation operations.
Required Methods§
Provided Methods§
Sourcefn with_default_host() -> Selfwhere
Self: Sized,
fn with_default_host() -> Selfwhere
Self: Sized,
Creates a new scheme instance using the default production host URL.
Convenience method that creates an instance configured to use the default Sodot production relay server at “us1.sodot.dev”.
Sourcefn init_keygen(&self) -> Result<(KeygenId, KeygenPrivateKey), SodotError>
fn init_keygen(&self) -> Result<(KeygenId, KeygenPrivateKey), SodotError>
Initializes the key generation process by creating a keygen ID and private key.
Generates the initial cryptographic material needed to participate in multi-party key generation protocols. The keygen ID serves as a unique identifier for this party, while the keygen private key is used for authentication.
Sourcefn create_room(
&self,
num_parties: NonZeroU16,
api_key: &str,
) -> impl Future<Output = Result<RoomUUID, SodotError>>
fn create_room( &self, num_parties: NonZeroU16, api_key: &str, ) -> impl Future<Output = Result<RoomUUID, SodotError>>
Creates a room for coordinating multi-party computation protocols.
A room serves as a communication channel and session identifier for MPC operations. All parties participating in the same protocol must use the same room UUID. Typically, one party creates the room and shares the UUID with other participants.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.