createTrioSession

open fun createTrioSession(messageSigner: MessageSigner, cloudVerifyingKey: String, websocketConfig: WebsocketConfig, storageClient: StorageClient): TrioSession

Creates a TrioSession using the default SilentShard websocket implementation.

This is the recommended way to create a three-party session for most use cases. It handles all network communication through WebSocket protocol with the MPC server.

Important: You must provide your own MessageSigner implementation that integrates with your secure key storage (Keystore, Secure Enclave, HSM, etc.). See MessageSigner for platform-specific implementation examples.

Example with Android Keystore:

// Implement secure key provider
class AndroidKeystoreProvider : MessageSigner {
override val verifyingKey: ByteArray
get() = loadFromAndroidKeystore()

override val masterSigningKeyType = MasterSigningKeyType.ECDSA

override fun sign(data: ByteArray) = signWithKeystore(data)
}

// Create trio session
val session = SilentShard.ECDSA.createTrioSession(
keyProvider = AndroidKeystoreProvider(),
cloudVerifyingKey = "server_public_key_hex",
websocketConfig = WebsocketConfig(url = "wss://mpc.example.com"),
storageClient = myStorageImplementation
)

// Perform three-party operations
val keyshare = session.keygen().getOrThrow()

Return

TrioSession ready for performing three-party MPC operations

Parameters

messageSigner

Your secure implementation of MessageSigner. Must integrate with platform-specific secure storage. See MessageSigner for examples.

cloudVerifyingKey

The server's verifying key in hex format. Used to verify the server's identity.

websocketConfig

WebSocket configuration including endpoint URL.

storageClient

Storage implementation for persisting keyshares and reconciliation data.

See also

for secure key provider implementation examples

for available operations


open fun createTrioSession(messageSigner: MessageSigner, cloudVerifyingKey: String, storageClient: StorageClient, networkClient: NetworkClient, trioNetworkActionProvider: TrioNetworkActionProvider): TrioSession

Creates a TrioSession with custom network client and action provider.

Use this when you need custom network transport or want to implement your own communication protocol instead of the default WebSocket implementation.

Example with custom HTTP client:

class MyHttpClient : NetworkClient<MyHttpAction> {
override suspend fun send(action: MyHttpAction) {
// Custom HTTP implementation
}
}

class MyActionProvider : InitiatorTrioActionProvider<MyHttpAction> {
override fun createKeygenAction(tssType: String) = MyHttpAction("keygen")
// ...implement other action creators
}

val session = SilentShard.ECDSA.createTrioSession(
keyProvider = SecureKeyProvider(),
cloudVerifyingKey = serverVerifyingKey,
networkClient = MyHttpClient(),
storageClient = myStorageImplementation,
actionProvider = MyActionProvider()
)

Return

TrioSession ready for performing three-party MPC operations

Parameters

T

Type of network action (e.g., WebSocketAction, HttpAction)

messageSigner

Your secure MessageSigner implementation

cloudVerifyingKey

The server's verifying key in hex format

networkClient

Custom network client implementation

storageClient

Storage implementation for persisting data

trioNetworkActionProvider

Custom action provider for network actions


open fun createTrioSession(messageSigner: MessageSigner, cloudVerifyingKey: String, networkClient: SilentShardWebsocketClient<TrioNetworkAction>, storageClient: StorageClient): TrioSession