// SPDX-FileCopyrightText: 2026 Progmasoft // SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 namespace Progmasoft.Progmaweb.Api.Accounts; /// An account as the store keeps it. /// Stable identifier; sessions refer to the account by it. /// Account name in its canonical spelling, as shown and used in URLs. /// Upper-case form of the name; the uniqueness key. /// Email address as the owner entered it. /// Upper-case form of the address; the uniqueness key. /// /// Subject identifier of the linked Google identity; for a password account. /// /// /// ASP.NET Core Identity password hash; for an account that signs in through Google only. /// /// Moment the account was created, in UTC. /// /// Version of the policies the owner accepted, at the time; /// for an account created before registration asked for it, or by operations tooling. /// /// Moment the owner accepted them, in UTC; null when the version is. internal sealed record AccountRecord( Guid Id, string AccountName, string NormalizedAccountName, string Email, string NormalizedEmail, string? GoogleSubject, string? PasswordHash, DateTimeOffset CreatedAt, string? PoliciesVersion = null, DateTimeOffset? PoliciesAcceptedAt = null); /// A session as the store keeps it. /// SHA-256 digest of the session token. The token itself is never stored. /// Identifier of the account the session belongs to. /// Moment the session was opened, in UTC. /// Moment the session stops being valid, in UTC. internal sealed record SessionRecord( byte[] TokenDigest, Guid AccountId, DateTimeOffset CreatedAt, DateTimeOffset ExpiresAt);