Google Drive sync

midden keeps your browsers in sync through a hidden app folder in your Google Drive, encrypted on your device with a sync passphrase. The app folder is private to midden: midden can't see your other Drive files, and they don't show it. Google stores only ciphertext.

This page covers how sync works and what it protects.

Once connected, midden syncs straight away. After that, your changes go out about 30 seconds after you make them. Other devices' changes come in when you open or return to midden (at most once a minute), when the browser starts, and every 10 minutes. sync in the menu (or sync now in Settings → Sync) runs one immediately.

Using it in another browser

  1. Install midden there.
  2. Settings → Sync: enter the same sync passphrase and connect. midden merges in everything your other browsers have, then sends this one's.

From then on, sync runs both ways by itself. Each change you make (a capture, a tag, a pin, a reminder, a deletion) is noted as it's saved, and goes out in a small encrypted batch once things go quiet. Each browser applies the other browsers' batches in order. Browsers that are never open at the same time still converge: the batches wait in Drive.

How changes merge:

When the store is erased or replaced: before each run, a device checks that the store's sync-key.json is still the one it joined. It's the same store if:

Anything else (no key file, a different key, nothing to tell by) stops sync on that device before anything is sent or taken. The device drops its copy of the key, and Settings → Sync says the store was erased or replaced. Nothing on the device changes. Connect again with the passphrase of the store that's there now. If the check itself can't run (offline, signed out), nothing goes either way, and the next run tries again.

Changing the passphrase: Settings → Sync → Sync passphrase → change asks for the current one and a new one, then re-wraps the same sync key under the new one. Browsers already connected keep syncing (they hold the key); a browser connecting from now on uses the new one. It doesn't re-encrypt what's already in Drive under a new key: if a passphrase leaked, start over (below). A recovery sheet keeps working.

The recovery key (optional): ten words from the EFF list (about 129 bits), printed once, that open the store if the passphrase is forgotten. Connecting offers one when the store has none, and Settings → Sync → Encryption → Recovery key makes one later. A connected device already holds the sync key, so it needs no passphrase: you print the sheet (or write it by hand), type two of its words back, and only then is it saved. The words wrap the same sync key the passphrase does (HKDF-SHA256 under its own label, then AES-256-GCM), and that slot sits beside the passphrase's in sync-key.json. midden keeps no copy of the words.

Joining a store with data in it: once the passphrase opens it, midden says what the store holds (files, size, how many devices wrote to it) before this device takes it in, with join it or erase it and start over.

Devices: each device puts a small sealed device-<id>.enc in the store: its name, whether it's a browser or a phone, and when it last ran. It starts as its browser and system ("Brave on Linux", "Android phone"), and Settings → Sync → Devices → rename changes it; the others pick the new name up on their next sync. The list shows only devices with files in the store. remove… takes another device out of sync: a removed-<id>.enc marker goes up first, then that device's logs, snapshots and name file go. What it sent is already on the devices that pulled it, and what's on it stays there. midden warns if this device hasn't taken in its latest changes yet. If the removed device runs again, it finds the marker, stops, and says it was removed; connecting it again clears the marker.

Starting over: Settings → Sync → Danger zone → Erase synced data removes every file in the store, the key file first, so each connected device's next run finds no key and stops (above) rather than writing into what's left. A run under way on this device stops between files. This device disconnects; what's on every device stays. A forgotten passphrase leads to the same place from the connect form.

What's stored, and how

Drive file What it is
sync-key.json the sync key, wrapped by your passphrase (Argon2id + AES-256-GCM), and the key's check mark (SHA-256 of a label and the key, so a device can recognize its key without the passphrase); the same key wrapped by the recovery key, when you made one; no data
blob-<sha256>.enc each image or file, and each link thumbnail, encrypted, uploaded once; an item's own file is removed once it's deleted for good (a thumbnail's stays)
hoard-<sha256>.enc each of the hoard's pictures, still encrypted by the hoard (its key is inside the item), then by the sync key; uploaded once; removed once only deleted hoard items have it
log-<browser>-<n>.enc one batch of a browser's changes, numbered in order
device-<id>.enc a device's name, kind and when it last ran (Settings → Sync → Devices)
removed-<id>.enc that device was removed from sync on another device: it stops if it runs again
snapshot-<browser>-<n>.enc everything that browser knew at batch n (pins only, not layout), for a browser catching up

Security

What protects what:

What Google can still see:

What's kept on the device:

Limits, said plainly: