From c7050a2b022904b2c68f922562845573819d1a72 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Sat, 28 Mar 2026 20:52:59 -0700 Subject: [PATCH] refactor(auth): eliminate dead _config_dir() and trim docstring - Wire _config_dir() into generate_and_save_password() so the helper is no longer dead code; the 0700 directory mode is now enforced correctly - Trim module docstring to reflect what the file actually contains (password file management only) --- muxplex/auth.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/muxplex/auth.py b/muxplex/auth.py index 88aa38d..9c34604 100644 --- a/muxplex/auth.py +++ b/muxplex/auth.py @@ -1,6 +1,5 @@ """ -muxplex authentication — password management, secret management, -session cookies, PAM integration, and request middleware. +muxplex authentication — password file management. """ import secrets @@ -41,7 +40,7 @@ def generate_and_save_password() -> str: """Generate a random password, write it to the password file (0600), return it.""" pw = secrets.token_urlsafe(20) path = get_password_path() - path.parent.mkdir(parents=True, exist_ok=True) + _config_dir() # ensures dir exists with mode 0700 path.write_text(pw + "\n") path.chmod(0o600) return pw