Files and signed URLs
Bucket bytes over HTTP — list, put, get, delete — and expiring signed URLs that serve one object with no credential, minted only by a caller who could read it.
A bucket holds bytes that are not a document — images, exports, uploads. The app surface serves the whole life of an object:
| method | path | answers |
|---|---|---|
| GET | …/buckets/{b}/objects | the listing — a query over the bucket's metadata records, taking the records grammar |
| PUT | …/objects/{path…} | body is the bytes, raw; 201 {"written": true} |
| GET | …/objects/{path…} | the bytes (application/octet-stream) or 404 |
| DELETE | …/objects/{path…} | 200 {"deleted": true} |
The path keeps its slashes — /avatars/ada/full.png is one object — and is
percent-decoded by the node. The listing is a metadata query, so it filters
and pages exactly like a record list.
curl -X PUT -H "Authorization: Bearer $TOKEN" \
--data-binary @avatar.png \
'http://127.0.0.1:8000/v1/app/main/buckets/media/objects/avatars/ada.png'
curl -H "Authorization: Bearer $TOKEN" \
'http://127.0.0.1:8000/v1/app/main/buckets/media/objects/avatars/ada.png' -o out.png
Signed URLs
A page cannot send your Bearer token to an <img> tag. A signed URL is
the answer: an expiring URL that serves one object with no credential at all.
curl -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
'http://127.0.0.1:8000/v1/app/main/buckets/media/sign' \
-d '{"path": "/avatars/ada.png", "expires": 600}'
# {"url":"http://127.0.0.1:8000/v1/app/main/buckets/media/objects/avatars/ada.png?expires=…&signature=…","expires":600}
Hand that URL to the browser and it works until its deadline. The rules that make it safe:
- Minting is a read. The node checks that you may read the object before it signs — a caller who may not read it cannot mint a URL for it.
- The serve resumes your authority. The read the URL stands for runs as the signer at signing time, so an account change — a narrowed grant, a disabled user — kills every URL that signer minted, the same way it kills their tokens.
- Tampering is a
403. The signature covers every fact of the URL: change the path, the deadline or anything else and it stops verifying. An unknown, altered or expired signature is refused identically, so probing learns nothing. - Signed URLs die with the node. They are held in memory like tokens; a restart invalidates them, and a page that cached one re-signs.
The expires you ask for is a ceiling in seconds; the answer echoes the
deadline the node recorded, which is the one to trust.