Skip to main content

Module browser_credential_store

Module browser_credential_store 

Source
Expand description

OS-keychain-backed storage for browser-pane HTTP Basic-Auth credentials, scoped per identity so one agent’s saved site credential is never reachable through another identity’s browsing session.

The old store. Sign-ins now live in the Vault, per browser profile (crate::backend::vault::signins); nothing is saved here any more, and this module only reads and deletes what is left as it moves in.

Reuses crate::identity::secret_store’s existing keyring-crate wrapper (already backing SecretRef::Keychain for account API keys) — this module only builds the right account-key string and JSON-encodes the {username, password} pair; no new keychain code, no filesystem path involved (so agentmux_common::data_paths::sanitize_path_segment genuinely doesn’t apply here — nothing is written to disk).

See docs/status/majestic-painting-minsky plan (credential-isolated browser-pane auto-fill) and docs/specs/SPEC_BROWSER_PANE_HTTP_BASIC_AUTH_2026_05_18.md (the v1 spec that named “Persisted credential store (OS keyring)” as deferred future work — this module is that follow-up).

Structs§

BrowserCredential
A saved browser credential. Zeroizes on drop so a decoded value doesn’t linger in memory longer than the caller actually needs it — mirrors secret_store::get’s own Zeroizing<String> discipline for the raw keychain read.

Functions§

delete
Delete the stored credential for this identity + protection-space. Idempotent (a missing entry is success) — same contract as secret_store::delete. Called when a stored credential turns out to be wrong (a re-challenge shortly after an auto-fill — see the credential_broker orchestration in agentmux-cef).
load
Look up a stored credential. Ok(None) means “nothing saved for this identity + protection-space” (not an error) — same contract as secret_store::get_optional, which this wraps directly so a transient keychain failure (locked keychain, no Secret Service daemon, permission denied) is distinguishable from “genuinely never saved” at the call site, the same distinction secret_store’s own doc comment argues for.