Beispiel #1
0
 public async Task <RestoreResult> RestoreAsync(Backup backup)
 {
     return(new RestoreResult
     {
         AddedAuthenticatorCount = await _authenticatorService.AddManyAsync(backup.Authenticators),
         AddedCategoryCount = await _categoryService.AddManyAsync(backup.Categories),
         AddedAuthenticatorCategoryCount =
             await _authenticatorCategoryService.AddManyAsync(backup.AuthenticatorCategories),
         AddedCustomIconCount = await _customIconService.AddManyAsync(backup.CustomIcons)
     });
 }
Beispiel #2
0
        public Task <int> ParseOtpMigrationUri(string uri)
        {
            var migration      = OtpAuthMigration.FromOtpAuthMigrationUri(uri);
            var authenticators = new List <Authenticator>();

            foreach (var item in migration.Authenticators)
            {
                Authenticator auth;

                try
                {
                    auth = Authenticator.FromOtpAuthMigrationAuthenticator(item, _iconResolver);
                }
                catch (ArgumentException)
                {
                    continue;
                }

                authenticators.Add(auth);
            }

            return(_authenticatorService.AddManyAsync(authenticators));
        }