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)
This commit is contained in:
+2
-3
@@ -1,6 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
muxplex authentication — password management, secret management,
|
muxplex authentication — password file management.
|
||||||
session cookies, PAM integration, and request middleware.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import secrets
|
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."""
|
"""Generate a random password, write it to the password file (0600), return it."""
|
||||||
pw = secrets.token_urlsafe(20)
|
pw = secrets.token_urlsafe(20)
|
||||||
path = get_password_path()
|
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.write_text(pw + "\n")
|
||||||
path.chmod(0o600)
|
path.chmod(0o600)
|
||||||
return pw
|
return pw
|
||||||
|
|||||||
Reference in New Issue
Block a user