oss.sarwagya.wtf

experimental@0xsarwagya/handoff

Why does moving something to another device require putting it on someone else's computer first?

I refuse to build cloud sync because someone wants to move something once.

You have state here. You want it there. The industry answer is an account, an upload to a server in another country, a database row, a sync engine — and then a download onto the device sitting next to you. Transfer is not sync. Handoff is the smaller primitive: the state becomes a QR code or a link, and the other device receives it. The state may exist for ten seconds. No server keeps a copy. That absence is the product.

Install
pnpm add @0xsarwagya/handoff# or: npm install @0xsarwagya/handoff

The whole API

import { createHandoff } from "@0xsarwagya/handoff";
 
const handoff = createHandoff({ receiveUrl: "https://app.example/receive" });
 
// device A
const offer = await handoff.create({ type: "draft", text: "finish on my phone" });
offer.url;        // https://app.example/receive#handoff=ho1_…
offer.qrFriendly; // true while it will actually scan
 
// device B
const state = await handoff.receive();

The move

No account. No sync engine. No permanent storage. The payload rides the URL fragment, which browsers never send in HTTP requests — your own server does not log what moved.

Compatibility

Reported from what CI actually exercises — an artifact created in one browser context must decode to identical state in a fresh one, per engine.

FeatureChromiumFirefoxWebKit
Cross-context URL transferTested in CITested in CITested in CI
Compression + bounded hostile decodingTested in CITested in CITested in CI
Physical QR scanning (laptop→phone, iPhone→Android, …) is a manual matrix — tracked honestly in the compatibility docs, not claimed here.

Used in Local

Local uses Handoff to move the WebRTC offer/answer bootstrap between two browsers as a QR code (or a link). Handoff carries the connection state; the messages themselves flow directly peer-to-peer once the ceremony completes. No signaling server in the middle. Source: github.com/0xsarwagya/local.