A grant is one line that allows the data module to reach one thing: a network origin, a file path, a named secret. Exact injects nothing by default, so anything app.ts does not list is refused. This page covers Exact's grants. A Seed capability (a signed delegation of write access between accounts) is a different thing, see the glossary.
The families
Exact's grants/src/lib.rs defines the grant kinds. "The parameter is the scope, and there is always a scope."
Line | Admits |
|---|---|
|
|
| Every host strictly under the suffix |
| Every origin of the scheme, "for a server the person names at run time" |
| WebSockets, with the same three forms. |
| Hosts on the local network |
| A file subtree, compared by whole path components |
| One database |
| Read, replace and forget one named secret |
| One environment variable, one key-value scope |
Grants cross no kinds: "an fs.read grant admits no network operation" (lib.rs L207-L246).
The app's grants
app.ts L16-L28 exports one string, built from literals joined by newlines. "Grants must be literal here (the build reads them without running the module)."
Grant | Purpose | Used by |
|---|---|---|
| Any HTTPS server: the person can type any Seed site, vault or agents server | Seed site read API, all modules |
| Redundant with the line above. Kept from the profile package's live dev tests | |
| The local test server | |
| The Keychain item holding every private key | |
| Stale: the agents mock binds | |
| Any plain HTTP server, for local daemons and self-hosted servers | |
| Agent streams | |
| The vault's key-encryption key and remote credential | |
| Read the encrypted vault file | |
| Write that file and create its folder |
The app holds no sqlite.open grant and stores nothing else on disk. currentAccount and server are persisted Contract state, not secrets.
What the module receives
answer(source, args, store, storage, native) gets two capability objects (app.ts L44-L45):
store is {get, set, forget} for secrets. Reads are synchronous because "the host reads them into a snapshot before boot" (reference).
storage.fs gives readFile, atomicWriteFile, mkdir and others under app:/. Only the vault uses it (store.ts L33-L40).
Where grants are enforced
Host | Network | Secrets | Files |
|---|---|---|---|
iOS | The Rust host checks every request, and "each redirect target against the source's | The Keychain | The app's sandbox, under |
Web host | Checked by Exact's runtime, but "the web lets the browser follow and checks only the final response URL". "Exact API grants do not sandbox page code" |
| Browser storage for the page's origin |
Test drives | Each test gets its own scratch store, removed after it. A web drive with no | scratch store | scratch store |
Quotes are from Exact's reference. The consequence for this project is in The web host for development: a redirect chain that passes on the web can be refused on a phone.
What a refusal looks like
Fetch. The promise rejects with a FetchError of kind Refused. A stream ends with {type: 'error', kind: 'Refused', โฆ} ("outside the grants").
Storage. An Error with kind: 'Unavailable' and code: 'denied' ("the grants do not cover it"). Other codes are POSIX names such as 'ENOENT'. "Branch on the code, never the message" (reference).
Secrets. A secret.keep name must be listed, and writes are "grant-checked, in Rust" (lib.rs).
In the view. The resource fails, failed(x) is true and failure(x) carries code refused, if the source lets the rejection through. Most app sources catch it and return a friendly message instead, for example read/client.ts L12-L18.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime