1
0
mirror of https://github.com/XFox111/SimpleOTP.git synced 2026-04-22 08:00:45 +03:00

Version 1.2.0 (#16)

* Expanded support to .NET Standard 2.1 and .NET Core 3.1
* Fixed documentation typos #14 (#15)

Co-authored-by: Akshay Kumar <72260914+AXE02@users.noreply.github.com>
This commit is contained in:
2021-06-06 12:36:49 +03:00
committed by GitHub
parent 9b2376c326
commit 66eab0a589
4 changed files with 13 additions and 10 deletions
+3 -2
View File
@@ -27,7 +27,8 @@ See more documentation at [project's wiki](https://github.com/xfox111/SimpleOTP/
```csharp
string sample_config_uri = "otpauth://totp/FoxDev%20Studio:eugene@xfox111.net?secret=ESQVTYRM2CWZC3NX24GRRWIAUUWVHWQH&issuer=FoxDev%20Studio";
OTPConfiguration config = OTPConfiguration.GetConfiguration(sample_config_uri);
// OTPModel { Id = af2358b0-3f69-4dd7-9537-32c07d6663aa, Type = TOTP, IssuerLabel = FoxDev Studio, AccountName = eugene@xfox111.net, Secret = ESQVTYRM2CWZC3NX24GRRWIAUUWVHWQH, Issuer = FoxDev Studio, Algorithm = SHA1, Digits = 6, Counter = 0, Period = 00:00:30 }
// OTPConfiguration { Id = af2358b0-3f69-4dd7-9537-32c07d6663aa, Type = TOTP, IssuerLabel = FoxDev Studio, AccountName = eugene@xfox111.net, Secret = ESQVTYRM2CWZC3NX24GRRWIAUUWVHWQH, Issuer = FoxDev Studio, Algorithm = SHA1, Digits = 6, Counter = 0, Period = 00:00:30 }
OTPCode code = OTPService.GenerateCode(ref config);
// OTPasswordModel { Code = 350386, Expiring = 23-May-21 06:08:30 PM }
@@ -53,7 +54,7 @@ string qrCode = config.GetQrImage(300); // data:image/png;base64,...
OTPFactory factory = new (config);
factory.CodeUpdated += (newCode) => Console.WriteLine(newCode);
// OTPasswordModel { Code = 350386, Expiring = 23-May-21 06:08:30 PM }
// OTPCode { Code = 350386, Expiring = 23-May-21 06:08:30 PM }
factory.PropertyChanged += (sender, args) =>
{
if (args.PropertyName == nameof(factory.TimeLeft))
+2 -2
View File
@@ -33,7 +33,7 @@ namespace SimpleOTP.Models
/// <summary>
/// Initializes a new instance of the <see cref="OTPCode"/> class.<br/>
/// Use this contructor only for HOTP key. Otherwise, fill out all properties.
/// Use this constructor only for HOTP key. Otherwise, fill out all properties.
/// </summary>
/// <param name="code">OTP code.</param>
public OTPCode(int code) =>
@@ -48,4 +48,4 @@ namespace SimpleOTP.Models
public string GetCode(string formatter = "000000") =>
Code.ToString(formatter);
}
}
}
+3 -3
View File
@@ -26,7 +26,7 @@ namespace SimpleOTP.Models
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>
/// Gets or sets oTP algorithm type.
/// Gets or sets OTP algorithm type.
/// </summary>
public OTPType Type { get; set; } = OTPType.TOTP;
@@ -217,7 +217,7 @@ namespace SimpleOTP.Models
HttpResponseMessage response = client.GetAsync($"https://chart.googleapis.com/chart?cht=qr&chs={qrCodeSize}x{qrCodeSize}&chl={HttpUtility.UrlEncode(GetUri().AbsoluteUri)}").Result;
if (!response.IsSuccessStatusCode)
throw new HttpRequestException("Response status code indicates that request has failed", null, response.StatusCode);
throw new HttpRequestException($"Response status code indicates that request has failed (Response code: {response.StatusCode})");
byte[] imageBytes = await response.Content.ReadAsByteArrayAsync();
string imageString = @$"data:image/png;base64,{Convert.ToBase64String(imageBytes)}";
@@ -225,4 +225,4 @@ namespace SimpleOTP.Models
return imageString;
}
}
}
}
+5 -3
View File
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFrameworks>net5.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<LangVersion>9</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
@@ -11,7 +12,7 @@
<PropertyGroup>
<PackageId>SimpleOTP</PackageId>
<AssemblyName>SimpleOTP</AssemblyName>
<Version>1.1.0</Version>
<Version>1.2.0</Version>
<Description>.NET library for TOTP/HOTP implementation on server (ASP.NET) or client (Xamarin) side</Description>
<Authors>Eugene Fox</Authors>
<Company>FoxDev Studio</Company>
@@ -21,7 +22,8 @@
<RepositoryUrl>https://github.com/XFox111/SimpleOTP</RepositoryUrl>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageTags>otp;totp;dotnet;hotp;authenticator;2fa;mfa;security;oath</PackageTags>
<PackageReleaseNotes>- Updated OTP validation methods signatures: `ValidateCode()` is now deprecated and will be removed in future releases</PackageReleaseNotes>
<PackageReleaseNotes>- Expanded support to .NET Standard 2.1 and .NET Core 3.1
- Fixed some documentation typos (https://github.com/XFox111/SimpleOTP/issues/14)</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">