Skip to main content

Module auth

Module auth 

Source
Expand description

Authentication helpers (sudo elevation) shared by all front-ends. Sudo/root authentication helpers shared by the TUI password prompt and the GUI authentication dialog.

This module contains no UI framework code — front-ends own their own widgets/state and call into these functions to perform the actual authentication.

Functions§

authenticate_sudo
Attempt to authenticate as root using sudo -S -v with the given password piped over stdin. Returns Ok(true) if authentication succeeded, Ok(false) if the password was rejected, and Err if sudo could not be invoked at all.
cache_sudo_password
Cache a validated sudo password for later privileged commands to reuse.
cached_sudo_password
Return a clone of the cached sudo password, if one is set.
clear_cached_sudo_password
Clear any cached sudo password (call once a run finishes, the dialog is cancelled, or the app is closing).