diff --git a/OTPConfiguration.GetConfiguration.md b/OTPConfiguration.GetConfiguration.md new file mode 100644 index 0000000..9498d3b --- /dev/null +++ b/OTPConfiguration.GetConfiguration.md @@ -0,0 +1,94 @@ +Namespace: `SimpleOTP.Models` + +Assembly: `SimpleOTP.dll` + +## Overloads +| Overload | Description | +| --- | --- | +| [GetConfiguration(string, string, string)](#GetConfigurationstring-string-string) | Load OTP configuraiton with default parameters. | +| [GetConfiguration(string)](#GetConfigurationstring) | Loads OTP configuration from OTP AUTH URI. | +| [GetConfiguration(Uri)](#GetConfigurationUri) | Loads OTP configuration from OTP AUTH URI. | + +## GetConfiguration(string, string, string) +Load OTP configuraiton with default parameters. +```csharp +public static OTPConfiguration GetConfiguration(string secret, string issuer, string accountName); +``` +### Parameters +`secret` `string` + +OTP generator secret key (Base32 encoded string). + +`issuer` `string` + +Name of your application/service. + +`accountName` `string` + +Username/email of the user. +### Returns +Valid `OTPConfiguration` configuraion. + +### Remarks +Default parameters for generated configuration: +- OTP algorithm: Time-based OTP +- Key length: 160 bit (20 characters) +- Hashing algorithm: HMAC-SHA-1 +- OTP length: 6 digits +- Period: 30 seconds + +--- + +## GetConfiguration(string) +Loads OTP configuration from OTP AUTH URI. +```csharp +public static OTPConfiguration GetConfiguration(string uri); +``` +### Parameters +`uri` `string` + +OTP Auth URI. Should be correctly formed. + +### Returns +Valid `OTPConfiguration` configuraion. +### Exceptions +[UriFormatException](https://docs.microsoft.com/en-us/dotnet/api/system.nullreferenceexception?view=net-5.0) + +`uri` is a malformed URI. See [here](https://docs.microsoft.com/en-us/dotnet/api/system.uri.-ctor?view=net-5.0#System_Uri__ctor_System_String_) for more info + +[ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.ArgumentException?view=net-5.0) + +`uri` is a malformed OTP URI: some values are missing or incorrect. + +### Remarks +For more information on OTP URI format please refer to [Key Uri Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format) + +--- + +## GetConfiguration(Uri) +Loads OTP configuration from OTP AUTH URI. +```csharp +public static OTPConfiguration GetConfiguration(Uri uri); +``` +### Parameters +`uri` [Uri](https://docs.microsoft.com/en-us/dotnet/api/system.uri?view=net-5.0) + +OTP Auth URI. Should be correctly formed. + +### Returns +Valid `OTPConfiguration` configuraion. +### Exceptions +[UriFormatException](https://docs.microsoft.com/en-us/dotnet/api/system.nullreferenceexception?view=net-5.0) + +`uri` is a malformed URI. See [here](https://docs.microsoft.com/en-us/dotnet/api/system.uri.-ctor?view=net-5.0#System_Uri__ctor_System_String_) for more info + +[ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.ArgumentException?view=net-5.0) + +`uri` is a malformed OTP URI: some values are missing or incorrect. + +[ArgumentNullException](https://docs.microsoft.com/en-us/dotnet/api/system.ArgumentNullException?view=net-5.0) + +`uri` is `null` + +### Remarks +For more information on OTP URI format please refer to [Key Uri Format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format) \ No newline at end of file