Storage Overview
@mountsqli/storage is a storage layer for objects (files, blobs). It supports
HMAC-signed URLs, content-addressed versioning, and an S3 adapter.
Core concepts
Section titled “Core concepts”| Concept | What it is |
|---|---|
StorageAdapter |
interface for put/get/delete/list |
| Signed URL | HMAC-signed, time-limited GET URL |
| Versioning | content-addressed revisions of an object |
ObjectAcl |
access control reused from the policy engine |
Why signed URLs?
Section titled “Why signed URLs?”A signed URL lets you grant temporary, revocable read access without exposing
your storage credentials or a long-lived token. The signature is verified
timing-safe (timingSafeEqual) so it can’t be forged byte-by-byte.
RLS reuse
Section titled “RLS reuse”Storage reuses the auth policy engine: compilePolicy(policy, ctx) returns the
same FilterNode[] shape the query builder uses, so object access follows the
same RLS rules as row access.
Best practices
Section titled “Best practices”- Use signed URLs for client-side downloads; never hand out raw credentials.
- Set short expiries on signed URLs.
- Apply an
ObjectAclto scope who can read/write.
Common mistakes
Section titled “Common mistakes”- Treating signed URLs as permanent — they expire.
- Storing secrets in the URL (only the HMAC signature belongs there).
Related
Section titled “Related”- Signed URLs — generate and verify.
- Versioning — content-addressed revisions.
- S3 Adapter — plug into S3-compatible storage.
