Module 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-friendly String label for the group.
  • parameters: Parameters for key generation and signing.

Create a new group; the client that calls this method automatically joins the group.

Returns the UUID for the group.

§Group.join

  • group_id: The String UUID for the group.

Register the calling client as a member of the group.

Returns the group object.

§Session.create

  • group_id: The String UUID for the group.
  • kind: The String kind of session (either keygen or sign).

Create a new session.

Returns the session object.

§Session.join

  • group_id: The String UUID for the group.
  • session_id: The String UUID for the session.
  • kind: The String kind of session (either keygen or sign).

Join an existing session.

Returns the session object.

§Session.signup

  • group_id: The String UUID for the group.
  • session_id: The String UUID for the session.
  • kind: The String kind of session (either keygen or sign).

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: The String UUID for the group.
  • session_id: The String UUID for the session.
  • kind: The String kind of session (must be keygen).
  • number: The u16 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.participant

  • group_id: The String UUID for the group.
  • session_id: The String UUID for the session.
  • index: The u16 party index.
  • number: The u16 party signup number.

Provide a mapping between receiver indices for a signing session so that the server can locate the connection identifier when relaying peer to peer messages.

When signing clients must provide an array of the indices used during DKG, the party index is the index (plus one) of each client’s local key index in that array. This is the value that the server sees as the receiver when relaying peer to peer messages but the server has no knowledge of this index so client’s must register a mapping from the party index to the server-issued party number so that the correct connection id can be resolved.

Returns an empty response to the caller.

§Session.message

  • group_id: The String UUID for the group.
  • session_id: The String UUID for the session.
  • kind: The String kind of session (either keygen or sign).
  • 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 for a keygen session or the party index for a signing session.

This method is a notification and does not return anything to the caller.

§Session.finish

  • group_id: The String UUID for the group.
  • session_id: The String UUID for the session.
  • number: The u16 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.

Structs§

ServiceHandler
Service for replying to client requests.

Enums§

ServiceError
Error thrown by the JSON-RPC services.

Constants§

CLOSE_CONNECTION
Error data indicating the connection should be closed.
GROUP_CREATE
Method to create a group.
GROUP_JOIN
Method to join a group.
SESSION_CLOSED_EVENT
Notification sent when a session has been marked as finished by all participating clients.
SESSION_CREATE
Method to create a session.
SESSION_CREATE_EVENT
Notification sent when a session has been created.
SESSION_FINISH
Method to indicate a session is finished.
SESSION_JOIN
Method to join a session.
SESSION_LOAD
Method to load a party number into a session.
SESSION_LOAD_EVENT
Notification sent when all parties have loaded a party signup number into a session.
SESSION_MESSAGE
Method to broadcast or relay a message peer to peer.
SESSION_MESSAGE_EVENT
Notification sent to clients with broadcast or peer to peer messages.
SESSION_PARTICIPANT
Register a participant lookup for a signing session.
SESSION_SIGNUP
Method to signup a session.
SESSION_SIGNUP_EVENT
Notification sent when all expected parties have signed up to a session.