CGLibs.2FA
8.51.128
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package CGLibs.2FA --version 8.51.128
NuGet\Install-Package CGLibs.2FA -Version 8.51.128
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CGLibs.2FA" Version="8.51.128" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CGLibs.2FA --version 8.51.128
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CGLibs.2FA, 8.51.128"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CGLibs.2FA as a Cake Addin #addin nuget:?package=CGLibs.2FA&version=8.51.128 // Install CGLibs.2FA as a Cake Tool #tool nuget:?package=CGLibs.2FA&version=8.51.128
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
cglibs-2fa
OTP, HOTP and TOTP library for .NET. Create and validate 6-8 digit codes.
Usage
Create a new instance of the Authenticator class and create a qr code image for the user to scan.
CGLibs._2FA.Imaging.Authenticator auth = new CGLibs._2FA.Imaging.Authenticator();
auth.Width = 500;
auth.Height = 500;
auth.Period = 60;
pictureBox1.Image = auth.GetQRCodeImage("$ecretKeyForTestingPurposesThatIsReallyLongAndCrazyToTryAndUse",
"Issuer", "UserAccount@SomeDomainOrAppEtc");
Generate a code
TOTPGenerator totpGenerator = new CGLibs._2FA.TOTP.TOTPGenerator("SecretKey");
string code = totpGenerator.GenerateForDate();
Validate a code
string usercode = "123456";
TOTPValidator totpValidator = new CGLibs._2FA.TOTP.TOTPValidator("SecretKey");
bool isValid = totpGenerator.Validate(usercode);
Credits
Thanks to ZXing.Net
for QR code generation!
https://github.com/micjahn/ZXing.Net
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Framework | net472 is compatible. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- ZXing.Net (>= 0.16.6)
-
.NETFramework 4.8
- System.Drawing.Common (>= 8.0.3)
- ZXing.Net (>= 0.16.6)
-
net8.0
- System.Drawing.Common (>= 8.0.3)
- ZXing.Net (>= 0.16.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.51.128 | 88 | 11/1/2024 |
8.51.127.1032 | 131 | 5/8/2024 |