pub fn try_interactive_auth_handoff() -> Result<bool, String>Expand description
What: Perform interactive privilege-tool authentication with a TUI terminal handoff.
Inputs:
- None (resolves the active privilege tool from settings).
Output:
Ok(true)if the user authenticated successfully.Ok(false)if authentication was denied or cancelled.
§Errors
Returns Err if the terminal cannot be restored/setup or the tool cannot be resolved.
Details:
- Temporarily restores the terminal (leave alternate screen, disable raw mode) so the user can interact with the privilege tool’s native prompt (password, fingerprint).
- For sudo: runs
sudo -vwhich refreshes the credential cache. - For doas: runs
doas true; works seamlessly withpersistindoas.conf. Withoutpersist, the initial auth succeeds but subsequent PTY commands may re-prompt. - Re-enters TUI (alternate screen, raw mode) regardless of auth outcome.