From 9163b9e4def2166ca8bd2a3f5f7cd56f137ecbf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Filipe=20da=20Silva=20Bispo?= Date: Tue, 23 Aug 2022 15:48:45 +0100 Subject: [PATCH] [SG-599] Cannot read authenticator key if you don't include URI before TOTP Secret. (#2047) Removed unnecessary code when adding a TOTP auth key secret manually --- src/App/Pages/Vault/ScanPage.xaml.cs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/App/Pages/Vault/ScanPage.xaml.cs b/src/App/Pages/Vault/ScanPage.xaml.cs index 1927e2587..4f87d1b72 100644 --- a/src/App/Pages/Vault/ScanPage.xaml.cs +++ b/src/App/Pages/Vault/ScanPage.xaml.cs @@ -170,27 +170,10 @@ namespace Bit.App.Pages private void AddAuthenticationKey_OnClicked(object sender, EventArgs e) { - var text = ViewModel.TotpAuthenticationKey; - if (!string.IsNullOrWhiteSpace(text)) + if (!string.IsNullOrWhiteSpace(ViewModel.TotpAuthenticationKey)) { - if (text.StartsWith("otpauth://totp")) - { - _callback(text); - return; - } - else if (Uri.TryCreate(text, UriKind.Absolute, out Uri uri) && - !string.IsNullOrWhiteSpace(uri?.Query)) - { - var queryParts = uri.Query.Substring(1).ToLowerInvariant().Split('&'); - foreach (var part in queryParts) - { - if (part.StartsWith("secret=")) - { - _callback(part.Substring(7)?.ToUpperInvariant()); - return; - } - } - } + _callback(ViewModel.TotpAuthenticationKey); + return; } _callback(null); }