DotNetBrightener.TimeBasedOtp
2024.0.12.12011
There is a newer 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 2024.0.12.12011
NuGet\Install-Package DotNetBrightener.TimeBasedOtp -Version 2024.0.12.12011
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.12.12011" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetBrightener.TimeBasedOtp --version 2024.0.12.12011
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotNetBrightener.TimeBasedOtp, 2024.0.12.12011"
#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.12.12011
// Install DotNetBrightener.TimeBasedOtp as a Cake Tool
#tool nuget:?package=DotNetBrightener.TimeBasedOtp&version=2024.0.12.12011
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 | 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)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- System.Runtime.Caching (>= 8.0.0)
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.12.14911 | 0 | 5/28/2024 |
2024.0.12.14910-alpha28-240... | 0 | 5/28/2024 |
2024.0.12.14823 | 23 | 5/27/2024 |
2024.0.12.14522-alpha7-2405... | 41 | 5/24/2024 |
2024.0.12.14514-alpha6-2405... | 38 | 5/24/2024 |
2024.0.12.14511 | 50 | 5/24/2024 |
2024.0.12.14314 | 92 | 5/22/2024 |
2024.0.12.14114 | 81 | 5/20/2024 |
2024.0.12.12815 | 114 | 5/7/2024 |
2024.0.12.12814 | 89 | 5/7/2024 |
2024.0.12.12721 | 103 | 5/6/2024 |
2024.0.12.12702 | 91 | 5/5/2024 |
2024.0.12.12622 | 106 | 5/5/2024 |
2024.0.12.12514 | 76 | 5/4/2024 |
2024.0.12.12512 | 82 | 5/4/2024 |
2024.0.12.12510 | 88 | 5/4/2024 |
2024.0.12.12420 | 66 | 5/3/2024 |
2024.0.12.12319 | 40 | 5/2/2024 |
2024.0.12.12319-rc-2405021801 | 29 | 5/2/2024 |
2024.0.12.12318 | 36 | 5/2/2024 |
2024.0.12.12215 | 73 | 5/1/2024 |
2024.0.12.12011 | 75 | 4/29/2024 |
2024.0.12.11720 | 97 | 4/26/2024 |
2024.0.12.11719 | 82 | 4/26/2024 |
2024.0.12.11621 | 97 | 4/25/2024 |
2024.0.12.11523 | 78 | 4/24/2024 |
2024.0.12.11522 | 80 | 4/24/2024 |
2024.0.12.11417 | 95 | 4/23/2024 |
2024.0.12.11400 | 95 | 4/22/2024 |
2024.0.12.11316 | 85 | 4/22/2024 |
2024.0.11.10220 | 79 | 4/11/2024 |
2024.0.11.10120 | 75 | 4/10/2024 |
2024.0.11.10119 | 68 | 4/10/2024 |
2024.0.11.10115 | 72 | 4/10/2024 |
2024.0.11.9914 | 115 | 4/8/2024 |
2024.0.11.9901 | 83 | 4/7/2024 |
2024.0.11.9823 | 95 | 4/7/2024 |
2024.0.11.9401 | 93 | 4/2/2024 |
2024.0.11.9301 | 74 | 4/1/2024 |
2024.0.11.9206 | 80 | 3/31/2024 |
2024.0.11.9205 | 76 | 3/31/2024 |
2024.0.11.8200 | 103 | 3/21/2024 |
2024.0.11.8122 | 71 | 3/21/2024 |
2024.0.11.8120 | 90 | 3/21/2024 |
2024.0.11.7320 | 144 | 3/13/2024 |
2024.0.11.7316 | 100 | 3/13/2024 |
2024.0.11.7310 | 92 | 3/13/2024 |
2024.0.11 | 95 | 3/13/2024 |
2024.0.10 | 123 | 3/3/2024 |
2024.0.9 | 83 | 2/27/2024 |
2024.0.8 | 141 | 2/1/2024 |
2024.0.7 | 93 | 1/26/2024 |
2024.0.6 | 90 | 1/25/2024 |
2024.0.5 | 85 | 1/24/2024 |
2024.0.4 | 79 | 1/24/2024 |
2024.0.3 | 92 | 1/22/2024 |
2024.0.2 | 151 | 1/10/2024 |
2024.0.1 | 104 | 1/9/2024 |
2024.0.1-alpha-3 | 86 | 1/9/2024 |
2024.0.1-alpha-2 | 74 | 1/9/2024 |
2024.0.1-alpha-1 | 106 | 1/3/2024 |
2024.0.0 | 151 | 12/26/2023 |
2023.0.27 | 111 | 12/21/2023 |
2023.0.26 | 89 | 12/21/2023 |
2023.0.25 | 112 | 12/11/2023 |
2023.0.24 | 103 | 12/8/2023 |
2023.0.23 | 103 | 12/6/2023 |
2023.0.21 | 106 | 12/4/2023 |
2023.0.20 | 132 | 11/27/2023 |
2023.0.19 | 112 | 11/20/2023 |
2023.0.18 | 130 | 10/25/2023 |
2023.0.17 | 158 | 10/22/2023 |
2023.0.16 | 138 | 10/16/2023 |
2023.0.16-alpha-1 | 73 | 10/16/2023 |
2023.0.15 | 119 | 10/14/2023 |
2023.0.14 | 100 | 10/14/2023 |
2023.0.13 | 101 | 10/14/2023 |
2023.0.12 | 96 | 10/14/2023 |
2023.0.11 | 101 | 10/10/2023 |
2023.0.10 | 102 | 10/9/2023 |
2023.0.9 | 129 | 8/16/2023 |
2023.0.8 | 125 | 8/15/2023 |
2023.0.8-alpha-2 | 189 | 5/31/2023 |
2023.0.7 | 117 | 5/12/2023 |
2023.0.6 | 153 | 5/10/2023 |
2023.0.5 | 113 | 5/7/2023 |
2023.0.4 | 136 | 4/22/2023 |
2023.0.3 | 167 | 4/19/2023 |
2023.0.2 | 169 | 4/6/2023 |
2023.0.1 | 182 | 3/13/2023 |
2022.9.0 | 259 | 10/15/2022 |