Encrypted sync
How XE AI Chat keeps chats, settings and media in step between a person's devices with end-to-end encryption. What the storage sees, which keys open it, and how a device is removed.
XE AI Chat can keep a person's chats, folders, settings and media in step between their iPhone and the web. Everything is encrypted on the device before it is stored. The storage, XE and anyone on the network see ciphertext only. The vault belongs to the person's XE account: their wallet can always open it, and only their wallet grants devices access to it.
This page explains the design for developers who build on it, review it or connect another client. One Rust library, xe-sync, implements it on every platform (natively on iOS, as WebAssembly on the web), so formats and merges can't drift between them.
#What the storage sees
| Sees | Doesn't see |
|---|---|
| Ciphertext, with sizes padded | Titles, messages, models, folders, settings, media |
| Object names, which are random-looking HMACs | Which objects are chats, media or settings, or how many chats there are |
| That this account uses sync, from the vault's location | |
| How many devices, their public keys, and when each one syncs | Device names (they're encrypted) |
| IP addresses and timing | |
| That a device was removed (a new key epoch starts) |
The storage can still delete, withhold or replay old objects. Devices detect replays and reordering (below) and keep their own local copies, but they can't force a store to keep data.
Sync never goes through a relay, and nothing is written on XE.
#Keys
unlock methods (any one opens the vault) wallet signature · sync passkey (PRF, optional) · recovery key (optional) │ │ │ └──── each gives an X25519 unlock key ─────┘ │ the vault key is sealed to every unlock key (HPKE) ▼ vault key VK, one per epoch (1, 2, …) │ HKDF ┌──────────────┬────────┴─────┬───────────────┐ object names records header MAC the previous epoch's key (HMAC-SHA256) (XChaCha20- (HMAC-SHA256) (so new devices can read history) Poly1305) device keys (Ed25519, one per device, never leave it): sign what the device writes and its requestsThe vault key. 32 random bytes per epoch. Each epoch's key is sealed with HPKE to the public half of every unlock method, so any unlocked device can start a new epoch without the passkey, the wallet or the recovery key at hand.
Ways to open the vault. A new vault opens with the wallet alone. A passkey and a recovery key are optional: the person adds them in the chat's sync settings. Any one of them opens the vault:
| Method | Where the unlock key comes from |
|---|---|
| Wallet signature (always) | The XE account's signature over a fixed text that names the site and the vault (below). XE signatures are deterministic, so the same account always derives the same key |
| Sync passkey (optional) | A passkey made for the chat's own site (RP ID chat.xe.marketized.io), evaluated with WebAuthn's PRF extension. The person's passkey provider carries it between their devices |
| Recovery key (optional) | 160 random bits shown once as 32 characters plus a check character, in groups of four. It is deliberately not a list of words, so it can't be mistaken for a wallet's recovery phrase |
While a vault has neither a passkey nor a recovery key, the chat says so: "If you lose access to your wallet, synced chats can't be recovered." Vaults made before 25 October 2026 keep the recovery key they were made with.
The chat never uses the wallet's own passkeys, which belong to the wallet's site and lock only the wallet.
Device keys. Each device makes its own Ed25519 key, which never leaves it. On iOS it is sealed under a Secure Enclave key; on the web it is kept encrypted under a non-extractable WebCrypto key. Every object a device writes is signed with it.
Per-blob keys. Each media file gets a random key of its own, carried inside the encrypted record that adds it. Two vaults holding the same file show nothing in common.
#The wallet's part
Sync adds five message purposes to XE's message format. An XE wallet shows what each one does and signs it only for the site it names:
| Message | Shown as | Used for |
|---|---|---|
xe-sync:unlock:v1:<host>:<network>:<account>:<vault id> | "Open your synced chats on chat.xe.marketized.io. Not a payment." | The wallet unlock method |
xe-sync:grant:v1:<host>:<network>:<account>:<locator>:<device key>:<expires>:<flags> | "Let this device keep your synced chats for chat.xe.marketized.io. Not a payment." | Letting a device read (r), write (w) and, optionally, remove other devices (v) |
xe-sync:revoke:v1:<host>:<account>:<locator>:<device key>:<at> | Removing a device | |
xe-sync:epoch:v1:<host>:<network>:<account>:<locator>:<epoch>:<digest> | Confirming a new key epoch after a device is removed | |
xe-sync:delete:v1:<host>:<network>:<account>:<locator>:<at>:<nonce> | Deleting the vault |
The wallet signs these only when it can check which site asks: the Web Wallet signs them; wallets that only hear a site's claim (a phone over the relay, XE Vault by QR code, a Ledger) refuse them.
Approvals per step, measured in the web chat on 26 October 2026:
| Step | Wallet approvals |
|---|---|
| Turning sync on | 2 (the device's grant and the unlock) |
| Opening it again on the same device | 0 |
| Adding a new device | 2 |
| Removing a device | 3 (the revocation, the unlock and the new epoch) |
A native app gets these signed in one wallet visit, with kind: "sign" (see XE Connect for native apps); over XE Wallet's relay, with xe_signMessage.
#Storage
Every vault lives under one prefix, v2/<locator>/. The locator is derived from the account, so any device that knows the account can find the vault:
// locator = base32(SHA-256("xe-sync/locator/v1\n" + network + "\n" + account)[0..20])async function syncLocator(network, account) { const text = `xe-sync/locator/v1\n${network}\n${account.toLowerCase()}`; const h = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text))).slice(0, 20); const A = "abcdefghijklmnopqrstuvwxyz234567"; let out = "", acc = 0, bits = 0; for (const b of h) { acc = (acc << 8) | b; bits += 8; while (bits >= 5) { bits -= 5; out += A[(acc >> bits) & 31]; } } return out;} await syncLocator("xe-sim", "9".repeat(64)); // "ofx3jk7qdj3cf2eyplonvtpwqbvfy5lt"| Object | Name | Changes |
|---|---|---|
| The header | v2/<locator>/h | Rarely: a device added, an unlock method changed, a new epoch |
| A device's tip | x/<HMAC> | Each sync, by its own device only |
| A log segment | x/<HMAC> | Never: written once |
| A snapshot | x/<HMAC> | Never |
| A media chunk | x/<HMAC> | Never; 1 MiB each |
Every request is signed by the device: Authorization: XE-Sync-2 dev=<device key>, ts=<unix ms>, nonce=<…>, sig=<…>, over the method, the store's host, the path, the query, the body hash, If-Match and If-None-Match, the hash of the grant header, the time and the nonce. The grant itself travels in X-XE-Sync-Grant. The store checks the time (within 5 minutes), that the nonce is new, the signature, the device's grant (signed by the account, not expired, not revoked) and that the path is inside the vault. It logs no paths or bodies.
XE's sync store on the test network is https://sync.xe.marketized.io, with 1 GiB and 50,000 objects per account, 32 MiB per object and 100 requests a minute per device. The client talks to it through a small interface (put, get, head, delete, list, with conditional writes), so another S3-compatible store can replace it without a format change.
#Integrity
- Every object is encrypted with XChaCha20-Poly1305, and its vault, kind, epoch and name are bound into the authenticated data. An object moved to another name or relabelled doesn't open.
- Sizes are padded (Padmé, at least 512 bytes), so lengths leak little.
- The header carries a MAC under the epoch's key and a version. A device refuses a header older than one it has seen: "Your storage returned older data."
- Each device's log segments are signed and hash-chained, and its tip names the last one. A withheld, reordered, swapped or forged segment is refused.
- Merges are deterministic: each field is last-writer-wins on a hybrid logical clock, a deleted chat stays deleted, and messages never change once written. Every device reaches the same state from the same operations.
#Removing a device
From any unlocked device:
- A revocation signed by the account (or by a device whose grant includes
v) goes to the store, which refuses that device's key from then on, for reads and writes. - A new vault key is made for the next epoch, with the old key sealed under it, so remaining devices still read history.
- The new key is sealed to every remaining unlock method and device. The removed device isn't among them.
- The header moves to the new epoch and marks the device removed. Anything it signs after that is dropped by every reader.
What removal doesn't undo: the device keeps what it had already downloaded and the keys of old epochs. Removal protects what is written after it. If a lost phone was unlocked, also remove it from the person's Apple or Google account, since the sync passkey lives there.
Removing an unlock method works the same way: a new epoch that leaves it out.
#Deleting the vault
The account alone can delete its vault: POST /v2/<locator>/delete with its signed xe-sync:delete:v1 text, no device needed. The store erases every object and keeps only a tombstone: when it happened and the vault's device keys, which are refused from then on.
Deleting your account in the web chat always deletes the synced vault, even when sync is off in that browser. On a phone it does so when sync is on there; the phones get the same rule next.
#Losing everything
| Lost | Still works |
|---|---|
| A phone | Remove it from another device; nothing else to do |
| Every device | A new device: connect the wallet (or use the passkey, if one was added) |
| The wallet | The passkey or the recovery key, if one was added |
| The wallet, with no passkey or recovery key | Nobody can open the vault, including XE. Local copies stay on any device that still has them |
That is why the chat warns while a vault has neither a passkey nor a recovery key.
#What it doesn't protect
- A compromised device or web page reads everything that device can open, until it is removed. The web chat is the softest place.
- The metadata listed above.
- Availability: a store can delete the vault. Devices keep local copies.
- Data inside one epoch has no forward secrecy: one vault key opens everything written in that epoch.
- Whoever controls the wallet can open the vault and grant devices. That is the point of keying it to the wallet.