Skip to main content

EddsaSession

The EddsaSession class offers APIs that facilitate easy access to Multi-Party Computation (MPC) functionalities.

Import

import { EddsaSession } from '@silencelaboratories/silent-shard-sdk';

Extends

  • MpcSession

Constructors

new EddsaSession()

new EddsaSession(config): EddsaSession

Creates a new EdDSA Session

Parameters

config

ShardSession

The configuration for the session.

Returns

EddsaSession

Overrides

MpcSession.constructor

Properties

name

name: string

Inherited from

MpcSession.name


protocol

protocol: "duo" | "trio"

Inherited from

MpcSession.protocol

Methods

export()

export(config): Promise<string>

Export the EdDSA MPC keyshares into a private key (Hex format).

Parameters

config

EddsaExportConfig

The configuration for the key export.

Returns

Promise<string>

  • A Promise that resolves to a private key in (Hex format).

Warning

Key export breaks MPC security mode only uses it for migration or backup


import()

import(config, option?): Promise<Keyshare>

Import private key into MPC (client and server) keyshares and return client keyshare

Parameters

config

EddsaImportConfig

The configuration for the key import.

option?

DKGOption

Optional configuration for the Distributed Key Generation (DKG) process.

Returns

Promise<Keyshare>

  • A Promise that resolves to a new MPC client keyshare.

keygen()

keygen(option?): Promise<Keyshare>

Generates a new MPC EdDSA keyshare client and server. And returns the client keyshare.

Parameters

option?

DKGOption

Optional configuration for the Distributed Key Generation (DKG) process.

Returns

Promise<Keyshare>

A Promise that resolves to a client keyshare.


reconcile()

reconcile(keyId): Promise<Keyshare>

Reconciles the MPC ECDSA keyshares between mobile and server to ensure they are in sync.

Parameters

keyId

string

The ID of the key to reconcile.

Returns

Promise<Keyshare>

  • A Promise that resolves when the reconciliation is complete.

recovery()

recovery(keysharePublicKey, option?): Promise<Keyshare>

Recover the MPC keyshare with a public key only applicable for Trio protocol.

Parameters

keysharePublicKey

string

Public key in hex format of the existing keyshare to be recovered.

option?

DKGOption

Optional configuration for the Distributed Key Generation (DKG) process.

Returns

Promise<Keyshare>

  • A Promise that resolves to a recovered client keyshare.

refresh()

refresh(keyshare, option?): Promise<Keyshare>

Refreshes an existing MPC EdDSA keyshares in both client and server. And returns refresh client keyshare.

Parameters

keyshare

Keyshare

The existing client keyshare to be refreshed.

option?

DKGOption

Optional configuration for the Distributed Key Generation (DKG) process.

Returns

Promise<Keyshare>

  • A Promise that resolves to a refreshed client keyshare.

sign()

sign(config): Promise<string>

Generate a signature (r|s) with digest(sha256,transaction hex, ...) using the MPC EdDSA keyshares.

Parameters

config

EddsaSignConfig

The configuration for the signing.

Returns

Promise<string>

  • A Promise that resolves to a signature (Hex format).