Skip to content

Commit

Permalink
ffi v0.3.0 (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
theomonnom authored Sep 4, 2023
1 parent c5e4d9c commit 03d4fc5
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 41 deletions.
68 changes: 50 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions livekit-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "livekit-ffi"
version = "0.2.2"
version = "0.3.0"
edition = "2021"
license = "Apache-2.0"
description = "LiveKit interface to easily use the Rust SDK on other languages"
Expand All @@ -23,8 +23,8 @@ livekit-protocol = { path = "../livekit-protocol", version = "0.2.0" }
tokio = { version = "1", features = ["full", "parking_lot"] }
futures-util = { version = "0.3", default-features = false, features = ["sink"] }
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
prost = "0.11"
prost-types = "0.11"
prost = "0.12"
prost-types = "0.12"
lazy_static = "1.4"
thiserror = "1.0"
log = "0.4"
Expand Down
16 changes: 8 additions & 8 deletions livekit-ffi/protocol/e2ee.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ message SetSharedKeyRequest {
}
message SetSharedKeyResponse { }

message RachetSharedKeyRequest {
message RatchetSharedKeyRequest {
int32 key_index = 1;
}
message RachetSharedKeyResponse {
message RatchetSharedKeyResponse {
optional bytes new_key = 1;
}

Expand All @@ -106,11 +106,11 @@ message SetKeyRequest {
}
message SetKeyResponse {}

message RachetKeyRequest {
message RatchetKeyRequest {
string participant_identity = 1;
int32 key_index = 2;
}
message RachetKeyResponse {
message RatchetKeyResponse {
optional bytes new_key = 1;
}

Expand All @@ -130,10 +130,10 @@ message E2eeRequest {
FrameCryptorSetEnabledRequest cryptor_set_enabled = 4;
FrameCryptorSetKeyIndexRequest cryptor_set_key_index = 5;
SetSharedKeyRequest set_shared_key = 6;
RachetSharedKeyRequest rachet_shared_key = 7;
RatchetSharedKeyRequest ratchet_shared_key = 7;
GetSharedKeyRequest get_shared_key = 8;
SetKeyRequest set_key = 9;
RachetKeyRequest rachet_key = 10;
RatchetKeyRequest ratchet_key = 10;
GetKeyRequest get_key = 11;
}
}
Expand All @@ -145,10 +145,10 @@ message E2eeResponse {
FrameCryptorSetEnabledResponse cryptor_set_enabled = 3;
FrameCryptorSetKeyIndexResponse cryptor_set_key_index = 4;
SetSharedKeyResponse set_shared_key = 5;
RachetSharedKeyResponse rachet_shared_key = 6;
RatchetSharedKeyResponse ratchet_shared_key = 6;
GetSharedKeyResponse get_shared_key = 7;
SetKeyResponse set_key = 8;
RachetKeyResponse rachet_key = 9;
RatchetKeyResponse ratchet_key = 9;
GetKeyResponse get_key = 10;
}
}
16 changes: 8 additions & 8 deletions livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ pub struct SetSharedKeyResponse {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RachetSharedKeyRequest {
pub struct RatchetSharedKeyRequest {
#[prost(int32, tag="1")]
pub key_index: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RachetSharedKeyResponse {
pub struct RatchetSharedKeyResponse {
#[prost(bytes="vec", optional, tag="1")]
pub new_key: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
Expand Down Expand Up @@ -132,15 +132,15 @@ pub struct SetKeyResponse {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RachetKeyRequest {
pub struct RatchetKeyRequest {
#[prost(string, tag="1")]
pub participant_identity: ::prost::alloc::string::String,
#[prost(int32, tag="2")]
pub key_index: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RachetKeyResponse {
pub struct RatchetKeyResponse {
#[prost(bytes="vec", optional, tag="1")]
pub new_key: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
Expand Down Expand Up @@ -182,13 +182,13 @@ pub mod e2ee_request {
#[prost(message, tag="6")]
SetSharedKey(super::SetSharedKeyRequest),
#[prost(message, tag="7")]
RachetSharedKey(super::RachetSharedKeyRequest),
RatchetSharedKey(super::RatchetSharedKeyRequest),
#[prost(message, tag="8")]
GetSharedKey(super::GetSharedKeyRequest),
#[prost(message, tag="9")]
SetKey(super::SetKeyRequest),
#[prost(message, tag="10")]
RachetKey(super::RachetKeyRequest),
RatchetKey(super::RatchetKeyRequest),
#[prost(message, tag="11")]
GetKey(super::GetKeyRequest),
}
Expand All @@ -215,13 +215,13 @@ pub mod e2ee_response {
#[prost(message, tag="5")]
SetSharedKey(super::SetSharedKeyResponse),
#[prost(message, tag="6")]
RachetSharedKey(super::RachetSharedKeyResponse),
RatchetSharedKey(super::RatchetSharedKeyResponse),
#[prost(message, tag="7")]
GetSharedKey(super::GetSharedKeyResponse),
#[prost(message, tag="8")]
SetKey(super::SetKeyResponse),
#[prost(message, tag="9")]
RachetKey(super::RachetKeyResponse),
RatchetKey(super::RatchetKeyResponse),
#[prost(message, tag="10")]
GetKey(super::GetKeyResponse),
}
Expand Down
8 changes: 4 additions & 4 deletions livekit-ffi/src/server/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,12 @@ fn on_e2ee_request(

proto::e2ee_response::Message::SetSharedKey(proto::SetSharedKeyResponse {})
}
proto::e2ee_request::Message::RachetSharedKey(request) => {
proto::e2ee_request::Message::RatchetSharedKey(request) => {
let new_key = e2ee_manager
.key_provider()
.and_then(|key_provider| key_provider.ratchet_shared_key(request.key_index));

proto::e2ee_response::Message::RachetSharedKey(proto::RachetSharedKeyResponse {
proto::e2ee_response::Message::RatchetSharedKey(proto::RatchetSharedKeyResponse {
new_key,
})
}
Expand All @@ -565,13 +565,13 @@ fn on_e2ee_request(
}
proto::e2ee_response::Message::SetKey(proto::SetKeyResponse {})
}
proto::e2ee_request::Message::RachetKey(request) => {
proto::e2ee_request::Message::RatchetKey(request) => {
let identity = request.participant_identity.try_into().unwrap();
let new_key = e2ee_manager
.key_provider()
.and_then(|key_provider| key_provider.ratchet_key(&identity, request.key_index));

proto::e2ee_response::Message::RachetKey(proto::RachetKeyResponse { new_key })
proto::e2ee_response::Message::RatchetKey(proto::RatchetKeyResponse { new_key })
}
proto::e2ee_request::Message::GetKey(request) => {
let identity = request.participant_identity.try_into().unwrap();
Expand Down

0 comments on commit 03d4fc5

Please sign in to comment.