63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using OtpNet;
|
|
|
|
namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public interface IAuthenticator
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="length"></param>
|
|
/// <returns></returns>
|
|
string GenerateCode(int length);
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="length"></param>
|
|
/// <returns></returns>
|
|
string GenerateTotpSecretKey(int? length = null);
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="userEmail"></param>
|
|
/// <param name="secretKey"></param>
|
|
/// <param name="issuer"></param>
|
|
/// <param name="totpUrlFormat"></param>
|
|
/// <param name="pixelsPerModule"></param>
|
|
/// <returns></returns>
|
|
byte[] GenerateTotpQrCode(string userEmail, string secretKey, string? issuer = null, string? totpUrlFormat = null, int? pixelsPerModule = null);
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="userEmail"></param>
|
|
/// <param name="length"></param>
|
|
/// <param name="issuer"></param>
|
|
/// <param name="totpUrlFormat"></param>
|
|
/// <param name="pixelsPerModule"></param>
|
|
/// <returns></returns>
|
|
byte[] GenerateTotpQrCode(string userEmail, int? length = null, string? issuer = null, string? totpUrlFormat = null, int? pixelsPerModule = null);
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="secretKey"></param>
|
|
/// <param name="step"></param>
|
|
/// <returns></returns>
|
|
string GenerateTotp(string secretKey, int step = 30);
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="totpCode"></param>
|
|
/// <param name="secretKey"></param>
|
|
/// <param name="step"></param>
|
|
/// <param name="window"></param>
|
|
/// <returns></returns>
|
|
bool VerifyTotp(string totpCode, string secretKey, int step = 30, VerificationWindow? window = null);
|
|
} |