Secure Link Sharing and Expiration
You'll learn how to implement time-limited links, password protection, download limits, and access revocation to control who accesses shared files and for how long.
The Core Idea
When you share files via a link—even if the file itself is end-to-end encrypted—you need granular controls over that link's lifetime and accessibility. Simply generating a unique URL isn't enough; adversaries who intercept or discover the link can access your sensitive data indefinitely. Secure link sharing treats each share as a temporary, revocable permission rather than a permanent door.
Key Controls
Time-limited links automatically expire after a specified duration (1 hour, 24 hours, 7 days). The server or client enforces this by checking timestamps before granting access. Think of it like a movie ticket valid only for one showing.
Password protection adds a second factor: even with the link, users must provide a password. This protects against accidental exposure if someone forwards the link carelessly.
Download limits (e.g., "download once" or "maximum 3 downloads") prevent unlimited redistribution. The server tracks access counts and refuses subsequent requests.
Access revocation lets you manually invalidate a link before its natural expiration—critical if you realize you shared with the wrong person or the link leaked.
Implementation Considerations
These controls should be enforced server-side, not just client-side hints. Store link metadata (creation time, expiration, access count, password hash) securely. For E2EE file shares, the decryption key can be embedded in the link fragment (invisible to servers) while access controls remain server-enforced.
Combining these mechanisms creates defense in depth: even if one control fails (e.g., someone guesses the link), others (password, expiration) still protect the file.
Key Takeaway:
Secure link sharing requires time limits, passwords, download caps, and revocation capabilities to ensure shared files remain under your control—treating links as temporary, accountable permissions rather than permanent access.