feat: add E2EE DMs, group chats, local serversettings.json, and security/perf fixes
This commit is contained in:
parent
b60b5a0774
commit
3b52de20d1
33 changed files with 5107 additions and 366 deletions
|
|
@ -17,6 +17,13 @@ public static class MessageTypes
|
|||
public const string ChannelListSync = "CHANNEL_LIST_SYNC";
|
||||
public const string CreateChannel = "CREATE_CHANNEL";
|
||||
public const string DeleteChannel = "DELETE_CHANNEL";
|
||||
public const string StartDm = "START_DM";
|
||||
public const string CreateGroup = "CREATE_GROUP";
|
||||
public const string InviteToGroup = "INVITE_TO_GROUP";
|
||||
public const string LeaveGroup = "LEAVE_GROUP";
|
||||
public const string PublishPublicKey = "PUBLISH_PUBLIC_KEY";
|
||||
public const string ToggleE2ee = "TOGGLE_E2EE";
|
||||
public const string FetchHistory = "FETCH_HISTORY";
|
||||
public const string UserListSync = "USER_LIST_SYNC";
|
||||
public const string FileListSync = "FILE_LIST_SYNC";
|
||||
public const string SystemNotice = "SYSTEM_NOTICE";
|
||||
|
|
@ -68,6 +75,9 @@ public class AuthResultPacket
|
|||
public string UserId { get; set; } = string.Empty;
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string Role { get; set; } = UserRoles.Member;
|
||||
public string? PublicKey { get; set; }
|
||||
public string? EncryptedPrivateKey { get; set; }
|
||||
public bool E2eeEnabled { get; set; } = true;
|
||||
public string? ErrorMessage { get; set; }
|
||||
public ServerUiSync? UiSync { get; set; }
|
||||
public string? ActiveChannelId { get; set; }
|
||||
|
|
@ -77,6 +87,9 @@ public class SendMessagePacket
|
|||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string Content { get; set; } = string.Empty;
|
||||
public bool IsEncrypted { get; set; } = false;
|
||||
public string? SenderPublicKey { get; set; }
|
||||
public string? RecipientPublicKey { get; set; }
|
||||
}
|
||||
|
||||
public class MessageBroadcastPacket
|
||||
|
|
@ -88,6 +101,16 @@ public class HistorySyncPacket
|
|||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public List<ChatMessage> Messages { get; set; } = new();
|
||||
public bool Prepend { get; set; } = false;
|
||||
public bool HasMore { get; set; } = false;
|
||||
public int Offset { get; set; } = 0;
|
||||
}
|
||||
|
||||
public class FetchHistoryPacket
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public int Offset { get; set; } = 0;
|
||||
public int Limit { get; set; } = 50;
|
||||
}
|
||||
|
||||
public class JoinChannelPacket
|
||||
|
|
@ -98,6 +121,8 @@ public class JoinChannelPacket
|
|||
public class ChannelListSyncPacket
|
||||
{
|
||||
public List<Channel> Channels { get; set; } = new();
|
||||
public List<Channel> DirectMessages { get; set; } = new();
|
||||
public List<Channel> GroupChats { get; set; } = new();
|
||||
public string ActiveChannelId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
|
|
@ -112,12 +137,53 @@ public class DeleteChannelPacket
|
|||
public string ChannelId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class StartDmPacket
|
||||
{
|
||||
public string TargetUserId { get; set; } = string.Empty;
|
||||
public string TargetUsername { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class CreateGroupPacket
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Topic { get; set; } = string.Empty;
|
||||
public List<string> MemberUsernames { get; set; } = new();
|
||||
public int? MaxUsers { get; set; }
|
||||
}
|
||||
|
||||
public class InviteToGroupPacket
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
public string TargetUsername { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class LeaveGroupPacket
|
||||
{
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class PublishPublicKeyPacket
|
||||
{
|
||||
public string PublicKey { get; set; } = string.Empty;
|
||||
public string? EncryptedPrivateKey { get; set; }
|
||||
public bool ResetKeys { get; set; } = false;
|
||||
}
|
||||
|
||||
public class ToggleE2eePacket
|
||||
{
|
||||
public string Scope { get; set; } = "dm"; // "dm" or "account"
|
||||
public string? ChannelId { get; set; }
|
||||
public bool Enabled { get; set; } = true;
|
||||
}
|
||||
|
||||
public class UserSummary
|
||||
{
|
||||
public string Id { get; set; } = string.Empty;
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string Role { get; set; } = UserRoles.Member;
|
||||
public bool IsOnline { get; set; }
|
||||
public string? PublicKey { get; set; }
|
||||
public bool E2eeEnabled { get; set; } = true;
|
||||
}
|
||||
|
||||
public class UserListSyncPacket
|
||||
|
|
@ -164,4 +230,5 @@ public class CommandResultPacket
|
|||
{
|
||||
public bool Success { get; set; }
|
||||
public string Output { get; set; } = string.Empty;
|
||||
public string ChannelId { get; set; } = string.Empty;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue