Skip to content

Encryption & Security Boundaries ​

Last updated

Chirp is built around one invariant: even if your server or media relay is compromised, the server cannot decrypt voice audio, text chat, or transferred files. All four native clients share one Rust core handling OpenMLS group crypto, device certification, and .chirpkey recovery, integrated with OS keystores (Apple Keychain, Android Keystore, Windows DPAPI) and patched WebRTC receivers.

Below is the complete map of credentials, key lifetimes, device trust verification, smooth rotation gates, and explicitly accepted security boundaries. V5 E2EE Protocol · Security Audit & E2EE Review · Attachment Transport

Key Hierarchy & Dual-Slot Rotation Overview ​

V5 Key Trust Hierarchy & Dual-Slot Smooth Rotation
Ed25519 Account RootOnly inside .chirpkeyNever kept in daily vaultDevice Cert Chain (≤8)Per-device Ed25519 keyMax 5 yrs · RevocableOpenMLS Group (V5)Binds entry_id & rosterAES-128-GCM / X2551932B Sender KeyMLS Exporter derivedEncrypts Opus & chatt = 0sSlot 0 ActiveSend/recv + 3s leaset = 48s (-12s lead)Pre-stage Slot 1Slot 0 stays livet = 60s (Switch)Switch Send to Slot 1Report activation · livet = 61s (+1s grace)Wipe Slot 0Random overwrite90s / 120s CapHard Cutoff90s rebuild / 120sAny membership change, disconnect, or candidate timeout aborts the candidate round and forces a paused rebuild; old candidate keys never apply to new rosters.
Media providers use 2 slots per sender with auto-ratchet and SIF plaintext bypass disabled: switching slots avoids recreating RTP encryptors or interrupting speech.

Credentials, Cryptographic Material & Lifetimes ​

Access credentials (Passkeys, Bearers, LiveKit JWTs) prove admission to servers and SFUs; decryption capability belongs exclusively to OpenMLS keys bound to SAS-verified devices and current entry_id sessions:

MaterialStorage & CreationExpiry & Retirement
Passkey Private KeyUser device / password manager (server stores public key only).Long-lived; deleting server accounts does not delete user Passkeys remotely.
WebAuthn ChallengeTemporary server SQLite record.Single-use; browser ceremony expires in 5 minutes.
Browser Session CookieDigest in DB; HttpOnly; SameSite=Strict (Secure over HTTPS) in browser.Up to 8 hours; revoked immediately on role change, disable, or sign-out.
Native Auth CodeDigest in DB bound to S256 PKCE + platform scheme.Single-use, expires in 1 minute.
Phone QR ClaimServer short-lived record bound to client verifier.Expires in 3 minutes; exchanged for Setup Grant without dropping old session until activation.
Identity Setup GrantShort-lived credential bound to Origin, account, PKCE, and challenge.5 minutes; activates/pairs a device only—grants no directory or room access.
Native Bearer TokenSHA-256 digest on server; RAM-only on client.Earlier of 20 hours or device leaf cert expiry; atomically superseded by new device login or cold-launch resumption rotation.
Login Resumption Token (resume_token)SHA-256 digest + bound origin/platform/login_id on server; sealed behind OS per-use auth on client (Apple biometryCurrentSet/userPresence Keychain, Android BIOMETRIC_STRONG + Keystore RSA, Windows opt-in Hello KSP NCryptDecrypt).Shares the exact expires_at deadline of initial sign-in; requires fresh V5 device signature over a 1-minute challenge; cleared immediately on logout, takeover, or revocation. Release Note
Room Preflight ProofHMAC-SHA256 signed by an in-memory app secret.Up to 30 seconds; invalidated on app restart or room password update.
Room Entry (entry_id)Server SQLite record tying login, room, and entry.30 seconds renewed by group join or 2s heartbeat, bounded by login lifetime.
LiveKit JWTSigned with shared keys.json between app and livekit.Default 5 minutes; allows publishing mic, subscribing tracks, and sending data frames only.
Account Ed25519 Root KeyGenerated locally on first approved login from CSPRNG.Never written to disk, Keychain, or server; lives transiently in RAM during setup/restore.
.chirpkey Recovery FileOffline encrypted backup exported by user (Argon2id + AES-256-GCM).Valid indefinitely unless passphrase lost or replaced. Format Spec
Device Ed25519 IdentityPer-origin, per-account isolated OS keystore (Data Protection Keychain / Android Keystore / DPAPI).Retained across sign-out to authorize future hardware; max 5-year lifetime, depth 8.
Auth Snapshot SeedServer signing seed (authorization-key).Replaceable with private seed for exclusive signing authority. Signing Keys
Auth Snapshot CacheRefreshed every 20s with fresh nonce; client persists highest seen checkpoints.Valid 60 seconds from request start (ContinuousClock); revocations are immutable.
MLS Session KeypairEphemeral RAM keypair bound to current entry_id.Destroyed on room exit; fresh KeyPackage generated per round.
MLS Exporter Sender KeysNative RAM exclusively.Smooth swap overlaps dual slots briefly, overwriting retired slots with CSPRNG bytes +1s post-switch.
Attachment File KeyRandom 256-bit key per transfer sent over encrypted chat channel.Lives solely inside revocable AttachmentLease RAM; wiped on exit or cache clear.

Device Identity, Pairing & SAS Trust ​

Device Certificate Chain (≤ 8 Levels) & Revocation Isolation
Account Ed25519 RootStored in .chirpkey onlySigns Device #1 (≤ 5 yrs)Device #1 (Revoked Later)CanEnroll = true (Depth 1)Cannot enroll new devicesDevice #2 (Still Valid!)Enrolled before A revokedIndependent revocation stateUp to 8 LevelsMax 128 devices/acctLast device = BanVersions 1 – 4096: Enrollments & Social EventsNormal device additions and friend/trust updates capped hereVersions 4097 – 8192: Reserved Strictly for RevocationsGuarantees an account can never be locked out of revoking devicesSQLite triggers prevent DELETE/UPDATE on identity_blacklist; clients reject any snapshot rolling back their local checkpoint.

Chirp V5 (chirp-mls-authenticated-v5) eliminates legacy host whitelists: Rust and platform clients independently check certificate chains, entry_id bindings, MLS keys, and member confirmations, never trusting server-provided ready flags alone.

1. Binding the Account Root Identity ​

After approval and Passkey auth (5m Setup Grant), the first device creates an account root + candidate device key, exports .chirpkey, enforces a 5s safety wait, and signs a one-time challenge. Concurrent initial bindings serialize in SQLite so only the first wins; dropped responses resume cleanly with the staged candidate material without losing the exported root. Setup Source

2. Device-to-Device QR Pairing (chirp-device-pair-v1) ​

  1. Signed request & SAS commitment: New device builds a signed request QR (valid ≤ 5 minutes, capped by Setup Grant) binding Origin, account ID, root key, candidate key, nonce, and pre-committed SAS material.
  2. Immutable server relay: Short-lived relay (512 global slots, 3 per account) fixes the initial Offer digest to block swap/tamper attacks while remaining retry-idempotent.
  3. Camera scan or image import: Old device scans via camera or imports a single QR image (≤ 8 MiB, ≤ 4096 px/side via Vision/Core Image on Apple, ZXing on Android/Windows). When importing images, the old device hides its computed SAS codes and requires manual entry of all 3 groups from the new device's screen (3 wrong tries abort pairing).
  4. Biometric approval & seamless takeover: Both roles verify distinct vodozemac (X25519 / HKDF / MAC) authenticators. Approving issues the cert without kicking the old device; handoff occurs only once the new device activates login. Pairing Protocol

Chain Depth & Independent Revocation

Device certs nest up to 8 levels and last up to 5 years. Revoking an ancestor stops it from issuing future certs without invalidating already-issued descendant devices. .chirpkey can always enroll a brand-new device, never revive a revoked device or banned account.

3. In-Room SAS Verification ​

  • Trust binds devices, not handles: Friend lists are UI conveniences only; every unverified peer triggers a full-room lock across voice, chat, and files until pairwise SAS verification completes out-of-band. SAS State Machine

4. Snapshot Freshness & Blacklist Enforcement ​

Clients request signed history snapshots every 20 seconds; responses stay valid for at most 60 seconds from request initiation (ContinuousClock). Clients persist highest checkpoints and reject empty or regressed snapshots. Apple and Windows update blacklists alongside fresh snapshots while enforcing known revocations offline; Android requires both snapshot signature and blacklist fetch to succeed before advancing the deadline.

Group Keying, Gating & Smooth Rotation ​

Group Key Establishment State Machine & Verification Hold
Pre-Gate: Unverified Device Present → Control-Only Session (No Transition Timeout)Only after all peers mutually verify SAS & fresh snapshots do clients submit KeyPackages to start the 12s timer.1. collectingCollect signed bindings& 120s KeyPackages2. welcomingLeader batches Add& publishes Welcome3. confirmingVerify roster & install32B sender keys first4. ready3s media leases active2s heartbeat · 60s rotatePeer join/leave · 6s heartbeat loss · 12s timeout → Retire keys & advance generation
  1. Group setup (collecting → welcoming → confirming → ready): Rooms advance generation on roster shifts/rebuilds and key/{key_epoch} on scheduled rotations. All /v1/group/ mutations carry Ed25519 signatures (Chirp group request v5) over exact paths and body SHA-256. Action Validator
  2. 2s heartbeats & 3s media leases: Heartbeats keep room membership alive (6s timeout, 12s handshake timeout; skipped while awaiting manual SAS confirmation), whereas active transmission requires renewing a 3-second monotonic media lease approximately every second.
  3. Dual-slot smooth rotation & hard age limits: Server triggers routine rotation every 60 seconds (pre-installing candidate slot min(12s, interval/2) early when everyone declares smooth_rotation), retiring previous slots +1s post-switch with random memory overwrites. Regardless of server timers, clients independently trigger rebuild at 90s key age and hard-halt at 120s. Room timers display advisory room_information metadata (update_reason: initial_connection, members_changed, scheduled_rotation, or connection_recovery). Public Info Source
  4. Local mic intent & no-fallback DataChannels: Patches block server-triggered unmutes, and outbound chat re-checks lease + provider state right before dequeuing into WebRTC. Chat Patch

Accepted Risks & Explicit Security Boundaries ​

DimensionEnforced GuaranteeExplicitly Outside Threat Model
Content confidentialityServers & SFU see zero plaintext media/chat/files; unverified devices blocked.Compromised endpoints, mistakenly confirming wrong SAS digits, or malicious authorized callers recording locally.
MetadataChat text and original filenames stay off server storage.Servers observe accounts, room attendance, public IPs, session duration, and encrypted packet cadence/sizes.
Forward secrecy & memory60s rotation / 120s hard ceiling; retired secrets wiped from native slots.Per-frame ratcheting; sub-second frames already queued inside OS/WebRTC C++ buffers; allocator-retained memory pages.
Revocation latencyAnti-rollback checkpoints block stale snapshots; max 60s propagation bound.Instantaneous sub-60s global push without server cooperation; default open-source seed shares verification root unless replaced. Signing Keys