Skip to content

Commit dd24a4e

Browse files
mdepinetclaude
andauthored
Fix E2EEManager::frameCryptors() sending an empty E2EE request (#300)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e7d33fd commit dd24a4e

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

‎src/e2ee.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ std::weak_ptr<const E2EEManager::KeyProvider> E2EEManager::keyProvider() const {
155155
std::vector<E2EEManager::FrameCryptor> E2EEManager::frameCryptors() const {
156156
proto::FfiRequest req;
157157
req.mutable_e2ee()->set_room_handle(room_handle_);
158+
req.mutable_e2ee()->mutable_manager_get_frame_cryptors();
158159
auto resp = FfiClient::instance().sendRequest(req);
159160
std::vector<E2EEManager::FrameCryptor> out;
160161
const auto& list = resp.e2ee().manager_get_frame_cryptors().frame_cryptors();
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2026 LiveKit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include <gtest/gtest.h>
18+
19+
#include <algorithm>
20+
#include <cstdint>
21+
#include <memory>
22+
#include <string>
23+
#include <vector>
24+
25+
#include "../common/audio_utils.h"
26+
#include "../common/test_common.h"
27+
28+
namespace livekit::test {
29+
30+
class E2EEIntegrationTest : public LiveKitTestBase {};
31+
32+
TEST_F(E2EEIntegrationTest, FrameCryptorsIncludePublishedTrack) {
33+
failIfNotConfigured();
34+
35+
Room room;
36+
RoomOptions room_options;
37+
room_options.encryption = E2EEOptions{};
38+
room_options.encryption->key_provider_options.shared_key = std::vector<std::uint8_t>{'k', 'e', 'y'};
39+
ASSERT_TRUE(room.connect(config_.url, config_.token_a, room_options));
40+
auto participant = lockLocalParticipant(room);
41+
42+
auto source = std::make_shared<AudioSource>(kDefaultAudioSampleRate, kDefaultAudioChannels, 0);
43+
auto track = participant->publishAudioTrack("e2ee-frame-cryptors", source, TrackSource::SOURCE_MICROPHONE);
44+
auto manager = room.e2eeManager().lock();
45+
ASSERT_NE(manager, nullptr);
46+
47+
std::vector<E2EEManager::FrameCryptor> cryptors;
48+
ASSERT_NO_THROW(cryptors = manager->frameCryptors());
49+
const bool found = std::any_of(cryptors.begin(), cryptors.end(), [&](const auto& cryptor) {
50+
return cryptor.participantIdentity() == participant->identity();
51+
});
52+
EXPECT_TRUE(found) << "No frame cryptor for the local participant's track";
53+
participant->unpublishTrack(track->publication()->sid());
54+
}
55+
56+
} // namespace livekit::test

0 commit comments

Comments
 (0)