Assets
Private assets and signed URLs
LiveKeep files private by default and generate short-lived URLs only when a user should download them.
Goal
Serve private files without making them publicly cacheable.
Current status
Live
This area is documented as current, user-reliable behavior.
Workflow
- 1Upload the file with visibility private.
- 2Store the returned asset ID in your database.
- 3Generate a signed URL when an authorized user needs access.
- 4Use maxDownloads for one-time downloads when appropriate.
Create a signed download URL
Example
tsconst signed = await stackshift.assets.signedUrl(asset.id, {
expiresIn: '10m',
maxDownloads: 1,
})
return signed.urlExpected result
Private assets are only downloadable with valid signed URLs and are returned with no-store cache headers.