mirror of
https://github.com/Stone-Red-Code/EchoHub.git
synced 2026-09-04 09:06:07 +02:00
feat: Implement message encryption and decryption support
- Added IMessageEncryptionService and its implementation MessageEncryptionService for handling message encryption. - Updated ChannelsController and ChatService to encrypt messages before storing and sending. - Introduced encryption key retrieval endpoint in ServerController. - Modified EchoHubDbContext to accommodate increased message content and embed JSON lengths for encrypted data. - Created migrations to support encryption-related database changes. - Enhanced FirstRunSetup to ensure encryption key is generated if not present. - Updated appsettings.example.json to include encryption configuration. - Added comprehensive unit tests for encryption service and compatibility tests between client and server encryption.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
namespace EchoHub.Core.Contracts;
|
||||
|
||||
public interface IMessageEncryptionService
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether database content should be encrypted at rest (server setting).
|
||||
/// </summary>
|
||||
bool EncryptDatabaseEnabled { get; }
|
||||
|
||||
string Encrypt(string plaintext);
|
||||
string Decrypt(string content);
|
||||
string? EncryptNullable(string? value);
|
||||
string? DecryptNullable(string? value);
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
namespace EchoHub.Core.DTOs;
|
||||
|
||||
public record ServerStatusDto(string Name, string? Description, int OnlineUsers, int TotalChannels);
|
||||
|
||||
public record EncryptionKeyResponse(string Key);
|
||||
|
||||
Reference in New Issue
Block a user