Adds a backup, retrieve and restore functionality
Routing.Edge: IEdgeClient service has CreateBackup, RetrieveBackup, ListAllBackups, RestoreBackup methods
Routing.Mediator: IStorageService created with a default implementation service that stores the wallet locally on server and appropriate Store/Retrieve handlers for the messages
Deleting the old wallet when calling RestoreBackup
TEST PLAN: #
Run unit tests
Run agent from samples project, use the .RegisterMediatorAgent<>
Reference the Hyperledger edge to the EdgeConsoleClient project under /Samples
Get the EdgeClientService and call CreateBackup from Program.cs
Call Retrieve and then Restore the wallet with the returned Attachment
Note: #
In order to execute the retrieve-restore functionality from a brand new wallet you have to create a key using the previously used mnemonic phase and store it as a tag using the provisioning record and update the record using the walletRecordService
Something like this:
var generatedKey = await Crypto.CreateKeyAsync(context.Wallet, new {seed}.ToJson()); provRecord.SetTag("backup_key", generatedKey); await walletRecordService.UpdateAsync(context.Wallet, provRecord);
Signed-off-by: Dule Pop-Andov dule@codechem.com
Short description of what this resolves:
Adds a backup, retrieve and restore functionality Routing.Edge: IEdgeClient service has CreateBackup, RetrieveBackup, ListAllBackups, RestoreBackup methods Routing.Mediator: IStorageService created with a default implementation service that stores the wallet locally on server and appropriate Store/Retrieve handlers for the messages Deleting the old wallet when calling RestoreBackup
TEST PLAN: # Run unit tests
Run agent from samples project, use the .RegisterMediatorAgent<> Reference the Hyperledger edge to the EdgeConsoleClient project under /Samples Get the EdgeClientService and call CreateBackup from Program.cs Call Retrieve and then Restore the wallet with the returned Attachment
Note: # In order to execute the retrieve-restore functionality from a brand new wallet you have to create a key using the previously used mnemonic phase and store it as a tag using the provisioning record and update the record using the walletRecordService Something like this:
var generatedKey = await Crypto.CreateKeyAsync(context.Wallet, new {seed}.ToJson()); provRecord.SetTag("backup_key", generatedKey); await walletRecordService.UpdateAsync(context.Wallet, provRecord);