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.keyRefresh()
which returnsResult
ofSuccess
with Refreshed-Keyshare bytes asData
orFailure
witherror
.
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 aSuccess
with bytes asData
(client's new share of the MPC wallet) orFailure
witherror
- 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.