diff --git a/OTPService.ValidateTotp.md b/OTPService.ValidateTotp.md new file mode 100644 index 0000000..1bfcf32 --- /dev/null +++ b/OTPService.ValidateTotp.md @@ -0,0 +1,36 @@ +Namespace: `SimpleOTP` + +Assembly: `SimpleOTP.dll` + +Validates provided TOTP code with provided parameters. +```csharp +public static bool ValidateTotp(int otp, OTPConfiguration target, TimeSpan? toleranceTime = null); +``` +### Parameters +`otp` `Int32` + +OTP code to validate. + +`target` [OTPConfiguration](https://github.com/XFox111/SimpleOTP/wiki/OTPConfiguration) + +OTP configuration for check codes generation. + +`toleranceTime` [TimeSpan?](https://docs.microsoft.com/en-us/dotnet/api/system.timespan?view=net-5.0) + +Time span from which OTP codes remain valid. Default: 15 seconds. + +### 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.HOTP` + +[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 Time-based OTP codes. \ No newline at end of file