diff --git a/OTPService.GenerateCode.md b/OTPService.GenerateCode.md new file mode 100644 index 0000000..e67cbe8 --- /dev/null +++ b/OTPService.GenerateCode.md @@ -0,0 +1,59 @@ +Namespace: `SimpleOTP` + +Assembly: `SimpleOTP.dll` + +## Overloads +| Overload | Description | +| --- | --- | +| [GenerateCode(ref OTPConfiguration)](#GenerateCoderef-OTPConfiguration) | Generates a new OTP code with provided configuration. | +| [GenerateCode(ref OTPConfiguration, DateTime)](#GenerateCoderef-OTPConfiguration-DateTime) | Generates a new TOTP code with provided configuration and for specific interval. | + +## GenerateCode(ref OTPConfiguration) +Generates a new OTP code with provided configuration. +```csharp +public static OTPCode GenerateCode(ref OTPConfiguration target); +``` +### Parameters +`target` [OTPConfiguration](https://github.com/XFox111/SimpleOTP/wiki/OTPConfiguration) + +OTP configuration object. +### Exceptions +[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 +If you're using HOTP algorithm, save `target` after calling the function. + +If OTP algorithm is HOTP, `target` counter is increased by 1. + +--- + +## GenerateCode(ref OTPConfiguration, DateTime) +Generates a new OTP code with provided configuration. +```csharp +public static OTPCode GenerateCode(ref OTPConfiguration target, DateTime date); +``` +### Parameters +`target` [OTPConfiguration](https://github.com/XFox111/SimpleOTP/wiki/OTPConfiguration) + +OTP configuration object. + +`date` [DateTime](https://docs.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) + +`DateTime` for which the OTP should be generated. +### Returns +[OTPCode](https://github.com/XFox111/SimpleOTP/wiki/OTPCode) instance with generated code. +### Exceptions +[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 +If you're using HOTP algorithm, save `target` after calling the function. + +If you're using HOTP algorithm, `date` will be ignored. + +If OTP algorithm is HOTP, `target` counter is increased by 1. \ No newline at end of file