- Marked `IEnvelopeReceiverRepository` and several repository classes as obsolete, recommending the use of `IRepository`. - Corrected `using` directive in `IReceiverService.cs`. - Removed `UpdateAsync` method from `IReceiverService`. - Enhanced `ISmsSender` interface with new properties and methods. - Updated `ReceiverCreateDto`, `ReceiverReadDto`, and `UserReceiverDto` to enforce non-nullable properties. - Refactored `TestReceiverController` to suggest using `MediatR`.
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
|
|
namespace EnvelopeGenerator.Application.DTOs.Receiver;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[ApiExplorerSettings(IgnoreApi = true)]
|
|
public record ReceiverCreateDto
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public ReceiverCreateDto()
|
|
{
|
|
_sha256HexOfMail = new(() =>
|
|
{
|
|
var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress!.ToUpper());
|
|
var hash_arr = SHA256.HashData(bytes_arr);
|
|
var hexa_str = BitConverter.ToString(hash_arr);
|
|
return hexa_str.Replace("-", string.Empty);
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[EmailAddress]
|
|
public required string EmailAddress { get; init; }
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public string? TotpSecretkey { get; init; }
|
|
|
|
/// <summary>
|
|
/// var bytes_arr = Encoding.UTF8.GetBytes(EmailAddress.ToUpper());<br/>
|
|
/// var hash_arr = SHA256.HashData(bytes_arr);
|
|
/// var hexa_str = BitConverter.ToString(hash_arr);
|
|
/// return hexa_str.Replace("-", string.Empty);
|
|
/// </summary>
|
|
public string Signature => _sha256HexOfMail.Value;
|
|
|
|
private readonly Lazy<string> _sha256HexOfMail;
|
|
|
|
/// <summary>
|
|
/// Default value is DateTime.Now
|
|
/// </summary>
|
|
public DateTime AddedWhen { get; } = DateTime.Now;
|
|
}; |