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:
@@ -27,7 +27,8 @@ See more documentation at [project's wiki](https://github.com/xfox111/SimpleOTP/
|
|||||||
```csharp
|
```csharp
|
||||||
string sample_config_uri = "otpauth://totp/FoxDev%20Studio:eugene@xfox111.net?secret=ESQVTYRM2CWZC3NX24GRRWIAUUWVHWQH&issuer=FoxDev%20Studio";
|
string sample_config_uri = "otpauth://totp/FoxDev%20Studio:eugene@xfox111.net?secret=ESQVTYRM2CWZC3NX24GRRWIAUUWVHWQH&issuer=FoxDev%20Studio";
|
||||||
OTPConfiguration config = OTPConfiguration.GetConfiguration(sample_config_uri);
|
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);
|
OTPCode code = OTPService.GenerateCode(ref config);
|
||||||
// OTPasswordModel { Code = 350386, Expiring = 23-May-21 06:08:30 PM }
|
// 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);
|
OTPFactory factory = new (config);
|
||||||
|
|
||||||
factory.CodeUpdated += (newCode) => Console.WriteLine(newCode);
|
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) =>
|
factory.PropertyChanged += (sender, args) =>
|
||||||
{
|
{
|
||||||
if (args.PropertyName == nameof(factory.TimeLeft))
|
if (args.PropertyName == nameof(factory.TimeLeft))
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace SimpleOTP.Models
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="OTPCode"/> class.<br/>
|
/// 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>
|
/// </summary>
|
||||||
/// <param name="code">OTP code.</param>
|
/// <param name="code">OTP code.</param>
|
||||||
public OTPCode(int code) =>
|
public OTPCode(int code) =>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace SimpleOTP.Models
|
|||||||
public Guid Id { get; set; } = Guid.NewGuid();
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets oTP algorithm type.
|
/// Gets or sets OTP algorithm type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OTPType Type { get; set; } = OTPType.TOTP;
|
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;
|
HttpResponseMessage response = client.GetAsync($"https://chart.googleapis.com/chart?cht=qr&chs={qrCodeSize}x{qrCodeSize}&chl={HttpUtility.UrlEncode(GetUri().AbsoluteUri)}").Result;
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
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();
|
byte[] imageBytes = await response.Content.ReadAsByteArrayAsync();
|
||||||
string imageString = @$"data:image/png;base64,{Convert.ToBase64String(imageBytes)}";
|
string imageString = @$"data:image/png;base64,{Convert.ToBase64String(imageBytes)}";
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFrameworks>net5.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
|
||||||
|
<LangVersion>9</LangVersion>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||||
@@ -11,7 +12,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>SimpleOTP</PackageId>
|
<PackageId>SimpleOTP</PackageId>
|
||||||
<AssemblyName>SimpleOTP</AssemblyName>
|
<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>
|
<Description>.NET library for TOTP/HOTP implementation on server (ASP.NET) or client (Xamarin) side</Description>
|
||||||
<Authors>Eugene Fox</Authors>
|
<Authors>Eugene Fox</Authors>
|
||||||
<Company>FoxDev Studio</Company>
|
<Company>FoxDev Studio</Company>
|
||||||
@@ -21,7 +22,8 @@
|
|||||||
<RepositoryUrl>https://github.com/XFox111/SimpleOTP</RepositoryUrl>
|
<RepositoryUrl>https://github.com/XFox111/SimpleOTP</RepositoryUrl>
|
||||||
<NeutralLanguage>en-US</NeutralLanguage>
|
<NeutralLanguage>en-US</NeutralLanguage>
|
||||||
<PackageTags>otp;totp;dotnet;hotp;authenticator;2fa;mfa;security;oath</PackageTags>
|
<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>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
|||||||
Reference in New Issue
Block a user