27 lines
1.0 KiB
C#
27 lines
1.0 KiB
C#
using SurrealDb.Net.Models;
|
|
|
|
namespace RelayServer.Models;
|
|
|
|
/// <summary>
|
|
/// 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).
|
|
/// </summary>
|
|
public class ClientPublicKeys : Record
|
|
{
|
|
/// <summary>Mixed-case username as the user registered it. Used as the lookup key.</summary>
|
|
public required string Username { get; set; }
|
|
|
|
/// <summary>Base64 SubjectPublicKeyInfo (DER) of the user's RSA public key.</summary>
|
|
public required string PublicKey { get; set; }
|
|
|
|
/// <summary>When the user first registered.</summary>
|
|
public required DateTime CreatedAt { get; set; }
|
|
|
|
/// <summary>When the key was last updated (key rotation, reinstall).</summary>
|
|
public required DateTime UpdatedAt { get; set; }
|
|
}
|