ApiKeyRecord
AgentPrism.Abstractions.dllAn API key’s database-stored view, which CARRIES no raw VALUE.
public sealed record ApiKeyRecord : IEquatable<ApiKeyRecord>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”This record has no raw key. Only an irreversible SHA-256 digest sits in the database (nowhere but ApiKeyRecord.KeyPrefix); the raw value is returned once, only at creation time, via ApiKeyCreationResult.PlaintextKey.
Constructors
Section titled “Constructors”ApiKeyRecord()
Section titled “ ApiKeyRecord()”public ApiKeyRecord()Properties
Section titled “Properties”CreatedAt
Section titled “ CreatedAt”The creation time (UTC).
public required DateTimeOffset CreatedAt { get; init; }Property Value
Section titled “Property Value”ExpiresAt
Section titled “ ExpiresAt”The expiration. Never expires if null.
public DateTimeOffset? ExpiresAt { get; init; }Property Value
Section titled “Property Value”The key identifier.
public required Guid Id { get; init; }Property Value
Section titled “Property Value”IsActive
Section titled “ IsActive”true if the key is not revoked and has not expired.
public bool IsActive { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”For DISPLAY ONLY (the UI list, GET /api/api-keys). The actual
authentication decision is made in ApiKeyAuthenticator with an
injected TimeProvider; using
DateTimeOffset.UtcNow here is not a security decision
and does not affect testability.
KeyPrefix
Section titled “ KeyPrefix”The raw value’s first characters; used to distinguish the key in a list.
public required string KeyPrefix { get; init; }Property Value
Section titled “Property Value”LastUsedAt
Section titled “ LastUsedAt”The last-used time. Used to spot an unused key.
public DateTimeOffset? LastUsedAt { get; init; }Property Value
Section titled “Property Value”The name for the operator to recognize the key by.
public required string Name { get; init; }Property Value
Section titled “Property Value”RevokedAt
Section titled “ RevokedAt”The revocation timestamp. The row is not DELETED; the audit trail is preserved through this field.
public DateTimeOffset? RevokedAt { get; init; }Property Value
Section titled “Property Value”Scopes
Section titled “ Scopes”The scope set. The effective authority is role ∩ scope.
public required IReadOnlyList<ApiKeyScope> Scopes { get; init; }Property Value
Section titled “Property Value”TenantId
Section titled “ TenantId”The tenant the key is bound to. On authentication, the tenant is resolved FROM HERE.
public required string TenantId { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(ApiKeyRecord?)
Section titled “ Equals(ApiKeyRecord?)”public bool Equals(ApiKeyRecord? other)Parameters
Section titled “Parameters”other ApiKeyRecord?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(ApiKeyRecord?, ApiKeyRecord?)
Section titled “ operator ==(ApiKeyRecord?, ApiKeyRecord?)”public static bool operator ==(ApiKeyRecord? left, ApiKeyRecord? right)Parameters
Section titled “Parameters”left ApiKeyRecord?
right ApiKeyRecord?
Returns
Section titled “Returns”operator !=(ApiKeyRecord?, ApiKeyRecord?)
Section titled “ operator !=(ApiKeyRecord?, ApiKeyRecord?)”public static bool operator !=(ApiKeyRecord? left, ApiKeyRecord? right)Parameters
Section titled “Parameters”left ApiKeyRecord?
right ApiKeyRecord?