# Dopame Connect

Dopame Connect is the phone app for Dopame (Android now, iOS later). Pair it with a Dopame desktop on the same network and it can do anything the desktop page can do: list and move windows, open apps, browse files, run a terminal, change the volume, sleep or lock the machine, and so on. It works by calling the desktop's `acde:` modules over an end-to-end encrypted channel. Callbacks and subscriptions work too, so `windows.on(...)` on the phone gets live events.

:::caution[Alpha]
The current version is `0.0.0-alpha.1`. The Android app, the desktop relay and the desktop service are published, but the Dopame desktop does not ship the **Phone** settings panel yet, so the desktop has nothing to pair with out of the box. Until a 0.1 release the protocol can change in incompatible ways, so the phone and the desktop must run the same version.
:::

## Download

| File | What it is |
| --- | --- |
| [dopame-connect-0.0.0-alpha.1.apk](https://pkgs.dopame.ai/mobileconnect/0.0.0-alpha.1/dopame-connect-0.0.0-alpha.1.apk) | The Android app (Android 8.0 or later) |
| [mobileconnect-relay-x86_64-unknown-linux-musl.tar.xz](https://pkgs.dopame.ai/mobileconnect/0.0.0-alpha.1/mobileconnect-relay-x86_64-unknown-linux-musl.tar.xz) | Desktop relay for x86_64 Linux (static binary) |
| [mobileconnect-relay-aarch64-unknown-linux-musl.tar.xz](https://pkgs.dopame.ai/mobileconnect/0.0.0-alpha.1/mobileconnect-relay-aarch64-unknown-linux-musl.tar.xz) | Desktop relay for aarch64 Linux (static binary) |
| [mobileconnect-service-0.0.0-alpha.1.tar.gz](https://pkgs.dopame.ai/mobileconnect/0.0.0-alpha.1/mobileconnect-service-0.0.0-alpha.1.tar.gz) | The acde service `mobileconnect` for the desktop package |
| [SHA256SUMS](https://pkgs.dopame.ai/mobileconnect/0.0.0-alpha.1/SHA256SUMS) | Checksums of the files above |

The newest version is always named in [pkgs.dopame.ai/mobileconnect/latest](https://pkgs.dopame.ai/mobileconnect/latest); see [Versions and downloads](https://docs.dopame.ai/mobile/releases.md) for the layout and the version rules. Check what you downloaded:

```sh
curl -fsSLO https://pkgs.dopame.ai/mobileconnect/0.0.0-alpha.1/SHA256SUMS
sha256sum -c --ignore-missing SHA256SUMS
```

## Install on Android

Open the `.apk` on the phone and allow installing from that source when Android asks. Alpha builds are signed with a development certificate: when the release certificate arrives, uninstall the alpha before installing the new version.

## Pair

1. On the desktop, open **Settings → Phone**. It shows a QR code and a `mobileconnect://pair?...` link.
2. In Dopame Connect, tap **Scan to pair** (or paste the link).
3. The phone remembers the desktop. Next time it reconnects on its own when both are on the same network.

The link carries the desktop's addresses, its public key and a one-time pairing code. Phone and desktop agree on keys with X25519 and encrypt every frame with ChaCha20-Poly1305, so the network (and the relay on the desktop) only sees ciphertext. **Settings → Phone** lists the paired phones; removing one disconnects it and revokes its key.

## How it fits together

```
phone app  ──ws://<desktop>:47800──▶  relay  ──stdio──▶  service mobileconnect  ──▶  desktop page  ──▶  acde:* modules
```

- **relay**: a small static program that accepts WebSocket connections and passes text frames through. It does no checks and cannot read the frames. Listens on `0.0.0.0:47800` (`MOBILECONNECT_LISTEN` changes it).
- **service** `mobileconnect`: an acde service in the desktop package. It starts the relay and pipes its lines to the desktop page.
- **desktop page**: does the pairing, decryption and dispatch, because only the desktop page has all the system modules (`fs`, `terminal`, `audio`, `power`, ...).

Nothing is added to `acde:`: the phone calls exactly the modules described in [Capabilities](https://docs.dopame.ai/guide/capabilities.md), with the same arguments, through the same API surface the desktop page sees. Traffic stays on the LAN; there is no cloud relay yet.
