From 307a5a584391c248f338befb7f5e7b371fa843b0 Mon Sep 17 00:00:00 2001 From: Matt Portune <59324545+mportune-bw@users.noreply.github.com> Date: Mon, 30 Aug 2021 12:44:12 -0400 Subject: [PATCH] FIDO2 WebAuthn support for mobile (#1519) * FIDO2 / WebAuthn support for mobile * fixes --- src/Android/Services/DeviceActionService.cs | 5 + src/App/Abstractions/IDeviceActionService.cs | 1 + src/App/Pages/Accounts/LoginPage.xaml | 2 +- src/App/Pages/Accounts/LoginPage.xaml.cs | 11 +-- src/App/Pages/Accounts/LoginPageViewModel.cs | 29 ++---- .../Pages/Accounts/LoginSsoPageViewModel.cs | 45 +++------ src/App/Pages/Accounts/RegisterPage.xaml | 2 +- src/App/Pages/Accounts/RegisterPage.xaml.cs | 8 +- .../Pages/Accounts/RegisterPageViewModel.cs | 35 ++----- src/App/Pages/Accounts/TwoFactorPage.xaml | 24 +++++ src/App/Pages/Accounts/TwoFactorPage.xaml.cs | 8 +- .../Pages/Accounts/TwoFactorPageViewModel.cs | 91 ++++++++++++++++--- src/App/Pages/CaptchaProtectedViewModel.cs | 42 ++------- src/App/Pages/Send/SendAddEditPage.xaml | 4 - src/App/Resources/AppResources.Designer.cs | 32 ++++++- src/App/Resources/AppResources.resx | 15 +++ .../Services/MobilePlatformUtilsService.cs | 4 +- src/App/Utilities/AppHelpers.cs | 15 +++ src/Core/Abstractions/IAuthService.cs | 2 +- .../Abstractions/IPlatformUtilsService.cs | 2 +- src/Core/Enums/TwoFactorProviderType.cs | 3 +- src/Core/Services/AuthService.cs | 17 ++-- src/iOS.Core/Services/DeviceActionService.cs | 24 ++++- src/iOS/AppDelegate.cs | 10 ++ 24 files changed, 276 insertions(+), 155 deletions(-) diff --git a/src/Android/Services/DeviceActionService.cs b/src/Android/Services/DeviceActionService.cs index 68523ca77..45fd32f27 100644 --- a/src/Android/Services/DeviceActionService.cs +++ b/src/Android/Services/DeviceActionService.cs @@ -776,6 +776,11 @@ namespace Bit.Droid.Services _messagingService.Send("finishMainActivity"); } + public bool SupportsFido2() + { + return true; + } + private bool DeleteDir(Java.IO.File dir) { if (dir != null && dir.IsDirectory) diff --git a/src/App/Abstractions/IDeviceActionService.cs b/src/App/Abstractions/IDeviceActionService.cs index 2f32a7da9..3c78759ba 100644 --- a/src/App/Abstractions/IDeviceActionService.cs +++ b/src/App/Abstractions/IDeviceActionService.cs @@ -45,5 +45,6 @@ namespace Bit.App.Abstractions bool UsingDarkTheme(); long GetActiveTime(); void CloseMainApp(); + bool SupportsFido2(); } } diff --git a/src/App/Pages/Accounts/LoginPage.xaml b/src/App/Pages/Accounts/LoginPage.xaml index e43026992..1363785ce 100644 --- a/src/App/Pages/Accounts/LoginPage.xaml +++ b/src/App/Pages/Accounts/LoginPage.xaml @@ -82,7 +82,7 @@ -