DotNetBrightener.TimeBasedOtp 2026.0.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package DotNetBrightener.TimeBasedOtp --version 2026.0.1
                    
NuGet\Install-Package DotNetBrightener.TimeBasedOtp -Version 2026.0.1
                    
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="2026.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetBrightener.TimeBasedOtp" Version="2026.0.1" />
                    
Directory.Packages.props
<PackageReference Include="DotNetBrightener.TimeBasedOtp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotNetBrightener.TimeBasedOtp --version 2026.0.1
                    
#r "nuget: DotNetBrightener.TimeBasedOtp, 2026.0.1"
                    
#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.
#:package DotNetBrightener.TimeBasedOtp@2026.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotNetBrightener.TimeBasedOtp&version=2026.0.1
                    
Install as a Cake Addin
#tool nuget:?package=DotNetBrightener.TimeBasedOtp&version=2026.0.1
                    
Install as a Cake Tool

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 net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DotNetBrightener.TimeBasedOtp:

Package Downloads
DotNetBrightener.NotificationService

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.0.2-preview-v2026-0-1-755 42 3/27/2026
2026.0.2-preview-758 25 3/29/2026
2026.0.2-preview-757 30 3/29/2026
2026.0.2-preview-756 42 3/27/2026
2026.0.2-preview-754 29 3/27/2026
2026.0.1 35 3/27/2026
2026.0.1-preview-temporal-s... 88 3/14/2026
2026.0.1-preview-752 55 3/26/2026
2026.0.1-preview-750 66 3/26/2026
2026.0.1-preview-749 75 3/25/2026
2026.0.1-preview-748 79 3/23/2026
2026.0.1-preview-742 81 3/22/2026
2026.0.1-preview-741 89 3/16/2026
2026.0.1-preview-737 86 3/9/2026
2026.0.1-preview-734 117 2/23/2026
2026.0.1-preview-733 100 2/6/2026
2026.0.1-preview-731 131 2/3/2026
2026.0.1-preview-728 113 1/20/2026
2026.0.1-preview-723 105 1/15/2026
2026.0.1-preview-721 104 1/15/2026
Loading failed