mirror of
https://github.com/XFox111/SimpleOTP.git
synced 2026-04-23 08:08:40 +03:00
Created OTPService.ValidateHotp (markdown)
@@ -0,0 +1,39 @@
|
|||||||
|
Namespace: `SimpleOTP`
|
||||||
|
|
||||||
|
Assembly: `SimpleOTP.dll`
|
||||||
|
|
||||||
|
Validates provided HOTP code with provided parameters.
|
||||||
|
```csharp
|
||||||
|
public static bool ValidateHotp(int otp, ref OTPConfiguration target, int toleranceSpan, bool resyncCounter);
|
||||||
|
```
|
||||||
|
### Parameters
|
||||||
|
`otp` `Int32`
|
||||||
|
|
||||||
|
HOTP code to validate.
|
||||||
|
|
||||||
|
`target` [OTPConfiguration](https://github.com/XFox111/SimpleOTP/wiki/OTPConfiguration)
|
||||||
|
|
||||||
|
OTP configuration for check codes generation.
|
||||||
|
|
||||||
|
`toleranceSpan` `Int32`
|
||||||
|
|
||||||
|
Counter span from which OTP codes remain valid.
|
||||||
|
|
||||||
|
`resyncCounter` `Boolean`
|
||||||
|
|
||||||
|
Defines whether method should resync <see `OTPConfiguration.Counter` of the `target` or not after successful validation.
|
||||||
|
### Returns
|
||||||
|
`True` if code is valid, `False` if it isn't.
|
||||||
|
|
||||||
|
### Exceptions
|
||||||
|
[ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.ArgumentException?view=net-5.0)
|
||||||
|
|
||||||
|
`target.Type` is `OTPType.TOTP`
|
||||||
|
|
||||||
|
[NullReferenceException](https://docs.microsoft.com/en-us/dotnet/api/system.nullreferenceexception?view=net-5.0)
|
||||||
|
|
||||||
|
`target` is `null`
|
||||||
|
### Examples
|
||||||
|
See `OTPService` usage examples on [Code generation/validation](https://github.com/XFox111/SimpleOTP/wiki/Code-generation-or-validation)
|
||||||
|
### Remarks
|
||||||
|
Use this method only with HOTP codes.
|
||||||
Reference in New Issue
Block a user