livekit-api 0.8.2

Rust Server SDK for LiveKit
Documentation
[package]
name = "livekit-api"
version = "0.8.2"
license.workspace = true
description = "Rust Server SDK for LiveKit"
edition.workspace = true
repository.workspace = true
readme = "README.md"

[features]
# By default ws TLS is not enabled
default = ["services", "access-token", "webhooks"]

# Signalling client. This is an internal compatibility shim: prefer depending on
# the livekit-signaling crate directly. Enabling it here only re-exports that
# crate under the historical `livekit_api::signal_client` path, which is marked
# deprecated.
signal-client        = ["dep:livekit-signaling"]
signal-client-native = ["signal-client", "livekit-signaling/native"]

services = ["access-token", "dep:livekit-region", "dep:reqwest", "dep:tokio", "tokio/time"]

access-token = ["dep:livekit-token"]
webhooks = ["access-token", "dep:serde_json", "dep:base64"]

# TLS Configuration
# -----------------
# These features control TLS behavior for WebSocket and HTTP connections.
# TLS is delegated to livekit-net; no local tungstenite/rustls deps.
#
# IMPORTANT FOR CONTAINER DEPLOYMENTS:
# When using `rustls-tls-native-roots`, the SDK relies on the operating system's
# CA certificate store. In container environments using slim/minimal base images,
# this store may be empty, causing TLS errors like "invalid peer certificate: UnknownIssuer".
#
# Solutions:
#   1. Install CA certificates in your Dockerfile:
#      - Debian/Ubuntu: RUN apt-get update && apt-get install -y ca-certificates
#      - Alpine: RUN apk add --no-cache ca-certificates
#
#   2. Use `rustls-tls-webpki-roots` instead, which bundles Mozilla's root
#      certificates and doesn't require system CA certificates. This is the
#      recommended option for containerized deployments. The drawback is that
#      the embedded certificates can expire, requiring a fresh build to update them.

# Uses the platform's native TLS implementation (OpenSSL on Linux, Secure Transport on macOS, SChannel on Windows)
native-tls              = ["livekit-signaling?/native-tls",             "reqwest?/native-tls"]
# Same as native-tls but compiles OpenSSL from source (useful for cross-compilation)
native-tls-vendored     = ["livekit-signaling?/native-tls-vendored",    "reqwest?/native-tls-vendored"]
# Uses rustls with the operating system's CA certificate store.
# Requires ca-certificates to be installed in container environments.
rustls-tls-native-roots = ["livekit-signaling?/rustls-tls-native-roots", "reqwest?/rustls-tls-native-roots"]
# Uses rustls with Mozilla's bundled root certificates.
# RECOMMENDED for container deployments - no system CA certificates required.
rustls-tls-webpki-roots = ["livekit-signaling?/rustls-tls-webpki-roots", "reqwest?/rustls-tls-webpki-roots"]
__rustls-tls            = ["livekit-signaling?/__rustls-tls",             "reqwest?/__rustls"]

# Feature combinations checked in CI. See the equivalent table in
# `livekit/Cargo.toml` for the encoding, and what `mode = "curated"` costs
# relative to cargo-hack's powerset.
[package.metadata.feature-combinations]
mode = "curated"
check = [
    ["default"],                                        # a plain `cargo check`
    [],                                                 # --no-default-features
    ["access-token"],
    ["webhooks"],
    ["services", "native-tls"],
    ["services", "native-tls-vendored"],
    ["services", "rustls-tls-webpki-roots"],
    ["services", "rustls-tls-native-roots"],
    ["signal-client-native", "rustls-tls-webpki-roots"],
    ["default", "rustls-tls-webpki-roots"],             # defaults *plus* one
]

[dependencies]
livekit-signaling = { workspace = true, optional = true }
livekit-protocol = { workspace = true }
livekit-region = { workspace = true, optional = true }
livekit-token = { workspace = true, optional = true }
thiserror = { workspace = true }
serde = { workspace = true, features = ["derive"] }
sha2 = "0.10"
url = "2.3"
log = { workspace = true }
prost = { workspace = true }
pbjson-types = "0.9"

# webhooks
serde_json = { workspace = true, optional = true }
base64 = { version = "0.21", optional = true, features = ["std"] }

# signal_client
tokio = { workspace = true, default-features = false, features = ["sync", "macros", "signal", "io-util", "net", "rt-multi-thread"], optional = true }

# This dependency must be kept in sync with reqwest's version
http = "1.1"
reqwest = { version = "0.12", default-features = false, features = [ "json" ], optional = true }

rand = { workspace = true }

[dev-dependencies]
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "net", "time", "macros", "io-util"] }