Key Recovery
Restore the client's secret shares to regain access to the wallet without changing its public address or key.
Step 1 : Create Session
- Create TrioSession if you haven't already.
Step 2 : Perform Key-Refresh
- We need to have key-share's public key to recover the share.
- Call trioSession.recovery() which returns Result of Success with Refreshed-Keyshare
ByteArrayor Failure with exception.
Example
- ECDSA
- EdDSA
Example.kt
suspend fun performKeyRecovery(trioSession: TrioSession): ByteArray {
return withContext(Dispatchers.IO) {
//At some point of time you might have done keygen.
val keyshare = trioSession.keygen().getOrThrow()
//You might have stored public-key of the keyshare(ECDSA).
val keysharePublicKey = SilentShard.ECDSA.getKeysharePublicKey<ByteArray>(keyshare).getOrThrow()
// Perform recovery operation
val recoveredKeyshare = trioSession.recovery(keysharePublicKey = keysharePublicKey).getOrThrow()
recoveredKeyshare
}
}
Example.kt
suspend fun performKeyRecovery(trioSession: TrioSession): ByteArray {
return withContext(Dispatchers.IO) {
//At some point of time you might have done keygen.
val keyshare = trioSession.keygen().getOrThrow()
//You might have stored public-key of the keyshare(EdDSA).
val keysharePublicKey = SilentShard.EdDSA.getKeysharePublicKey<ByteArray>(keyshare).getOrThrow()
// Perform recovery operation
val recoveredKeyshare = trioSession.recovery(keysharePublicKey = keysharePublicKey).getOrThrow()
recoveredKeyshare
}
}
- trioSession.recovery() performs message exchange between mobile and server to "recover" the MPC wallet. Refer to Key Recovery for more details.
- Result of trioSession.recovery() could be a
SuccesswithByteArray(client's recovered share of the MPC wallet) orFailurewithException - 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.