Skip to main content

Module client_state

Module client_state 

Source
Expand description

Compile-time client-state machine for CLI commands.

Each Commands arm dispatches to a BwCommand implementation whose BwCommand::Client declares the auth/lock state required to run. The dispatcher in main constructs a ClientContext once per invocation and routes the command through the corresponding TryFrom extractor; commands therefore never check auth/lock state manually.

Modules§

sealed 🔒

Structs§

AnyState
Catch-all. The extractor is infallible.
ClientContext
Per-invocation context built once in process_commands and consumed by a single extractor.
Locked
Authenticated and locked. The extractor rejects an unlocked vault.
LoggedIn
Authenticated state, lock-status-agnostic. The extractor requires a user.
LoggedOut
Unauthenticated state. The extractor rejects when a user is already logged in.
Unlocked
Authenticated and unlocked. The extractor requires the user’s symmetric key to be loaded.

Traits§

BwCommand
Trait implemented by commands that participate in the typestate dispatch.
BwCommandExt
Extension trait that wires BwCommand up to the ClientContext dispatcher.
ClientState
Marker trait implemented by the five client-state types in this module.