Safe Send
End-to-end encrypted file sharing with expiring links
A secure file transfer platform that encrypts files with hybrid RSA + AES encryption before storage. Files can only be accessed via password-protected, expiring share links tied to a specific recipient.
Safe Send lets users share files with specific recipients under strict security guarantees. Every file is encrypted server-side with a hybrid AES + RSA scheme, gated behind a password and expiration date, and automatically cleaned up once expired.
- Email and cloud storage expose sensitive files to third parties with no end-to-end encryption.
- Most file-sharing tools rely only on a secret URL, with no recipient identity binding or key-level protection.
- Shared files often have no expiry, leaving them accessible indefinitely.
- Manual cleanup of stale files is error-prone and easy to neglect.
A Rust/Axum API and a Next.js frontend run as separate Docker services, sharing a PostgreSQL database. The frontend authenticates via NextAuth and forwards a JWT to the backend on every request.
User registers → backend generates an RSA key pair and hashes the password
User logs in → backend issues a JWT session token
Sender uploads a file with a recipient, password, and expiry date
Backend encrypts the file (AES) and the AES key (RSA) before storing both
Recipient opens their inbox and requests the file with the share password
Backend verifies recipient, password, and expiry, then decrypts and returns the file
An hourly cron job purges expired files and links
Key Architectural Decisions
- ✓Each user gets a unique RSA-2048 key pair on signup; the public key is stored in the DB, the private key on the server.
- ✓Files are encrypted with a random AES-256 key, and that AES key is then encrypted with the recipient's RSA public key — so only the intended recipient can ever decrypt it.
- ✓Every share link is bound to one recipient, an Argon2-hashed password, and a mandatory expiration date.
- ✓On download, the server checks recipient identity, expiry, and password before decrypting and streaming the file back.
- ✓An hourly background job automatically deletes expired files and links, keeping storage clean without manual intervention.
- Hybrid encryption (RSA for key exchange, AES for the actual file) is the standard way to encrypt large data asymmetrically.
- Storing private keys on the server filesystem is simple but is a single point of failure — a secrets manager would be safer in production.
- SQLx's compile-time query checks catch database bugs early, before they hit runtime.
- Argon2 is a stronger choice than bcrypt for password hashing thanks to its memory-hardness against GPU attacks.
- Background cron jobs are an easy way to keep encrypted storage clean without adding latency to the main API.