open-transfer

Trusted Sync Network

Pair once. Trust once. Sync across all eligible devices.

Copy on one device and paste on the others, without opening the app and without picking a destination. This page covers the design, what each operating system allows, and the wire format. The work is split into phases, the same way as the roadmap.

Status legend: ✅ shipped · 🚧 in progress · ⏳ planned · ⛔ blocked (the reason is given)


Phase 0 — Audit and feasibility

What existed before (v3.3.0)

Piece Where Reused?
Device identity: a stable random id (d-…), a name, a form and a platform devices.IdentityStore → device.json ✅ Used as-is as the sync device ID
Pairing: a 6-digit code proved without being sent, which gives a pairwise 256-bit key devices.pair_*, Mesh.pair_with/pair_begin/pair_confirm → trusted.json ✅ Remains the only way trust starts. Introductions (below) hand out more pairwise keys
Request signing: X-OT-Auth = HMAC-SHA256 over the method, path, sender and body digest, with a ±120 s timestamp window and replay protection devices.sign, SignatureChecker ✅ Authenticates every sync request
Transport: plain HTTP between apps on the LAN, UDP discovery, and a relay (“Via X”) for files Mesh._http, discovery.py ✅ Reused. Sync payloads are additionally encrypted (HTTP alone would let anyone on the Wi‑Fi read them)
Clipboard sharing: manual “Share clipboard”, per-device “share with” switches (both sides must allow), history with retention limits, and sensitive-text checks clipboard.ClipboardStore, Mesh.share_clipboard/handle_clip, sensitive.py ✅ The per-device switches are kept as the sync device list, and sensitive detection is reused. Manual image sharing stays as it is
Auto-share static/clipboard.js (the page polls navigator.clipboard while focused) ❌ This is the gap. The UI was the sync engine, so closing or unfocusing the window stopped it
Android shell: a foreground service runs the same Python server, and events reach Kotlin through PythonEvents TransferService.kt, android.py ✅ The service receives clips. Kotlin writes them to the clipboard
Desktop app: pywebview window plus an in-process server, single-instance lock desktop.py, instance.py 🔧 It needs a windowless background agent

Capability matrix

This is what each OS allows without workarounds. The design never tries to get around a ❌.

  macOS Windows Android (phone/tablet) iOS / iPadOS Linux
Read clipboard in background ✅ NSPasteboard.changeCount poll (cheap). Newer macOS releases may show a one-time paste-permission prompt: check on a real device ✅ GetClipboardSequenceNumber poll, then CF_UNICODETEXT ❌ Since Android 10, only the focused app or the default keyboard can read it ❌ No background execution, and every read shows a paste banner ✅ wl-paste / xclip if installed
Write clipboard in background ✅ NSPasteboard.setString ✅ SetClipboardData ✅ ClipboardManager.setPrimaryClip from the foreground service ❌ Not without the app running. A Shortcut can set it when the user runs it ✅ wl-copy / xclip
Stay running with no window ✅ A login item (LaunchAgent) running --background. No Dock icon, plus a menu-bar item ✅ The Run key at login, --background ✅ The foreground service (connectedDevice type: no 6-hours-a-day cap, which dataSync has on Android 15+) ❌ Apps get suspended. No continuous polling ✅ XDG autostart
Password-manager markers org.nspasteboard.ConcealedType / TransientType / AutoGeneratedType → never synced ExcludeClipboardContentFromMonitorProcessing, CanIncludeInClipboardHistory = 0 → never synced ClipDescription.EXTRA_IS_SENSITIVE set on writes we make — x-kde-passwordManagerHint → never synced
Lowest-friction send when reads are blocked — — Quick Settings tile “Send clipboard” (a one-tap transparent activity reads it legitimately), Share sheet, the text-selection menu, and the app sends automatically whenever it comes to the front Shortcut “Send clipboard” run from Back Tap, the Action button, a widget or the Share sheet —
Lowest-friction receive automatic automatic automatic (the service writes the clipboard) Shortcut “Paste from my devices” (Back Tap) pulls the latest clip automatic
Encryption on the wire ✅ ✅ ✅ ⚠️ The Shortcut talks plain HTTP to its hub on the LAN, protected by a per-device token. Shortcuts can’t do custom crypto or trust a self-signed certificate ✅

Platform facts that limit the design:

Device-pair targets

The table below covers all ten combinations. They all use the same protocol and trust model; the only difference is the platform agent on each end.

Pair A → B B → A
Mac ↔ Windows auto auto
Mac ↔ iOS/iPadOS Mac → hub mailbox, iPhone runs Paste (1 action) Send shortcut (1 action)
Mac ↔ Android auto (the service writes the clipboard) tile / share / app in front (1 action)
Mac ↔ Android tablet same as Android same as Android
Windows ↔ iOS/iPadOS as Mac ↔ iOS as Mac ↔ iOS
Windows ↔ Android auto 1 action
Windows ↔ Android tablet auto 1 action
Android ↔ iOS/iPadOS 1 action → iPhone runs Paste Send shortcut → auto on Android
iOS/iPadOS ↔ Android tablet as Android ↔ iOS as Android ↔ iOS
Android tablet ↔ Android phone 1 action → auto 1 action → auto

Architecture

 native clipboard agent ──► sync engine (policy · HLC · dedup · queue) ──► trusted sync protocol ──► authorized devices
   (macOS / Windows /            runs in the app's process, never in the page             (signed + encrypted HTTP)
    Linux / Android Kotlin)

Trust model

Protocol (sync/1)

The event envelope is posted to POST /api/p2p/v1/sync/event, signed with the pair key:

Field Meaning
v 1
id Globally unique event ID (128-bit random hex)
src The source device ID: the device where the copy happened (for an iPhone, its own id)
seq The source’s sequence number (monotonic, persisted)
hlc Hybrid logical clock [wall_ms, counter] from the source
type text or url (later: image, …)
created, expires Unix seconds. expires = created + pending expiry (default 120 s)
via The devices that forwarded it (at most 1 hop)
dst The recipient device ID (each envelope is sealed for one recipient)
nonce, ct, tag The sealed payload

Sealing: the stdlib only, keeping the project’s no-new-runtime-dependencies rule.

Forwarding never opens the payload: the source seals it for the final recipient.

Rules every receiver applies, in order:

  1. Authenticate: the signed request comes from a trusted device; the envelope’s tag verifies under the source–recipient key; and dst is me.
  2. Validate: the fields are well-formed, type is allowed, and the size is ≤ 1 MB of text.
  3. Expiry: if expires < now, it is dropped. Expired clips are never delivered, including after a reconnect.
  4. Dedup: id is already seen, or seq is ≤ the highest seen from src → dropped. Seen-IDs are kept until the event would have expired.
  5. Policy: sync with src is enabled here, sync isn’t paused, and the type is allowed.
  6. Stale protection / conflicts: the event is applied only if (hlc, src) is newer than what’s on this device’s clipboard right now. A local copy always gets an HLC above everything seen so far. Policy: the newest copy in hybrid-logical-clock order wins, and ties are broken by device ID. This means two devices that copied while disconnected end up with the same clipboard once they reconnect, if the events haven’t expired.
  7. Apply: the agent writes the clipboard and tags the write as remote.
  8. Never rebroadcast: a received event is never sent on as a new copy. The agent ignores its own remote writes (by content hash and a marker type), and the engine ignores a “local copy” that equals the last applied remote clip.

Sending:

Privacy:

Using it on a computer (phase 2)

  1. Open the app → Clipboard → Clipboard sync → turn on Sync the clipboard on this device. Do the same on your other devices.
  2. Copy anything. Your other devices get it within about half a second.
  3. Close the window: syncing goes on in the background (the macOS menu bar shows ⇄). Turn on Start at login to have it after a restart.
  4. Open the app again to see the window; Quit Open Transfer (in the sheet, or the menu bar) stops it.
Agent Notices a copy by Reads/writes Password managers
macOS NSPasteboard.changeCount every 0.5 s (doesn’t read until it changes, and not at all while sync is off) AppKit org.nspasteboard.ConcealedType / TransientType / AutoGeneratedType
Windows GetClipboardSequenceNumber every 0.5 s Win32 CF_UNICODETEXT (ctypes) ExcludeClipboardContentFromMonitorProcessing, CanIncludeInClipboardHistory = 0; private clips we write are kept out of Win+V history and the cloud clipboard
Linux the text’s digest every 0.5 s while sync is on wl-paste/wl-copy, xclip or xsel x-kde-passwordManagerHint
CLI open-transfer --clipboard uses the same agents    

Clips the agent writes carry its own marker (io.github.itsonu.open-transfer.synced), so it never reports them back as copies; the engine’s echo check is the second guard.

Using it on Android (phase 3)

You want to… Do this Why this way
Get what you copied elsewhere Nothing: it’s on the clipboard. Long-press → Paste The service writes the clipboard in the background, which Android allows
Send what you copied Swipe down → Send clipboard tile (add it once: edit tiles → drag it in) Android 10+ lets only the app in front read the clipboard; the tile opens an invisible screen for that instant
Send selected text Select → ⋮ → Send to my devices Text-selection menu (PROCESS_TEXT)
Send from any app Share → Send to my devices Share sheet (SEND text/plain)
Send automatically Just open Open Transfer: a new copy goes out as it comes to the front Only when sync is on and set to Every time I copy. It checks the clip’s timestamp first, so Android’s “pasted from your clipboard” message appears only for a new copy

Using it on iPhone and iPad (phase 4)

iOS doesn’t let other apps read or write the clipboard in the background, and it suspends them. So an iPhone or iPad joins through two Shortcuts that run when you ask: one tap each, from Back Tap, the Action button, a widget or the share sheet.

  1. On any of your Open Transfer apps (a computer or an Android device that’s usually on: that becomes the hub): Clipboard sync → iPhone and iPad → Add iPhone or iPad.
  2. It shows a key (shown only once) and two addresses. In the Shortcuts app, make:

    Shortcut Actions
    Send clipboard Get Clipboard → Get Contents of URL: the send address, Method POST, Header Authorization = the key, Request Body JSON: text = Clipboard → Show Notification: message
    Paste from my devices Get Contents of URL: the paste address, Header Authorization = the key → Get Dictionary Value text → If it has any value → Copy to Clipboard
  3. Settings → Accessibility → Touch → Back Tap → Double Tap → Paste from my devices (and Triple Tap → Send clipboard).

How it fits the network:

Policies (per device and global)

Setting Default
Sync clipboard on this device Off until turned on
Send to Selected devices (the per-device switches) · or All trusted devices except excluded ones
Mode Automatic · or Only when I ask (tile, shortcut, button)
Content types Text and links
Pause Everything, or one device: for 1 hour / until tomorrow / until resumed
Temporary session “Sync for the next hour”, which then turns off by itself
Pending expiry 2 minutes (choices: 30 s to 1 hour)
Sensitive-looking text Never sync automatically · or sync anyway
Blocked source apps A list of app names / bundle IDs whose copies are never synced (desktop)
Accept introductions On

Phases

Phase Scope Status
0 The audit and capability matrix (this page) ✅
1 Shared protocol, trusted network, introductions/revocation, policies, engine, P2P + UI API. Tests first (tests/test_sync.py, tests/test_sync_api.py) ✅
2 Desktop agents (macOS, Windows, Linux), --background agent, start at login, window = view, settings UI. Mac ↔ Windows with both windows closed (tests/test_clipagent.py, tests/test_background.py, tests/e2e/test_sync_ui.py) ✅ (real-device check pending)
3 Android: background clipboard write, Quick Settings tile, Share sheet and text-selection send, send on focus (tests/test_android.py; Kotlin built in CI) ✅ (real-device check pending)
4 iOS/iPadOS via Shortcuts (token enrolment, push/pull, setup guide; tests/test_sync_clients.py). ⛔ A native iOS app is blocked on an Apple developer account ✅ (real-device check pending)
5 Tests for all ten pairs, both directions, plus fan-out, offline, concurrent copies and revocation (tests/test_sync_matrix.py, tests/test_sync.py); the real-device checklist (device-testing.md §7) ✅ automated · ⏳ real devices
6 Images, rich content, diagnostics, a cross-network relay. Only after 1–5 prove reliable on real devices ⏳