using SurrealDb.Net.Models; namespace RelayServer.Models; /// /// Surreal record for the `channel_messages` table. One row per message. /// /// Encryption: CipherText/Nonce/Tag use the channel AES key (ChannelDbKey), NOT any user's /// RSA keypair. This means the server can decrypt for history queries; the per-recipient /// RSA wrapping happens at delivery time in DeliverToServerMembers. /// public class ChannelMessages : Record { /// "channels:xyz" — which channel this belongs to. public required string ChannelId { get; set; } /// "users:keeper317" — who wrote it. Lowercased to match CoreClientService's id format. public required string SenderUserId { get; set; } /// Base64 AES-GCM ciphertext of the JSON-serialised ChatMessageContent. public required string CipherText { get; set; } /// Base64 AES-GCM 96-bit nonce. Different every message. public required string Nonce { get; set; } /// Base64 AES-GCM 128-bit authentication tag. public required string Tag { get; set; } /// UTC timestamp of original send. Drives history ordering. public required DateTime CreatedAt { get; set; } /// UTC timestamp of last edit. Null = never edited. Drives the (edited) bubble footer. public DateTime? EditedAt { get; set; } /// Soft-delete flag. Tombstones in history responses; bubbles show "deleted" placeholder. public bool IsDeleted { get; set; } }