aries-framework-dotnet
aries-framework-dotnet copied to clipboard
Procedure for Creating and Retrieving Backup of the Wallet
CreateBackupAsync and RetrieveBackupAsync(or RestorFromBackupAsync) in Hyperledger.Aries.Routing.IEdgeClientService
I have few questions regarding Wallet Backups:
-
Are these methods capable of creating and restoring wallet backups if I reinstall the application on different phone? Well I tried it myself, but as these methods have Context as an argument, which doesn't have an instance before the wallet is created. So, the backup was restored, but only in the case where app wasn't uninstalled. eg. I just deleted the credential and connection after creating the backup and restored it(using same seed), but didn't work if I uninstalled the app.
-
Does Mediator's Inbox(in .IndyClient folder ) contains a backup or copy of the wallet? If 'yes' than can we access that for restoring wallet?
-
Should I be looking into Hyperledger.Indy.WalletApi's ExportAsync & ImportAsync methods? As it seems to fix the problem of restoration of backups after reinstalling the application.
@naman20sharma,
Types of Backup
-
Cloud Backup: Stored with the Mediator Agent (
EdgeClientService.CreateBackupAsync
) -
File Backup: Exported to a file (
AgentContext.Wallet.ExportAsync
)
Steps to restore the backup
From Cloud Backup
- Get the backup using the seed (string) (
EdgeClientService.RetrieveBackupAsync
) - Restore the backup (
EdgeClientService.RestoreFromBackupAsync
)
From File Backup
- Create an attachment from the contents of the file (
Attachment.Data.Base64
) - Restore the backup (
EdgeClientService.RestoreFromBackupAsync
)
Below are the answers to your questions, with reference to Mobile Edge Agents
-
Are these methods capable of creating and restoring wallet backups if I reinstall the application on different phone? A. The backups can be restored on the same device or onto another device (iOS and Android). The same backup can be restored on multiple devices
-
Does Mediator's Inbox(in .IndyClient folder ) contains a backup or copy of the wallet? If 'yes' than can we access that for restoring wallet? A. Not sure about this. This needs to be explored further
-
Should I be looking into Hyperledger.Indy.WalletApi's ExportAsync & ImportAsync methods? A. Refer to the steps above to backup and restore a wallet onto the same or a different device
Hi @sahil-khanna thanks for your reply.
I've been using Aries .NET sdk for over a year now. I've tried using the apis mentioned above. But, my concern was that (EdgeClientService.RetrieveBackupAsync)
requires agentContext as an argument, and context is available post-provision (includes Creation) of the Wallet.
So, do we need to create a new wallet first and only then can we retrieve the backup stored with the mediator agent ?
If yes then attributes of the wallet like WalletCredentials.Key
and connection with the mediator-agent will be new. So, does this restoration of the wallet replaces these attributes and connectionID
(with the mediator) with the older one ?
Hi @sahil-khanna thanks for your reply. I've been using Aries .NET sdk for over a year now. I've tried using the apis mentioned above. But, my concern was that
(EdgeClientService.RetrieveBackupAsync)
requires agentContext as an argument, and context is available post-provision (includes Creation) of the Wallet. So, do we need to create a new wallet first and only then can we retrieve the backup stored with the mediator agent ? If yes then attributes of the wallet likeWalletCredentials.Key
and connection with the mediator-agent will be new. So, does this restoration of the wallet replaces these attributes andconnectionID
(with the mediator) with the older one ?
From what I have seen so far
- A wallet needs to be created before a backup can be restored.
- When the wallet is restored, the data of the existing wallet is cleared/replaced with the restored data
- Restoring the wallet will give the new
AgentOptions
. These need to be used henceforthAgentOptions agentOptions = await EdgeClientService.RestoreFromBackupAsync(AgentContext, seed)
Note: I haven't checked if the connectionId
of the MediatorAgent will change after restoration. However, I believe the connectionId
of the MediatorAgent will be of the restored (old) one.
Hi @sahil-khanna,
I try to use the RestoreFromBackupAsync function, but I have a problem.
I don't know what to do with the AgentOptions
: when i try to use it in _edgeProvisioningService.ProvisionAsync(agentOptions)
it return The wallet already exists
but the restore works.
Everything is alright until I restart my Wallet :
_agentContextProvider.GetContextAsync() return
Hyperledger.Indy.WalletApi.WalletNotFoundException: The wallet does not exist.
Even if I store the AgentOption
and try to ProvisionAsync
when the app start, it doesn't work : GetContextAsync
return the same Exception
Am I forgetting to do something?
Hi @sahil-khanna,
I try to use the RestoreFromBackupAsync function, but I have a problem. I don't know what to do with the
AgentOptions
: when i try to use it in_edgeProvisioningService.ProvisionAsync(agentOptions)
it returnThe wallet already exists
but the restore works.Everything is alright until I restart my Wallet : _agentContextProvider.GetContextAsync() return
Hyperledger.Indy.WalletApi.WalletNotFoundException: The wallet does not exist.
Even if I store the
AgentOption
and try toProvisionAsync
when the app start, it doesn't work :GetContextAsync
return the same ExceptionAm I forgetting to do something?
Hi @Acarcan, did you get any success ?