feat(RSACryptographerList): Hinzufügen der Methode try get mit dem Wort out-key

This commit is contained in:
Developer 02 2024-12-05 14:36:28 +01:00
parent 738005f5dc
commit 016d8bdcf2

View File

@ -19,6 +19,12 @@ namespace DigitalData.Core.Security.Cryptographer
=> _cryptographers.SingleOrDefault(crypt => _keyGenerator(crypt) == key)
?? throw new InvalidOperationException($"No {typeof(TRSACryptographer).GetType().Name.TrimStart('I')} found with Key: {key}.");
public bool TryGet(string key, out TRSACryptographer? cryptographer)
{
cryptographer = _cryptographers.SingleOrDefault(crypt => _keyGenerator(crypt) == key);
return cryptographer is not null;
}
public IEnumerator<TRSACryptographer> GetEnumerator() => _cryptographers.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();