Developer docs
12. Call encryption and emoji fingerprint (normative)
On this page
Media flows through the SFU (LiveKit); Telvoro only signals. 1:1 calls and group calls are end-to-end encrypted at the frame level, channel live streams are not (§12.6). The security model, the support matrix and what the SFU still learns are in SECURITY.md §4.
12.1 1:1 key agreement and emoji fingerprint
1:1 calls agree on a media key with X25519 commit-reveal (calls.proto):
- Caller: ephemeral
a.RequestCall(g_a_hash = SHA-256(g_a)). - Callee: ephemeral
b.AcceptCall(g_b). - Caller:
ConfirmCall(g_a). The callee checks thatSHA-256(g_a) == g_a_hash; the server checks the same and aborts the call on a mismatch. - Both:
shared = X25519(a, g_b) = X25519(b, g_a)key = HKDF-SHA256(ikm = shared, salt = le64(call_id), info = "televo-call-v1", L = 32). This is the media frame key.fp = HKDF-SHA256(ikm = shared, salt = empty, info = "televo-call-emoji", L = 8). An empty salt is HashLen zero bytes per RFC 5869.emoji[i] = TABLE[be16(fp[2i], fp[2i+1]) mod 64]for i = 0..3, shown in that order.
TABLE (index = row + column; the strings are exact, e.g. ❄️ is U+2744 U+FE0F and ☂️ is U+2602 U+FE0F):
| +0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 | |
|---|---|---|---|---|---|---|---|---|
| 0 | 😀 | 😎 | 🤖 | 👻 | 🐶 | 🐱 | 🦊 | 🐻 |
| 8 | 🐼 | 🐨 | 🐯 | 🦁 | 🐮 | 🐷 | 🐸 | 🐵 |
| 16 | 🐔 | 🐧 | 🐦 | 🦉 | 🐴 | 🦄 | 🐝 | 🐞 |
| 24 | 🦋 | 🐢 | 🐍 | 🐙 | 🐬 | 🐳 | 🦈 | 🦀 |
| 32 | 🌵 | 🌲 | 🌻 | 🍀 | 🍁 | 🍄 | 🌙 | ⭐ |
| 40 | 🔥 | 🌈 | ❄️ | ☂️ | 🍎 | 🍋 | 🍉 | 🍇 |
| 48 | 🍓 | 🍒 | 🍑 | 🍍 | 🥕 | 🌽 | 🍕 | 🍩 |
| 56 | ⚽ | 🏀 | 🎸 | 🎲 | 🚀 | ⚓ | 🔑 | 💡 |
Test vector: caller private key = bytes 0x01…0x20, callee private key = 0x21…0x40 (X25519 scalars as given), call_id = 123456789.
g_a 07a37cbc142093c8b755dc1b10e86cb426374ad16aa853ed0bdfc0b2b86d1c7c
g_b 5869aff450549732cbaaed5e5df9b30a6da31cb0e5742bad5ad4a1a768f1a67b
g_a_hash aaa8fff703b50b2297f4f6e13508f72420d96fd01ebb84cb074449caaef64041
shared a84dc7c3c8f058b1b2dc4cd1e9b5dc0a7987f88b6a9564cde3391fc421159e77
key 93365732b080f441a333e21045035511e3fa9118dc38ad0ce2a930b2304a8d9a
fp 48ee18335d0cd1c0
emoji 🍉 🍍 🐮 😀
Reference implementations:
- Go:
server/internal/callcrypto. Its test checks that the table is identical to the Dart SDK’s. - Dart:
sdk/dart/lib/src/calls/call_crypto.dart. Running it on this vector produces the same output.
12.2 Frame encryption
Clients use the LiveKit frame cryptor (“GCM” encryption, TrackInfo.encryption = GCM at the
SFU) — the same format in libwebrtc (iOS, Android, macOS, Windows, Linux), the web worker and
LiveKit’s Go SDK:
- Key import: the 32-byte media key is the key material; the AES key is
PBKDF2-HMAC-SHA256(material, salt = "LKFrameEncryptionKey", 100000 iterations, 16 bytes)(AES-128-GCM). This is whatBaseKeyProvider.setRawKeydoes; LiveKit’s ratcheting is disabled (ratchetWindowSize = 0): keys are only ever replaced by fresh random keys. - Frame:
header ‖ AES-GCM(key, iv, payload, aad = header) ‖ iv(12) ‖ 0x0C ‖ key_index.headerstays in clear so packetizers and the SFU keep working: 1 byte for Opus (the TOC byte), 10 bytes for VP8 key frames / 3 for delta frames, and for H.264/H.265 everything before the first slice NAL unit plus that unit’s first 2 bytes (so SPS/PPS/SEI stay in clear). The last byte names the key-ring slot (0..15) the sender used. - 1:1: one key for both directions (
sharedKey = true), the §12.1key. - Group: one key per sender device (
sharedKey = false,setKey(participantIdentity = user id)), §12.4.
12.3 Calls that can’t be end-to-end encrypted
A client whose platform can’t encrypt frames sets RequestCallRequest.e2ee_unsupported or
AcceptCallRequest.e2ee_unsupported; the server then reports Call.e2ee = false to both sides
(the caller sees it in the STATE_ACCEPTED update, before ConfirmCall). The key exchange still
runs, but no frame key is used and no emoji are shown. Clients MUST NOT start or accept such a
call — and the caller MUST NOT send ConfirmCall — before the user explicitly agreed to
“This call won’t be end-to-end encrypted”. Call.e2ee can only turn encryption off; a client that
can encrypt never falls back silently while both sides support it.
12.4 Group calls: sender keys over Olm to-device messages
Every participant device encrypts its own media with its own key and sends that key to every other participant device through Olm (the secret-chat account, SECURITY.md §3). The SFU and the server never see keys.
Participants. JoinCallRequest.e2ee = true declares that the device does this. Every
CallParticipant carries the session_id of the device that is in the call and its e2ee
flag (in GetParticipants and in CallUpdate.participant). Joining again from another device
replaces session_id and is announced like a join. Streams (KIND_STREAM) are never e2ee.
To-device channel. SecretService/SendToDevice(user_id, session_id, ciphertext, message_type, kind = "call_key", call_id) queues one opaque Olm message for one device, delivered as
Update.to_device (ToDeviceMessage: queue_id, from_user_id, from_session_id,
from_identity_key, kind, call_id, ciphertext, message_type) through the same per-device
queue as secret chats: live push + GetQueue, removed by Ack(max_queue_id). No push
notification is sent for it. Server rules (errors in brackets):
kindmust be"call_key"[TO_DEVICE_KIND_INVALID]; 1..16384 bytes, Olm type 0 or 1 [ENCRYPTED_MESSAGE_INVALID]; not to the sending device itself [USER_ID_INVALID].- The call exists [
CALL_NOT_FOUND], is not a stream [CALL_TYPE_INVALID], is not ended and, for 1:1, isSTATE_ACTIVE[CALL_NOT_ACTIVE]. - The sending session AND the recipient
(user_id, session_id)are both current participant devices of that call (left_at = 0, matchingsession_id) [CALL_PARTICIPANT_REQUIRED]. A departed device, a user’s other devices, and outsiders get nothing. - Both devices have published device keys [
DEVICE_KEYS_REQUIRED,DEVICE_NOT_FOUND]. - 20 messages/s, burst 300, per sending device [
FLOOD_WAIT].
Olm sessions. Separate from secret-chat sessions, one or more per peer device. To send, a
client uses its newest session with that device or creates an outbound one with
ClaimKey(user_id, session_id) (verify the device signature and the one-time key signature).
To receive, it tries every session it has with the sender device; if none decrypts and the
message is a pre-key message (type 0), it creates an inbound session from it with
from_identity_key. Two devices that start sessions at the same time therefore both work. As
with secret chats, effects (session pickles, consumed one-time key) are committed before Ack.
Plaintext. ToDevicePayload { call_key: CallMediaKey, padding } (secret.proto):
| field | rule |
|---|---|
call_id | must equal ToDeviceMessage.call_id |
sender_user_id, sender_session_id | must equal the Olm peer (from_user_id, from_session_id); otherwise drop |
epoch | strictly increasing per (call, sender device); a key with epoch <= the last accepted one is a replay: drop. Senders start at their clock in ms and add 1 per rotation, so a restarted client that rejoins keeps increasing |
key_index | 0..15, the key-ring slot the sender will encrypt with; slots cycle rotation_count mod 16 |
key | 32 fresh random bytes (never derived from an earlier key) |
padding | 0..31 random bytes so ciphertext length says nothing; ignored |
Epoch rules.
- On joining (first participant list), a device generates its first key and sends it to every
other participant device that has
e2ee = true. - Every change of the participant set — a device joins, leaves, or a user switches device —
makes every remaining device rotate: new random key,
epoch + 1, next slot, sent to the participant devices now in the call. Leavers therefore never get keys for later media, and newcomers never get keys for earlier media. Leaves rotate immediately; join bursts are coalesced (≈150 ms). - A sender installs its new key for itself immediately, sends it, and switches its encryption to the new slot once the sends have returned plus a grace for receivers to import it: 100 ms after a leave, 500 ms after a join. Receivers keep all 16 slots.
LeaveCallalso removes the leaver from the SFU room at once, so its own connection stops receiving. What remains is an adversary that records at the SFU and holds the leaver’s keys: it can decrypt media until the senders switched — signalling latency (participant-left update) + key send round trip + 100 ms; measured 0.37–0.74 s on a dev machine (over 1 s when the machine is heavily loaded) (TestGroupCallSenderKeysE2EElogs it). The short grace can cost the remaining members a few hundred ms of undecryptable audio when a key import is slow.- Keys are accepted only from the device currently listed for that user. A key that arrives before its sender appears in the participant list is parked for at most 30 s.
- If any participant has
e2ee = false(or this device can’t do E2EE: web has no Olm), every client disables frame encryption for the call and shows “Not end-to-end encrypted” naming the participants that can’t encrypt; it re-enables it when they leave (with a rotation). - Keys exist in memory only; at the end of the call clients overwrite them with zeros (their
own state and every key-provider slot). The server deletes queued, unacked
call_keyitems when the call ends, when the recipient device leaves or switches away, and after 10 minutes.
Verification. Each received key carries the sender device’s identity key; clients look it up in the secret-chat trust-on-first-use store and show per participant: verified (fingerprint compared in a secret chat with that device), not verified, or security key changed (differs from the key first seen for that device).
12.5 Test vectors
Frame key import (§12.2) of the §12.1 vector key and one Opus frame (fc0102030405060708)
encrypted with iv = 000102030405060708090a0b, key_index = 0:
material 93365732b080f441a333e21045035511e3fa9118dc38ad0ce2a930b2304a8d9a
aes_key 4daf76c3ff3ea800daf1176df5547fe2
frame fc8b6523faa58da2441edd3eb1125c74fe46080240b9ed9cc1000102030405060708090a0b0c00
ToDevicePayload{call_key{call_id 900, sender_user_id 1, sender_session_id 11, epoch 1700000000000, key_index 1, key 00 01 … 1f}} (no padding):
0a320884071001180b2080d095ffbc3128013220000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Checked by server/internal/itest/call_e2ee_test.go (TestFrameVectorLiveKitSDK, against LiveKit’s
Go SDK), todevice_test.go and sdk/dart/test/group_call_keys_test.dart.
12.6 Live streams
Channel live streams (KIND_STREAM) are server-trusted: no frame encryption, no call keys
(SendToDevice refuses them). Clients label them “Not end-to-end encrypted”.
Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.