Update: Channel Based VC (Same Issues)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user