refactor: Mergen von Encryptors und Decryptors in eine einzelne Sammlung

- Kombiniert `Encryptors` und `Decryptors` in `cryptographers` für eine vereinfachte Initialisierung in `OnDeserialized`.
This commit is contained in:
Developer 02 2024-12-07 03:10:29 +01:00
parent 08ffe821ff
commit 0bfec426d4

View File

@ -36,21 +36,23 @@ namespace DigitalData.Core.Security.Config
{ {
base.OnDeserialized(); base.OnDeserialized();
foreach (var decryptor in Decryptors) var cryptographers = Encryptors.Cast<IRSACryptographer>().Concat(Decryptors.Cast<IRSACryptographer>());
foreach (var crypt in cryptographers)
{ {
// set default path // set default path
if (decryptor.Pem is null) if (crypt.Pem is null)
{ {
decryptor.Directory ??= Directory; crypt.Directory ??= Directory;
decryptor.FileName ??= string.Format( crypt.FileName ??= string.Format(
FileNameFormat, FileNameFormat,
decryptor.Issuer, crypt.Issuer,
decryptor.Audience, crypt.Audience,
TypeTagOf(decryptor), TypeTagOf(crypt),
Secrets.Version); Secrets.Version);
} }
decryptor.Init(); crypt.Init();
} }
} }
} }