# The Store and its package sources How an app gets from a build to a device. ## What the Store reads A **package source** is a folder of plain files served over HTTP or HTTPS: ``` catalog a line an app: name|title|version|size|description|rights packages/.ppk the app's package, signed blobs/ the app's files, named by their SHA-256 ``` The Store reads every source in turn: `/settings/store-url` on the system disk (the source `cargo xtask` serves beside QEMU, or a bundle's `start`), then each line of `/settings/store-sources`. A source that does not answer is left out; an app two sources offer comes from the first. A **package** (`pkg/`) is a small signed archive: the app's `manifest` and `files`, a line a file — ` `, the path within the app's folder (`program`, `assets/shaders/sky.wesl`). Its publisher signs the whole archive with Ed25519. The Store installs it only when a key in `/settings/trusted-keys` made that signature, and only when its manifest asks for no more rights than the catalog showed before Install was tapped. Then it fetches each file from `blobs/`, a megabyte at a time onto the disk, and checks its size and SHA-256 against the list; a file that does not match is removed and nothing is installed. The manifest is written last: until it is there, the app is not on the home screen. An installed app keeps its list (`/apps//files`). When the catalog offers another version the Store shows **Update**, fetches only the files whose hash changed, and removes the ones the new version no longer has. ## Updates by themselves The `updates` service (`programs/src/bin/updates.rs`, started with the rest of the system once the data is open) looks at the same catalogs a minute after the start, then every six hours, and when Settings → Updates asks (Look now). Settings offers three choices, kept in `/settings/updates`: | Choice | What a new version leads to | |---|---| | Not looked for (`off`) | Nothing: no catalog is fetched. | | Told (`tell`, the default) | A notification naming the apps the Store can update, once a version. | | Installed by themselves (`install`) | The app brought up to date by the same install the Store does, then a notification saying so. | Installing by itself is only for a version that asks for no more than the installed one may do (its catalog rights within the installed manifest's, and its signed manifest within its catalog rights, as for any install): one that asks for more is told, and installed from the Store, where its rights show before the tap. An app that is running is not changed under it: the service asks the display server (`RUNNING`) and tries again five minutes later. What the last look found is in `/settings/updates-last`, and Settings shows it. `cargo xtask updates-demo` shows it. The system is updated beside the apps: `updates.md`. ## The sources a system has | Source | Who signs | What it offers | |---|---|---| | `http://10.0.2.2:/` — `cargo xtask`'s own (`serve`), or a bundle's `start` | This checkout's development key, `target/publisher.key`, made once and never committed | Calculator and Paint, built from this checkout | | `https://pinnacle-os.eu/store/pinnacle/` (a PC's: `…/pinnacle/pc/`) | The hosted Store's key, `keys/store-publisher.pub` | Calculator and Paint from main, published after every landing (`midas deploy pinnacle-apps`) | | `https://pinnacle-os.eu/store/cartopolis/` (ARM only) | The hosted Store's key | Cartopolis's client (`midas deploy pinnacle-store`, when asked) | | `https://pinnacle-os.eu/store/flitz/` (ARM only) | The hosted Store's key | Flitz, the web browser (`midas deploy flitz-store`, from jeroen/flitz's main after every landing) | An app two sources offer comes from the first, so on a development system the checkout's own Calculator and Paint stand in front of main's. Every system disk `cargo xtask` makes trusts both keys. The hosted key's secret half is only on the server that serves pinnacle-os.eu, readable by the user `pinnacle-sign` alone; it never reaches a build node. ## Publishers and their keys Every key belongs to one publisher (`pkg/src/trust.rs`). `/settings/trusted-keys` names each: ` `, and `registry` after it for a key that may vouch for others. A disk `cargo xtask` makes has two, both registries: `this-checkout` (the development key) and `pinnacle` (the hosted Store's). - **A package opens as its publisher's**, and the Store writes the name beside the app, `/apps//publisher`. An app installed already is replaced (updated) only by a package of that publisher: another publisher's `calculator` is refused, by the Store and by the updates service alike. An app installed before apps kept their publisher takes the first one that updates it. - **A registry list admits other publishers.** It is a package (`packages/publishers.ppk` in a source, the entry `publishers`) signed by a registry key: `issued `, then `key ` lines. Each time the Store or the updates service reads a source's catalog it reads its list too, and keeps it (`/settings/publishers-`) when it is newer than the one kept. A list may not hand out a name the system gives a key of its own (only its own name, which is how a registry moves to a new key). - **A list takes keys back**: `revoked `. Such a key opens nothing again, on every system that has read the list, and stays taken back (`/settings/revoked-keys`) whatever list comes later, so an old list served again cannot bring it back. Apps already installed from it stay installed; they are not updated from it. The hosted Store's list is `keys/publishers` in this repository: admitting a publisher is a landing that adds its key there, and taking a key back one that adds `revoked`. `cargo xtask package-apps` writes it as `packages/publishers.ppa`, issued as the version, and the server signs it with the apps; it is at `https://pinnacle-os.eu/store/pinnacle/packages/publishers.ppk`. The development source serves a list of its own, which the self-check reads: it admits `friend` and admits and takes back `leaky`, and their packages beside it (`friendly`, `leaked`) open as `friend`'s and are refused. A publisher sends its public key the way it likes (it is public); its secret half stays with it, and its packages are signed as the Store's are (`openssl pkeyutl -sign -rawin` over the archive, `PSIG` appended), served from a source of its own or from a folder at pinnacle-os.eu. ## Publishing on pinnacle-os.eu Caddy serves `/data/pinnacle-store` at `https://pinnacle-os.eu/store/`, a folder per publisher. A midas deploy target fills one folder: 1. **On a build node** the target's steps build the app and write an *unsigned* package source: `catalog`, `packages/.ppa` (the archive without its signature) and `blobs/`. For this repository's apps that is `tools/deploy/store.sh` (`cargo xtask package-apps`, ARM's and a PC's in `pc/`); for Cartopolis `cargo xtask package-cartopolis `, run by Cartopolis's `deploy/build/pinnacle-store.sh`; for Flitz `cargo xtask package-flitz`, run by Flitz's `deploy/pinnacle-store.sh`. 2. **On the server**, as `pinnacle-sign`, the target's `prepare` signs each archive with OpenSSL (`openssl pkeyutl -sign -rawin`, the same Ed25519 signature `pkg` makes: its test `a_package_signed_by_openssl_opens`), appends `PSIG` and the signature to make `.ppk`, and removes the `.ppa`. 3. Its `checks` verify each signature against the key and each blob's name against its SHA-256; then midas replaces the folder. A version is whatever string the catalog and manifest say; the Store offers an update when it differs from the installed one. This repository's apps use the number of commits on main; Cartopolis its build number (as its server and APK do). ## Limits - The Store fetches one source's catalog at a time, each with an 8 s wait; a source that is down slows the Store's first screen by that much. - No resuming: an install cut off starts again, though files already fetched whole and listed with the same hash are kept on an update. - Cartopolis needs a GPU (Venus) to draw, which a bundle's plain QEMU does not give it: it installs there, and runs where `cargo xtask cartopolis` runs it. - A publisher cannot take its own key back: only a registry's list does, so a key that leaked waits for a landing in `keys/publishers` and the next deploy. - The Store does not say whose an app is before it is installed (the catalog does not sign it); a refusal names why. - A system disk keeps the sources it was made with (`/settings/store-sources`): one made before Flitz's source was added (2026-11-29) does not offer Flitz until the line is added to that file.