Skip to content

Commit f4085eb

Browse files
committed
Fix building livekit-ffi
1 parent a69af0a commit f4085eb

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

livekit-ffi/protocol/e2ee.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ message KeyProviderOptions {
3838
required int32 ratchet_window_size = 2;
3939
required bytes ratchet_salt = 3;
4040
required int32 failure_tolerance = 4; // -1 = no tolerance
41+
required int32 key_ring_size = 5;
42+
required KeyDerivationFunction key_derivation_function = 6;
43+
}
44+
45+
enum KeyDerivationFunction {
46+
PBKDF2 = 0;
47+
HKDF = 1;
4148
}
4249

4350
message E2eeOptions {

livekit-ffi/src/conversion/room.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use crate::{proto, server::room::FfiRoom};
1616
use livekit::{
1717
e2ee::{
18-
key_provider::{KeyProvider, KeyProviderOptions},
18+
key_provider::{KeyDerivationFunction, KeyProvider, KeyProviderOptions},
1919
E2eeOptions, EncryptionType,
2020
},
2121
options::{AudioEncoding, TrackPublishOptions, VideoEncoding},
@@ -108,10 +108,22 @@ impl From<DisconnectReason> for proto::DisconnectReason {
108108

109109
impl From<proto::KeyProviderOptions> for KeyProviderOptions {
110110
fn from(value: proto::KeyProviderOptions) -> Self {
111+
let key_derivation_function = value.key_derivation_function().into();
111112
Self {
112113
ratchet_window_size: value.ratchet_window_size,
113114
ratchet_salt: value.ratchet_salt,
114115
failure_tolerance: value.failure_tolerance,
116+
key_ring_size: value.key_ring_size,
117+
key_derivation_function,
118+
}
119+
}
120+
}
121+
122+
impl From<proto::KeyDerivationFunction> for KeyDerivationFunction {
123+
fn from(value: proto::KeyDerivationFunction) -> Self {
124+
match value {
125+
proto::KeyDerivationFunction::Pbkdf2 => KeyDerivationFunction::PBKDF2,
126+
proto::KeyDerivationFunction::Hkdf => KeyDerivationFunction::HKDF,
115127
}
116128
}
117129
}

livekit/src/room/e2ee/key_provider.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const DEFAULT_FAILURE_TOLERANCE: i32 = -1; // no tolerance by default
2727
const DEFAULT_KEY_RING_SIZE: i32 = 16;
2828

2929
#[derive(Clone)]
30-
#[non_exhaustive]
3130
pub struct KeyProviderOptions {
3231
pub ratchet_window_size: i32,
3332
pub ratchet_salt: Vec<u8>,

0 commit comments

Comments
 (0)