EcdsaSession class

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

Import

import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk;

Usage

final cloudClient = sdk.CloudClient(
  baseUri: nodeUri,
  isSecure: false,
  webSocketClient: SocketExtended(),
);
final sessionConfig = sdk.SessionConfig(
  cloudClient: cloudClient,
  cloudVerifyingKeyHex: cloudVerifyingKey,
  protocol: sdk.Protocol.duo // Or use sdk.Protocol.trio for trio
);

final session = sdk.EcdsaSession(sessionConfig);

Keygen

final keyshare = await session.keygen();

Key refresh

final keyRefresh = await session.refresh(keyshare);

Signature generation

final signature = await session.sign(keyshare: keyshare, messageHash: messageHash, derivationPath: 'm');

Constructors

EcdsaSession(EcdsaSessionConfig config)
Creates a new ECDSA Session. EcdsaSessionConfig config - The configuration for the session.
EcdsaSession.create({required CloudClient cloudClient, required String cloudVerifyingKeyHex, required StorageClientInterface<StorageKeyshare> storageClient, Protocol protocol = Protocol.duo, required DklsSigningKey signingKey})
Creates a new ECDSA Session. EcdsaSessionConfig config - The configuration for the session.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

export({required String keyId}) Future<String>
Exports a keyshare from the MPC to ECDSA private key. (Only trio)
finishPreSign({required Uint8List preSign, required String messageHash, String derivationPath = 'm'}) Future<Uint8List>
Finish sign using pre-sign
import({required String privateKey, String? rootChainCode}) Future<DklsKeyshare>
Import private key into MPC (client and server) keyshares
keygen() Future<DklsKeyshare>
Generates a new dkls.DklsKeyshare
keygenMigration({required LegacyKeyshare legacyKeyshare}) Future<DklsKeyshare>
Generates a new dkls.DklsKeyshare from a legacy keyshare
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preSign({required String keyId}) Future<Uint8List>
Compute pre sign with the ECDSA keyshare (only trio)
reconcile(String keyId) Future<void>
Reconcile the dkls.DklsKeyshare with the cloud to make sure it is up to date on all the parties.
recovery({required String publicKey}) Future<DklsKeyshare>
Recover keyshare with public key in hex (only trio)
refresh({required String keyId}) Future<DklsKeyshare>
Perform ECDSA keyrotation using dkls.DklsKeyshare to rotate the keyshare to a new one.
sign({required String keyId, required String messageHash, String derivationPath = "m"}) Future<Uint8List>
Signs a message hash with the ECDSA keyshare
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited