purple-plumber-89552
08/19/2025, 10:02 AMconst keyProviderOptions = {
sharedKey: yourSecureKey, // Your externally distributed encryption key
};
I tweaked the source to initialize it correctly but the decrypt doesn't seem to work and I can't debug what is happening.
Anyone done something similar or hints?
Thanks palsrefined-appointment-81829
08/19/2025, 1:04 PMpurple-plumber-89552
08/19/2025, 1:43 PM// 1. Initialize the key provider with options
const keyProviderOptions = {
sharedKey: yourSecureKey, // Your externally distributed encryption key
};
// 2. Configure E2EE options
const e2eeOptions = {
keyProviderOptions,
};
will erase some needed encryption parameters in the default keyProviderOptions when processed by the room object here
https://github.com/livekit/node-sdks/blob/c4f195aae64653c6b718cd34c19fffbed09c59c8/packages/livekit-rtc/src/room.ts#L177
I tried this fix in room.js and no more exception, but decryption seems to not work properly
const e2eeOptions = { ...defaultE2EEOptions };
e2eeOptions.keyProviderOptions.sharedKey = opts.e2ee.keyProviderOptions.sharedKey;
const options = { ...defaultRoomOptions, e2ee: e2eeOptions};
EXCEPTION :
❌ Error: Error: cannot encode field livekit.proto.E2eeOptions.encryption_type to binary: required field not set
at Object.writeMessage ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js10131)
at _E2eeOptions.toBinary ([...]/node_modules/@bufbuild/protobuf/dist/esm/message.js7513)
at writeMessageField ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js37728)
at writeField ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js31717)
at Object.writeMessage ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js10817)
at _RoomOptions.toBinary ([...]/node_modules/@bufbuild/protobuf/dist/esm/message.js7513)
at writeMessageField ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js37728)
at writeField ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js31717)
at Object.writeMessage ([...]/node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js10817)
at _ConnectRequest.toBinary ([...]/node_modules/@bufbuild/protobuf/dist/esm/message.js7513)purple-plumber-89552
08/21/2025, 6:12 AMrefined-appointment-81829
08/21/2025, 12:43 PME2eeOptions are not being set up properly, specifically the encryption_type field is required but not being set.
Here's a breakdown of what you need to do:
1. Ensure All Required Fields are Set: The E2eeOptions must include all required fields, including encryption_type. It seems that when you are creating the e2eeOptions, you are not including the necessary default settings.
2. Modify the Key Provider Options: Instead of directly assigning the keyProviderOptions, you should spread the default options and then set the sharedKey. This way, you retain any other necessary parameters that might be required for E2EE to function correctly.
Here’s an example of how you might set this up:
(Note: this code not tested, it was generated by AI)
const defaultE2EEOptions = {
encryption_type: 'your_encryption_type', // Set the appropriate encryption type
keyProviderOptions: {
// other default options if necessary
},
};
const keyProviderOptions = {
sharedKey: yourSecureKey, // Your externally distributed encryption key
};
const e2eeOptions = { ...defaultE2EEOptions, keyProviderOptions };
const options = {
...defaultRoomOptions,
e2ee: e2eeOptions,
};
// Now create and connect to the room with the options
const room = new Room();
await room.connect(url, token, options);
1. Debugging Decryption Issues: If you have modified the source code and the decryption still does not work, you may want to add logging to see what keys are being used and whether they match between the participants. Ensure that the keys are being set correctly and that the encryption process is functioning as expected.
2. Check for Updates in the SDK: If you are using an older version of the SDK, consider checking for updates or documentation changes that might address your issue.
If you continue to face issues, providing more specific details about the decryption process and any errors you encounter would be helpful for further troubleshooting.
Notes:
• Ensure that the encryption_type is set according to the encryption algorithm you are using.
• The sharedKey must be securely distributed to all participants who need to decrypt the media.
• The LiveKit documentation on E2EE provides additional context and examples that may be useful.purple-plumber-89552
08/21/2025, 3:39 PMrefined-appointment-81829
08/21/2025, 4:18 PMpurple-plumber-89552
08/22/2025, 10:27 AM