pub struct CallClient { /* private fields */ }Expand description
The engine of one app: at most one live call.
Two constructors; they differ in who builds the call keys:
CallClient::with_mlsis the one to use in an app. It builds Sew’s MLS call keys (crate::e2ee::MlsKeys) from theClientConfig: the device key whereClientConfig::device_storesays (a 0600 file by default, the host’s store withClientConfig::with_device_key_store, a hardware key withClientConfig::with_hardware_device_key) and the platform the device enrols as.CallClient::newtakes anyE2eeProviderthe host built. Use it to configurecrate::e2ee::MlsKeysyourself, for example the device name Sew shows in the person’s device list (crate::e2ee::MlsKeys::with_label), or in tests with thetestingfeature’sStaticKeys. No provider turns encryption off.
use std::path::PathBuf;
use std::sync::Arc;
use sew_call_client::e2ee::MlsKeys;
use sew_call_client::{CallClient, ClientConfig};
let data_dir = PathBuf::from("/var/lib/example-app/sew-voice");
let config = ClientConfig::new("com.example.app", data_dir);
// What an app needs: Sew's MLS call keys, from the config.
let _client = CallClient::with_mls(config.clone());
// The same keys built by hand, with the device name Sew shows.
let keys = MlsKeys::new(config.device_store.clone())
.with_platform(config.device_platform)
.with_label("Example app on Linux");
let _client = CallClient::new(config, Arc::new(keys));Implementations§
Source§impl CallClient
impl CallClient
Sourcepub fn new(cfg: ClientConfig, e2ee: Arc<dyn E2eeProvider>) -> CallClient
pub fn new(cfg: ClientConfig, e2ee: Arc<dyn E2eeProvider>) -> CallClient
An engine with cfg whose call keys come from e2ee (the sew-e2ee key session;
there is no plaintext alternative).
For keys the host configured itself (crate::e2ee::MlsKeys with its own label, or
the testing feature’s StaticKeys). An app that needs no such setting uses
CallClient::with_mls, which builds the MLS keys from cfg (see CallClient).
Sourcepub fn set_video_codec_preference(&self, pref: VideoCodecPreference)
pub fn set_video_codec_preference(&self, pref: VideoCodecPreference)
Sets this device’s video codec preference (crate::VideoCodecPreference, a user
setting) for every call of this engine, the live one included: a camera or screen
turned on after it publishes under it (crate::effective_publish_codec).
crate::VideoCodecPreference::PreferVp8 also stops this device offering to receive
H.264, from its next join. The engine keeps it until the process ends; persisting it
across launches is the host’s job (store CallClient::video_codec_preference with
the app’s settings and set it again at start).
Sourcepub fn video_codec_preference(&self) -> VideoCodecPreference
pub fn video_codec_preference(&self) -> VideoCodecPreference
This device’s video codec preference (CallClient::set_video_codec_preference;
crate::VideoCodecPreference::Automatic until set).
Sourcepub fn set_video_decode(&self, codecs: &[VideoCodec])
pub fn set_video_decode(&self, codecs: &[VideoCodec])
Declares the video codecs this host can decode, from the next join: the OS decoders its
kessel-video backend lists (its capabilities’ decode entries, a run-time answer) and the
codecs its webview decodes (a WebCodecs probe). The media connection then offers to
receive VP8 always and H.264 only if codecs lists it, never on Linux and never under
crate::VideoCodecPreference::PreferVp8; the media server then sends this device a
sender’s VP8 instead of H.264. Nothing is assumed: list only what was found.
Until a host declares, ClientConfig::video_h264 alone decides, as before.
Sourcepub fn video_decode(&self) -> Option<Vec<VideoCodec>>
pub fn video_decode(&self) -> Option<Vec<VideoCodec>>
The codecs CallClient::set_video_decode declared (sorted, None until then).
Sourcepub fn with_mls(cfg: ClientConfig) -> CallClient
pub fn with_mls(cfg: ClientConfig) -> CallClient
An engine with cfg and Sew’s MLS call keys (crate::e2ee::MlsKeys), the device key
where cfg.device_store says (by default a 0600 file; the host’s own store with
ClientConfig::with_device_key_store, a hardware key with
ClientConfig::with_hardware_device_key), enrolled as cfg.device_platform: the
production constructor, the one an app uses. CallClient::new is for keys the host
builds itself (see CallClient).
Sourcepub fn known_device_keys(&self) -> Result<Vec<DeviceKeyId>, DeviceError>
pub fn known_device_keys(&self) -> Result<Vec<DeviceKeyId>, DeviceError>
Every device key this engine’s data directory holds a record of
(crate::device::known_device_keys), sorted: with a hardware key, one Keychain item
or Keystore alias each (crate::device::DeviceKeyId::account). A host store’s
(ClientConfig::with_device_key_store) devices are the host’s and not listed.
Blocking (it reads the directory).
Sourcepub async fn forget_server(
&self,
install_id: u64,
) -> Result<Vec<DeviceKeyId>, DeviceError>
pub async fn forget_server( &self, install_id: u64, ) -> Result<Vec<DeviceKeyId>, DeviceError>
The host’s sign-out from one Sew install (crate::device::forget_install with
cfg.device_store): every device of install_id is reset (its key deleted, a hardware
key through HardwareDeviceKey::delete; the device and the pins cleared) and its files
removed. Answers the ids it removed. Refused with
crate::device::DeviceError::InCall while a call is live or joining; a join while it
runs is refused with CallError::AlreadyInCall.
Sourcepub async fn join(
&self,
provider: Arc<dyn JoinProvider>,
req: JoinRequest,
) -> Result<Call, CallError>
pub async fn join( &self, provider: Arc<dyn JoinProvider>, req: JoinRequest, ) -> Result<Call, CallError>
Joins through provider and starts the call.
A room that is recorded (Sew’s 409 recording_consent_required, the provider’s
ProviderError::ConsentRequired) is not an error: the call comes back held at
CallState::ConsentRequired, with the notice in Call::recording, until the host
answers (Call::consent) or leaves.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CallClient
impl !UnwindSafe for CallClient
impl Forget for CallClient
impl Freeze for CallClient
impl Move for CallClient
impl Send for CallClient
impl Sync for CallClient
impl Unpin for CallClient
impl UnsafeUnpin for CallClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CryptoSafe for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more