search and ai stabilization work, localization stablized.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Audit.ReplayToken;
|
||||
|
||||
public sealed partial class ReplayToken
|
||||
@@ -11,20 +13,20 @@ public sealed partial class ReplayToken
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(canonical))
|
||||
{
|
||||
throw new ArgumentException("Token cannot be empty.", nameof(canonical));
|
||||
throw new ArgumentException(_t("common.audit.replay_token_empty"), nameof(canonical));
|
||||
}
|
||||
|
||||
var parts = canonical.Split(':', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (parts.Length < 4 || parts.Length > 5 || !string.Equals(parts[0], Scheme, StringComparison.Ordinal))
|
||||
{
|
||||
throw new FormatException($"Invalid replay token format: {canonical}");
|
||||
throw new FormatException(_t("common.audit.replay_token_format_invalid", canonical));
|
||||
}
|
||||
|
||||
var versionPart = parts[1];
|
||||
if (!versionPart.StartsWith("v", StringComparison.Ordinal) || versionPart.Length <= 1)
|
||||
{
|
||||
throw new FormatException($"Invalid replay token version: {canonical}");
|
||||
throw new FormatException(_t("common.audit.replay_token_version_invalid", canonical));
|
||||
}
|
||||
|
||||
var version = versionPart[1..];
|
||||
@@ -36,7 +38,7 @@ public sealed partial class ReplayToken
|
||||
{
|
||||
if (!long.TryParse(parts[4], out var unixSeconds))
|
||||
{
|
||||
throw new FormatException($"Invalid expiration timestamp in replay token: {canonical}");
|
||||
throw new FormatException(_t("common.audit.replay_token_expiration_invalid", canonical));
|
||||
}
|
||||
expiresAt = DateTimeOffset.FromUnixTimeSeconds(unixSeconds);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Audit.ReplayToken;
|
||||
|
||||
/// <summary>
|
||||
@@ -67,7 +69,7 @@ public sealed partial class ReplayToken : IEquatable<ReplayToken>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
throw new ArgumentException("Token value cannot be empty.", nameof(value));
|
||||
throw new ArgumentException(_t("common.audit.replay_token_value_empty"), nameof(value));
|
||||
}
|
||||
|
||||
Value = value.Trim();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using static StellaOps.Localization.T;
|
||||
|
||||
namespace StellaOps.Audit.ReplayToken;
|
||||
|
||||
@@ -51,7 +52,7 @@ public sealed partial class Sha256ReplayTokenGenerator
|
||||
var key = kvp.Key.Trim();
|
||||
if (!seen.Add(key))
|
||||
{
|
||||
throw new ArgumentException($"AdditionalContext contains duplicate key after normalization: '{key}'.", nameof(values));
|
||||
throw new ArgumentException(_t("common.audit.replay_token_duplicate_context_key", key), nameof(values));
|
||||
}
|
||||
|
||||
normalized.Add(new KeyValuePair<string, string>(key, kvp.Value?.Trim() ?? string.Empty));
|
||||
|
||||
@@ -16,5 +16,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\\StellaOps.Cryptography\\StellaOps.Cryptography.csproj" />
|
||||
<ProjectReference Include="..\\StellaOps.Localization\\StellaOps.Localization.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user