Sign
Please refer to the Session creation section to learn how to create a new session.
Full example
- ECDSA
- EdDSA
main.dart
import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk;
const messageHash = 'e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03';
Future<void> signGen(sdk.EcdsaSession session) async {
// Creating a new keyshare for demo purpose. In real application, you can use an existing keyshare.
final keyshare = await session.keygen();
final signature = await session.sign(
keyshare: keyshare,
messageHash: messageHash,
);
print('Signature: $signature');
}
main.dart
import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk;
const messageHash = 'e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03';
Future<void> signGen(sdk.EddsaSession session) async {
// Creating a new keyshare for demo purpose. In real application, you can use an existing keyshare.
final keyshare = await session.keygen();
final signature = await session.sign(
keyshare: keyshare,
messageHash: messageHash,
);
print('Signature: $signature');
}
- The
sign
method takes a EcdsaSignConfig(EdDsaSignConfig) object as an argument. keyshare
is the client's "share" of the MPC wallet.messageHash
is the hash of the message to be signed as a hex string.- When
session.sign()
is called, the app and the server exchange messages to generate an ECDSA(EdDSA) signature. signature
is the ECDSA(EdDSA) signature (hex string) ofmessageHash
, corresponding to the public key (or address) of the wallet.