pub struct AppState { /* private fields */ }Expand description
Shared application state. Cheap to clone (an Arc); holds the registry root,
the resolved master key (zeroized on drop via MasterKey), the ephemeral
session token, and the last-activity instant for the idle watchdog.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(
root: PathBuf,
master: MasterKey,
confirmer: Arc<dyn Confirmer + Send + Sync>,
) -> Self
pub fn new( root: PathBuf, master: MasterKey, confirmer: Arc<dyn Confirmer + Send + Sync>, ) -> Self
Build state for a registry root, a resolved master key, and the
attended-confirmation confirmer, minting a fresh random session token
(128 bits of hex). The token dies with the process — it is never
persisted.
Sourcepub fn new_with_session(
root: PathBuf,
master: MasterKey,
session_token: String,
confirmer: Arc<dyn Confirmer + Send + Sync>,
) -> Self
pub fn new_with_session( root: PathBuf, master: MasterKey, session_token: String, confirmer: Arc<dyn Confirmer + Send + Sync>, ) -> Self
Like AppState::new but with a caller-supplied session token. Used by
the L11 container entrypoint so the host orchestrator (kovra ui --docker) — which generated the token and built the browser URL — and
the in-container server agree on it.
Sourcepub fn session_token(&self) -> &str
pub fn session_token(&self) -> &str
The ephemeral session token (embedded into the page URL by kovra ui).
Sourcepub fn lock(&self)
pub fn lock(&self)
Lock the UI (KOV-73): the secret-rendering API then returns 423 Locked
and reveals nothing until AppState::unlock. Public so a [host] native
bridge (NSWorkspace screen-lock/sleep notifications) can flip it on the
persistent UI; idempotent and lock-free.