Guide
How ShareText Works
A detailed explanation of how ShareText transfers files between devices — from pairing to encrypted transfer to completion.
The simple version: Open ShareText on both devices. Connect with a code. Send your file. It moves directly between devices, encrypted. Close the tab when done. Nothing is stored.
The Transfer Flow
Open ShareText on both devices
Visit sharetexts.online in a browser on each device. No app download. No account creation.
Create a room (Device A)
On the sending device, tap "Send something." ShareText creates a temporary room and generates a 6-digit pairing code. The room exists only for this session.
Join the room (Device B)
On the receiving device, tap "Receive something" and enter the 6-digit code. Alternatively, scan the QR code or open a share link. The two devices now know about each other.
WebRTC connection established
The browsers negotiate a direct peer-to-peer connection using WebRTC. The signaling server helps them find each other, then steps aside. All subsequent data flows directly between devices.
Transfer data
Type text, paste a link, or attach a file. The data is chunked into 64KB pieces, sent over the encrypted DataChannel, and reassembled on the other side. Progress is shown in real time.
Verify and complete
Each file is verified using SHA-256 checksum. If the checksums match, the transfer is confirmed. The receiver can save or download the received content.
Close the room
When you close the tab or the session expires, the room is destroyed. No files, messages, or metadata are stored on any server.
What Happens Technically
Room Creation
When you click "Send something," the frontend calls the signaling server to create a room. The server generates a unique room ID and a TOTP-based pairing code. The room has a limited lifetime and closes automatically if not used.
Pairing Code
The 6-digit pairing code is derived from a time-based one-time password (TOTP) algorithm. It rotates periodically for security. The code is displayed on Device A and entered on Device B to prove they're intended partners.
WebRTC Connection
WebRTC is a browser technology that enables direct peer-to-peer connections. Here's what happens:
- Offer/Answer: Device A creates a connection offer. The signaling server relays it to Device B. Device B creates an answer.
- ICE Candidates: Both devices discover their network addresses (local, public, and relay) and share them through the signaling server.
- Connection: The browsers establish a direct connection using the best available path — typically a direct peer-to-peer connection.
- Encryption: The connection is encrypted using DTLS (Datagram Transport Layer Security), the same protocol used by secure web browsing.
Data Transfer
Once connected, data flows through a WebRTC DataChannel:
- Text messages are sent as structured JSON messages
- Files are split into 64KB chunks and sent sequentially
- Each chunk is tracked for progress reporting
- The receiver reassembles chunks into the original file
- SHA-256 checksums verify integrity after transfer
Relay Fallback
If a direct peer-to-peer connection isn't possible (e.g., both devices are behind strict firewalls), ShareText uses a TURN relay server as a fallback. The data remains encrypted — the relay only forwards encrypted packets and cannot read the content.
Encryption Details
Protocol: DTLS-SRTP over WebRTC DataChannel
Scope: All data between devices is encrypted in transit
Key exchange: DTLS handshake during connection setup
Server visibility: The signaling server sees connection metadata but not file contents
File Integrity
Every file transfer includes a SHA-256 checksum verification. The sender computes the checksum before sending. The receiver computes it after receiving. If they match, the file arrived intact. If they don't match, ShareText flags the discrepancy.
Session Lifecycle
- Room creation: Temporary, with a limited lifetime
- Pairing code: Rotates periodically, expires after a short window
- Active session: Exists only while both devices are connected
- Disconnection: If one device disconnects, the other can wait for reconnection
- Closure: When the tab closes or the session expires, the room is destroyed
Limitations
- Both devices must be online during the transfer
- ShareText connects two devices only (no group transfers)
- File size is limited by browser memory, not by ShareText
- Some network configurations may require the relay fallback (slightly slower)
- The pairing code expires — a new code must be generated for reconnection