Discord: Bootstrap ASAR vs dynamic modules, Gateway v10, Components v2 and DAVE MLS E2EE
Static teardown of Discord macOS 0.0.420, Android 352.17, Gateway v10, Components v2, Activities SDK 2.5.0, and DAVE MLS E2EE voice/video.
- Bootstrap ASAR + Rust discore
- Gateway v10 + Components v2
- DAVE MLS E2EE + Activities SDK
Investigation question
How do Discord Desktop and Discord Android split immutable bootstrap shells from dynamically updated runtime modules and shared Rust networking, and how do Gateway v10, Components v2, Embedded App SDK Activities, and DAVE MLS end-to-end voice/video encryption fit together on the wire?
Observed
Zero-execution static inspection of macOS Discord.app 0.0.420 (CFBundleIdentifier = com.hnc.Discord, team 53Q6R32WPB, Electron 44.9.3, 8 Mach-O binaries) paired with offline APK/JNI analysis of Discord Android 352.17 - Stable (com.discord versionCode 352017, targetSdk 36) and revision-pinned public Discord specifications maps the cross-platform client and protocol stack. On macOS, Electron fuses leave EnableCookieEncryption, EnableEmbeddedAsarIntegrityValidation, and OnlyLoadAppFromAsar disabled (raw byte 48) while keeping EnableNodeOptionsEnvironmentVariable, GrantFileProtocolExtraPrivileges, and WasmTrapHandlers enabled (raw byte 49). Shipped app.asar (3.47 MB, 11 files, 976 Rspack modules in app_bootstrap/bundle.js, 2,091 AST nodes across package.json and splashScreenPreload.js) is an updater bootstrapper registering discord:// and disclip:// URL schemes, attaching Crashpad minidump stream 0xd15c0d01 (DISCORD_CODE_INTEGRITY), disabling WaylandWpColorManagerV1 on Linux, and delegating module installation to Contents/Resources/updater.node (11.80 MB Rust N-API addon). On Android, 14,493 DEX classes, 78 manifest components, a 70.40 MB Hermes Bytecode v98 bundle (index.android.bundle plus an MBSDIF43 bsdiff patch), and 45 arm64-v8a .so libraries link libdiscord.so (475 exports spanning DAVE MLS and Secure Frames JNI), liblibdiscore-rn-jsi-module.so (10.53 MB, 8,308 exports sharing exact rustc commit 73dc9167f1cd099e525c9ade2e068d1907b78564 with macOS updater.node), libkrisp-audio-sdk.so, libcronet.143.0.7445.0.so, and libzstd-jni-1.5.7-3.so. Public OpenAPI v10 (157 paths, 250 operations, 542 schemas, 20 MessageComponentTypes), Embedded App SDK 2.5.0 (35 commands, 13 events), and DAVE Protocol MLS voice/video E2EE (opcodes 21..31, AES-128-GCM 8-byte tag + 0xFAFA footer) complete the wire contract.
Inferred
Three engineering tradeoffs stand out across client and bot boundaries: (1) disabling OnlyLoadAppFromAsar and EnableEmbeddedAsarIntegrityValidation on Desktop is required by Discord’s two-tier updater architecture—shipping a tiny bootstrapper in /Applications while updater.node stages versioned desktop core, voice, Krisp, Erlpack, and zstd native modules out-of-bundle and reports integrity anomalies via Crashpad stream 0xd15c0d01—whereas sharing one Rust toolchain (73dc9167f1cd099e525c9ade2e068d1907b78564) unifies Desktop updater logic with Android’s Tokio/JSI discore runtime; (2) setting IS_COMPONENTS_V2 (flag 1 << 15 = 32768) replaces legacy prose + embed payloads with a 40-component, 4,000-character layout tree (Container, Section, TextDisplay, Thumbnail, MediaGallery, File, Separator) that leaves top-level message.content empty unless archivers flatten TextDisplay nodes; and (3) coalescing in-place status card updates within Discord’s 5 edits / 5s per-channel rate-limit bucket avoids 429 stalls while keeping official Bot API integrations fully compliant without user-token automation.
Unknown & limitations
Static bundle, Mach-O, offline public APK, and public specification inspection only; Discord.app was never launched and no local Application Support directory, post-install updater module cache (discord_desktop_core or discord_voice), OS Keychain secret, Android /data/data/com.discord directory, or user session token was accessed. Server-side Gateway cluster routing, anti-abuse scoring heuristics, and proprietary Krisp neural audio weights remain outside static bootstrap artifacts and public specifications.
Architecture
Discord’s client architecture pairs thin platform hosts with shared Rust and C++ media/state engines: (1) macOS Desktop runs Electron 44.9.3 with an immutable 3.47 MB app.asar bootstrapper + 11.80 MB Rust updater.node that stages dynamic desktop_core and voice modules per user profile; (2) Android 352.17 runs React Native + 70.40 MB Hermes Bytecode v98 bridged via JSI to Rust discore_common (Tokio runtime, HTTP/Gateway caches) and JNI libdiscord.so (WebRTC, DAVE MLS, Krisp audio); and (3) third-party rich UIs run inside sandboxed iframe Activities speaking postMessage RPCs through @discord/embedded-app-sdk 2.5.0.
Domain & data models
OpenAPI v10 (542 schemas) models Guilds, Forum/Media Channels (available_tags, applied_tags, default_reaction_emoji), Threads, Polls, Message Snapshots (type 1 forward reference), Voice Messages (IS_VOICE_MESSAGE flag 8192 with base64 waveform + duration_secs), and all 20 MessageComponentTypes: ActionRow (1), Button (2), String/User/Role/Mentionable/Channel Selects (3, 5..8), TextInput (4), Section (9), TextDisplay (10), Thumbnail (11), MediaGallery (12), File (13), Separator (14), ContentInventoryEntry (16), Container (17), Label (18), FileUpload (19), RadioGroup (21), CheckboxGroup (22), and Checkbox (23).
Workflows & state machines
Three real-time state machines govern sessions and media: (1) Gateway v10 WebSockets negotiate zstd-stream or zlib-stream framing with JSON or etf Erlpack payloads across IDENTIFY, HEARTBEAT, and seq/session_id RESUME while REST v10 enforces X-RateLimit-Bucket headers (including 5 edits / 5s per channel and 3-second Interaction ACK deadlines); (2) DAVE Protocol E2EE voice/video advances Voice Gateway opcodes 21..31 through MLS KeyPackage/Proposal/Commit/Welcome handshakes (RFC 9420, ciphersuite MLS_128_DHKEMP256_AES128GCM_SHA256_P256) to encrypt per-sender WebRTC media frames with AES-128-GCM 8-byte tags, ULEB128 unencrypted header ranges, and a 0xFAFA magic footer while keeping SFU RTP headers routable; and (3) verification out-of-band compares 30-digit decimal Epoch Authenticators for group call state and 45-digit scrypt-derived pairwise verification fingerprints.
API & protocol surfaces
157 REST v10 paths (250 operations across channels, interactions, webhooks, guilds, polls, threads, and voice), Gateway v10 opcodes 0..11 + Voice Gateway v8 opcodes (including DAVE MLS opcodes 21..31 binary/JSON frames), 35 @discord/embedded-app-sdk 2.5.0 Activity commands + 13 subscribed events, macOS splashScreenPreload contextBridge IPC, and Android 475 libdiscord.so JNI + 8,308 liblibdiscore-rn-jsi-module.so native exports.