Skip to main content

Key Refresh

Update the client's and server's secret shares without altering the wallet's public address or key.

Step 1 : Create Session


Step 2 : Perform Key-Refresh


  • Call duoSession.refresh() with the keyId of the wallet to refresh. It returns Result of Success with the refreshed keyshare ByteArray or Failure with exception. The refreshed share is also persisted to your StorageClient under the same keyId.

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()
}
}
  • keyId addresses 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 Success with the refreshed keyshare ByteArray (also persisted to your StorageClient under the same keyId) or Failure with Exception
  • 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.