[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110348":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":29,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":15,"starSnapshotCount":15,"syncStatus":33,"lastSyncTime":34,"discoverSource":35},110348,"zalo-swift-re","qnguyen3\u002Fzalo-swift-re","qnguyen3","A reverse-engineered version of Zalo written in Swift — native macOS client",null,"Swift",161,131,1,5,0,7,42,54.05,"GNU General Public License v3.0",false,"main",true,[24,25,26,27,28],"macos","reverse-engineering","swift","swiftui","zalo","2026-11-11 20:51:31","2026-11-23 13:41:41","# zalo-swift-re — Olaz\n\n**A reverse-engineered, native macOS client for [Zalo](https:\u002F\u002Fzalo.me), written in Swift.**\n\nOlaz puts a native SwiftUI interface (Liquid Glass, sidebar + labels, native media viewer) on top of Zalo's\nown client code. It does **not** re-implement Zalo's protocol. Instead it runs the **official Zalo PC renderer**\n(`app.asar`) headless inside a `WKWebView` and supplies in Swift everything that Electron's preload and main\nprocess used to provide. The UI is native SwiftUI driven by the official client's state.\n\nZalo PC does not need to be installed. On first launch Olaz downloads the official Zalo PC installer from VNG\n(or copies an installed Zalo.app of the same version), checks VNG's code signature and keeps only `app.asar`\nand `ZaloHelper.app` (calls, screenshots) in `~\u002FLibrary\u002FApplication Support\u002FOlaz\u002FZaloRuntime\u002F` (~270 MB).\nSee [`ZaloRuntime\u002FZaloRuntimeInstaller.swift`](Sources\u002FOlaz\u002FZaloRuntime\u002FZaloRuntimeInstaller.swift).\n\n> [!IMPORTANT]\n> **Unofficial project, not affiliated with or endorsed by VNG Corporation.** \"Zalo\" is a trademark of VNG.\n> This is an interoperability and reverse-engineering research project. Using an unofficial client may\n> conflict with Zalo's terms of service, so use it at your own risk with your own account.\n\n## Features\n\n- **Real QR login** (trusted-device QR → scan with Zalo on your phone → confirm), session restore on relaunch\n- **Chat**: history and load older, send text \u002F reply \u002F mentions, reactions, typing, read state, realtime updates\n- **Composer \"+\"**: photos \u002F video, files, screenshot (Zalo's own `ZaloCap`), my contact card, reminders\n- **Message actions**: forward, copy, recall, delete with undo, pin bar, star\n- **Voice \u002F video calls** through Zalo's own `ZaloCall` helper\n- **E2EE conversations**, including E2EE video playback\n- **Phone → PC message sync** with a native progress UI\n- Contacts and friend requests, My Cloud, polls, stickers, labels, hidden chats (PIN), stranger folder,\n  shared-media browser, quick switcher, native notifications\n\n## Requirements\n\n- macOS 26 or later, Xcode 27 (Swift 6 toolchain)\n- A Zalo account and the Zalo app on your phone (for QR login)\n- About 340 MB of download on first launch (Zalo PC's code, fetched from VNG)\n\nZalo allows **one desktop (PC) session per account**. If the official Zalo PC is also running, quit it while\nusing Olaz.\n\n## Build & run\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fqnguyen3\u002Fzalo-swift-re.git\ncd zalo-swift-re\n\nswift test                     # crypto parity (vs Node), asar reader, JSC\u002Flibsignal and host-script tests\n.\u002Fscripts\u002Fmake-app.sh debug    # → build\u002FOlaz.app (ad-hoc signed, JIT entitlement)\nopen build\u002FOlaz.app            # real QR login — scan with Zalo on your phone\n```\n\nA new PC session has no message history except My Cloud, because Zalo keeps history on the phone. Use\n**Đồng bộ tin nhắn từ điện thoại** (confirm on the phone) to import it.\n\n### Release (maintainers)\n\n```bash\nxcrun notarytool store-credentials \"olaz-notary\" --apple-id \u003Capple-id> --team-id \u003Cteam-id>   # once\n.\u002Fscripts\u002Frelease.sh           # → dist\u002FOlaz-1.0.dmg + dist\u002FOlaz-1.0.zip (Developer ID, hardened runtime, notarized, stapled)\nOLAZ_VERSION=1.1 .\u002Fscripts\u002Frelease.sh\n```\n\nThe script signs `build\u002FOlaz.app` with the \"Developer ID Application\" identity in your keychain, notarizes and\nstaples the app, then wraps it in a drag-to-Applications DMG that is signed, notarized and stapled as well.\nCredentials stay in your keychain. Users still fetch the pinned Zalo runtime from VNG on first launch.\n\n### Pinned Zalo version\n\nThe Zalo version is pinned in `ZaloRuntime.pinned` (version, DMG URL, SHA-256). To move Olaz to a newer Zalo,\ntest against it and bump the pin. Installed runtimes are upgraded in the background and switched at the next launch.\nIf the pinned DMG disappears from VNG's CDN, a fresh install falls back to whatever `zalo.me\u002Fdownload\u002Fzalo-pc` offers\n(still signature-checked). `OLAZ_ZALO_DMG=pinned OLAZ_NETWORK_TESTS=1 swift test --filter ZaloRuntimeTests` runs the\ninstall end to end.\n\n### Developer harness\n\nPrints every bridge\u002FIPC call, console line and network request:\n\n```bash\n.build\u002Fdebug\u002FOlaz --engine-probe [login|main] [seconds]\nOLAZ_TRACE_WORKERS=1 OLAZ_DEBUG_RESPONSES=1 OLAZ_QR_OUT=\u002Ftmp\u002Fqr.png …\n```\n\n* Engine diagnostics: `~\u002FLibrary\u002FApplication Support\u002FOlaz\u002Flogs\u002Fengine.log` (shapes only, no message content or tokens).\n* Dev evaluation channel (debug builds only, off by default): `defaults write app.olaz.mac OlazDevEval -bool YES`.\n\n## Architecture\n\n```\nSwiftUI (Liquid Glass)                     Views\u002F, Shell\u002F, App\u002F\n        │  @Observable ZaloEngine           ZaloRuntime\u002FZaloEngine.swift (+ feature extensions)\n        ▼\nOfficialClientHost  ── WKWebView, headless\n  ├─ zalo-app:\u002F\u002F scheme → pc-dist served straight out of Zalo's app.asar      (AsarArchive, ZaloRuntimeInstaller)\n  ├─ HostScripts\u002Fnetwork-shim.js → XHR\u002Ffetch\u002FWebSocket proxied to URLSession   (NetworkProxy)\n  ├─ HostScripts\u002Fbridge.js       → $z* preload globals, Electron IPC emulation (ZaloBridge)\n  ├─ HostScripts\u002Flocal-modules.js→ Node path\u002Fos\u002Fcrypto objects, electron-store\n  ├─ HostScripts\u002Fstate-adapter.js→ official state → Swift (QR via DI container, Redux store)\n  └─ HostScripts\u002F*-adapter.js    → per-feature adapters over the official services (chat, composer, calls, …)\n        │\nZaloMainProcess  ── Swift stand-in for Electron main.js: IPC channel handlers,\n                    cookies (zpw_sek), zsafe-storage, keychain cipher, page hand-off\n```\n\n* **Bridge table**: `Resources\u002Fbridge-table.json` maps all 450 table-driven preload members\n  to their IPC channel + type, generated from the official `preload-render.js`.\n  Semantics per channel: [`reanalysis\u002Fbridge-spec.md`](reanalysis\u002Fbridge-spec.md).\n* **Node parity**: `$znode.crypto` is reproduced on CommonCrypto\u002FCryptoKit and verified\n  byte-for-byte against Node (`Tests\u002FOlazTests\u002FRuntimeTests.swift`). The official\n  client uses it to encrypt `zcid` and request params.\n* **Storage**: native SQLite, as Zalo PC 26.10 runs after its IndexedDB → SQLite migration. The official data access\n  layer talks to its `utility-process-sqlite` over a MessagePort channel; `HostScripts\u002Fsqlite-host.js` plays that\n  process inside each page (channel broker + request protocol) and `ZaloRuntime\u002FSQLiteHost.swift` executes the SQL on\n  the system SQLite (`\u003CuserData>\u002Fsqlite\u002F_production\u002F\u003Cdb>.db`). Installs that already hold IndexedDB data stay on the\n  official \"migration disabled\" branch (`isMigrateFullDone→false`) until **Settings ▸ Engine ▸ Chuyển sang SQLite**;\n  `OLAZ_STORAGE=idb|sqlite` overrides for a run. The legacy message search index still runs in its web worker\n  (`fail_sqlite3=true`).\n* **JSBridge\u002F**: standalone JavaScriptCore runtime + WebCrypto shim + libsignal E2EE\n  module, for JS-only pieces that run outside the renderer.\n\n## Status\n\n| Area | State |\n|---|---|\n| Official renderer in WKWebView, from the Zalo PC code Olaz fetches from VNG (no Zalo PC install needed) | ✅ |\n| Electron main-process emulation (450-member IPC table) | ✅ login + main client paths |\n| Network via Swift: cookies, UA `ZaloPC-darwin-23v694`, CSP-safe sync bridge | ✅ |\n| Real QR login (trusted-device QR) → scan → confirm → session | ✅ verified end to end |\n| Session restore on relaunch (no QR) | ✅ |\n| Realtime WebSocket (`wsN-msg.chat.zalo.me`) | ✅ handshake + official sync commands |\n| Conversation list from official services, native SwiftUI | ✅ names, groups, members, unread |\n| Chat: open, history + load older, send text \u002F reply, reactions, typing, read state, realtime | ✅ official chatbox controller + message loaders (`HostScripts\u002Fchat-adapter.js`) |\n| Native chat UI (bubbles, media, quotes, reactions, composer with IME-safe Return) | ✅ `Views\u002FChatView.swift`, `MessageBubble.swift`, `ChatComposer.swift` |\n| Composer \"+\": photos \u002F video, files, screenshot, my contact card, reminder | ✅ official toolbar paths (`HostScripts\u002Fcomposer-adapter.js`, `ZaloEngine+Composer.swift`) |\n| Message actions: forward, copy, recall, delete + undo, pin bar, star | ✅ `HostScripts\u002Fmessage-actions-adapter.js` |\n| Voice \u002F video calls | ✅ official `ZaloCall` helper (`CallBridge.swift`, `HostScripts\u002Fcall-adapter.js`) |\n| Phone → PC message sync, native Liquid Glass progress UI | ✅ official sync-v2 state machine (`HostScripts\u002Ftransfer-adapter.js`, `Views\u002FTransferView.swift`) |\n| Hidden shared-worker window (Electron `sharedWorkerManager` port) | ✅ `ZaloRuntime\u002FSharedWorkerRouter.swift` |\n| CDN media when system DNS fails `*.zadn.vn` | ✅ DNS-over-HTTPS fallback with pinned-SNI TLS (`ZaloRuntime\u002FMediaLoader.swift`), Zalo hosts only |\n| Create group | 🧪 implemented over the official `createGroupV2` path, not yet verified against a live account |\n| Native SQLite backend (Zalo 26.10 migrates new sessions to SQLite) | ✅ fresh installs; existing IndexedDB installs switch from Settings (no data migration: re-sync from the phone) |\n\n## Reverse-engineering notes\n\n* [REVERSE-ENGINEERING-NOTES.md](REVERSE-ENGINEERING-NOTES.md): how the original Zalo PC app (Electron 22) is\n  packaged and structured, and why the renderer can be hosted outside Electron.\n* [reanalysis\u002Fbridge-spec.md](reanalysis\u002Fbridge-spec.md): the preload bridge (`window.$z*`), IPC channels and\n  their semantics, written as a spec for a Swift\u002FWKWebView host.\n* [reanalysis\u002Fbridge-table.json](reanalysis\u002Fbridge-table.json): machine-readable channel table.\n* Comments at the top of each `HostScripts\u002F*-adapter.js` document the official code paths each feature drives.\n\n## What is (and isn't) in this repo\n\n* **The Zalo runtime is not included.** Each user's Olaz downloads it from VNG and checks VNG's signature.\n* **Zalo's brand assets, UI string table and other files from the official bundle are not included.** They're\n  gitignored (see [.gitignore](.gitignore)). To regenerate them for research, extract them from your own copy of\n  Zalo PC.\n* **One third-party file is vendored**: [`Sources\u002FOlaz\u002FJSModules\u002Fvendor\u002Flibsignal-protocol.js`](Sources\u002FOlaz\u002FJSModules\u002Fvendor\u002Flibsignal-protocol.js),\n  VNG's fork of [signalapp\u002Flibsignal-protocol-javascript](https:\u002F\u002Fgithub.com\u002Fsignalapp\u002Flibsignal-protocol-javascript),\n  taken from Zalo PC 26.10.20 (`pc-dist\u002Flibs\u002Flibsignal-protocol.static.js`). Upstream is licensed **GPL-3.0**, so\n  this build is redistributed under GPL-3.0. Only the standalone `JSBridge` E2EE module and its tests use it. The live\n  client runs the copy inside the `app.asar` it downloads.\n\n## License\n\nOlaz is free software, licensed under the [GNU General Public License v3.0](LICENSE).\nCopyright © 2026 Quan Nguyen.\n","这是一个基于逆向工程实现的 Zalo 官方桌面客户端 macOS 原生替代方案，使用 Swift 和 SwiftUI 构建。它不重新实现通信协议，而是安全地加载并运行 Zalo PC 官方渲染器（app.asar）于 WKWebView 中，通过 Swift 层桥接状态与交互，提供原生 UI 体验。支持 QR 登录、端到端加密聊天、音视频通话、消息同步、截图、文件传输等完整功能，并严格校验官方代码签名以保障安全性。适用于希望在 macOS 上获得轻量、原生、隐私可控的 Zalo 使用体验，且已拥有 Zalo 手机端账号的用户。",2,"2026-11-24 04:38:45","CREATED_QUERY"]