Skip to main content

The Leverine Core — definition

Working paper for the roadmap (TASKS.md Task 1), written 2026-11-23. Status: draft for Kev’s review. This document defines what the core is and owns. The companion document, docs/module-contract.md, defines what a module is and what the core expects of one. Where the two disagree, this document wins on what the core owns; the contract wins on what a module must declare. Hard constraints (from docs/brief.md) apply throughout: the name is Leverine; Pro is a one-time purchase, never a subscription; mobile unlocks go through App Store / Google Play in-app purchase only; no account is required; keys never leave the device; no ads in the terminal.

1. What the core is

The core is everything a user gets with the free app, plus everything every module depends on. It is the trust boundary of the product: if a piece of code can touch a private key, hold a credential, move a file, or spend the user’s entitlement, it is either in the core or acting through a core API. Modules never get their own path around the core. The core ships as one Flutter codebase (Android + iOS) with native bridges where the platform demands it (background execution, keystore / Secure Enclave, file providers).

2. Core components

2.1 Vault — hosts, keys, credentials

  • The single store for hosts, SSH keys, passwords, and module credentials (for example bridge tokens).
  • Keys are generated and held in the platform keystore (Android Keystore / iOS Secure Enclave where available). Private key material is never exported to a module, never logged, and never leaves the device except through the core’s own encrypted export.
  • The Vault is a registry of host types, not a fixed SSH-only list. The core ships the SSH/SFTP host type. Modules may register additional host types (see module-contract.md §4) — the demo module Bifrost registers a “bridge host” type. The Vault stores the host’s non-secret configuration; secrets are stored as keystore references, never inline.
  • ~/.ssh/config import, jump hosts, and host grouping live here.
  • Free-tier limit (2 servers — amended from the brief’s 3 by Kev’s 2026-11-23 decision, roadmap Part F Q7) is enforced here, by the core, not by any module.

2.2 Browse — the file manager

  • Two-pane browsing, multi-select batch operations, thumbnails that do not break on scroll, complete navigation controls.
  • Browse works against any host type registered in the Vault, through the core’s file-system provider interface (list, stat, read, write, rename, delete, mkdir). The core ships the SFTP provider. A module may register an additional provider for its host type, but all file operations still pass through the core’s provider interface so the UI, the transfer queue, and the audit log see them uniformly.
  • No 0-byte files from network moves: the provider interface requires size/hash confirmation on completed writes, enforced by the core.

2.3 Transfer Engine

  • One persistent queue for all transfers, from every provider and module: pause, resume, retry, and survive the phone sleeping (background transfer via native code where the OS requires it).
  • Tar-acceleration and parallel channels for batch SFTP are engine features, available to any provider that declares batch support.
  • Modules never move files on their own. A module that needs a transfer enqueues it with the engine and receives progress/completion callbacks.

2.4 Shell — UI, navigation, settings

  • The app shell: navigation, host list, settings screens, search.
  • Modules contribute screens and actions into shell-defined slots (see module-contract.md §3); the shell owns layout, theming, and navigation so the app always feels like one app.
  • Global settings (appearance, transfer defaults, security options such as app lock) are core settings. Modules get their own settings section, rendered by the shell from the module’s declaration.

2.5 Module Registry & Loader

  • Knows which modules exist, which are installed, enabled, and entitled.
  • Loads a module only when: its manifest is valid, its declared core version range covers the running core, its entitlement check passes, and the user has it enabled.
  • A module that fails to load is disabled, not fatal: the core starts, the module is marked broken with a plain-language reason, and the failure is logged. The core must never crash because a module did.
  • First-party only (decided 2026-11-23, Kev): the registry loads only modules bundled with the app and built by us. Module integrity is verified at load; a module whose code or manifest does not match its shipped state — foreign, unsigned, or modified — is refused and the refusal is written to the audit log. There is no third-party module mechanism, no sideloading, and none will be designed: modules are the monetization strategy, proprietary and closed (module-contract.md §6 rule 8).
  • Per-module kill switch in settings: disable stops the module’s background work and removes its UI contributions immediately.

2.6 Entitlements

  • The core — and only the core — talks to the stores. One-time, non-consumable in-app purchases unlock paid modules and the Pro bundle.
  • A module declares the entitlement it requires (free, a module SKU, or pro-bundle); the registry enforces it. Modules never check receipts themselves.
  • No licence server. A purchased unlock keeps working if the company disappears (the JuiceSSH lesson): store receipts are validated on device and cached locally.
  • The existing Leverine web licensing system is out of scope for the mobile core; it belongs to a future web/desktop tier only.
  • Modules declare capabilities in their manifest (module-contract.md §2). The core mediates every capability: the first time a module exercises a sensitive capability (network beyond its declared endpoints, a new host, background execution), the core asks the user, in the shell’s UI, with the module’s name on the prompt.
  • Approval-gated actions (the Ferret inheritance): any module action that runs a command, deletes, or overwrites asks the user first, through a core-rendered approval sheet the module cannot fake or bypass.

2.8 Audit Log

  • The core keeps a local, user-readable log of module activity: which module connected where, ran what, and moved which files.
  • Modules write to the log only through the core API; they cannot edit or delete entries. The log is exportable by the user and is part of the “no account, no analytics” trust story: it stays on the device.

2.9 Sync & Export (core-owned data)

  • Vault data (hosts, keys) is exportable in an encrypted export file, and syncs via user-chosen self-hosted options (WebDAV, Syncthing, QR transfer between devices). The core owns the export format; the Sync & Automate module may add scheduling and automation on top, but manual export/import is core and free — a user’s own hosts are never paywalled (the Termius complaint).

3. What the core never delegates

  • Private key handling and credential storage.
  • Store purchases and entitlement decisions.
  • Permission prompts and approval sheets.
  • The transfer queue.
  • The audit log.
  • App lock / device-auth integration.

4. Core versioning

  • The core exposes a Module API version (separate from the app version in pubspec.yaml): MAJOR increments when the module contract breaks, MINOR when capabilities are added compatibly.
  • Every module declares the Module API range it supports; the registry refuses incompatible modules with a plain-language reason (§2.5).

5. Distribution model (decided 2026-11-23, Kev)

How modules reach the user is settled:
  • Mobile (App Store / Google Play): modules are compiled into the binary and unlocked by entitlement. Nothing executable downloads after install. Downloading code that adds features would violate Apple guideline 2.5.2 and Google Play’s Device and Network Abuse policy, and unlocking features through any non-store payment system violates both stores’ payment rules — the pattern that gets developer accounts terminated, not just apps rejected.
  • The module catalog may be fetched as data (names, descriptions, screenshots, version notes), so the Modules screen can stay current without an app update. Data is not code.
  • Modules-as-data may download: content interpreted by code already in the binary — Sync & Automate recipes, Discover scan profiles, Media presets — is ordinary downloadable content on both stores.
  • Desktop/web tier (post-launch): real downloadable modules, served from leverine.com under the existing Leverine licensing system, with full control and analytics. No store rules apply there.
  • Analytics: store-provided aggregate reporting (App Store Connect, Play Console) only. This keeps the “no account, no analytics” promise literally true while still giving sales and conversion data.
  • Pricing: modules à la carte at $10 each one-time (set by Kev 2026-11-28, docs/decisions.md; the $9.99 store tier in practice), Pro bundle at $39.99–$49.99 one-time (“less than half of one year of Termius, yours forever”). Enroll in both stores’ small-business programs at launch so the store cut is 15%, not 30%.
  • Bifrost ships in the store build, free, behind a “show demo modules” settings toggle, and is disclosed in the App Store review notes (Apple guideline 2.3.1 dislikes hidden features; a disclosed toggle is not a hidden feature). Remote commands on the user’s own machines are permitted — that is what every SSH client does; guideline 2.5.2 restricts code executed inside the app, not commands sent to a remote host.

6. Open questions for Kev

  1. First-party modules only, or a third-party ecosystem later? — decided 2026-11-23 (Kev): first-party only, permanently. No ecosystem, no SDK, no sideloading; enforcement (integrity check at load, refuse + log foreign or modified modules) instead. See §2.5 and decisions.md.
  2. Compiled-in vs downloadable modules — decided: compiled-in (§5).
  3. Bifrost store-build shipping — decided: ships in the store build, toggle-gated, disclosed to review (§5).

Source: Leverine/Leverine-File-Handler@3c51ed8 — docs/core.md.