Introducing a new way to review your PRs.

Read the announcement

fwdai / rowel

🔑 Local-first Secrets Manager

View on GitHub

23 documents · Updated Oct 9, 2026

docs / desktop-platform-integration

Desktop platform integration

Rowel uses a Tauri native host to give its web UI a controlled desktop application shell. The host creates the main window, connects the UI to operating-system services, handles files opened by the OS, supports browser extensions, and keeps application rules such as auto-lock and single-instance behavior active outside the web page.

System boundary

The native host is the boundary between the web UI and the operating system. The UI asks for application work through commands and receives longer-running or externally triggered changes through typed events. Native code owns the parts that must remain active when the page is hidden, reloaded, or not yet ready.

Native host responsibilities

The host starts the Rowel process and assembles the services that support the application. It keeps the UI focused on vault and account workflows while it handles native windows, the tray, file associations, browser extension access, external links, updates, logs, local file access, and platform-specific behavior.

The host also owns shared application state that must be consistent across those services. This includes the active workspace, settings, lock state, and paths that the user has explicitly selected for local reading.

References: src-tauri/…/lib.rs• L77-150 src-tauri/…/grants.rs• L1-28 src-tauri/…/mod.rs• L1-18

Platform variants

The desktop build adds single-instance handling, update support, process control, a tray, document opening, and an optional browser extension host. The Rust workspace keeps the desktop app, the Tauri-free vault core, and the iOS AutoFill library as default members, while desktop-only host services are enabled only for desktop targets. Shared application code also supports mobile where the operating system uses different entry points, such as deep links instead of desktop file arguments.

The platform split preserves one application model while adapting the edges. For example, desktop file associations arrive from command-line arguments or macOS open events, mobile OAuth returns through the app URL scheme, and Safari uses a macOS app extension while other browsers use the desktop native host.

References: src-tauri/Cargo.toml• L19-25 src-tauri/Cargo.toml• L105-136 src-tauri/Cargo.toml• L172-176 src-tauri/…/lib.rs• L59-102 src-tauri/…/lib.rs• L184-205 src-tauri/…/lib.rs• L290-298 src-tauri/…/server.rs• L36-99

Application lifecycle

The host starts before the web UI and prepares the state that the first screen needs. It loads preferences, repairs interrupted workspace changes, selects the last active workspace, creates the hidden window, starts enabled desktop services, and then exposes the native bridge to the page.

This order lets the lock screen describe the correct workspace without waiting for the UI to rebuild native state. It also makes startup safe when a previous process stopped during a workspace change.

Startup sequence

The startup path moves from native preparation to a controlled handoff to the web UI. The window stays hidden until the UI has armed its splash screen, with a short fallback so a broken or slow page still becomes visible.

The diagram shows how native startup and web startup meet at the first usable frame.

flowchart TD
    A[Native process starts] --> B[Install platform services]
    B --> C[Load settings and recover workspace state]
    C --> D[Create hidden main window]
    D --> E[Inject first-frame theme and language]
    E --> F[Web UI subscribes to events and probes status]
    F --> G[Web UI signals app ready]
    G --> H[Reveal and focus window]
    D --> I[Fallback reveal after delay]
    I --> H

References: src-tauri/…/lib.rs• L59-75 src-tauri/…/lib.rs• L140-193 src-tauri/…/window.rs• L20-49 src-tauri/…/app.rs• L132-173

Application state

The host gives commands and event handlers access to managed state for the current session, settings, workspace selection, auto-lock, and user-approved local paths. A single status probe gives the web UI the non-secret facts it needs to choose setup, unlock, and main application flows.

Settings are durable preferences rather than vault secrets. The host loads them before the window is created, applies values that affect native behavior such as auto-lock, and returns the merged result when the UI changes them.

References: src-tauri/…/lib.rs• L140-143 src-tauri/…/app.rs• L15-40 src-tauri/…/app.rs• L60-129 src-tauri/…/settings.rs• L129-199

Native window behavior

The main window is a native container for the web UI. The host controls when it appears, how it responds to focus and drops, and which navigation remains inside the application.

The window is created from the Tauri configuration with a desktop-sized, resizable frame. It is hidden at launch so the user sees the web UI's splash handoff rather than an empty or partly loaded page. The application also uses a strict content security policy that limits page resources and prevents embedded frames.

Window reveal

The web UI calls app_ready when its first frame is ready. The host reveals the window once, and a fallback reveal protects against a missing signal. Later requests from the tray or a second launch show and focus the existing window without replaying the startup reveal.

This keeps startup presentation separate from normal window activation. A file opened while the app is already visible raises the window, while a file received during launch waits for the normal reveal.

References: src-tauri/…/window.rs• L9-18 src-tauri/…/window.rs• L88-94 src-tauri/…/window.rs• L127-154 src-tauri/…/app.rs• L167-180 src-tauri/tauri.conf.json• L12-32

The webview keeps application content inside the native window and sends ordinary external HTTP and HTTPS links to the operating-system browser. Local development hosts remain inside the webview so the development application can run normally.

This boundary prevents a link in the application from silently changing the native window into a general web browser.

References: src-tauri/…/window.rs• L116-125 src-tauri/tauri.conf.json• L30-32

User-selected file access

The host treats an operating-system file picker or a window drop as proof that the user selected a path. It records that choice for a specific purpose, such as image scanning or environment-file reading, and the later read must use the same purpose.

This gives local file commands a native consent boundary. A path supplied only by page code is not enough, and a one-use choice cannot be reused silently.

References: src-tauri/…/grants.rs• L1-28 src-tauri/…/grants.rs• L56-99 src-tauri/…/window.rs• L57-79

Operating-system integration

The host turns operating-system actions into application behavior. It provides a tray entry point, accepts registered backup files, prevents duplicate application windows, supports browser extensions, and uses native services for updates and external links.

These integrations let Rowel remain available as a desktop application even when its main window is hidden or the web UI is not active.

Tray behavior

The desktop tray provides the persistent native entry point for opening Rowel, locking the vault, opening the product website, and quitting the process. Its labels follow the same language choice as the web UI and update when the user changes language.

The tray therefore controls important application actions without requiring the main window to be open. Its lock action uses the same session lock path as inactivity handling.

References: src-tauri/…/tray.rs• L127-181 src-tauri/…/tray.rs• L187-216 src-tauri/…/autolock.rs• L170-176

Document opening

The application registers .rowel backups and .swftx legacy vault files with the operating system. The host accepts only existing files with those extensions, parks the first valid path until the web UI is listening, and then reports it through the same event path used for files opened while the app is running.

Windows and Linux provide command-line arguments. macOS provides open events. Single-instance handling folds a second launch into the existing process, so opening a document does not create a second main window.

The diagram shows how the three operating-system entry paths converge before the web UI consumes the file.

flowchart LR
    A[Windows or Linux launch] --> D[Validate and park document]
    B[Windows or Linux second launch] --> C[Single-instance handoff]
    C --> D
    E[macOS open event] --> D
    D --> F{Web UI ready?}
    F -->|No| G[UI takes parked path]
    F -->|Yes| H[Emit file opened event]
    G --> I[Import or open backup flow]
    H --> I

References: src-tauri/tauri.conf.json• L55-67 src-tauri/…/lib.rs• L81-91 src-tauri/…/lib.rs• L184-193 src-tauri/…/lib.rs• L290-298 src-tauri/…/opened.rs• L1-14 src-tauri/…/opened.rs• L27-45 src/App.tsx• L68-75

Browser extension host

The optional browser extension host lets a supported extension use the open Rowel vault for login fill, one-time codes, password generation, login saves, and passkeys. It uses a local native connection instead of exposing vault data through a web page, and it follows the same locked-session and active-workspace rules as the desktop UI.

The host registers itself with detected browsers when the feature is enabled. Chrome, Chromium-based browsers, and Firefox reach the application through a native messaging proxy, while Safari reaches a second local connection in the shared macOS app group. The host can ask the user to approve an extension or passkey action, and it refuses access when the vault is locked or the approval no longer belongs to the active workspace.

References: src-tauri/…/lib.rs• L160-175 src-tauri/…/mod.rs• L1-18 src-tauri/…/manifest.rs• L251-281 src-tauri/…/server.rs• L36-99

Focus and auto-lock

The host treats user activity, focus changes, and backgrounding as part of vault protection. An unlocked session has one idle timer, and the host records when the window loses focus so a long sleep or suspension still counts toward the timeout.

Returning after the full timeout locks the vault instead of starting a new idle period. The same lock path serves the timer, the tray, and other application actions, which keeps the session boundary consistent.

References: src-tauri/…/autolock.rs• L15-37 src-tauri/…/autolock.rs• L94-116 src-tauri/…/autolock.rs• L125-176 src-tauri/…/window.rs• L57-61

macOS extension integration

The macOS build joins the native app and the Safari extension into one application bundle. The bundle step supplies the extension, while signed app entitlements allow the native host and extension to use the shared services they need.

Safari extension bundle

The macOS bundle runs the Safari extension build before packaging and places the resulting .appex inside the app's plug-in area. This makes Safari support part of the shipped desktop product rather than a separate install step.

References: src-tauri/tauri.macos.conf.json• L1-12 src-tauri/…/server.rs• L76-99

macOS security boundary

The signed macOS app uses keychain access for protected biometric items and an application group shared with the Safari extension. These permissions let the app protect secure data and let the sandboxed extension reach the native browser connection without giving the extension direct vault access.

The entitlements must agree with the macOS signing and provisioning setup. If the signed bundle requests a group that its profile does not grant, macOS can stop the process before application code runs. The application group also has to remain the same for the Safari extension and native host.

References: src-tauri/Entitlements.plist• L7-19 src-tauri/Entitlements.plist• L37-51 src-tauri/Entitlements.plist• L53-63 src-tauri/…/mod.rs• L113-160

Command and event bridge

The web UI and native host communicate through two related channels. Commands are request-and-response calls for a direct result, while events carry state changes or background progress that may happen after the original request returns.

The command catalog is registered by the host. The event catalog defines names and payload shapes in one place, and the web UI exposes typed wrappers so both sides use the same contract.

Command contract

The command bridge exposes application status, startup readiness, settings, vault actions, workspace actions, tools, import and export, synchronization, sharing, authentication, and browser extension control. The host keeps sensitive or blocking work away from the UI thread and checks the active session before returning vault data.

The most important shell commands are app_status, app_ready, take_opened_file, and set_settings. Feature commands use the same bridge but are documented in the child page Tauri command bridge.

References: src-tauri/…/lib.rs• L208-287 src-tauri/…/mod.rs• L27-85 src-tauri/…/app.rs• L60-189 src/…/app.ts• L43-117

Event contract

Events report changes that do not fit a single synchronous reply. They cover vault locks, merged vault data, sync status, import progress, setup results, workspace changes, files opened by the operating system, and browser approval requests.

The event design sends complete state snapshots where possible. For example, a sync status event carries the full current status, so the web UI does not need to rebuild state from a fragile sequence of smaller transitions.

References: src-tauri/…/events.rs• L1-26 src-tauri/…/events.rs• L58-120 src/…/events.ts• L7-64 src/…/events.ts• L72-95

Web UI handoff

The web UI subscribes to events before it retrieves any parked document. This order closes the gap between launch-time files and files opened after startup. The UI then uses the native status probe to select its initial flow and listens for later native changes.

The related page Native window and events explains the window reveal, focus, file-open, and event timing rules in more detail.

References: src/App.tsx• L52-81 src/…/app.ts• L102-117 src/…/events.ts• L91-95

Failure containment

The host is designed to fail in ways that preserve the user's session boundary and avoid unsafe native access. A bad preference file falls back to defaults, a missing document is ignored, an unavailable Safari listener does not disable other browser support, and an external link leaves the app rather than changing the in-app page.

Native failures are also kept local where possible. A tray label update can fail without losing the saved preference, and a fallback window reveal prevents a missing web UI signal from leaving the application invisible.

Boundary guarantees

The main guarantees are visible at the edges between native code and the web UI:

  • The page cannot read an arbitrary local path without a matching native grant.
  • A lock event tells the UI to discard its unlocked view of the vault.
  • A document opened before event listeners exist remains available through a one-time handoff.
  • A second desktop launch focuses the existing process instead of creating another application window.
  • A malformed preference file does not prevent the app from starting.
  • A browser extension cannot use the vault after it is locked or after the active workspace changes.

References: src-tauri/…/grants.rs• L10-28 src-tauri/…/events.rs• L58-70 src-tauri/…/opened.rs• L10-14 src-tauri/…/lib.rs• L81-91 src-tauri/…/settings.rs• L129-144 src-tauri/…/mod.rs• L446-469

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the native command registration in src-tauri/…/lib.rs, the Rust command functions, and the TypeScript wrappers in agreement.
  • Keep event names and payloads aligned between src-tauri/…/events.rs and src/…/events.ts; a renamed event can leave the UI waiting without an error.
  • Keep the parked-file handoff and live file:opened event as one flow so documents opened during launch are not lost.
  • Keep tray labels aligned with the supported UI locales because the tray exists outside the webview's translation system.
  • Keep file-association extensions, document validation, and backup import behavior aligned when a supported document type changes.
  • Keep the startup reveal signal and fallback behavior aligned with the web UI splash flow so the app does not show a blank native window.
  • Keep the Safari extension build artifact, macOS bundle plug-in path, and Safari local connection available as one release path.
  • Keep macOS keychain and application-group entitlements aligned with the signed bundle, provisioning profile, and Safari extension.
  • Keep browser manifest registration, the enabled setting, and the local host listener aligned so browser support does not appear enabled without a reachable host.
  • Keep workspace default members, target-specific native dependencies, and src-tauri/Cargo.lock aligned so the resolved desktop dependency graph matches the supported build targets.

Important failure modes

TriggerConsequenceGuard
The web UI does not call app_readyThe main window stays hidden until the fallback delay expires.The native host has a one-shot fallback reveal.
A backup opens before the web UI subscribesA live event alone would be missed.The host parks the path and exposes take_opened_file.
A second desktop process receives a backupTwo application windows could compete for the same session.The single-instance plugin forwards the path to the existing process.
The page sends an unselected local pathThe backend could expose a file the user did not choose.Path grants require a native picker or drop and a matching purpose.
The window stays unfocused beyond the idle limitAn unlocked vault remains exposed.Focus loss starts the auto-lock measurement and resume checks elapsed wall time.
A command or event payload changes on one side onlyThe UI can fail to call a command or silently ignore a state update.Rust registration and typed TypeScript catalogs define the shared contract.
The Safari extension is not included in the macOS bundleSafari cannot load the shipped extension or reach its native host.The macOS bundle step builds and places the .appex plug-in.
Signed macOS entitlements do not match the allowed profile or shared groupmacOS can refuse to start the app or the Safari extension cannot reach the shared connection.Keep the entitlements, signing profile, and bundle identifiers aligned.
The browser host cannot bind its local connectionBrowser requests cannot reach the app even when the feature is enabled.The host logs the failure, leaves other app functions running, and retries when enabled again.
A desktop-only native dependency is enabled for a mobile targetThe mobile build can fail or include an unavailable platform service.Cargo target gates keep desktop plugins and browser-host services out of mobile builds.

Key files

FileWhy to read it
src-tauri/…/lib.rsPrimary native entry point. It assembles plugins, managed state, startup work, command registration, browser host startup, and runtime events.
src-tauri/Cargo.tomlDefines the workspace members and the target-specific native services that shape desktop and mobile builds.
src-tauri/Cargo.lockRecords the resolved native dependency graph used to reproduce the desktop and mobile builds.
src-tauri/tauri.conf.jsonDefines the application shell, build boundary, security policy, window defaults, file associations, and updater endpoint.
src-tauri/tauri.macos.conf.jsonDefines the macOS-only Safari extension build and bundle placement.
src-tauri/Entitlements.plistDefines the signed macOS permissions used for protected keychain data and shared Safari extension access.
src-tauri/…/window.rsShows how the native window is created, revealed, focused, protected from unwanted navigation, and connected to file drops.
src-tauri/…/app.rsDefines the launch status probe, first-frame boot data, window-ready signal, parked-file handoff, and settings update.
src-tauri/…/events.rsDefines the native-to-web event names and payload shapes.
src-tauri/…/opened.rsExplains how desktop file associations converge into one document-open flow.
src-tauri/…/tray.rsDefines the desktop tray actions and its language behavior.
src-tauri/…/autolock.rsDefines the application-level inactivity and focus rules that protect an unlocked vault.
src-tauri/…/grants.rsDefines the native consent boundary for local file reads.
src-tauri/…/mod.rsDescribes the browser extension host and its link to the active vault session.
src-tauri/…/manifest.rsDefines browser registration and compatibility behavior for native messaging.
src-tauri/…/server.rsDefines the local browser connections and their lock-state signals.
src/…/app.tsProvides the web UI's shell-facing command types and wrappers.
src/…/events.tsProvides the web UI's typed event catalog and listener wrapper.
src/App.tsxShows the web UI startup order: subscribe, route from native status, take any parked file, and render the selected flow.