Update: Channel Based VC (Same Issues)

This commit is contained in:
2026-03-31 09:47:15 -04:00
parent 6fedad92b1
commit e9f96b7389
7 changed files with 69 additions and 54 deletions

View File

@@ -384,29 +384,29 @@ public class ChatTest : WebSocketBehavior
return;
}
var targetClient = Task.Run(async () => await ClientKeyService.GetByUsernameAsync(clientPayload.RecipientUsername))
var allKeys = Task.Run(async () => await ClientKeyService.GetAllAsync())
.GetAwaiter()
.GetResult();
if (targetClient is null)
foreach (var client in allKeys)
{
Console.WriteLine($"No target RTC client key found for {clientPayload.RecipientUsername}");
return;
if (client.Username == clientPayload.SenderUsername)
continue;
var encrypted = E2EeHelper.EncryptForRecipient(plainJson, client.PublicKey);
var outbound = new SocketRtcSignalMessage
{
Type = "encrypted_rtc_signal",
SenderUsername = clientPayload.SenderUsername,
ChannelId = clientPayload.ChannelId,
CipherText = encrypted.CipherText,
Nonce = encrypted.Nonce,
Tag = encrypted.Tag,
EncryptedKey = encrypted.EncryptedKey
};
Sessions.Broadcast(JsonSerializer.Serialize(outbound));
}
var encrypted = E2EeHelper.EncryptForRecipient(plainJson, targetClient.PublicKey);
var outbound = new SocketRtcSignalMessage
{
Type = "encrypted_rtc_signal",
SenderUsername = clientPayload.SenderUsername,
RecipientUsername = clientPayload.RecipientUsername,
CipherText = encrypted.CipherText,
Nonce = encrypted.Nonce,
Tag = encrypted.Tag,
EncryptedKey = encrypted.EncryptedKey
};
Sessions.Broadcast(JsonSerializer.Serialize(outbound));
}
}