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 / native-browser-services

Native browser services and passkeys

Native browser services connect the desktop vault to browser extensions through the KeePassXC-Browser protocol. They provide login fill and save actions plus WebAuthn passkey use, while the desktop app remains the owner of vault access, user consent, and passkey signing keys.

System boundary

The browser service is the native side of browser integration and autofill. The extension supplies the browser-facing UI and page hooks. The desktop app supplies the local host, vault actions, approval dialogs, and passkey authenticator. Browser extension automation covers the extension-side behavior.

Native browser path

The native browser path carries extension messages from a browser-managed process to the running desktop app. Chrome, Chromium-based browsers, and Firefox start a native host through a manifest. The host proxy relays framed messages to the app's local server, which serves the request against the open vault.

Safari uses a separate macOS App Group socket because its extension runs in a sandbox. It still reaches the same browser service, but it does not depend on the data-directory socket used by the other desktop browsers.

The same service can support Rowel's extension and the stock KeePassXC-Browser extension. The optional compatibility setting registers the KeePassXC host name without replacing a host that KeePassXC already owns.

This diagram shows how a browser request reaches the vault and returns as a protocol reply.

flowchart LR
    E[Browser extension] -->|Native messaging frames| P[Native host proxy]
    P -->|Local socket frames| S[Desktop local server]
    S -->|KeePassXC-Browser protocol| A[Browser service]
    A --> V[Open vault]
    V --> A --> S --> P --> E
    SE[Safari extension] -->|App Group socket frames| S

References: src-tauri/…/mod.rs• L1-18 src-tauri/…/mod.rs• L57-177 src-tauri/…/proxy.rs• L1-24 src-tauri/…/server.rs• L18-45 src-tauri/…/manifest.rs• L1-11

Message framing

The browser and app exchange one JSON message per native-messaging frame. Each frame carries a bounded length followed by its body, so the proxy can pass a complete message between browser standard input/output and the app socket without changing its contents.

The local server stays available for the life of the app after it starts. Turning the browser service off does not need to tear down the listener: the next request is refused and existing connections stop at their next request. Lock and unlock signals can also reach active connections so the extension can update its view of vault access.

References: src-tauri/…/frame.rs• L1-10 src-tauri/…/frame.rs• L12-51 src-tauri/…/server.rs• L101-123 src-tauri/…/server.rs• L166-186 src-tauri/…/tests.rs• L1171-1311

Protocol protection

The first protocol message exchanges session public keys. Later messages use an authenticated encrypted envelope with a fresh nonce for each request and a related nonce for its reply. This protects the browser exchange after setup and lets the extension match each reply to its request.

The service exposes only actions supported by the claimed protocol version. These actions include login lookup, TOTP lookup, password generation, login save, vault lock, and passkey registration or sign-in. Unsupported actions return protocol errors instead of reaching the vault.

References: src-tauri/…/protocol.rs• L1-10 src-tauri/…/protocol.rs• L16-32 src-tauri/…/protocol.rs• L121-221 src-tauri/…/actions.rs• L107-141 src-tauri/…/tests.rs• L139-148 src-tauri/…/tests.rs• L354-431

Vault association

Extension association

Association is the user approval that lets an extension use one open vault. The extension presents an identification key. The desktop app shows that key as a short fingerprint and stores the approved key with the vault, not as a device-wide setting.

After association, each request must still match an approved key in the currently open vault. A workspace switch, vault lock, or forgotten client therefore removes access on the next request. The same extension must be approved again for another vault.

References: src-tauri/…/actions.rs• L27-36 src-tauri/…/actions.rs• L43-55 src-tauri/…/actions.rs• L275-305 src-tauri/…/mod.rs• L340-383 src-tauri/…/tests.rs• L468-600 src-tauri/…/tests.rs• L1088-1140

The desktop app holds one browser security decision at a time. An association ask includes a unique request ID and the extension key. The user can allow it with a name or deny it. The answer is accepted only for that request ID, so a late answer cannot approve a later retry.

The request expires after one minute. A second association or passkey ask does not queue behind the first; it is refused while the first decision is active. This prevents two browser requests from putting competing approval dialogs on screen.

References: src-tauri/…/mod.rs• L180-325 src-tauri/…/events.rs• L130-145 src/…/AssociateDialog.tsx• L14-37 src/…/browser.ts• L45-64 src-tauri/…/tests.rs• L109-137

Passkey ceremonies

Passkey registration

Passkey registration starts when a page asks the extension to create a WebAuthn credential. The native service checks the page origin, relying-party ID, challenge, user ID, and supported algorithm before it asks the user for approval.

After approval, the desktop authenticator creates the credential in the open vault and returns the browser-shaped credential to the page. The private signing key remains in the vault. The webview and page receive only the data needed to complete the WebAuthn ceremony.

References: src-tauri/…/passkeys.rs• L99-181 src-tauri/…/passkeys.rs• L219-253 src-tauri/…/actions.rs• L246-255 src-tauri/…/tests.rs• L25-26

Passkey sign-in

Passkey sign-in uses the page origin and relying-party ID to find credentials for the site. When the vault has more than one matching account, the consent dialog shows the available accounts and the user selects one. The native authenticator then signs the assertion for that choice.

The page receives a normal WebAuthn assertion or a WebAuthn error outcome. A denied, expired, or unavailable request does not expose which account exists through a special native refusal path.

References: src-tauri/…/passkeys.rs• L109-115 src-tauri/…/passkeys.rs• L184-216 src-tauri/…/passkeys.rs• L255-288 src-tauri/…/actions.rs• L256-259 src-tauri/…/tests.rs• L25-26

Passkey validation

The native service treats the page origin as part of the security decision. It accepts HTTPS origins and the browser-safe localhost case. It also requires the relying-party ID to match the origin host or a valid registrable suffix. Invalid challenges, user IDs, domains, or algorithms fail before the authenticator runs.

These checks keep a page from using a passkey for another site. They also preserve the browser's expected error types and timing when the user denies a request or no matching credential exists.

References: src-tauri/…/passkeys.rs• L321-372 src-tauri/…/passkeys.rs• L375-411 src-tauri/…/protocol.rs• L53-65

Desktop surfaces

Browser settings

Settings exposes the browser service as an Autofill control. The user can enable or disable the native host, enable KeePassXC-Browser compatibility, see which supported browsers were found and registered, and inspect the extensions associated with the open vault.

The browser list distinguishes a browser that is not installed, one that is detected but not set up, and one whose native host is ready. The connected-extension list shows each saved name and fingerprint. Forget removes that extension's approval from the current vault.

References: src/…/index.tsx• L20-35 src/…/index.tsx• L82-135 src/…/Browsers.tsx• L10-43 src/…/Clients.tsx• L8-53

The browser consent surface is a single modal gate for both extension association and passkey ceremonies. It raises the desktop window when needed and shows only the newest pending decision.

The association dialog shows the extension fingerprint and asks for a name. The passkey dialog shows the relying-party site and requesting page. Registration shows the account named by the site. Sign-in shows matching vault accounts when the user must choose one. Allow and Deny send the decision back with the ask ID.

References: src/…/index.tsx• L5-21 src/…/AssociateDialog.tsx• L40-87 src/…/PasskeyDialog.tsx• L17-119 src-tauri/…/events.rs• L147-221

Browser status bridge

The frontend reads browser state from the native side and redraws it after each change. The bridge returns one complete status that includes the service switch, compatibility switch, supported browser state, and approved clients. Browser events refresh the client list when an association completes outside the Settings view.

Native host status also reports conflicts with another program that owns the KeePassXC host name. The app leaves that foreign registration in place and shows the conflict instead of silently taking control of it.

References: src/…/browser.ts• L4-43 src/…/browser.ts• L66-116 src-tauri/…/browser.rs• L13-32 src-tauri/…/browser.rs• L44-105 src-tauri/…/events.rs• L224-230 src-tauri/…/manifest.rs• L143-169 src-tauri/…/manifest.rs• L242-325

Change checklist

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

  • Keep the protocol version aligned with the actions the host actually supports. A higher version enables extension features that the host may not answer.
  • Keep the native host names, browser manifest locations, allowed extension identities, and compatibility behavior aligned. A mismatch can make the service appear enabled while the browser cannot start it.
  • Keep the browser event payloads aligned with the frontend BrowserConsent types. Ask IDs must remain stable across the event and its response command.
  • Keep association storage tied to the active vault and re-check it on every request. Do not turn a vault approval into a device-wide approval.
  • Keep passkey origin and relying-party checks aligned with the WebAuthn data returned to the page. A change in one side can allow a credential for the wrong site or produce an invalid ceremony.
  • Keep passkey account ordering aligned between the native account list, the dialog selection, and the response index.
  • Keep the Safari App Group, socket name, frame size, and debug path aligned with the Safari extension. A drift can affect Safari without changing Chrome or Firefox behavior.

Important failure modes

TriggerConsequenceGuard
The browser host is enabled but its manifest is missing or owned by another hostThe extension cannot start the native service, or compatibility stays with KeePassXCManifest status reports detection, installation, and conflicts. Foreign manifests are left alone.
The vault locks or the workspace changes during an associationThe extension could be told that it is approved for a vault that is no longer openThe approval keeps the vault session identity and writes the client only if that session is still active.
A late dialog answer uses an old ask IDA new association or passkey ceremony could receive the wrong decisionEach ask has a unique ID and the native consent slot accepts only its current ID.
A page supplies an invalid origin or relying-party IDA passkey ceremony could target a different siteNative validation rejects insecure or mismatched WebAuthn site data before signing.
A passkey sign-in has several matching accounts and no selected accountThe site could receive a signature for an unexpected accountThe dialog selects an account by index and the native side uses only that selected account.
The extension is forgotten after it has an open connectionThe connection could continue reading the vaultAssociation is checked against the current vault on every protected request.
The Safari socket path is too long or the app uses a debug data overrideThe Safari extension cannot reach the local serviceThe app uses the entitled App Group path and rejects paths that exceed the Unix socket limit.

Key files

FileWhy to read it
src-tauri/…/mod.rsDefines the browser host boundary, socket paths, consent slot, vault-scoped clients, passkey access, and app host.
src-tauri/…/server.rsShows the local listener lifecycle and how connections serve requests and lock signals.
src-tauri/…/proxy.rsShows how browser native messaging reaches the app socket.
src-tauri/…/frame.rsDefines the shared native-message framing contract.
src-tauri/…/protocol.rsDefines the encrypted KeePassXC-Browser wire session and supported protocol version.
src-tauri/…/actions.rsMaps browser actions to vault capabilities and association checks.
src-tauri/…/passkeys.rsDefines the native WebAuthn checks and passkey ceremony results.
src-tauri/…/manifest.rsDefines browser discovery, native host registration, compatibility conflicts, and safe ownership of existing manifests.
src-tauri/…/browser.rsExposes browser settings and consent responses to the desktop UI.
src-tauri/…/events.rsDefines association, passkey, and connected-client events sent to the webview.
src/…/browser.tsDefines the frontend status, ask, and response contracts.
src/…/index.tsxSelects the one visible browser security dialog.
src/…/AssociateDialog.tsxShows and answers extension association approval.
src/…/PasskeyDialog.tsxShows and answers passkey registration and sign-in approval.
src/…/index.tsxConfigures the browser service and refreshes its native status.