Chirp V5 End-to-End Encryption Protocol
Chirp V5 (chirp-mls-authenticated-v5) specifies unified device identity verification, authorization history freshness, and OpenMLS (RFC 9420) room keying across macOS, iOS, Android, and Windows.
All four clients invoke the same Rust cryptographic core over FFI/JNI/C-ABI for group key agreement, SAS state machines, and key-age gates, while Go persists device registration events and signs challenge-bound history snapshots. System Architecture · Encryption & Boundaries
The client fetches passkey_origin, service endpoints, and platform version policies. Clients below the minimum version are blocked with an update prompt.
Threat Model & Core Assumptions
V5 rests on zero trust in transport, bounded trust in authorization history:
- Zero content access by servers: REST APIs, signaling WebSockets, LiveKit SFU, and network links may drop, delay, replay, or tamper with traffic. Bearer tokens and LiveKit JWTs authorize connectivity only—decryption requires client-verified device cert chains, SAS verification, exact member rosters, and mutual MLS key confirmations.
- Bounded trust in revocation history: Clients refresh challenge-bound snapshots from
/authorization/v5/every 20 seconds, valid for at most 60 seconds from initiation. A compromised authorization server can delay propagation of a brand-new revocation within that window, yet cannot forge device private signatures or derive MLS secrets, and clients reject any snapshot omitting or regressing locally persisted history checkpoints. Replace the default signing seed for exclusive signing authority. Signing Keys
Authorization Endpoint Integration
In Go, authorization endpoints share port 18115/TCP inside the binary while isolating state inside authorization.db and a dedicated Ed25519 seed. App Wiring · Auth Server
| Route | Verification & Contract |
|---|---|
POST /authorization/v5/append | Verifies device signature, strictly monotonic sequence, and signer's register/revoke scope before appending events. |
POST /authorization/v5/snapshot | Accepts canonical Origin, 32-byte random nonce, and 1–2 account roots; returns Base64 payload + Ed25519 signature bound to request digest. |
GET /authorization/healthz | Checks authorization.db availability independently (HTTP 204). |
GET /healthz | Verifies both chirp.db and authorization.db (HTTP 200). |
Zero fallback or credential substitution
Authorization appends reject cookies and login Bearers in place of device signatures. Missing, malformed, or non-0400/0600 signing seeds abort server startup immediately.
Verification & Admission Invariants
- Strict isolation until verified: Whenever any room participant lacks mutual SAS verification, clients exchange only identities, certs, SAS messages, and state—never MLS
Welcome, voice frames, chat, or attachment keys. Opaque client-to-client E2EE signals relay over/v1/identity/signals(≤ 64 KiB, Origin-scoped). - Independent out-of-band SAS checks: Compare all 3 safety code groups in person or via a separately verified channel—never confirm over the unverified call itself.
- Never substitute nicknames or
readyflags: Trust bindsOrigin + Account Root Key + Specific Device Key. - Approve roster before group creation: Clients approve exact rosters (
entry_id, device identity, MLS key, fresh auth) locally before Rust calls OpenMLSCreate/Joinor acceptsWelcome. - Mutual confirmation before media: Roster shifts halt media and retire keys until all members confirm identical
epoch authenticatordigests and obtain fresh media leases. - Shared bundled verification root: All builds embed
AuthorizationTrust.jsonand derive/authorization/v5/frompasskey_origin. Custom signing seeds require rebuilding and redistributing clients. Trust JSON
Authorization Log Chain, Caps & Freshness
The authorization state machine (Source) tracks a strictly incrementing hash chain per account root:
- Verification sequence:
prior state → signer authority → event signature → next stateserialized via SQLite Compare-And-Swap (CAS). - Idempotency & revocation reservation: Duplicate retries at identical sequence + digest succeed idempotently. Each account supports up to 128 devices and 8,192 total log entries; registration and social events cap at sequence 4,096, reserving the upper half exclusively so saturated accounts can always record revocations.
| Parameter | Constraint & Behavior |
|---|---|
| Refresh interval | New random nonce request every 20 seconds. |
| Maximum snapshot lifetime | 60 seconds from request initiation on ContinuousClock (sleep & RTT included; multi-batch takes earliest). |
| No-extension rules | Reused nonces, empty responses, short pages, or regressed checkpoints never extend the 60s window. |
| Read proof window | Full personal social payload requests include a signed device proof within ±60 seconds of server time. |
Client Forced Re-Keying & Media Gates
Key Timers & Hard Bounds
- Server rotation schedule: Default 60 seconds (
CHIRP_GROUP_ROTATIONconfigurable30sto30m). - Client key-age law: Clients trigger proactive rebuild at 90 seconds and hard-halt at 120 seconds from initial key creation/decryption—immune to heartbeats, leases, or device sleep.
- Candidate window: Candidate prepare + activation allow up to 15 seconds; old receive slots linger at most 1 second for in-flight UDP packets without outliving leases or key caps.
- Effective send/play ceiling:
min(media lease, login/cert expiry, 60s auth deadline, 120s hard key age).
Frame Decryption & Replay Guards
- Ordered pause teardown: On roster change or expired auth, clients revoke permits and clear current/candidate MLS state before pausing audio hardware; tracks stay subscribed until re-keyed and authorized.
- AES-GCM + 96-bit IV ceiling: Before Opus decoding, frames pass AES-GCM tag checks and per-(sender, key) seen-IV deduplication (allowing reordering across packets, stopping at 65,536 distinct IVs per sender/key).
- Tight enforcement loops: Apple checks
ContinuousClockper capture frame alongside a ~20ms watchdog sweep; DataChannel chat re-checks permits immediately prior to queuing; Android and Windows enforce symmetric checks. Android VoiceKeys · Windows Media
Physical engineering boundaries
Because Chirp preserves upstream WebRTC C++ jitter/encoder queues without hard millisecond aborts, trace already-queued frames in OS/driver buffers cannot be recalled, and Rust memory wiping complements rather than replaces OS full-disk encryption.
Client Implementation & Protocol Test Suites
- Apple: RoomIdentity.swift · GroupSession.swift
- Windows: authority_windows.go · room_windows.go
- Android: AccountIdentity.kt · SecureGroup.kt
| Suite | Command & Verified Scope |
|---|---|
| Go race & vet | go test -race ./... and go vet ./... on Linux/macOS covering routing, auth challenges, CAS chains, and fail-closed startup. |
| Apple SharedFSM | swift test --package-path Client/apple --scratch-path .build/swift-core on macOS. |
| V5 Authorization | python3 scripts/test-v5-authorization.py exercising live Go + Swift enrollment, read proofs, and revocations. |
| Key Age & Candidate Stall | python3 scripts/test-v5-key-age.py (--candidate tests timeout) proving 90s rebuild and 120s retirement. |
| Cross-Platform Guides | Native Client Builds · Server Build & Testing · Manual QA Checklist |
