Overview
Share links enable teams to share videos with external stakeholders securely. Each share link can be configured with expiration dates, password protection, and download permissions.Creating Share Links
Team members with member role or higher can create share links:Generate Token
A unique 32-character token is generated for each share link to ensure unpredictability
Share Link Options
Expiration Date
Set links to expire after a specific number of days (1, 7, 30, etc.)
Password Protection
Require a password to access the shared video
Download Permission
Control whether viewers can download the video file
View Tracking
Automatically count how many times the link has been accessed
Password Protection
Share links support secure password protection:Password Security
- Hashing
- Verification
- Migration
Passwords are hashed using bcrypt before storage. Plain text passwords are never stored in the database.
Brute Force Protection
Multiple security layers prevent unauthorized access:Password Limits
- Maximum password length: 256 characters
- Empty passwords are treated as no password protection
- Password can be added, changed, or removed at any time
Rate Limiting
Share link access is protected by multi-level rate limiting:Global Limit
600 access grants per minute across all share links (8 shards)
Per-Token Limit
120 access grants per minute per individual share link
Password Failures
10 password failures per minute per share link
Rate limiting is implemented using a fixed window algorithm via the Convex rate limiter component.
Access Grant System
Share links use a two-step access process:Step 1: Validation
When a user visits a share link URL:- Token is validated (must exist and not be expired)
- Video status is checked (must be “ready”)
- Password requirement is communicated to the user
Step 2: Grant Issuance
After validation (and optional password entry):- Temporary access to the video
- Time-limited validity (configurable)
- No password re-entry required during validity period
Share Link States
- Missing
- Expired
- Requires Password
- OK
Token doesn’t exist or video has been deleted
Managing Share Links
Teams can view and manage all share links for a video:Link List View
Each share link displays:- Creation date and creator name
- Expiration status (active or expired)
- Password protection indicator
- View count
- Download permission status
Updating Links
Share link settings can be modified after creation:- Change expiration date or remove expiration
- Add, change, or remove password
- Toggle download permissions
- View count cannot be modified
Changing a share link password resets the failed attempt counter and removes any lockout.
Deleting Links
Deleting a share link:- Immediately invalidates the link
- Deletes all associated access grant tokens
- Cannot be undone
- Video remains accessible via other share links or team access
View Count Tracking
Each share link tracks usage metrics:- Incremented: When an access grant is successfully issued
- Displayed: In the share link management interface
- Persistent: Never resets automatically
- Per-Link: Each share link has independent tracking
View counts help teams understand engagement and decide when links can be revoked.
Share Link Security
Multiple security measures protect shared videos:Token Generation
- 32-character random tokens
- Uniqueness validated before creation
- Maximum 5 retry attempts if collision occurs
- Cryptographically random generation
Access Validation
Every access attempt validates:- Token exists in database
- Link hasn’t expired
- Video is in “ready” state
- Not currently locked out (if password-protected)
- Password is correct (if required)
- Rate limits not exceeded
Grant Token Security
Access grant tokens are:- Separate from share link tokens
- Time-limited (default expiration)
- Stored in a separate table
- Indexed for fast validation
- Automatically cleaned up after expiration
Share Links vs. Public Links
Integration with Comments
Users accessing videos via share links:- Can add comments if authenticated
- Must use share grant token for comment creation
- Comments persist after grant expires
- User identity comes from Clerk authentication
Performance Considerations
Share link validation is optimized for speed:Database Indexing
by_token: Fast share link lookupby_video: List all links for a video- Grant token index for validation
Caching Strategy
- Share link status can be cached (check expiration client-side)
- Grant tokens validated on every request
- View count updates are non-blocking
Share link access is designed to be fast, even under high load, with multiple layers of rate limiting and caching.
