pub struct TuiRegistry { /* private fields */ }Expand description
Daemon-wide registry of connected TUI clients.
Source of truth for live TUI connection state. Not persisted —
rebuilt on each daemon start from incoming initialize handshakes.
Implementations§
Source§impl TuiRegistry
impl TuiRegistry
Sourcepub fn new(config_dir: &Path) -> Self
pub fn new(config_dir: &Path) -> Self
Create a registry, attempting to load the signing key from
<config_dir>/.secret_key. If the file is missing or
unreadable, signing is silently disabled.
Sourcepub fn signing_is_enabled(&self) -> bool
pub fn signing_is_enabled(&self) -> bool
Whether HMAC signing is enabled (.secret_key was loaded).
Sourcepub fn generate_tui_id() -> String
pub fn generate_tui_id() -> String
Generate a short TUI ID: tui_ + 8 hex chars (4 random bytes).
Sourcepub fn generate_unique_tui_id(&self) -> String
pub fn generate_unique_tui_id(&self) -> String
Generate a TUI ID that is not currently in the registry.
Sourcepub fn sign(&self, tui_id: &str) -> Option<String>
pub fn sign(&self, tui_id: &str) -> Option<String>
Sign a TUI ID with HMAC-SHA256. Returns None if signing is
disabled.
Sourcepub fn verify(&self, tui_id: &str, sig: &str) -> bool
pub fn verify(&self, tui_id: &str, sig: &str) -> bool
Verify a TUI ID + signature. Returns true if:
- Signing is disabled (trust all), OR
- The signature is valid.
Sourcepub fn unregister(&self, tui_id: &str)
pub fn unregister(&self, tui_id: &str)
Unregister a disconnected TUI.
Auto Trait Implementations§
impl !Freeze for TuiRegistry
impl RefUnwindSafe for TuiRegistry
impl Send for TuiRegistry
impl Sync for TuiRegistry
impl Unpin for TuiRegistry
impl UnsafeUnpin for TuiRegistry
impl UnwindSafe for TuiRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more