remove lazy loading of signature

This commit is contained in:
tekh 2025-08-29 10:03:19 +02:00
parent ab9a6cd595
commit aa1e218b37

View File

@ -11,20 +11,6 @@ namespace EnvelopeGenerator.Application.Receivers.Commands;
[ApiExplorerSettings(IgnoreApi = true)]
public record CreateReceiverCommand
{
/// <summary>
///
/// </summary>
public CreateReceiverCommand()
{
_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>
@ -42,9 +28,16 @@ public record CreateReceiverCommand
/// var hexa_str = BitConverter.ToString(hash_arr);
/// return hexa_str.Replace("-", string.Empty);
/// </summary>
public string Signature => _sha256HexOfMail.Value;
private readonly Lazy<string> _sha256HexOfMail;
public string Signature
{
get
{
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>
/// Default value is DateTime.Now