Technology
A file you lock for a friend so that only they can open it — and you can't reopen it yourself. Here's exactly what happens under the hood, and why it's safe to share the "lock code".
The tempting first design is: my friend hashes their password, gives me the hash, I encrypt with it. That can't work. With any symmetric scheme, whatever locks also unlocks — if you can encrypt with a secret, you can decrypt with it too. So you'd be able to reopen the file, which defeats the whole purpose.
The primitive that separates "can lock" from "can unlock" is public-key cryptography. Your friend holds a key pair:
| Purpose | What we use |
|---|---|
| Turn a password into a key (slowly, on purpose) | Argon2id — winner of the Password Hashing Competition; the current OWASP-recommended default |
| Public / private key pair | X25519 (Curve25519), seeded deterministically from the password |
| Encrypt so only the recipient can open | Sealed box — X25519 + XSalsa20-Poly1305 authenticated encryption |
| Bundle files / folders | ZIP (preserves names and structure), encrypted as one blob |
All cryptography is provided by libsodium
(the audited -sumo build), running as WebAssembly in your browser.
The locked output is a real, viewable .jpg: a cover image with a
short notice and a QR code. A JPEG officially ends at its end-of-image marker, and viewers ignore
anything after it — so the encrypted data is appended there. Open the file in any photo viewer and
you see the picture; drop it into friend-lock and it reads past the image and decrypts. A plain
.flock download is offered too, for channels that re-compress images.
.jpg as a file attachment, not
as an in-chat photo. Messengers like WhatsApp or Telegram re-compress images and would strip the
hidden data. Use the .flock file for those.lock code = base64url( u8 version | u32 ops | u32 mem | 16B salt | 32B public key )
.flock blob = "FLK1" | u8 version | u32 ops | u32 mem | 16B salt | sealed ciphertext
.jpg carrier = <valid JPEG cover> | .flock blob | "FLCKPLD1" | u64 payload length
friend-lock is a single static web page. All processing happens in your browser. Your files and passwords are never uploaded — there is no server to upload them to, no database, no account, and no tracking. You can even save the page and use it fully offline. See our privacy note for details.