search and ai stabilization work, localization stablized.

This commit is contained in:
master
2026-02-24 23:29:36 +02:00
parent 4f947a8b61
commit b07d27772e
766 changed files with 55299 additions and 3221 deletions

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using static StellaOps.Localization.T;
namespace StellaOps.Cryptography;
@@ -29,7 +30,7 @@ public sealed class CryptoProviderRegistry : ICryptoProviderRegistry
var providerList = providers.ToList();
if (providerList.Count == 0)
{
throw new ArgumentException("At least one crypto provider must be registered.", nameof(providers));
throw new ArgumentException(_t("crypto.registry.empty"), nameof(providers));
}
providersByName = providerList.ToDictionary(p => p.Name, StringComparer.OrdinalIgnoreCase);
@@ -66,7 +67,7 @@ public sealed class CryptoProviderRegistry : ICryptoProviderRegistry
{
if (string.IsNullOrWhiteSpace(algorithmId))
{
throw new ArgumentException("Algorithm identifier is required.", nameof(algorithmId));
throw new ArgumentException(_t("crypto.registry.algorithm_required"), nameof(algorithmId));
}
foreach (var provider in EnumerateCandidates())
@@ -79,8 +80,14 @@ public sealed class CryptoProviderRegistry : ICryptoProviderRegistry
}
CryptoProviderMetrics.RecordProviderResolutionFailure(capability, algorithmId);
throw new InvalidOperationException(
$"No crypto provider is registered for capability '{capability}' and algorithm '{algorithmId}'.");
var notSupportedMessage = capability switch
{
CryptoCapability.Signing => _t("crypto.registry.signing_not_supported", algorithmId),
CryptoCapability.ContentHashing => _t("crypto.registry.hash_not_supported", algorithmId),
CryptoCapability.Verification => _t("crypto.registry.verify_not_supported", algorithmId),
_ => _t("crypto.registry.signing_not_supported", algorithmId)
};
throw new InvalidOperationException(notSupportedMessage);
}
public CryptoSignerResolution ResolveSigner(
@@ -113,7 +120,7 @@ public sealed class CryptoProviderRegistry : ICryptoProviderRegistry
{
if (string.IsNullOrWhiteSpace(algorithmId))
{
throw new ArgumentException("Algorithm identifier is required.", nameof(algorithmId));
throw new ArgumentException(_t("crypto.registry.algorithm_required"), nameof(algorithmId));
}
if (!string.IsNullOrWhiteSpace(preferredProvider) &&
@@ -122,7 +129,7 @@ public sealed class CryptoProviderRegistry : ICryptoProviderRegistry
if (!hinted.Supports(CryptoCapability.ContentHashing, algorithmId))
{
throw new InvalidOperationException(
$"Provider '{preferredProvider}' does not support content hashing with algorithm '{algorithmId}'.");
_t("crypto.provider.no_content_hashing", preferredProvider));
}
var hasher = hinted.GetHasher(algorithmId);