Skip to content

Conversation

@lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Sep 18, 2025

this PR adds data channel encryption capabilities.
For backwards compatibility this is not enabled on existing implementations.
Instead RoomOptions.e2ee is being deprecated (no dc encryption) and a new RoomOptions.encryption field is introduced which enables data channel encryption

@lukasIO lukasIO changed the title DC e2ee feature(e2ee): add data channel encryption Sep 19, 2025
@lukasIO lukasIO marked this pull request as ready for review September 19, 2025 12:35
};

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice example!

pub auto_subscribe: bool,
pub adaptive_stream: bool,
pub dynacast: bool,
#[deprecated(note = "Use `encryption` field instead, see x for a detailed explanation")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have something ready to link for "x"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently wip, will wait for the actual link to update and merge

Copy link
Contributor

@cloudwebrtc cloudwebrtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

identity: String,
encryption_type: livekit_protocol::encryption::Type,
) {
let Ok(info) = AnyStreamInfo::try_from_with_encryption(header, encryption_type.into())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ladvoc sorry, ended up messing with this anyways as I feel having the encryption type on the stream info does in fact make sense?
Let me know if you think that's unnecessary and I'll remove this again

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it makes sense to enforce the encryption type specified in the header.

Internal,

#[error("encryption type mismatch")]
EncryptionTypeMismatch,
Copy link
Contributor Author

@lukasIO lukasIO Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ladvoc is it ok to introduce this as a new error type? I think we also forgot non_exhaustive here?

type Error = StreamError;

fn try_from(mut header: proto::Header) -> Result<Self, Self::Error> {
Self::try_from_with_encryption(header, EncryptionType::None)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we keep the new try_from_with_encryption, we could probably remove this one here

identity: String,
encryption_type: livekit_protocol::encryption::Type,
) {
let Ok(info) = AnyStreamInfo::try_from_with_encryption(header, encryption_type.into())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think it makes sense to enforce the encryption type specified in the header.

@lukasIO lukasIO merged commit 785a7bb into main Oct 8, 2025
19 checks passed
@lukasIO lukasIO deleted the lukas/dc-e2ee branch October 8, 2025 14:07
@github-actions github-actions bot mentioned this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants