Files
forkmessager/backend/src/Modules/Federation/Application/Abstractions/IFederationGateway.cs

39 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Threading;
using System.Threading.Tasks;
using Knot.Shared.Kernel;
namespace Knot.Modules.Federation.Application.Abstractions;
/// <summary>
/// Шлюз для безопасной передачи данных между серверами Knot Messager.
/// </summary>
public interface IFederationGateway
{
/// <summary>
/// Отправляет пакет на конкретный домен.
/// </summary>
Task<Result> SendPacketAsync(FederationMessagePacket packet, string targetDomain, CancellationToken ct = default);
}
/// <summary>
/// Федеративный пакет сообщения с гибридным шифрованием.
/// </summary>
public record FederationMessagePacket(
string SenderDomain,
string RecipientDomain,
string EncryptedPayload, // AES-256
string EncryptedIV, // RSA-Encrypted for Recipient
string Signature, // RSA-Signed by Sender
FederationMetadata Metadata
);
public record FederationMetadata(
Guid ChatId,
Guid SenderId,
string SenderUsername,
string MessageType,
DateTime CreatedAt,
Guid UserId = default // ID пользователя-исполнителя (для реакций и т.д.)
);