Implement chat server auth, models, handlers, and docs context

This commit is contained in:
Foxyz committed 2026-02-20 03:44:02 +03:00
1 parent 23602efd5f
commit f6b27565cd
16 files changed
+1285 -152

No files matched your search

+13 -12
View File
@@ -1,18 +1,18 @@
import 'package:objectbox/objectbox.dart';
/// User entity - works for both HOME and GUEST servers
///
///
/// On HOME server:
/// - isLocal = true
/// - stores password, encrypted private key
/// - this is where identity lives
///
///
/// On GUEST server:
/// - isLocal = false
/// - homeServer contains the URL of user's home
/// - publicKey cached for verification
@Entity()
class User {
@Entity(uid: 3848231140411393897)
class ChatUser {
@Id()
int id = 0;
@@ -37,7 +37,8 @@ class User {
// Server relationship
bool isLocal; // true = this is their home server
String? homeServer; // if guest, where is their home? (e.g., "https://my.server.com")
String?
homeServer; // if guest, where is their home? (e.g., "https://my.server.com")
// Server-specific
List<String> roles; // ["admin", "moderator", "member"]
@@ -48,7 +49,7 @@ class User {
@Property(type: PropertyType.date)
DateTime? lastSyncedAt; // When profile was last refreshed from home
User({
ChatUser({
required this.userId,
required this.username,
required this.publicKey,
@@ -68,8 +69,8 @@ class User {
lastSyncedAt = lastSyncedAt;
}
@Entity()
class Channel {
@Entity(uid: 2663861829934850300)
class ChatChannel {
@Id()
int id = 0;
@@ -81,15 +82,15 @@ class Channel {
@Property(type: PropertyType.date)
DateTime createdAt;
Channel({
ChatChannel({
required this.name,
this.description,
DateTime? createdAt,
}) : createdAt = createdAt ?? DateTime.now();
}
@Entity()
class Message {
@Entity(uid: 2697867424319168785)
class ChatMessage {
@Id()
int id = 0;
@@ -112,7 +113,7 @@ class Message {
@Property(type: PropertyType.date)
DateTime? editedAt;
Message({
ChatMessage({
required this.channelId,
required this.authorLocalId,
required this.authorUserId,