using DigitalData.Core.Security.Cryptographer;
namespace DigitalData.Core.Security.Config
{
public class AsymCryptParams : RSAFactoryParams
{
public string PemDirectory { get; init; } = string.Empty;
///
/// Represents the separator used to concatenate the components of a token string.
///
///
/// The resulting token string is constructed as follows:
/// string.Join(Separator, Issuer, Audience, Secret_version).
/// If Secret_version is not null, it will be included in the concatenation.
///
///
/// For example, if Separator = "_-_", the output might look like:
/// "Issuer_-_Audience_-_Secret_version".
///
public string Separator { get; init; } = "_-_";
public IEnumerable Decryptors { get; init; } = new List();
public override void OnDeserialized()
{
base.OnDeserialized();
// Create root folder if it does not exist
if (!Directory.Exists(PemDirectory))
Directory.CreateDirectory(PemDirectory);
foreach (var crypt in Decryptors)
{
// set default path
if (crypt.IsPemNull)
{
var file_name_params = new List