DotNetBrightener.TimeBasedOtp 2024.0.14.5

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package DotNetBrightener.TimeBasedOtp --version 2024.0.14.5                
NuGet\Install-Package DotNetBrightener.TimeBasedOtp -Version 2024.0.14.5                
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" />                
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                
#r "nuget: DotNetBrightener.TimeBasedOtp, 2024.0.14.5"                
#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

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

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
2024.0.14.6-rc-243031001 107 10/29/2024
2024.0.14.6-rc-243030701 75 10/29/2024
2024.0.14.6-rc-242840501 73 10/10/2024
2024.0.14.6-rc-242820305 70 10/8/2024
2024.0.14.6-rc-242771401 135 10/3/2024
2024.0.14.6-rc-242770501 70 10/3/2024
2024.0.14.6-rc-242770201 81 10/3/2024
2024.0.14.6-rc-242761801 72 10/2/2024
2024.0.14.6-rc-242761601 75 10/2/2024
2024.0.14.6-rc-242761501 69 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 79 10/1/2024
2024.0.14.6-rc-242750502 70 10/1/2024
2024.0.14.6-rc-242750201 76 10/1/2024
2024.0.14.6-rc-242741501 65 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 82 9/26/2024
2024.0.14.6-preview-2620901 118 9/18/2024
2024.0.14.6-preview-2570701 88 9/13/2024
2024.0.14.6-preview-2510703 108 9/7/2024
2024.0.14.6-preview-2480501 105 9/4/2024
2024.0.14.6-preview-2430401 112 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 67 8/29/2024
2024.0.14.6-preview-2420901 84 8/29/2024
2024.0.14.6-preview-2390101 100 8/26/2024
2024.0.14.6-preview-2381603 102 8/25/2024
2024.0.14.6-preview-2341601 116 8/21/2024
2024.0.14.6-preview-2321602 91 8/20/2024
2024.0.14.6-preview-2190801 129 8/6/2024
2024.0.14.6-preview-2041501 95 7/22/2024
2024.0.14.6-preview-1920603 156 7/10/2024
2024.0.14.6-preview-1920301 72 7/10/2024
2024.0.14.6-preview-1911302 101 7/9/2024
2024.0.14.6-preview-1901001 115 7/8/2024
2024.0.14.6-preview-1900901 92 7/8/2024
2024.0.14.6-preview-1900801 89 7/8/2024
2024.0.14.6-preview-1860304 97 7/4/2024
2024.0.14.5 156 7/1/2024
2024.0.14.5-preview-1811601 92 6/29/2024
2024.0.14.5-preview-1810501 111 6/29/2024
2024.0.14.5-preview-180132 105 6/28/2024
2024.0.14.5-preview-180131 97 6/28/2024
2024.0.14.5-preview-180121 91 6/28/2024
2024.0.14.4 115 6/27/2024
2024.0.14.4-preview-7 90 6/27/2024
2024.0.14.3 84 6/21/2024
2024.0.14.1 98 6/6/2024
2024.0.14.1-preview 85 6/6/2024
2024.0.14-preview-1 94 6/6/2024
2024.0.13.8-preview 90 6/6/2024
2024.0.13.1-preview-0146 87 6/6/2024
2024.0.12.15803-preview-03 73 6/6/2024
2024.0.12.15608 107 6/4/2024
2024.0.12.15515 188 6/3/2024
2024.0.12.15220 100 5/31/2024
2024.0.12.15220-alpha31-240... 79 5/31/2024
2024.0.12.14911 140 5/28/2024
2024.0.12.14910-alpha28-240... 80 5/28/2024
2024.0.12.14823 110 5/27/2024
2024.0.12.14522-alpha7-2405... 99 5/24/2024
2024.0.12.14514-alpha6-2405... 99 5/24/2024
2024.0.12.14511 122 5/24/2024
2024.0.12.14314 125 5/22/2024
2024.0.12.14114 99 5/20/2024
2024.0.12.12815 144 5/7/2024
2024.0.12.12814 119 5/7/2024
2024.0.12.12721 117 5/6/2024
2024.0.12.12702 106 5/5/2024
2024.0.12.12622 140 5/5/2024
2024.0.12.12514 106 5/4/2024
2024.0.12.12512 97 5/4/2024
2024.0.12.12510 119 5/4/2024
2024.0.12.12420 97 5/3/2024
2024.0.12.12319 54 5/2/2024
2024.0.12.12319-rc-2405021801 52 5/2/2024
2024.0.12.12318 65 5/2/2024
2024.0.12.12215 100 5/1/2024
2024.0.12.12011 99 4/29/2024
2024.0.12.11720 125 4/26/2024
2024.0.12.11719 110 4/26/2024
2024.0.12.11621 128 4/25/2024
2024.0.12.11523 111 4/24/2024
2024.0.12.11522 111 4/24/2024
2024.0.12.11417 129 4/23/2024
2024.0.12.11400 143 4/22/2024
2024.0.12.11316 116 4/22/2024
2024.0.11.10220 106 4/11/2024
2024.0.11.10120 101 4/10/2024
2024.0.11.10119 84 4/10/2024
2024.0.11.10115 102 4/10/2024
2024.0.11.9914 141 4/8/2024
2024.0.11.9901 111 4/7/2024
2024.0.11.9823 124 4/7/2024
2024.0.11.9401 120 4/2/2024
2024.0.11.9301 102 4/1/2024
2024.0.11.9206 108 3/31/2024
2024.0.11.9205 108 3/31/2024
2024.0.11.8200 130 3/21/2024
2024.0.11.8122 99 3/21/2024
2024.0.11.8120 106 3/21/2024
2024.0.11.7320 171 3/13/2024
2024.0.11.7316 129 3/13/2024
2024.0.11.7310 121 3/13/2024
2024.0.11 126 3/13/2024
2024.0.10 155 3/3/2024
2024.0.9 106 2/27/2024
2024.0.8 170 2/1/2024
2024.0.7 126 1/26/2024
2024.0.6 116 1/25/2024
2024.0.5 110 1/24/2024
2024.0.4 109 1/24/2024
2024.0.3 109 1/22/2024
2024.0.2 178 1/10/2024
2024.0.1 116 1/9/2024
2024.0.1-alpha-3 98 1/9/2024
2024.0.1-alpha-2 87 1/9/2024
2024.0.1-alpha-1 131 1/3/2024
2024.0.0 178 12/26/2023
2023.0.27 139 12/21/2023
2023.0.26 111 12/21/2023
2023.0.25 140 12/11/2023
2023.0.24 127 12/8/2023
2023.0.23 128 12/6/2023
2023.0.21 129 12/4/2023
2023.0.20 159 11/27/2023
2023.0.19 122 11/20/2023
2023.0.18 159 10/25/2023
2023.0.17 189 10/22/2023
2023.0.16 162 10/16/2023
2023.0.16-alpha-1 85 10/16/2023
2023.0.15 147 10/14/2023
2023.0.14 114 10/14/2023
2023.0.13 132 10/14/2023
2023.0.12 126 10/14/2023
2023.0.11 117 10/10/2023
2023.0.10 130 10/9/2023
2023.0.9 153 8/16/2023
2023.0.8 149 8/15/2023
2023.0.8-alpha-2 212 5/31/2023
2023.0.7 142 5/12/2023
2023.0.6 166 5/10/2023
2023.0.5 138 5/7/2023
2023.0.4 163 4/22/2023
2023.0.3 196 4/19/2023
2023.0.2 181 4/6/2023
2023.0.1 192 3/13/2023
2022.9.0 289 10/15/2022