DotNetBrightener.TimeBasedOtp 2024.0.8

dotnet add package DotNetBrightener.TimeBasedOtp --version 2024.0.8
NuGet\Install-Package DotNetBrightener.TimeBasedOtp -Version 2024.0.8
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="DotNetBrightener.TimeBasedOtp" Version="2024.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetBrightener.TimeBasedOtp --version 2024.0.8
#r "nuget: DotNetBrightener.TimeBasedOtp, 2024.0.8"
#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 DotNetBrightener.TimeBasedOtp as a Cake Addin
#addin nuget:?package=DotNetBrightener.TimeBasedOtp&version=2024.0.8

// Install DotNetBrightener.TimeBasedOtp as a Cake Tool
#tool nuget:?package=DotNetBrightener.TimeBasedOtp&version=2024.0.8

Time Based OTP Library

© 2022 DotNet Brightener.

Installation

Run this in command line:

dotnet add package DotNetBrightener.TimeBasedOtp

Or add the following to .csproj file

<PackageReference Include="DotNetBrightener.TimeBasedOtp" Version="2022.10.0" />

You should check the latest version from Nuget Site

Usage

Register service

serviceCollection.AddOtpProvider();

In your service / controller:

// inject the service
IOTPProvider otpProvider; 

// generate a secret
var secret = "<some random string>";

// define the length of the password to generate
var passwordLength = 6;

// indicates whether the secret's spaces matter or not.
var ignoreSpaces = false; // false: Spaces matter. true: Spaces don't matter

var otp = otpProvider.GetPassword(secret, passwordLength, ignoreSpaces);

// the adjacent intervals to check for the OTP. The greater this value is, the higher risk of being hijacked.
var checkAdjacentIntervals = 2;

var isOtpValid = otpProvider.ValidateOTP(otp, secret, ignoreSpaces, checkAdjacentIntervals;

Note

The secret should be stored securely within your application.

Product 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. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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
2024.0.8 126 2/1/2024
2024.0.7 80 1/26/2024
2024.0.6 78 1/25/2024
2024.0.5 73 1/24/2024
2024.0.4 67 1/24/2024
2024.0.3 75 1/22/2024
2024.0.2 139 1/10/2024
2024.0.1 92 1/9/2024
2024.0.1-alpha-3 80 1/9/2024
2024.0.1-alpha-2 69 1/9/2024
2024.0.1-alpha-1 101 1/3/2024
2024.0.0 142 12/26/2023
2023.0.27 101 12/21/2023
2023.0.26 81 12/21/2023
2023.0.25 104 12/11/2023
2023.0.24 95 12/8/2023
2023.0.23 95 12/6/2023
2023.0.21 98 12/4/2023
2023.0.20 124 11/27/2023
2023.0.19 103 11/20/2023
2023.0.18 116 10/25/2023
2023.0.17 147 10/22/2023
2023.0.16 127 10/16/2023
2023.0.16-alpha-1 68 10/16/2023
2023.0.15 108 10/14/2023
2023.0.14 89 10/14/2023
2023.0.13 90 10/14/2023
2023.0.12 86 10/14/2023
2023.0.11 90 10/10/2023
2023.0.10 92 10/9/2023
2023.0.9 114 8/16/2023
2023.0.8 111 8/15/2023
2023.0.8-alpha-2 185 5/31/2023
2023.0.7 105 5/12/2023
2023.0.6 130 5/10/2023
2023.0.5 100 5/7/2023
2023.0.4 124 4/22/2023
2023.0.3 157 4/19/2023
2023.0.2 159 4/6/2023
2023.0.1 172 3/13/2023
2022.9.0 247 10/15/2022