using SurrealDb.Net.Models; namespace RelayServer.Models; /// /// Surreal record for the `client_public_keys` table. Stores the RSA public key each user /// has registered. Written by HandleRegisterKey, read by DeliverToServerMembers and history /// fetches to encrypt outbound messages per recipient. /// /// When a client reinstalls and regenerates a keypair, the existing row is updated rather /// than duplicated (ClientKeyService.RegisterOrUpdateKeyAsync). /// public class ClientPublicKeys : Record { /// Mixed-case username as the user registered it. Used as the lookup key. public required string Username { get; set; } /// Base64 SubjectPublicKeyInfo (DER) of the user's RSA public key. public required string PublicKey { get; set; } /// When the user first registered. public required DateTime CreatedAt { get; set; } /// When the key was last updated (key rotation, reinstall). public required DateTime UpdatedAt { get; set; } }