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-preview-2041501 57 7/22/2024
2024.0.14.6-preview-1920603 119 7/10/2024
2024.0.14.6-preview-1920301 59 7/10/2024
2024.0.14.6-preview-1911302 72 7/9/2024
2024.0.14.6-preview-1901001 88 7/8/2024
2024.0.14.6-preview-1900901 66 7/8/2024
2024.0.14.6-preview-1900801 61 7/8/2024
2024.0.14.6-preview-1860304 72 7/4/2024
2024.0.14.5 121 7/1/2024
2024.0.14.5-preview-1811601 66 6/29/2024
2024.0.14.5-preview-1810501 86 6/29/2024
2024.0.14.5-preview-180132 78 6/28/2024
2024.0.14.5-preview-180131 71 6/28/2024
2024.0.14.5-preview-180121 61 6/28/2024
2024.0.14.4 88 6/27/2024
2024.0.14.4-preview-7 64 6/27/2024
2024.0.14.3 73 6/21/2024
2024.0.14.1 75 6/6/2024
2024.0.14.1-preview 61 6/6/2024
2024.0.14-preview-1 72 6/6/2024
2024.0.13.8-preview 71 6/6/2024
2024.0.13.1-preview-0146 67 6/6/2024
2024.0.12.15803-preview-03 65 6/6/2024
2024.0.12.15608 83 6/4/2024
2024.0.12.15515 163 6/3/2024
2024.0.12.15220 75 5/31/2024
2024.0.12.15220-alpha31-240... 54 5/31/2024
2024.0.12.14911 116 5/28/2024
2024.0.12.14910-alpha28-240... 72 5/28/2024
2024.0.12.14823 88 5/27/2024
2024.0.12.14522-alpha7-2405... 78 5/24/2024
2024.0.12.14514-alpha6-2405... 75 5/24/2024
2024.0.12.14511 97 5/24/2024
2024.0.12.14314 104 5/22/2024
2024.0.12.14114 91 5/20/2024
2024.0.12.12815 120 5/7/2024
2024.0.12.12814 95 5/7/2024
2024.0.12.12721 109 5/6/2024
2024.0.12.12702 98 5/5/2024
2024.0.12.12622 113 5/5/2024
2024.0.12.12514 84 5/4/2024
2024.0.12.12512 90 5/4/2024
2024.0.12.12510 96 5/4/2024
2024.0.12.12420 74 5/3/2024
2024.0.12.12319 47 5/2/2024
2024.0.12.12319-rc-2405021801 34 5/2/2024
2024.0.12.12318 43 5/2/2024
2024.0.12.12215 80 5/1/2024
2024.0.12.12011 77 4/29/2024
2024.0.12.11720 99 4/26/2024
2024.0.12.11719 84 4/26/2024
2024.0.12.11621 101 4/25/2024
2024.0.12.11523 82 4/24/2024
2024.0.12.11522 84 4/24/2024
2024.0.12.11417 100 4/23/2024
2024.0.12.11400 100 4/22/2024
2024.0.12.11316 90 4/22/2024
2024.0.11.10220 82 4/11/2024
2024.0.11.10120 79 4/10/2024
2024.0.11.10119 73 4/10/2024
2024.0.11.10115 77 4/10/2024
2024.0.11.9914 118 4/8/2024
2024.0.11.9901 86 4/7/2024
2024.0.11.9823 98 4/7/2024
2024.0.11.9401 98 4/2/2024
2024.0.11.9301 79 4/1/2024
2024.0.11.9206 84 3/31/2024
2024.0.11.9205 83 3/31/2024
2024.0.11.8200 107 3/21/2024
2024.0.11.8122 75 3/21/2024
2024.0.11.8120 97 3/21/2024
2024.0.11.7320 149 3/13/2024
2024.0.11.7316 106 3/13/2024
2024.0.11.7310 97 3/13/2024
2024.0.11 99 3/13/2024
2024.0.10 130 3/3/2024
2024.0.9 86 2/27/2024
2024.0.8 145 2/1/2024
2024.0.7 97 1/26/2024
2024.0.6 96 1/25/2024
2024.0.5 89 1/24/2024
2024.0.4 83 1/24/2024
2024.0.3 96 1/22/2024
2024.0.2 153 1/10/2024
2024.0.1 106 1/9/2024
2024.0.1-alpha-3 87 1/9/2024
2024.0.1-alpha-2 75 1/9/2024
2024.0.1-alpha-1 107 1/3/2024
2024.0.0 152 12/26/2023
2023.0.27 113 12/21/2023
2023.0.26 90 12/21/2023
2023.0.25 113 12/11/2023
2023.0.24 104 12/8/2023
2023.0.23 104 12/6/2023
2023.0.21 109 12/4/2023
2023.0.20 133 11/27/2023
2023.0.19 113 11/20/2023
2023.0.18 131 10/25/2023
2023.0.17 159 10/22/2023
2023.0.16 139 10/16/2023
2023.0.16-alpha-1 74 10/16/2023
2023.0.15 120 10/14/2023
2023.0.14 101 10/14/2023
2023.0.13 103 10/14/2023
2023.0.12 97 10/14/2023
2023.0.11 102 10/10/2023
2023.0.10 103 10/9/2023
2023.0.9 130 8/16/2023
2023.0.8 126 8/15/2023
2023.0.8-alpha-2 190 5/31/2023
2023.0.7 118 5/12/2023
2023.0.6 157 5/10/2023
2023.0.5 114 5/7/2023
2023.0.4 137 4/22/2023
2023.0.3 168 4/19/2023
2023.0.2 170 4/6/2023
2023.0.1 183 3/13/2023
2022.9.0 263 10/15/2022