Keygen
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;
Future<sdk.DklsKeyshare> keygen(sdk.EcdsaSession session) async {
final sdk.DklsKeyshare keyshare = await session.keygen();
print('Keyshare created, public key: ${keyshare.publicKeyHex}');
return keyshare;
}
main.dart
import 'package:silent_shard_sdk/silent_shard_sdk.dart' as sdk;
Future<void> keygen(sdk.EddsaSession session) async {
final sdk.SchnorrKeyshare keyshare = await session.keygen();
print('Keyshare created, public key: ${keyshare.publicKeyHex}');
}
- When
session.keygen()is called, the app and the server exchange messages to generate a new MPC wallet. - Two new DklsKeyshare are generated: one for the client and one for the server. Both shares together form the MPC wallet.
- The
keyshare.publicKeyHexproperty is the public key of the MPC wallet in hex format.