updated to shared lib

This commit is contained in:
2026-04-11 18:42:29 -04:00
parent a67f94b08e
commit 085507519a
6 changed files with 46 additions and 62 deletions

View File

@@ -2,20 +2,25 @@
namespace RelayShared.Rtc;
public static class RtcSignalTypes
public enum SignalType
{
public const string Offer = "rtc_offer";
public const string Answer = "rtc_answer";
public const string Candidate = "rtc_candidate";
public const string OfferUpdated = "rtc_offer_updated";
public const string AnswerUpdated = "rtc_answer_updated";
public const string CandidateAdded = "rtc_candidate_added";
public const string CallLeft = "rtc_call_left";
Offer,
Answer,
Candidate,
OfferUpdated,
AnswerUpdated,
CandidateAdded,
CallLeft,
ChannelList,
ServerPublicKey,
EncryptedSignal,
EncryptedChat,
ClientEncryptedChat
}
public sealed class RtcSignalMessage
{
public string Type { get; set; } = string.Empty;
public SignalType Type { get; set; }
public string From { get; set; } = string.Empty;
public string ChannelId { get; set; } = string.Empty;
public string? Sdp { get; set; }
@@ -27,7 +32,7 @@ public sealed class RtcSignalMessage
public sealed class RtcNotificationMessage
{
public string? Type { get; set; }
public SignalType? Type { get; set; }
public string? ChannelId { get; set; }
public string? Username { get; set; }
public string? Direction { get; set; }
@@ -35,13 +40,13 @@ public sealed class RtcNotificationMessage
public sealed class ServerPublicKeyMessage
{
public string Type { get; set; } = string.Empty;
public SignalType Type { get; set; } = SignalType.ServerPublicKey;
public string PublicKey { get; set; } = string.Empty;
}
public sealed class SocketRtcSignalMessage
{
public string Type { get; set; } = string.Empty;
public SignalType Type { get; set; }
public string SenderUsername { get; set; } = string.Empty;
public string ChannelId { get; set; } = string.Empty;
public string CipherText { get; set; } = string.Empty;
@@ -52,7 +57,7 @@ public sealed class SocketRtcSignalMessage
public sealed class SocketEncryptedMessage
{
public string Type { get; set; } = string.Empty;
public SignalType Type { get; set; } = SignalType.EncryptedChat;
public string SenderUsername { get; set; } = string.Empty;
public string RecipientUsername { get; set; } = string.Empty;
public string ChannelId { get; set; } = string.Empty;
@@ -71,7 +76,7 @@ public sealed class ChannelItem
public sealed class SocketChannelList
{
public string Type { get; set; } = string.Empty;
public SignalType Type { get; set; } = SignalType.ChannelList;
public List<ChannelItem> Channels { get; set; } = [];
}
@@ -98,7 +103,7 @@ public sealed class RtcLeaveRequest
public sealed class RtcSessionDescription
{
public string Type { get; set; } = string.Empty;
public SignalType Type { get; set; }
public string Sdp { get; set; } = string.Empty;
}