← Back to Direct share

Under the hood

How it works

File transfer between two browsers with no upload server. This page explains what that means, and where it stops being true.

In short

This site is one static page. It has no backend, no accounts and no database. One person creates a channel and gets an ID. The other person types that ID. Their browsers find each other and open a direct, encrypted connection. Files travel over that connection and nowhere else.

Step by step

  1. You create a channel. Your browser makes a random ID in the form XXXX-XXXX (8 characters from a 32-symbol alphabet, about 40 bits). You become the host of that channel.
  2. Your browser hashes the ID. It computes SHA-256 of the ID with a fixed prefix and keeps the first 32 hex characters. That is the room name. The ID itself is never sent anywhere.
  3. The other person enters the ID. Their browser computes the same room name. Using the open-source library Trystero, both browsers post small signaling notes to public Nostr relays, tagged with that room name. The notes are encrypted with the ID as password, so relays only see unreadable data.
  4. A direct connection opens. When the two browsers read each other's notes they set up a WebRTC connection. WebRTC data channels are encrypted in transit (DTLS).
  5. The host accepts exactly one person. The first joiner is accepted. Anyone who tries afterwards is told the channel is full and is ignored.
  6. Files go browser to browser. Each file is read in small pieces, sent over the data channel, and put back together in the other browser's memory. Nothing is sent to the site's host or to the relays, and nothing is written to a database.
  7. The channel closes for both of you. If either person clicks Leave, closes the tab, loses connection, or 60 minutes pass, the other side is told right away and the channel ends. There is no history to recover.

Who can see what

PartyCan seeCannot see
The other personThe files you send them, their names and sizes, your IP addressAnything else on your device
The site's hostThat someone downloaded this page (IP, time)IDs, file names, file contents
Nostr relaysYour IP, the hashed room name, encrypted signaling dataThe ID, file names, file contents
STUN serversYour IP, to help work out your public addressIDs, file names, file contents
The CDNThat the Trystero library was loaded (IP, time)IDs, file names, file contents
Your network providerThat you connected to the peer and to relays, and how much data movedFile contents

Known limits

Not for situations where your safety depends on anonymity. This tool keeps files off servers, not you off the network.

Source code

The whole project is two HTML files. Read it, check it, or host your own copy.

View on GitHub