38 lines
1.6 KiB
C#
38 lines
1.6 KiB
C#
using SurrealDb.Net.Models;
|
|
|
|
namespace RelayServer.Models;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public class ChannelMessages : Record
|
|
{
|
|
/// <summary>"channels:xyz" — which channel this belongs to.</summary>
|
|
public required string ChannelId { get; set; }
|
|
|
|
/// <summary>"users:keeper317" — who wrote it. Lowercased to match CoreClientService's id format.</summary>
|
|
public required string SenderUserId { get; set; }
|
|
|
|
/// <summary>Base64 AES-GCM ciphertext of the JSON-serialised ChatMessageContent.</summary>
|
|
public required string CipherText { get; set; }
|
|
|
|
/// <summary>Base64 AES-GCM 96-bit nonce. Different every message.</summary>
|
|
public required string Nonce { get; set; }
|
|
|
|
/// <summary>Base64 AES-GCM 128-bit authentication tag.</summary>
|
|
public required string Tag { get; set; }
|
|
|
|
/// <summary>UTC timestamp of original send. Drives history ordering.</summary>
|
|
public required DateTime CreatedAt { get; set; }
|
|
|
|
/// <summary>UTC timestamp of last edit. Null = never edited. Drives the (edited) bubble footer.</summary>
|
|
public DateTime? EditedAt { get; set; }
|
|
|
|
/// <summary>Soft-delete flag. Tombstones in history responses; bubbles show "deleted" placeholder.</summary>
|
|
public bool IsDeleted { get; set; }
|
|
}
|