ddad573b75
- Resolve 14 conflicts from popping local stash on top of origin'seed1e88+8d3352fdoc-comment additions (11 mechanical, plus version.rs, DashboardAuthenticatorTests.cs, DashboardGalaxyProjector.cs) - Fix 4 test files that used AGENTS.md as the repo-root sentinel (now use CLAUDE.md, since AGENTS.md was removed in4731ab5) - Redirect 10 doc citations from AGENTS.md to the matching gateway.md sections (Value Model, Status Model, Security, STA Worker Thread Model, gRPC Layer rule, cancellation rule) Verified: solution build clean, x86 worker build clean, 266/266 gateway tests passing, 121/121 worker tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
32 lines
1.4 KiB
C#
32 lines
1.4 KiB
C#
using Microsoft.Data.Sqlite;
|
|
|
|
namespace MxGateway.Server.Security.Authentication;
|
|
|
|
/// <summary>Reads API key records from SQLite query results.</summary>
|
|
public static class ApiKeyRecordReader
|
|
{
|
|
/// <summary>Deserializes a row from the API key table into an ApiKeyRecord.</summary>
|
|
/// <param name="reader">The data reader positioned at the API key row.</param>
|
|
/// <returns>The deserialized API key record.</returns>
|
|
public static ApiKeyRecord Read(SqliteDataReader reader)
|
|
{
|
|
return new ApiKeyRecord(
|
|
KeyId: reader.GetString(0),
|
|
KeyPrefix: reader.GetString(1),
|
|
SecretHash: (byte[])reader["secret_hash"],
|
|
DisplayName: reader.GetString(3),
|
|
Scopes: ApiKeyScopeSerializer.Deserialize(reader.GetString(4)),
|
|
Constraints: ApiKeyConstraintSerializer.Deserialize(reader.IsDBNull(5) ? null : reader.GetString(5)),
|
|
CreatedUtc: DateTimeOffset.Parse(reader.GetString(6), System.Globalization.CultureInfo.InvariantCulture),
|
|
LastUsedUtc: ReadNullableDateTimeOffset(reader, 7),
|
|
RevokedUtc: ReadNullableDateTimeOffset(reader, 8));
|
|
}
|
|
|
|
private static DateTimeOffset? ReadNullableDateTimeOffset(SqliteDataReader reader, int ordinal)
|
|
{
|
|
return reader.IsDBNull(ordinal)
|
|
? null
|
|
: DateTimeOffset.Parse(reader.GetString(ordinal), System.Globalization.CultureInfo.InvariantCulture);
|
|
}
|
|
}
|