Class Scheme
- Namespace
- SodotSDK
- Assembly
- Unity.Temp.dll
Base scheme class that provides core functionality for distributed cryptographic operations. This class serves as the foundation for creating cryptographic rooms and initializing key generation. Inherits from MonoBehaviour to integrate with Unity's component system.
public class Scheme : MonoBehaviour
- Inheritance
-
MonoBehaviourScheme
- Derived
- Inherited Members
Fields
hostUrl
The host URL for the Sodot relay server used for distributed operations.
protected string hostUrl
Field Value
Methods
CreateRoom(ushort, string)
Creates a room for the given number of parties. A room is a one time instance used to perform a single MPC operation(keygen/signing/refresh etc.) between parties. This function should be called in the backend so to not embed the API key in code that is distributed to the users. After the backend calls this function, the other parties can join the room by calling the relevant keygen/signing/refresh/etc. operation.
public Task<Uuid> CreateRoom(ushort numParties, string apiKey)
Parameters
numPartiesushortThe number of parties that will participate in the room.
apiKeystringThe API key for authentication with the Sodot relay server.
Returns
Exceptions
- SodotException
Thrown when room creation fails due to invalid parameters or server errors.
InitKeygen()
All parties must call this function before calling keygen. All parties receive an (KeygenId, KeygenSecret) as an output from this function. The keygenId must be sent through an authenticated communication channel to all other devices we wish to perform keygen with. Once we have the keygenId-s of all parties, then keygen can be called with the same KeygenSecret as was given here.
public (KeygenId, KeygenSecret) InitKeygen()
Returns
- (KeygenId, KeygenSecret)
A tuple containing:
- KeygenId: A unique identifier for this participant in the keygen process
- KeygenSecret: The private key data for this participant
Exceptions
- SodotException
Thrown when keygen initialization fails due to cryptographic errors or system issues. The exception will have error code CsBindgen.NativeMethods.SODOT_INVALID_KEYGEN_INIT_KEYPAIR_ERR.
Initialize(string)
Initializes the scheme with the specified host URL. This must be called before performing any cryptographic operations.
public void Initialize(string hostUrl)
Parameters
hostUrlstringThe URL of the Sodot relay server (e.g., "us1-test.sodot.dev").