feat(RSACryptographer): RsaSecurityKey.get Eigenschaft mit Lazy Loading hinzugefügt

This commit is contained in:
Developer 02 2024-12-19 01:52:00 +01:00
parent 66ed34b664
commit ed29c9f990

View File

@ -1,4 +1,5 @@
using DigitalData.Core.Abstractions.Security;
using Microsoft.IdentityModel.Tokens;
using System.Reflection;
using System.Security.Cryptography;
@ -24,8 +25,15 @@ namespace DigitalData.Core.Security.Cryptographer
public string Audience { get; init; } = string.Empty;
private readonly Lazy<RsaSecurityKey> _lazyRsaSecurityKey;
public RsaSecurityKey RsaSecurityKey => _lazyRsaSecurityKey.Value;
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
internal RSACryptographer() { }
internal RSACryptographer()
{
_lazyRsaSecurityKey = new(() => new RsaSecurityKey(RSA));
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
}
}