DotNetBrightener.TimeBasedOtp
2025.0.10
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DotNetBrightener.TimeBasedOtp --version 2025.0.10
NuGet\Install-Package DotNetBrightener.TimeBasedOtp -Version 2025.0.10
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="2025.0.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotNetBrightener.TimeBasedOtp" Version="2025.0.10" />
<PackageReference Include="DotNetBrightener.TimeBasedOtp" />
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 2025.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotNetBrightener.TimeBasedOtp, 2025.0.10"
#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@2025.0.10
#: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=2025.0.10
#tool nuget:?package=DotNetBrightener.TimeBasedOtp&version=2025.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.11)
- System.Runtime.Caching (>= 9.0.11)
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.1-preview-notificati... | 130 | 12/6/2025 |
| 2026.0.1-preview-733 | 87 | 2/6/2026 |
| 2026.0.1-preview-731 | 101 | 2/3/2026 |
| 2026.0.1-preview-728 | 102 | 1/20/2026 |
| 2026.0.1-preview-723 | 97 | 1/15/2026 |
| 2026.0.1-preview-721 | 96 | 1/15/2026 |
| 2026.0.1-preview-717 | 114 | 1/5/2026 |
| 2026.0.1-preview-713 | 460 | 12/10/2025 |
| 2026.0.1-preview-700 | 232 | 12/7/2025 |
| 2026.0.1-preview-689 | 123 | 12/6/2025 |
| 2026.0.1-preview-676 | 688 | 12/2/2025 |
| 2026.0.1-preview-671 | 126 | 11/29/2025 |
| 2026.0.1-preview-670 | 118 | 11/29/2025 |
| 2026.0.1-preview-669 | 119 | 11/29/2025 |
| 2026.0.1-preview-667 | 194 | 11/27/2025 |
| 2026.0.1-preview-665 | 181 | 11/27/2025 |
| 2026.0.1-preview-664 | 179 | 11/27/2025 |
| 2025.0.10 | 204 | 11/25/2025 |
Loading failed