Multigravity Security & Zero-Knowledge E2EE Architecture
Security Summary: Multigravity is a self-hosted local companion for your official Google Antigravity IDE/CLI. It never extracts Google OAuth tokens, never proxies Google APIs, and stores zero source code or chat history on developer servers. When you connect outside your local network, relay traffic is protected by zero-knowledge end-to-end encryption (mgy-e2ee-v1: ECDH P-256 + HKDF-SHA256 + AES-256-GCM), and unencrypted relay requests are hard-rejected with HTTP 426 Upgrade Required.
1. Zero Token Extraction & Official Harness Boundary
A common concern with third-party AI tools is whether they intercept vendor authentication tokens or imitate official API clients. Multigravity avoids that entire attack surface by design:
iPhone / iPad / Android / Web PWA
──[LAN Wi-Fi | Tailscale | E2EE Relay (mgy-e2ee-v1) | Cloudflare HTTPS]──▶
Local Go Gateway (`mgy` running on your macOS / Linux / Windows machine)
──▶ Local Official Google Antigravity IDE / CLI (`language_server`)
- Your official local Antigravity runtime stays in charge: All model invocations, MCP tools, skills, workspace file reads, and
/swarmexecutions happen exclusively inside your official local Google Antigravity installation. - No cloud credential relay: Multigravity never uploads Google credentials, cookies, or repository snapshots to external servers.
- Full MIT transparency: Every component — Go gateway, E2EE library, SwiftUI iOS client, Jetpack Compose Android client, and the stateless APNs Worker — is open-source under the MIT license.
2. Transport Paths & Trust Boundaries
Multigravity concurrently probes available routes and automatically selects the lowest-latency path. You can remain strictly on LAN/Tailscale or combine direct routes with the zero-knowledge relay pool:
| Transport Path | What Traverses It | Encryption Layer | Who Can Read Payloads |
|---|---|---|---|
| LAN Wi-Fi / Tailscale | Direct HTTP + WebSocket between phone and local mgy |
Local network / WireGuard (Tailscale) + device auth token | Only your phone and your local computer |
| Multi-Region E2EE Relay | Opaque encrypted HTTP envelopes & WebSocket frames | TLS + mandatory mgy-e2ee-v1 (ECDH P-256 + HKDF-SHA256 + AES-256-GCM) |
Only your phone and your local computer (relays cannot decrypt; plaintext rejected with HTTP 426) |
| Bring-Your-Own Cloudflare Tunnel | Gateway traffic via mgy cloudflare |
Cloudflare TLS + device authentication | Controlled under your own Cloudflare account |
Stateless APNs Worker (push.jiuge.space) |
Short push alerts (approval prompts, Live Activity step progress) | HTTPS + Apple APNs TLS; ES256 JWT cached in memory only (45 min) | Stateless pass-through with zero DB and zero logs; self-hostable on free Cloudflare Workers |
3. Inside mgy-e2ee-v1 (Auditable Source Reference)
Instead of trusting relay operators with TLS termination, Multigravity wraps both HTTP API payloads and streaming WebSocket frames in application-layer authenticated encryption:
- Gateway Identity Key (
internal/e2ee/crypto.go): On first launch,mgygenerates a persistent NIST P-256 ECDH keypair stored at~/.multigravity/e2ee_identity.jsonwith strict0600file permissions. - Per-Device Pairing & Key Derivation: During one-time QR pairing, each paired device derives dedicated directional session keys via
HKDF-SHA256with domain separation (PairSalt = "mgy-e2ee-pair-v1"and info prefixmgy-e2ee-v1:<deviceID>:<direction>). - Authenticated Ciphertext: Every HTTP envelope and WebSocket frame is sealed with
AES-256-GCMusing a fresh 96-bit random nonce (NonceSize = 12,KeySize = 32). - Fail-Closed Plaintext Guard (
internal/e2ee/http.go): Any request marked byWithRelayTransport(ctx)that arrives without valid E2EE wrapping is rejected immediately withHTTP 426 Upgrade Required— preventing silent downgrade attacks.
4. Device Credentials, Android Signing & Instant Revocation
- Mobile key storage: Pairing tokens and device keys are stored exclusively in Apple Keychain on iOS/iPadOS and EncryptedSharedPreferences on Android.
- Deterministic Android APK verification: Direct-install Android releases are signed with an offline private release keystore and verified by SHA-256 checksum inside the built-in updater before installation.
- One-command revocation: Run
mgy listto inspect paired devices ormgy clear allto revoke every paired client immediately.
5. Frequently Asked Questions
Is Multigravity safe to use on company or private codebases?
Yes — especially when paired over LAN Wi-Fi or your organization's Tailscale / VPN tailnet, where zero traffic touches any external relay. When remote relay mode is enabled, payloads remain end-to-end encrypted with mgy-e2ee-v1 and can be independently audited in internal/e2ee/ on GitHub.
Can I self-host the APNs notification relay on my own Cloudflare account?
Yes. The exact worker code lives in scripts/cloudflare-apns-worker/ and runs on Cloudflare Workers' free tier (100,000 requests/day) with zero database or log storage.
What happens if I lose my phone?
Run mgy clear all on your desktop machine to immediately invalidate all paired device tokens and E2EE session keys. Because no repository files or Google credentials are stored on the phone, revoking the pairing key cuts off access instantly.