From 3ca9b652a7208c85aa7a9a22714141f2b0d2fd5c Mon Sep 17 00:00:00 2001 From: Frans Lytzen Date: Tue, 3 May 2022 19:03:41 +0100 Subject: [PATCH 1/5] Changed to netstandard2.0 --- .../Google.Authenticator.csproj | 17 +-------------- .../TwoFactorAuthenticator.cs | 21 ++++++------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/Google.Authenticator/Google.Authenticator.csproj b/Google.Authenticator/Google.Authenticator.csproj index 3327d9b..4fed822 100644 --- a/Google.Authenticator/Google.Authenticator.csproj +++ b/Google.Authenticator/Google.Authenticator.csproj @@ -1,7 +1,7 @@  - netstandard2.0;net45;net5.0;net6.0 + netstandard2.0 Google Authenticator Two-Factor Google Authenticator Two-Factor Authentication Library Google Authenticator Two-Factor Authentication Library (Not officially affiliated with Google.) @@ -23,21 +23,6 @@ - - - NETCORE;NETSTANDARD;NETSTANDARD2_0 - - - - NET45;NETFULL - - - - NET5_0;NETCOREAPP - - - NET6_0; - diff --git a/Google.Authenticator/TwoFactorAuthenticator.cs b/Google.Authenticator/TwoFactorAuthenticator.cs index ebf96d8..0a1d963 100644 --- a/Google.Authenticator/TwoFactorAuthenticator.cs +++ b/Google.Authenticator/TwoFactorAuthenticator.cs @@ -89,21 +89,12 @@ private static string GenerateQrCodeUrl(int qrPixelsPerModule, string provisionU { using (var qrGenerator = new QRCodeGenerator()) using (var qrCodeData = qrGenerator.CreateQrCode(provisionUrl, QRCodeGenerator.ECCLevel.Q)) - #if NET6_0 - using (var qrCode = new PngByteQRCode(qrCodeData)) - { - var qrCodeImage = qrCode.GetGraphic(qrPixelsPerModule); - qrCodeUrl = $"data:image/png;base64,{Convert.ToBase64String(qrCodeImage)}"; - } - #else - using (var qrCode = new QRCode(qrCodeData)) - using (var qrCodeImage = qrCode.GetGraphic(qrPixelsPerModule)) - using (var ms = new MemoryStream()) - { - qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png); - qrCodeUrl = $"data:image/png;base64,{Convert.ToBase64String(ms.ToArray())}"; - } - #endif + using (var qrCode = new PngByteQRCode(qrCodeData)) + { + var qrCodeImage = qrCode.GetGraphic(qrPixelsPerModule); + qrCodeUrl = $"data:image/png;base64,{Convert.ToBase64String(qrCodeImage)}"; + } + } catch (TypeInitializationException e) { From 32076886f6986a74f3ed37475f3757f135ccff33 Mon Sep 17 00:00:00 2001 From: Frans Lytzen Date: Tue, 3 May 2022 19:53:35 +0100 Subject: [PATCH 2/5] Re-added net462 --- Google.Authenticator/Google.Authenticator.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Google.Authenticator/Google.Authenticator.csproj b/Google.Authenticator/Google.Authenticator.csproj index 4fed822..520aecc 100644 --- a/Google.Authenticator/Google.Authenticator.csproj +++ b/Google.Authenticator/Google.Authenticator.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard2.0;net462 Google Authenticator Two-Factor Google Authenticator Two-Factor Authentication Library Google Authenticator Two-Factor Authentication Library (Not officially affiliated with Google.) From 38ffe3a0f694287ed0d44e11ae8333edbcbbae08 Mon Sep 17 00:00:00 2001 From: Frans Lytzen Date: Tue, 3 May 2022 20:33:22 +0100 Subject: [PATCH 3/5] Updated readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0d7c980..0d19fbc 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ bool result = tfa.ValidateTwoFactorPIN(key, txtCode.Text) ## Updates +### 3.0 +Removed support for legacy .Net Framework. Lowest supported versions are now netstandard2.0 and Net 4.6.2. +ALl use of System.Drawing has been removed. In 2.5, only Net 6.0 avoided System.Drawing. + ### 2.5.0 Now runs on .Net 6.0. Technically the QR Coder library we rely on still does not fully support .Net 6.0 so it is possible there will be other niggling issues, but for now all tests pass for .Net 6.0 on both Windows and Linux. From 8808c010ae4d5c04570de7fd341e86e640a7c37b Mon Sep 17 00:00:00 2001 From: Frans Lytzen Date: Tue, 3 May 2022 20:40:01 +0100 Subject: [PATCH 4/5] Updated readme 2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d19fbc..51b17f7 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ bool result = tfa.ValidateTwoFactorPIN(key, txtCode.Text) ## Updates -### 3.0 +### 3.0.0-beta1 Removed support for legacy .Net Framework. Lowest supported versions are now netstandard2.0 and Net 4.6.2. ALl use of System.Drawing has been removed. In 2.5, only Net 6.0 avoided System.Drawing. From d3aad2d75f368ba5725358da84f0751aa4aa9c31 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 5 May 2022 08:00:13 -0600 Subject: [PATCH 5/5] small typo fixes --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 51b17f7..ad05b7d 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ bool result = tfa.ValidateTwoFactorPIN(key, txtCode.Text) ## Updates ### 3.0.0-beta1 -Removed support for legacy .Net Framework. Lowest supported versions are now netstandard2.0 and Net 4.6.2. -ALl use of System.Drawing has been removed. In 2.5, only Net 6.0 avoided System.Drawing. +Removed support for legacy .Net Framework. Lowest supported versions are now netstandard2.0 and .Net 4.6.2. +All use of System.Drawing has been removed. In 2.5, only Net 6.0 avoided System.Drawing. ### 2.5.0 Now runs on .Net 6.0.