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 DuoSession if you haven't already.
Step 2 : Perform Key-Refresh
- Call duoSession.refresh() with the
keyIdof the wallet to refresh. It returns Result of Success with the refreshed keyshareByteArrayor Failure with exception. The refreshed share is also persisted to your StorageClient under the samekeyId.
Example
Example.kt
// refresh rotates both parties' shares for the key addressed by keyId, leaving
// the public key unchanged. The new share is persisted under the same keyId.
suspend fun performKeyRefresh(keyId: String, duoSession: DuoSession): ByteArray {
return withContext(Dispatchers.IO) {
duoSession.refresh(
keyId = keyId
).getOrThrow()
}
}
keyIdaddresses the wallet whose shares are refreshed (from keygen/import).- duoSession.refresh() performs message exchange between mobile and server to "refresh" the MPC wallet. Refer to Key Refresh for more details.
- Result of duoSession.refresh() could be a
Successwith the refreshed keyshareByteArray(also persisted to your StorageClient under the samekeyId) 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.