Module mpc_websocket::services
source · [−]Expand description
Services for handling JSON-RPC requests.
Some methods send notifications to connected clients, see the method’s documentation for more details.
Notifications sent to connected clients are sent as a tuple
of String
event name followed by an arbitrary JSON Value
payload for the event.
Methods
These are the JSON-RPC methods clients may call; some methods will broadcast events to connected clients, see the documentation for each method for more information.
Group.create
label
: Human-friendlyString
label for the group.parameters
: Parameters for key generation and signing.
Create a new group; the client that sends this method automatically joins the group.
Returns the UUID for the group.
Group.join
group_id
: TheString
UUID for the group.
Register the calling client as a member of the group.
Returns the group object.
Session.create
group_id
: TheString
UUID for the group.kind
: TheString
kind of session (eitherkeygen
orsign
).
Create a new session.
Returns the session object.
Session.join
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.kind
: TheString
kind of session (eitherkeygen
orsign
).
Join an existing session.
Returns the session object.
Session.signup
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.kind
: TheString
kind of session (eitherkeygen
orsign
).
Register as a co-operating party for a session.
When the required number of parties have signed up to a session a sessionSignup
event is emitted to all the clients in the session. For key generation there must be parties
clients in the session and for signing there must be threshold + 1
clients registered for the session.
Returns the party signup number.
Session.load
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.kind
: TheString
kind of session (must bekeygen
).number
: Theu16
party signup number.
Load a client into a given slot (party signup number). This is used to allow the party signup numbers allocated to saved key shares to be assigned and validated in the context of a session.
The given number
must be in range and must be an available slot.
When the required number of parties
have been allocated to a session a sessionLoad
event is emitted to all the clients in the session.
Returns the party signup number.
Session.message
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.kind
: TheString
kind of session (eitherkeygen
orsign
).message
: The message to broadcast or send peer to peer.
Relay a message to all the other peers in the session (broadcast) or send directly to another peer.
A message
is treated as peer to peer when the receiver
field is present which should be the party signup number
for the peer.
This method is a notification and does not return anything to the caller.
Session.finish
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.number
: Theu16
party signup number.
Indicate the session has been finished for the calling client.
When all the clients in a session have called this method the server will emit a sessionClosed
event to all the clients in the session.
This method is a notification and does not return anything to the caller.
Notify.proposal
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.proposal_id
: Unique identifier for the proposal.message
: The message to be signed.
Sends a signing proposal to all other clients in the group. The event emitted is notifyProposal
and the payload is an object with sessionId
, proposalId
and the message
to be signed.
This method is a notification and does not return anything to the caller.
Notify.signed
group_id
: TheString
UUID for the group.session_id
: TheString
UUID for the session.value
: Opaque value for the signing result sent to non-participants.
Sends a signing result to clients in the session that did not participate in the signing; the event name emitted is notifySigned
and the payload is the value
passed to this method.
Client implementations should ensure this method is only called once when signing is complete.
This method is a notification and does not return anything to the caller.
Structs
Service for replying to client requests.
Enums
Error thrown by the JSON-RPC services.
Constants
Error data indicating the connection should be closed.
Method to create a group.
Method to join a group.
Method to notify of a proposal for signing.
Notification sent when a proposal has been received.
Method to notify a proposal has been signed.
Notification sent when a proposal has been signed.
Notification sent when a session has been marked as finished by all participating clients.
Method to create a session.
Notification sent when a session has been created.
Method to indicate a session is finished.
Method to join a session.
Method to load a party number into a session.
Notification sent when all parties have loaded a party signup number into a session.
Method to broadcast or relay a message peer to peer.
Notification sent to clients with broadcast or peer to peer messages.
Method to signup a session.
Notification sent when all expected parties have signed up to a session.