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.keyRefresh() which returns Result of Success with Refreshed-Keyshare bytes as Data or Failure with error.

Example


Example.swift
    func performKeyRefresh(keyshare: Data, duoSession: DuoSession) async -> Data?
{
let result = await duoSession.keyRefresh(
keyshare: keyshare
)
// returns nil if operation fails or other flow you might have
switch result {
case .success(let dataBytes):
do {
// do something with bytes
Swift.print(dataBytes)
return dataBytes
}
case .failure(let error):
do {
// show error to user or abort process
Swift.print(error)
return nil
}
}
}
  • keyshare is the client's "share" of the MPC wallet.
  • duoSession.keyRefresh() performs message exchange between mobile and server to "refresh" the MPC wallet. Refer to Key Refresh for more details.
  • Result of duoSession.keyRefresh() could be a Success with bytes as Data (client's new share of the MPC wallet) or Failure with error
  • 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.