important-garden-60239
08/05/2025, 9:25 AMtall-airline-16756
08/05/2025, 9:25 AMtall-airline-16756
08/05/2025, 9:25 AMimportant-garden-60239
08/05/2025, 9:29 AMtall-airline-16756
08/05/2025, 9:30 AMimportant-garden-60239
08/05/2025, 9:31 AMtall-airline-16756
08/05/2025, 9:31 AMe2ee option with a keyProvider when configuring your room.
2. Set Up a Key Provider: This is your go-to for managing encryption keys — it takes care of generating, distributing, and rotating them. Just a heads-up, LiveKit itself doesn’t store or share these keys.
3. Distribute Keys Securely: Generate your encryption keys safely on your server and share them with participants through secure methods, like encrypted channels.
4. Enable E2EE on Local Tracks: Each participant needs to turn on E2EE for their own local tracks when they join the room.
Here’s a handy example in JavaScript to get you started:
// Initialize the external key provider
const keyProvider = new ExternalE2EEKeyProvider();
// Configure room options
const roomOptions = {
e2ee: {
keyProvider: keyProvider,
worker: new Worker(new URL('livekit-client/e2ee-worker', import.meta.url)),
},
};
// Create and configure the room
const room = new Room(roomOptions);
// Set your externally distributed encryption key
await keyProvider.setKey(yourSecureKey);
// Enable E2EE for all local tracks
await room.setE2EEEnabled(true);
// Connect to the room
await room.connect(url, token);
When you’re ready for production, just make sure your key distribution is super secure, and it’s a great idea to use unique keys for each participant to keep things extra safe. If you want a hand with any of this, feel free to ask — I’m here to help!important-garden-60239
08/05/2025, 9:32 AMtall-airline-16756
08/05/2025, 9:32 AME2EEOptions class to set up your encryption settings and initialize a KeyProvider with a shared encryption key.
2. Initialize Room with E2EE: Configure your RoomOptions with the E2EE options, then connect to the room using these settings.
3. Set Shared Key: Use the KeyProvider to set the shared encryption key. Just make sure the same key is securely shared with everyone joining.
Here’s a quick example to get you started:
from livekit import rtc
# Create E2EE options with the KeyProvider
e2ee_options = rtc.E2EEOptions(
key_provider_options=rtc.KeyProviderOptions(
shared_key=b"your_shared_key_here"
),
encryption_type=rtc.EncryptionType.GCM
)
# Initialize room options with E2EE configuration
room_options = rtc.RoomOptions(
e2ee=e2ee_options
)
# Connect to the room with E2EE enabled
room = rtc.Room()
await room.connect(url, token, options=room_options)
# Access the E2EEManager
e2ee_manager = room.e2ee_manager
# Set shared encryption key (must be done before participants join)
key_provider = e2ee_manager.key_provider
await key_provider.set_shared_key(b"your_shared_key_here", key_index=1)
Just a heads-up: make sure to handle the key distribution securely, since LiveKit doesn’t store the keys for you. If you have any questions or need a hand with anything else, I’m here to help!steep-postman-58563
08/14/2025, 8:27 AMtall-airline-16756
08/14/2025, 8:28 AMsteep-postman-58563
08/14/2025, 8:35 AMtall-airline-16756
08/14/2025, 8:36 AMsteep-postman-58563
08/14/2025, 8:37 AMtall-airline-16756
08/14/2025, 8:38 AMsteep-postman-58563
08/14/2025, 8:40 AMtall-airline-16756
08/14/2025, 8:40 AMsteep-postman-58563
08/14/2025, 8:41 AMtall-airline-16756
08/14/2025, 8:42 AMsteep-postman-58563
08/14/2025, 8:43 AMtall-airline-16756
08/14/2025, 8:44 AMsteep-postman-58563
08/14/2025, 8:45 AMtall-airline-16756
08/14/2025, 8:45 AM