Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 2 min read

How I Built a Zero-Signup Cross-Device File Transfer Tool with WebRTC and an HTTPS Relay

Moving a photo, screen recording, or snippet of text from a phone to a laptop shouldn't require emailing yourself, logging into cloud storage, or hunting for a USB cable. ​To solve this daily friction, I built SendlyShar

Moving a photo, screen recording, or snippet of text from a phone to a laptop shouldn't require emailing yourself, logging into cloud storage, or hunting for a USB cable.
​To solve this daily friction, I built SendlyShareβ€”a lightweight, browser-based file transfer and live clipboard tool that pairs two devices using a 6-digit code or QR scan, with zero accounts or app installs.
​Here is a look under the hood at the architectural choices and trade-offs I ran into while building it.
​1. Hybrid Transfer Architecture: WebRTC + HTTPS Relay
​Originally, I wanted every file transfer to be 100% peer-to-peer (P2P) using WebRTC DataChannels. On paper, WebRTC is ideal: files stream directly from device A to device B over local Wi-Fi without touching a server.
​In practice, pure P2P breaks more often than users expect:
​Carrier CG-NAT & Strict Firewalls: When one device is on cellular data and the other is on a corporate or restrictive Wi-Fi network, direct ICE/STUN hole-punching frequently fails.
​Browser Background Throttling: Mobile browsers aggressively throttle background tabs, which can drop a P2P handshake mid-transfer if a user switches apps.
​The Solution:
I split transfers into two distinct paths:
​1. Local Drop (P2P): When both devices are on the same network, they establish a direct WebRTC DataChannel for fast, local transfer with no server storage limits.
​2. Remote Relay (HTTPS): When P2P isn't viable or devices are on separate networks, files upload over HTTPS to temporary storage with auto-expiring links (capped at 1GB per transfer).
​2. 6-Digit Pairing Codes vs. Long URLs
​Early prototypes generated a unique shareable URL for every session. While URLs work well for sending files to someone else, they create unnecessary friction when sending a file to yourself (e.g., from your phone to your laptop sitting right in front of you).
​Switching to a 6-digit numeric room code (paired with an optional QR scan) solved this immediately. Typing six digits on a keyboard takes two seconds, requires zero copy-pasting across messaging apps, and still maps cleanly to an underlying signaling session.
​3. Client-Side Encryption in the Browser
​For sensitive documents, I added an optional password lock that encrypts single files (up to 50MB) directly inside the sender's browser before any bytes leave the device.
​Right now, I'm working on upgrading the encryption pipeline from a legacy CryptoJS setup to the native Web Crypto API (AES-GCM + PBKDF2) using a TransformStream and IndexedDB buffer pattern. Using a fresh 12-byte random IV per 1–4MB chunk allows larger files to be encrypted and decrypted in streams without spiking mobile browser RAM.
​4. Adding a Live Synced Notepad
​Half the time, I didn't need to transfer a fileβ€”I just needed to move a URL, an OTP, or a snippet of text from my phone to my desktop. Adding a real-time synced scratchpad alongside the file drop turned out to be one of the most-used features in my own daily workflow.
​Try It Out & Share Feedback
​If you want to test the pairing flow or inspect how the transfers behave on your network, you can try it here: https://www.sendlyshare.com/

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.