git clone https://garage44.eu/jeroen/cartopolis.git.. /crates/calls/Cargo.toml
# Calls: end-to-end encrypted voice and video in private chats, forwarded by the
# simulator (`docs/notes/calls.md`). Pure logic with no I/O and no Bevy, like
# `cartopolis_e2ee`, so it is testable on its own and both sides can link the
# half they need.
#
# Two halves, one feature each, and the split is the point:
#
# - `client`: frame encryption (SFrame keyed from the chat's MLS group) and the
# Opus codec. What a device needs to seal and open media.
# - `sfu`: the forwarding server. The simulator links only this, so it contains
# no code that could open a frame even if it were somehow handed a key — the
# same rule that keeps `cartopolis_e2ee` out of the simulator.
#
# Everything here is pure Rust with no `cc`, measured for x86_64,
# aarch64-linux-android and wasm32 (the note has the numbers). `str0m` is the
# WebRTC stack for native devices and the server; the browser has its own, so
# str0m is not built for wasm at all.
[package]
name = "cartopolis_calls"
version.workspace = true
edition.workspace = true
license.workspace = true
[lib]
name = "cartopolis_calls"
path = "src/lib.rs"
doctest = false
[features]
default = []
client = ["dep:sframe", "dep:opus-pure", "dep:uuid", "dep:oxideav-vp8", "dep:rusty_vp9", "dep:matroska-demuxer", "dep:nnnoiseless"]
sfu = []
[dependencies]
thiserror = { workspace = true }
tracing = { workspace = true }
# `rust-crypto` rather than the default `ring`: the same pure-Rust backend
# family openmls already uses, and it builds for wasm with no C.
sframe = { version = "2", default-features = false, features = ["rust-crypto"], optional = true }
opus-pure = { version = "0.2", optional = true }
# VP8, encoder and decoder, pure Rust (`video`). Without the default
# `registry` feature, which only adds a framework the crate can plug into.
oxideav-vp8 = { version = "0.2.7", default-features = false, optional = true }
# VP9, encoder and decoder, pure Rust with no dependencies (`video`): what the
# app sends. Bit-exact against libvpx's conformance vectors.
rusty_vp9 = { version = "0.1.1", optional = true }
# WebM, for clips played on a prim (`clip`). Pure Rust, no dependencies.
matroska-demuxer = { workspace = true, optional = true }
# Only for a random SFrame context id per join (`keys::Sender::new`).
uuid = { workspace = true, optional = true }
# str0m with *no* crypto backend of its own: its `rust-crypto` backend still
# reaches aws-lc (C) for one thing, making the DTLS certificate, so this crate
# carries that provider itself with a pure-Rust certificate (`src/crypto`). The
# dependencies below are exactly upstream's provider's, minus `rcgen`, plus the
# two RustCrypto crates the certificate needs — all already under `dimpl`.
# It is installed explicitly (`install_crypto`): str0m fails at the first
# connection, not at build time, when no provider is set.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
str0m = { version = "0.24", default-features = false }
# Noise suppression for the app's microphone (`denoise`): RNNoise's network,
# ported to Rust, no C. Without its defaults, which add a command-line tool.
# The browser has the platform's own (`noiseSuppression`).
nnnoiseless = { version = "0.5", default-features = false, optional = true }
dimpl = { version = "0.7.4", default-features = false, features = ["rust-crypto"] }
aes = "0.8"
aes-gcm = "0.10"
ctr = "0.9"
hmac = "0.12.1"
sha1 = "0.10"
# `oid`: the certificate names its signature algorithm, ECDSA with SHA-256.
sha2 = { workspace = true, features = ["oid"] }
p256 = { version = "0.13", features = ["ecdsa", "pkcs8"] }
x509-cert = { version = "0.2", features = ["builder"] }
rand_core = { version = "0.6", features = ["getrandom"] }
# The web build generates a join's SFrame context with `Uuid::new_v4`, and uuid
# has no randomness source on wasm unless told to use the browser's.
[target.'cfg(target_arch = "wasm32")'.dependencies]
uuid = { workspace = true, features = ["js"], optional = true }
[dev-dependencies]
# The link test runs a whole call, so it needs both halves.
cartopolis_calls = { path = ".", features = ["client", "sfu"] }
cartopolis_e2ee = { path = "../e2ee" }
uuid = { workspace = true }
[lints]
workspace = true