public override void ViewDidLoad() { _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _userService = ServiceContainer.Resolve <IUserService>("userService"); _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _secureStorageService = ServiceContainer.Resolve <IStorageService>("secureStorageService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _pinSet = _vaultTimeoutService.IsPinLockSetAsync().GetAwaiter().GetResult(); _pinLock = (_pinSet.Item1 && _vaultTimeoutService.PinProtectedKey != null) || _pinSet.Item2; _biometricLock = _vaultTimeoutService.IsBiometricLockSetAsync().GetAwaiter().GetResult() && _cryptoService.HasKeyAsync().GetAwaiter().GetResult(); _biometricIntegrityValid = _biometricService.ValidateIntegrityAsync(BiometricIntegrityKey).GetAwaiter() .GetResult(); BaseNavItem.Title = _pinLock ? AppResources.VerifyPIN : AppResources.VerifyMasterPassword; BaseCancelButton.Title = AppResources.Cancel; BaseSubmitButton.Title = AppResources.Submit; var descriptor = UIFontDescriptor.PreferredBody; MasterPasswordCell.Label.Text = _pinLock ? AppResources.PIN : AppResources.MasterPassword; MasterPasswordCell.TextField.SecureTextEntry = true; MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go; MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) => { CheckPasswordAsync().GetAwaiter().GetResult(); return(true); }; if (_pinLock) { MasterPasswordCell.TextField.KeyboardType = UIKeyboardType.NumberPad; } TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 70; TableView.Source = new TableSource(this); TableView.AllowsSelection = true; base.ViewDidLoad(); if (_biometricLock) { if (!_biometricIntegrityValid) { return; } var tasks = Task.Run(async() => { await Task.Delay(500); NSRunLoop.Main.BeginInvokeOnMainThread(async() => await PromptBiometricAsync()); }); } }
protected override void OnAppearing() { base.OnAppearing(); biometricsService = DependencyService.Resolve <IBiometricService>(); if (biometricsService != null) { BiometricButton.Text = biometricsService.BiometricCheck(); } }
public SettingsPageViewModel() { _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _userService = ServiceContainer.Resolve <IUserService>("userService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _syncService = ServiceContainer.Resolve <ISyncService>("syncService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); GroupedItems = new ExtendedObservableCollection <SettingsPageListGroup>(); PageTitle = AppResources.Settings; }
async void Handle_FaceAuth(object sender, System.EventArgs e) { if (biometricsService == null) { biometricsService = DependencyService.Resolve <IBiometricService>(); } if (biometricsService != null) { if (await biometricsService.AuthenticateMe()) { //await this.Navigation.PushAsync(new RateMePage()); Application.Current.MainPage = new MasterDetail(); } } }
public LockPageViewModel() { _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _userService = ServiceContainer.Resolve <IUserService>("userService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _secureStorageService = ServiceContainer.Resolve <IStorageService>("secureStorageService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); PageTitle = AppResources.VerifyMasterPassword; TogglePasswordCommand = new Command(TogglePassword); SubmitCommand = new Command(async() => await SubmitAsync()); }
public SettingsPageViewModel() { _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _syncService = ServiceContainer.Resolve <ISyncService>("syncService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _policyService = ServiceContainer.Resolve <IPolicyService>("policyService"); _localizeService = ServiceContainer.Resolve <ILocalizeService>("localizeService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _clipboardService = ServiceContainer.Resolve <IClipboardService>("clipboardService"); GroupedItems = new ObservableRangeCollection <ISettingsPageListItem>(); PageTitle = AppResources.Settings; }
public SettingsPageViewModel() { _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _syncService = ServiceContainer.Resolve <ISyncService>("syncService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _policyService = ServiceContainer.Resolve <IPolicyService>("policyService"); _localizeService = ServiceContainer.Resolve <ILocalizeService>("localizeService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _clipboardService = ServiceContainer.Resolve <IClipboardService>("clipboardService"); _loggerService = ServiceContainer.Resolve <ILogger>("logger"); GroupedItems = new ObservableRangeCollection <ISettingsPageListItem>(); PageTitle = AppResources.Settings; ExecuteSettingItemCommand = new AsyncCommand <SettingsPageListItem>(item => item.ExecuteAsync(), onException: _loggerService.Exception, allowsMultipleExecutions: false); }
public LockPageViewModel() { _apiService = ServiceContainer.Resolve <IApiService>("apiService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _environmentService = ServiceContainer.Resolve <IEnvironmentService>("environmentService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _logger = ServiceContainer.Resolve <ILogger>("logger"); PageTitle = AppResources.VerifyMasterPassword; TogglePasswordCommand = new Command(TogglePassword); SubmitCommand = new Command(async() => await SubmitAsync()); AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger) { AllowAddAccountRow = true, AllowActiveAccountSelection = true }; }
public override async void ViewDidLoad() { _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _stateService = ServiceContainer.Resolve <IStateService>("stateService"); _secureStorageService = ServiceContainer.Resolve <IStorageService>("secureStorageService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _accountManager = ServiceContainer.Resolve <IAccountsManager>("accountsManager"); // We re-use the lock screen for autofill extension to verify master password // when trying to access protected items. if (autofillExtension && await _stateService.GetPasswordRepromptAutofillAsync()) { _passwordReprompt = true; _isPinProtected = false; _isPinProtectedWithKey = false; _pinLock = false; _biometricLock = false; } else { (_isPinProtected, _isPinProtectedWithKey) = await _vaultTimeoutService.IsPinLockSetAsync(); _pinLock = (_isPinProtected && await _stateService.GetPinProtectedKeyAsync() != null) || _isPinProtectedWithKey; _biometricLock = await _vaultTimeoutService.IsBiometricLockSetAsync() && await _cryptoService.HasKeyAsync(); _biometricIntegrityValid = await _biometricService.ValidateIntegrityAsync(BiometricIntegrityKey); _usesKeyConnector = await _keyConnectorService.GetUsesKeyConnector(); _biometricUnlockOnly = _usesKeyConnector && _biometricLock && !_pinLock; } if (_pinLock) { BaseNavItem.Title = AppResources.VerifyPIN; } else if (_usesKeyConnector) { BaseNavItem.Title = AppResources.UnlockVault; } else { BaseNavItem.Title = AppResources.VerifyMasterPassword; } BaseCancelButton.Title = AppResources.Cancel; if (_biometricUnlockOnly) { BaseSubmitButton.Title = null; BaseSubmitButton.Enabled = false; } else { BaseSubmitButton.Title = AppResources.Submit; } var descriptor = UIFontDescriptor.PreferredBody; if (!_biometricUnlockOnly) { MasterPasswordCell.Label.Text = _pinLock ? AppResources.PIN : AppResources.MasterPassword; MasterPasswordCell.TextField.SecureTextEntry = true; MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go; MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) => { CheckPasswordAsync().GetAwaiter().GetResult(); return(true); }; if (_pinLock) { MasterPasswordCell.TextField.KeyboardType = UIKeyboardType.NumberPad; } MasterPasswordCell.Button.TitleLabel.Font = UIFont.FromName("bwi-font", 28f); MasterPasswordCell.Button.SetTitle(BitwardenIcons.Eye, UIControlState.Normal); MasterPasswordCell.Button.TouchUpInside += (sender, e) => { MasterPasswordCell.TextField.SecureTextEntry = !MasterPasswordCell.TextField.SecureTextEntry; MasterPasswordCell.Button.SetTitle(MasterPasswordCell.TextField.SecureTextEntry ? BitwardenIcons.Eye : BitwardenIcons.EyeSlash, UIControlState.Normal); }; } if (TableView != null) { TableView.BackgroundColor = ThemeHelpers.BackgroundColor; TableView.SeparatorColor = ThemeHelpers.SeparatorColor; TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 70; TableView.Source = new TableSource(this); TableView.AllowsSelection = true; } base.ViewDidLoad(); if (_biometricLock) { if (!_biometricIntegrityValid) { return; } var tasks = Task.Run(async() => { await Task.Delay(500); NSRunLoop.Main.BeginInvokeOnMainThread(async() => await PromptBiometricAsync()); }); } }
public override async void ViewDidLoad() { _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _cryptoService = ServiceContainer.Resolve <ICryptoService>("cryptoService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _userService = ServiceContainer.Resolve <IUserService>("userService"); _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _secureStorageService = ServiceContainer.Resolve <IStorageService>("secureStorageService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _biometricService = ServiceContainer.Resolve <IBiometricService>("biometricService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); // We re-use the lock screen for autofill extension to verify master password // when trying to access protected items. if (autofillExtension && await _storageService.GetAsync <bool>(Bit.Core.Constants.PasswordRepromptAutofillKey)) { _passwordReprompt = true; _pinSet = Tuple.Create(false, false); _pinLock = false; _biometricLock = false; } else { _pinSet = _vaultTimeoutService.IsPinLockSetAsync().GetAwaiter().GetResult(); _pinLock = (_pinSet.Item1 && _vaultTimeoutService.PinProtectedKey != null) || _pinSet.Item2; _biometricLock = _vaultTimeoutService.IsBiometricLockSetAsync().GetAwaiter().GetResult() && _cryptoService.HasKeyAsync().GetAwaiter().GetResult(); _biometricIntegrityValid = _biometricService.ValidateIntegrityAsync(BiometricIntegrityKey).GetAwaiter() .GetResult(); _usesKeyConnector = await _keyConnectorService.GetUsesKeyConnector(); _biometricUnlockOnly = _usesKeyConnector && _biometricLock && !_pinLock; } if (_pinLock) { BaseNavItem.Title = AppResources.VerifyPIN; } else if (_usesKeyConnector) { BaseNavItem.Title = AppResources.UnlockVault; } else { BaseNavItem.Title = AppResources.VerifyMasterPassword; } BaseCancelButton.Title = AppResources.Cancel; if (_biometricUnlockOnly) { BaseSubmitButton.Title = null; BaseSubmitButton.Enabled = false; } else { BaseSubmitButton.Title = AppResources.Submit; } var descriptor = UIFontDescriptor.PreferredBody; if (!_biometricUnlockOnly) { MasterPasswordCell.Label.Text = _pinLock ? AppResources.PIN : AppResources.MasterPassword; MasterPasswordCell.TextField.SecureTextEntry = true; MasterPasswordCell.TextField.ReturnKeyType = UIReturnKeyType.Go; MasterPasswordCell.TextField.ShouldReturn += (UITextField tf) => { CheckPasswordAsync().GetAwaiter().GetResult(); return(true); }; if (_pinLock) { MasterPasswordCell.TextField.KeyboardType = UIKeyboardType.NumberPad; } MasterPasswordCell.Button.TitleLabel.Font = UIFont.FromName("FontAwesome", 28f); MasterPasswordCell.Button.SetTitle("\uf06e", UIControlState.Normal); MasterPasswordCell.Button.TouchUpInside += (sender, e) => { MasterPasswordCell.TextField.SecureTextEntry = !MasterPasswordCell.TextField.SecureTextEntry; MasterPasswordCell.Button.SetTitle(MasterPasswordCell.TextField.SecureTextEntry ? "\uf06e" : "\uf070", UIControlState.Normal); }; } TableView.RowHeight = UITableView.AutomaticDimension; TableView.EstimatedRowHeight = 70; TableView.Source = new TableSource(this); TableView.AllowsSelection = true; base.ViewDidLoad(); if (_biometricLock) { if (!_biometricIntegrityValid) { return; } var tasks = Task.Run(async() => { await Task.Delay(500); NSRunLoop.Main.BeginInvokeOnMainThread(async() => await PromptBiometricAsync()); }); } }
public BiometricDataController(IBiometricService bio) { _BiometricService = bio; }