diff --git a/src/e2ee.cpp b/src/e2ee.cpp index 8ce73742..403582df 100644 --- a/src/e2ee.cpp +++ b/src/e2ee.cpp @@ -155,6 +155,7 @@ std::weak_ptr E2EEManager::keyProvider() const { std::vector E2EEManager::frameCryptors() const { proto::FfiRequest req; req.mutable_e2ee()->set_room_handle(room_handle_); + req.mutable_e2ee()->mutable_manager_get_frame_cryptors(); auto resp = FfiClient::instance().sendRequest(req); std::vector out; const auto& list = resp.e2ee().manager_get_frame_cryptors().frame_cryptors(); diff --git a/src/tests/integration/test_e2ee.cpp b/src/tests/integration/test_e2ee.cpp new file mode 100644 index 00000000..68880c59 --- /dev/null +++ b/src/tests/integration/test_e2ee.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2026 LiveKit + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include +#include +#include + +#include "../common/audio_utils.h" +#include "../common/test_common.h" + +namespace livekit::test { + +class E2EEIntegrationTest : public LiveKitTestBase {}; + +TEST_F(E2EEIntegrationTest, FrameCryptorsIncludePublishedTrack) { + failIfNotConfigured(); + + Room room; + RoomOptions room_options; + room_options.encryption = E2EEOptions{}; + room_options.encryption->key_provider_options.shared_key = std::vector{'k', 'e', 'y'}; + ASSERT_TRUE(room.connect(config_.url, config_.token_a, room_options)); + auto participant = lockLocalParticipant(room); + + auto source = std::make_shared(kDefaultAudioSampleRate, kDefaultAudioChannels, 0); + auto track = participant->publishAudioTrack("e2ee-frame-cryptors", source, TrackSource::SOURCE_MICROPHONE); + auto manager = room.e2eeManager().lock(); + ASSERT_NE(manager, nullptr); + + std::vector cryptors; + ASSERT_NO_THROW(cryptors = manager->frameCryptors()); + const bool found = std::any_of(cryptors.begin(), cryptors.end(), [&](const auto& cryptor) { + return cryptor.participantIdentity() == participant->identity(); + }); + EXPECT_TRUE(found) << "No frame cryptor for the local participant's track"; + participant->unpublishTrack(track->publication()->sid()); +} + +} // namespace livekit::test