DotNetBrightener.TimeBasedOtp 2024.0.14.5-preview-1810501

This is a prerelease version of DotNetBrightener.TimeBasedOtp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DotNetBrightener.TimeBasedOtp --version 2024.0.14.5-preview-1810501                
NuGet\Install-Package DotNetBrightener.TimeBasedOtp -Version 2024.0.14.5-preview-1810501                
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.14.5-preview-1810501" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetBrightener.TimeBasedOtp --version 2024.0.14.5-preview-1810501                
#r "nuget: DotNetBrightener.TimeBasedOtp, 2024.0.14.5-preview-1810501"                
#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.14.5-preview-1810501&prerelease

// Install DotNetBrightener.TimeBasedOtp as a Cake Tool
#tool nuget:?package=DotNetBrightener.TimeBasedOtp&version=2024.0.14.5-preview-1810501&prerelease                

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)
Included target framework(s) (in package)
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
2025.0.1-rc-243301701 55 11/25/2024
2024.0.14.6 73 11/25/2024
2024.0.14.6-rc-243031001 126 10/29/2024
2024.0.14.6-rc-243030701 76 10/29/2024
2024.0.14.6-rc-242840501 73 10/10/2024
2024.0.14.6-rc-242820305 71 10/8/2024
2024.0.14.6-rc-242771401 136 10/3/2024
2024.0.14.6-rc-242770501 71 10/3/2024
2024.0.14.6-rc-242770201 81 10/3/2024
2024.0.14.6-rc-242761801 73 10/2/2024
2024.0.14.6-rc-242761601 76 10/2/2024
2024.0.14.6-rc-242761501 70 10/2/2024
2024.0.14.6-rc-242761401 82 10/2/2024
2024.0.14.6-rc-242760701 79 10/2/2024
2024.0.14.6-rc-242751002 76 10/1/2024
2024.0.14.6-rc-242750901 80 10/1/2024
2024.0.14.6-rc-242750502 71 10/1/2024
2024.0.14.6-rc-242750201 77 10/1/2024
2024.0.14.6-rc-242741501 66 9/30/2024
2024.0.14.6-rc-242730701 89 9/29/2024
2024.0.14.6-preview-2730501 74 9/29/2024
2024.0.14.6-preview-2701501 83 9/26/2024
2024.0.14.6-preview-2620901 119 9/18/2024
2024.0.14.6-preview-2570701 88 9/13/2024
2024.0.14.6-preview-2510703 109 9/7/2024
2024.0.14.6-preview-2480501 105 9/4/2024
2024.0.14.6-preview-2430401 113 8/30/2024
2024.0.14.6-preview-242730701 74 9/29/2024
2024.0.14.6-preview-2421703 85 8/29/2024
2024.0.14.6-preview-2421701 68 8/29/2024
2024.0.14.6-preview-2420901 84 8/29/2024
2024.0.14.6-preview-2390101 101 8/26/2024
2024.0.14.6-preview-2381603 103 8/25/2024
2024.0.14.6-preview-2341601 117 8/21/2024
2024.0.14.6-preview-2321602 92 8/20/2024
2024.0.14.6-preview-2190801 130 8/6/2024
2024.0.14.6-preview-2041501 96 7/22/2024
2024.0.14.6-preview-1920603 157 7/10/2024
2024.0.14.6-preview-1920301 73 7/10/2024
2024.0.14.6-preview-1911302 102 7/9/2024
2024.0.14.6-preview-1901001 116 7/8/2024
2024.0.14.6-preview-1900901 93 7/8/2024
2024.0.14.6-preview-1900801 90 7/8/2024
2024.0.14.6-preview-1860304 98 7/4/2024
2024.0.14.5 159 7/1/2024
2024.0.14.5-preview-1811601 93 6/29/2024
2024.0.14.5-preview-1810501 112 6/29/2024
2024.0.14.5-preview-180132 106 6/28/2024
2024.0.14.5-preview-180131 98 6/28/2024
2024.0.14.5-preview-180121 92 6/28/2024
2024.0.14.4 118 6/27/2024
2024.0.14.4-preview-7 91 6/27/2024
2024.0.14.3 87 6/21/2024
2024.0.14.1 100 6/6/2024
2024.0.14.1-preview 86 6/6/2024
2024.0.14-preview-1 95 6/6/2024
2024.0.13.8-preview 91 6/6/2024
2024.0.13.1-preview-0146 88 6/6/2024
2024.0.12.15803-preview-03 74 6/6/2024
2024.0.12.15608 110 6/4/2024
2024.0.12.15515 191 6/3/2024
2024.0.12.15220 103 5/31/2024
2024.0.12.15220-alpha31-240... 80 5/31/2024
2024.0.12.14911 143 5/28/2024
2024.0.12.14910-alpha28-240... 81 5/28/2024
2024.0.12.14823 113 5/27/2024
2024.0.12.14522-alpha7-2405... 100 5/24/2024
2024.0.12.14514-alpha6-2405... 100 5/24/2024
2024.0.12.14511 125 5/24/2024
2024.0.12.14314 128 5/22/2024
2024.0.12.14114 102 5/20/2024
2024.0.12.12815 147 5/7/2024
2024.0.12.12814 122 5/7/2024
2024.0.12.12721 120 5/6/2024
2024.0.12.12702 109 5/5/2024
2024.0.12.12622 143 5/5/2024
2024.0.12.12514 109 5/4/2024
2024.0.12.12512 100 5/4/2024
2024.0.12.12510 122 5/4/2024
2024.0.12.12420 100 5/3/2024
2024.0.12.12319 57 5/2/2024
2024.0.12.12319-rc-2405021801 53 5/2/2024
2024.0.12.12318 68 5/2/2024
2024.0.12.12215 103 5/1/2024
2024.0.12.12011 102 4/29/2024
2024.0.12.11720 128 4/26/2024
2024.0.12.11719 112 4/26/2024
2024.0.12.11621 130 4/25/2024
2024.0.12.11523 114 4/24/2024
2024.0.12.11522 114 4/24/2024
2024.0.12.11417 131 4/23/2024
2024.0.12.11400 146 4/22/2024
2024.0.12.11316 119 4/22/2024
2024.0.11.10220 109 4/11/2024
2024.0.11.10120 104 4/10/2024
2024.0.11.10119 87 4/10/2024
2024.0.11.10115 105 4/10/2024
2024.0.11.9914 144 4/8/2024
2024.0.11.9901 114 4/7/2024
2024.0.11.9823 127 4/7/2024
2024.0.11.9401 123 4/2/2024
2024.0.11.9301 105 4/1/2024
2024.0.11.9206 111 3/31/2024
2024.0.11.9205 111 3/31/2024
2024.0.11.8200 135 3/21/2024
2024.0.11.8122 102 3/21/2024
2024.0.11.8120 109 3/21/2024
2024.0.11.7320 176 3/13/2024
2024.0.11.7316 132 3/13/2024
2024.0.11.7310 123 3/13/2024
2024.0.11 129 3/13/2024
2024.0.10 158 3/3/2024
2024.0.9 109 2/27/2024
2024.0.8 173 2/1/2024
2024.0.7 129 1/26/2024
2024.0.6 119 1/25/2024
2024.0.5 113 1/24/2024
2024.0.4 112 1/24/2024
2024.0.3 112 1/22/2024
2024.0.2 181 1/10/2024
2024.0.1 121 1/9/2024
2024.0.1-alpha-3 99 1/9/2024
2024.0.1-alpha-2 88 1/9/2024
2024.0.1-alpha-1 132 1/3/2024
2024.0.0 182 12/26/2023
2023.0.27 142 12/21/2023
2023.0.26 114 12/21/2023
2023.0.25 143 12/11/2023
2023.0.24 130 12/8/2023
2023.0.23 131 12/6/2023
2023.0.21 132 12/4/2023
2023.0.20 162 11/27/2023
2023.0.19 125 11/20/2023
2023.0.18 162 10/25/2023
2023.0.17 192 10/22/2023
2023.0.16 165 10/16/2023
2023.0.16-alpha-1 86 10/16/2023
2023.0.15 150 10/14/2023
2023.0.14 117 10/14/2023
2023.0.13 135 10/14/2023
2023.0.12 129 10/14/2023
2023.0.11 120 10/10/2023
2023.0.10 133 10/9/2023
2023.0.9 155 8/16/2023
2023.0.8 152 8/15/2023
2023.0.8-alpha-2 213 5/31/2023
2023.0.7 145 5/12/2023
2023.0.6 169 5/10/2023
2023.0.5 141 5/7/2023
2023.0.4 166 4/22/2023
2023.0.3 199 4/19/2023
2023.0.2 184 4/6/2023
2023.0.1 195 3/13/2023
2022.9.0 292 10/15/2022