Skip to main content

Key Recovery

Please refer to the Session creation section to learn how to create a new session.

Full example:

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

Future<void> recovery(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();
print('Keyshare created, public key: ${keyshare.publicKeyHex}');

final recoveredKeyshare =
await session.recovery(publicKey: keyshare.publicKeyHex);
print('Recovered keyshare, public key: ${recoveredKeyshare.publicKeyHex}');
}
  • When session.recovery(keyshare_public_key) is called, the app and the server exchange message to "recover" the MPC wallet. Refer to Key Recovery for more details.
  • publicKeyHex is the public key of the client's share of the MPC wallet to be recovered.
  • This process enhances the long-term security of the MPC wallet by proactively updating the client's and server's secret shares.
  • The wallet's public address or key remains unchanged during this process.
  • The recoveredKeyshare object is of type DklsKeyshare and represents the client's new share of the MPC wallet.