Пример #1
0
        public async Task RetrieveLatestBackup()
        {
            var seed = "00000000000000000000000000000000";

            SetupDirectoriesAndReturnPath(seed);
            await EdgeClient.CreateBackupAsync(EdgeContext, seed);

            var result = await EdgeClient.RetrieveBackupAsync(EdgeContext, seed);

            Assert.NotEmpty(result);
            Assert.IsType <Attachment>(result.First());
        }
Пример #2
0
        public async Task RestoreAgentFromBackup()
        {
            var seed  = "00000000000000000000000000000000";
            var path  = SetupDirectoriesAndReturnPath(seed);
            var myDid = await Did.CreateAndStoreMyDidAsync(EdgeContext.Wallet, "{}");

            await EdgeClient.CreateBackupAsync(EdgeContext, seed);

            // Create a DID that we will retrieve and compare from imported wallet

            var attachments = await EdgeClient.RetrieveBackupAsync(EdgeContext, seed);

            await EdgeClient.RestoreFromBackupAsync(EdgeContext, seed, attachments);

            var newWallet = await WalletService.GetWalletAsync(AgentOptions.WalletConfiguration, AgentOptions.WalletCredentials);

            var myKey = await Did.KeyForLocalDidAsync(newWallet, myDid.Did);

            Assert.Equal(myKey, myDid.VerKey);
        }