private void CleanupOld(string key) { if (_oldKeyStorageService.Contains(key)) { _oldKeyStorageService.Delete(key); } var formattedKeyV1 = string.Format(SettingsFormatV1, key); if (_settings.Contains(formattedKeyV1)) { _settings.Remove(formattedKeyV1); } }
public void SetTwoFactorToken(string email, string token) { var emailEncoded = Convert.ToBase64String(Encoding.UTF8.GetBytes(email)); var key = string.Format(TwoFactorTokenKeyFormat, emailEncoded); if (token != null) { var tokenBytes = Encoding.UTF8.GetBytes(token); _secureStorage.Store(key, tokenBytes); } else { _secureStorage.Delete(key); } }