public SyncService( IUserService userService, IApiService apiService, ISettingsService settingsService, IFolderService folderService, ICipherService cipherService, ICryptoService cryptoService, ICollectionService collectionService, IStorageService storageService, IMessagingService messagingService, IPolicyService policyService, ISendService sendService, IKeyConnectorService keyConnectorService, Func <bool, Task> logoutCallbackAsync) { _userService = userService; _apiService = apiService; _settingsService = settingsService; _folderService = folderService; _cipherService = cipherService; _cryptoService = cryptoService; _collectionService = collectionService; _storageService = storageService; _messagingService = messagingService; _policyService = policyService; _sendService = sendService; _keyConnectorService = keyConnectorService; _logoutCallbackAsync = logoutCallbackAsync; }
public SyncService( IStateService stateService, IApiService apiService, ISettingsService settingsService, IFolderService folderService, ICipherService cipherService, ICryptoService cryptoService, ICollectionService collectionService, IOrganizationService organizationService, IMessagingService messagingService, IPolicyService policyService, ISendService sendService, IKeyConnectorService keyConnectorService, Func <Tuple <string, bool, bool>, Task> logoutCallbackAsync) { _stateService = stateService; _apiService = apiService; _settingsService = settingsService; _folderService = folderService; _cipherService = cipherService; _cryptoService = cryptoService; _collectionService = collectionService; _organizationService = organizationService; _messagingService = messagingService; _policyService = policyService; _sendService = sendService; _keyConnectorService = keyConnectorService; _logoutCallbackAsync = logoutCallbackAsync; }
public VaultTimeoutService( ICryptoService cryptoService, IStateService stateService, IPlatformUtilsService platformUtilsService, IFolderService folderService, ICipherService cipherService, ICollectionService collectionService, ISearchService searchService, IMessagingService messagingService, ITokenService tokenService, IPolicyService policyService, IKeyConnectorService keyConnectorService, Func <Tuple <string, bool>, Task> lockedCallback, Func <Tuple <string, bool, bool>, Task> loggedOutCallback) { _cryptoService = cryptoService; _stateService = stateService; _platformUtilsService = platformUtilsService; _folderService = folderService; _cipherService = cipherService; _collectionService = collectionService; _searchService = searchService; _messagingService = messagingService; _tokenService = tokenService; _policyService = policyService; _keyConnectorService = keyConnectorService; _lockedCallback = lockedCallback; _loggedOutCallback = loggedOutCallback; }
public TabsPage(AppOptions appOptions = null, PreviousPageInfo previousPage = null) { _broadcasterService = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService"); _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _groupingsPage = new NavigationPage(new GroupingsPage(true, previousPage: previousPage)) { Title = AppResources.MyVault, IconImageSource = "lock.png" }; Children.Add(_groupingsPage); _sendGroupingsPage = new NavigationPage(new SendGroupingsPage(true, null, null, appOptions)) { Title = AppResources.Send, IconImageSource = "send.png", }; Children.Add(_sendGroupingsPage); _generatorPage = new NavigationPage(new GeneratorPage(true, null, this)) { Title = AppResources.Generator, IconImageSource = "generate.png" }; Children.Add(_generatorPage); var settingsPage = new NavigationPage(new SettingsPage(this)) { Title = AppResources.Settings, IconImageSource = "cog_settings.png" }; Children.Add(settingsPage); if (Device.RuntimePlatform == Device.Android) { Effects.Add(new TabBarEffect()); Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetToolbarPlacement(this, Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom); Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSwipePagingEnabled(this, false); Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSmoothScrollEnabled(this, false); } if (appOptions?.GeneratorTile ?? false) { appOptions.GeneratorTile = false; ResetToGeneratorPage(); } else if (appOptions?.MyVaultTile ?? false) { appOptions.MyVaultTile = false; } else if (appOptions?.CreateSend != null) { ResetToSendPage(); } }
public RemoveMasterPasswordPageViewModel() { PageTitle = AppResources.RemoveMasterPassword; _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _apiService = ServiceContainer.Resolve <IApiService>("apiService"); _syncService = ServiceContainer.Resolve <ISyncService>("syncService"); }
public VerificationActionsFlowHelper(IKeyConnectorService keyConnectorService, IPasswordRepromptService passwordRepromptService, ICryptoService cryptoService) { _keyConnectorService = keyConnectorService; _passwordRepromptService = passwordRepromptService; _cryptoService = cryptoService; _actionExecutionerDictionary.Add(VerificationFlowAction.DeleteAccount, ServiceContainer.Resolve <IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner")); }
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 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"); _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"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); PageTitle = AppResources.VerifyMasterPassword; TogglePasswordCommand = new Command(TogglePassword); SubmitCommand = new Command(async() => await SubmitAsync()); }
public ExportVaultPageViewModel() { _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"); _i18nService = ServiceContainer.Resolve <II18nService>("i18nService"); _exportService = ServiceContainer.Resolve <IExportService>("exportService"); _policyService = ServiceContainer.Resolve <IPolicyService>("policyService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _userVerificationService = ServiceContainer.Resolve <IUserVerificationService>("userVerificationService"); _apiService = ServiceContainer.Resolve <IApiService>("apiService"); PageTitle = AppResources.ExportVault; TogglePasswordCommand = new Command(TogglePassword); ExportVaultCommand = new Command(async() => await ExportVaultAsync()); FileFormatOptions = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("json", ".json"), new KeyValuePair <string, string>("csv", ".csv"), new KeyValuePair <string, string>("encrypted_json", ".json (Encrypted)") }; }
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 AddEditPage( string cipherId = null, CipherType?type = null, string folderId = null, string collectionId = null, string name = null, string uri = null, bool fromAutofill = false, AppOptions appOptions = null, bool cloneMode = false, ViewPage viewPage = null) { _storageService = ServiceContainer.Resolve <IStorageService>("storageService"); _deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"); _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"); _keyConnectorService = ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"); _appOptions = appOptions; _fromAutofill = fromAutofill; FromAutofillFramework = _appOptions?.FromAutofillFramework ?? false; InitializeComponent(); _vm = BindingContext as AddEditPageViewModel; _vm.Page = this; _vm.CipherId = cipherId; _vm.FolderId = folderId == "none" ? null : folderId; _vm.CollectionIds = collectionId != null ? new HashSet <string>(new List <string> { collectionId }) : null; _vm.CollectionsRepeaterView = _collectionsRepeaterView; _vm.Type = type; _vm.DefaultName = name ?? appOptions?.SaveName; _vm.DefaultUri = uri ?? appOptions?.Uri; _vm.CloneMode = cloneMode; _vm.ViewPage = viewPage; _vm.Init(); SetActivityIndicator(); if (_vm.EditMode && !_vm.CloneMode && Device.RuntimePlatform == Device.Android) { ToolbarItems.Add(_attachmentsItem); ToolbarItems.Add(_deleteItem); } if (Device.RuntimePlatform == Device.iOS) { ToolbarItems.Add(_closeItem); if (_vm.EditMode && !_vm.CloneMode) { ToolbarItems.Add(_moreItem); } _vm.ShowNotesSeparator = true; _typePicker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished); _ownershipPicker.On <iOS>().SetUpdateMode(UpdateMode.WhenFinished); } _typePicker.ItemDisplayBinding = new Binding("Key"); _cardBrandPicker.ItemDisplayBinding = new Binding("Key"); _cardExpMonthPicker.ItemDisplayBinding = new Binding("Key"); _identityTitlePicker.ItemDisplayBinding = new Binding("Key"); _folderPicker.ItemDisplayBinding = new Binding("Key"); _ownershipPicker.ItemDisplayBinding = new Binding("Key"); _loginPasswordEntry.Keyboard = Keyboard.Create(KeyboardFlags.None); _nameEntry.ReturnType = ReturnType.Next; _nameEntry.ReturnCommand = new Command(() => { if (_vm.Cipher.Type == CipherType.Login) { _loginUsernameEntry.Focus(); } else if (_vm.Cipher.Type == CipherType.Card) { _cardholderNameEntry.Focus(); } }); _loginUsernameEntry.ReturnType = ReturnType.Next; _loginUsernameEntry.ReturnCommand = new Command(() => _loginPasswordEntry.Focus()); _loginPasswordEntry.ReturnType = ReturnType.Next; _loginPasswordEntry.ReturnCommand = new Command(() => _loginTotpEntry.Focus()); _cardholderNameEntry.ReturnType = ReturnType.Next; _cardholderNameEntry.ReturnCommand = new Command(() => _cardNumberEntry.Focus()); _cardExpYearEntry.ReturnType = ReturnType.Next; _cardExpYearEntry.ReturnCommand = new Command(() => _cardCodeEntry.Focus()); _identityFirstNameEntry.ReturnType = ReturnType.Next; _identityFirstNameEntry.ReturnCommand = new Command(() => _identityMiddleNameEntry.Focus()); _identityMiddleNameEntry.ReturnType = ReturnType.Next; _identityMiddleNameEntry.ReturnCommand = new Command(() => _identityLastNameEntry.Focus()); _identityLastNameEntry.ReturnType = ReturnType.Next; _identityLastNameEntry.ReturnCommand = new Command(() => _identityUsernameEntry.Focus()); _identityUsernameEntry.ReturnType = ReturnType.Next; _identityUsernameEntry.ReturnCommand = new Command(() => _identityCompanyEntry.Focus()); _identityCompanyEntry.ReturnType = ReturnType.Next; _identityCompanyEntry.ReturnCommand = new Command(() => _identitySsnEntry.Focus()); _identitySsnEntry.ReturnType = ReturnType.Next; _identitySsnEntry.ReturnCommand = new Command(() => _identityPassportNumberEntry.Focus()); _identityPassportNumberEntry.ReturnType = ReturnType.Next; _identityPassportNumberEntry.ReturnCommand = new Command(() => _identityLicenseNumberEntry.Focus()); _identityLicenseNumberEntry.ReturnType = ReturnType.Next; _identityLicenseNumberEntry.ReturnCommand = new Command(() => _identityEmailEntry.Focus()); _identityEmailEntry.ReturnType = ReturnType.Next; _identityEmailEntry.ReturnCommand = new Command(() => _identityPhoneEntry.Focus()); _identityPhoneEntry.ReturnType = ReturnType.Next; _identityPhoneEntry.ReturnCommand = new Command(() => _identityAddress1Entry.Focus()); _identityAddress1Entry.ReturnType = ReturnType.Next; _identityAddress1Entry.ReturnCommand = new Command(() => _identityAddress2Entry.Focus()); _identityAddress2Entry.ReturnType = ReturnType.Next; _identityAddress2Entry.ReturnCommand = new Command(() => _identityAddress3Entry.Focus()); _identityAddress3Entry.ReturnType = ReturnType.Next; _identityAddress3Entry.ReturnCommand = new Command(() => _identityCityEntry.Focus()); _identityCityEntry.ReturnType = ReturnType.Next; _identityCityEntry.ReturnCommand = new Command(() => _identityStateEntry.Focus()); _identityStateEntry.ReturnType = ReturnType.Next; _identityStateEntry.ReturnCommand = new Command(() => _identityPostalCodeEntry.Focus()); _identityPostalCodeEntry.ReturnType = ReturnType.Next; _identityPostalCodeEntry.ReturnCommand = new Command(() => _identityCountryEntry.Focus()); }
public AuthService( ICryptoService cryptoService, ICryptoFunctionService cryptoFunctionService, IApiService apiService, IStateService stateService, ITokenService tokenService, IAppIdService appIdService, II18nService i18nService, IPlatformUtilsService platformUtilsService, IMessagingService messagingService, IVaultTimeoutService vaultTimeoutService, IKeyConnectorService keyConnectorService, bool setCryptoKeys = true) { _cryptoService = cryptoService; _cryptoFunctionService = cryptoFunctionService; _apiService = apiService; _stateService = stateService; _tokenService = tokenService; _appIdService = appIdService; _i18nService = i18nService; _platformUtilsService = platformUtilsService; _messagingService = messagingService; _keyConnectorService = keyConnectorService; _setCryptoKeys = setCryptoKeys; TwoFactorProviders = new Dictionary <TwoFactorProviderType, TwoFactorProvider>(); TwoFactorProviders.Add(TwoFactorProviderType.Authenticator, new TwoFactorProvider { Type = TwoFactorProviderType.Authenticator, Priority = 1, Sort = 1 }); TwoFactorProviders.Add(TwoFactorProviderType.YubiKey, new TwoFactorProvider { Type = TwoFactorProviderType.YubiKey, Priority = 3, Sort = 2, Premium = true }); TwoFactorProviders.Add(TwoFactorProviderType.Duo, new TwoFactorProvider { Type = TwoFactorProviderType.Duo, Name = "Duo", Priority = 2, Sort = 3, Premium = true }); TwoFactorProviders.Add(TwoFactorProviderType.OrganizationDuo, new TwoFactorProvider { Type = TwoFactorProviderType.OrganizationDuo, Name = "Duo (Organization)", Priority = 10, Sort = 4 }); TwoFactorProviders.Add(TwoFactorProviderType.Fido2WebAuthn, new TwoFactorProvider { Type = TwoFactorProviderType.Fido2WebAuthn, Priority = 4, Sort = 5, Premium = true }); TwoFactorProviders.Add(TwoFactorProviderType.Email, new TwoFactorProvider { Type = TwoFactorProviderType.Email, Priority = 0, Sort = 6, }); }
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()); }); } }