private async Task LogOutAsync(bool expired) { var userId = await _userService.GetUserIdAsync(); await Task.WhenAll( _syncService.SetLastSyncAsync(DateTime.MinValue), _tokenService.ClearTokenAsync(), _cryptoService.ClearKeysAsync(), _userService.ClearAsync(), _settingsService.ClearAsync(userId), _cipherService.ClearAsync(userId), _folderService.ClearAsync(userId), _collectionService.ClearAsync(userId), _passwordGenerationService.ClearAsync(), _lockService.ClearAsync(), _stateService.PurgeAsync()); _lockService.PinLocked = false; _lockService.FingerprintLocked = true; _searchService.ClearIndex(); _authService.LogOut(() => { Current.MainPage = new HomePage(); }); }
public async Task SignOut() { // Based on: // bitwarden-mobile\src\App\App.xaml.cs#LogOutAsync var userId = await _userService.GetUserIdAsync(); await Task.WhenAll( _syncService.SetLastSyncAsync(DateTime.MinValue), _tokenService.ClearTokenAsync(), _cryptoService.ClearKeysAsync(), _userService.ClearAsync(), _settingsService.ClearAsync(userId), _cipherService.ClearAsync(userId), _folderService.ClearAsync(userId), _collectionService.ClearAsync(userId), _passwordGenerationService.ClearAsync(), _lockService.ClearAsync(), _stateService.PurgeAsync()); _lockService.FingerprintLocked = true; _searchService.ClearIndex(); //_authService.LogOut(() => //{ // Current.MainPage = new HomePage(); // if (expired) // { // _platformUtilsService.ShowToast("warning", null, AppResources.LoginExpired); // } //}); }
private async Task LogOutAsync(bool expired) { var userId = await _userService.GetUserIdAsync(); await Task.WhenAll( _syncService.SetLastSyncAsync(DateTime.MinValue), _tokenService.ClearTokenAsync(), _cryptoService.ClearKeysAsync(), _userService.ClearAsync(), _settingsService.ClearAsync(userId), _cipherService.ClearAsync(userId), _folderService.ClearAsync(userId), _collectionService.ClearAsync(userId), _passwordGenerationService.ClearAsync(), _lockService.ClearAsync(), _stateService.PurgeAsync(), _cozyClientService.LogoutAsync()); _lockService.FingerprintLocked = true; _searchService.ClearIndex(); _authService.LogOut(() => { Current.MainPage = new HomePage(); if (expired) { _platformUtilsService.ShowToast("warning", null, AppResources.LoginExpired); } }); }
public async Task UpdatePinAsync() { _pin = !_pin; if (_pin) { var pin = await _deviceActionService.DisplayPromptAync(AppResources.EnterPIN, AppResources.SetPINDescription, null, AppResources.Submit, AppResources.Cancel, true); if (!string.IsNullOrWhiteSpace(pin)) { var masterPassOnRestart = await _platformUtilsService.ShowDialogAsync( AppResources.PINRequireMasterPasswordRestart, AppResources.UnlockWithPIN, AppResources.Yes, AppResources.No); var kdf = await _userService.GetKdfAsync(); var kdfIterations = await _userService.GetKdfIterationsAsync(); var email = await _userService.GetEmailAsync(); var pinKey = await _cryptoService.MakePinKeyAysnc(pin, email, kdf.GetValueOrDefault(Core.Enums.KdfType.PBKDF2_SHA256), kdfIterations.GetValueOrDefault(5000)); var key = await _cryptoService.GetKeyAsync(); var pinProtectedKey = await _cryptoService.EncryptAsync(key.Key, pinKey); if (masterPassOnRestart) { var encPin = await _cryptoService.EncryptAsync(pin); await _storageService.SaveAsync(Constants.ProtectedPin, encPin.EncryptedString); _lockService.PinProtectedKey = pinProtectedKey; } else { await _storageService.SaveAsync(Constants.PinProtectedKey, pinProtectedKey.EncryptedString); } } else { _pin = false; } } if (!_pin) { await _cryptoService.ClearPinProtectedKeyAsync(); await _lockService.ClearAsync(); } BuildList(); }