Key Refresh
Update the client's and server's secret shares without altering the wallet's public address or key.
Step 1 : Create Session
- Create TrioSession if you haven't already.
Step 2 : Perform Key-Refresh
- Call trioSession.refresh() which returns Result of Success with Refreshed-Keyshare
ByteArrayor Failure with exception.
Example
Example.kt
// refresh rotates the keyshares of the key addressed by keyId without changing
// its public key. The refreshed share is persisted to your StorageClient under
// the same keyId; the refreshed keyshare bytes are also returned.
suspend fun performKeyRefresh(keyId: String, trioSession: TrioSession): ByteArray {
return withContext(Dispatchers.IO) {
trioSession.refresh(
keyId = keyId
).getOrThrow()
}
}
keyIdidentifies the key to refresh; it is returned by keygen and stays the same after the refresh.- trioSession.refresh() performs message exchange between mobile and server to "refresh" the MPC wallet. Refer to Key Refresh for more details.
- Result of trioSession.refresh() could be a
SuccesswithByteArray(client's new 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.