From 31d6a0d00ecc4d088c63e3c701ba9bb5ede892f5 Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Mon, 31 May 2021 01:08:05 +0300 Subject: [PATCH] Created OTPService.GenerateCode (markdown) --- OTPService.GenerateCode.md | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 OTPService.GenerateCode.md 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