From 14c7099e3bc8dfd575e9e10b169180ab4cf2f299 Mon Sep 17 00:00:00 2001 From: Daniel Hammer Date: Sat, 17 Oct 2026 10:36:07 +0200 Subject: [PATCH] feat: remove remaining use of session.toml --- programs/include/montauk/user.h | 17 +---------------- programs/include/montauk/wifi.h | 2 +- programs/src/login/login_input.cpp | 2 -- programs/src/login/main.cpp | 3 --- template/docs/syscalls.md | 4 +--- template/sysroot/include/montauk/user.h | 17 +---------------- template/sysroot/include/montauk/wifi.h | 2 +- 7 files changed, 5 insertions(+), 42 deletions(-) diff --git a/programs/include/montauk/user.h b/programs/include/montauk/user.h index 855d0a7..37259c5 100644 --- a/programs/include/montauk/user.h +++ b/programs/include/montauk/user.h @@ -328,22 +328,7 @@ namespace user { return false; } - // ---- Session state and current user helpers ---- - - // Persist login session state after successful login. - // Current processes should use getuser() for their active username. - inline void set_session(const char* username) { - montauk::toml::Doc doc; - doc.init(); - config::set_string(&doc, "session.username", username); - config::save("session", &doc); - doc.destroy(); - } - - // Clear the session (on logout). - inline void clear_session() { - montauk::fdelete("0:/config/session.toml"); - } + // ---- Current user helpers ---- // Read the current process username into buf. Returns true if one is set. inline bool get_session_username(char* buf, int bufSz) { diff --git a/programs/include/montauk/wifi.h b/programs/include/montauk/wifi.h index 69adc5a..ec71373 100644 --- a/programs/include/montauk/wifi.h +++ b/programs/include/montauk/wifi.h @@ -17,7 +17,7 @@ * a raw PSK). Anyone who can read 0:/config can read the keys. * * No default copy of this file ships in the image, deliberately. Every other - * config an app writes (bluetooth.toml, display.toml, session.toml) is + * config an app writes (bluetooth.toml, display.toml) is * created on demand for the same reason: a shipped copy is laid down again * by anything that refreshes the system files, and it would overwrite the * networks the user had saved. diff --git a/programs/src/login/login_input.cpp b/programs/src/login/login_input.cpp index 4a493fc..65c8b3b 100644 --- a/programs/src/login/login_input.cpp +++ b/programs/src/login/login_input.cpp @@ -25,7 +25,6 @@ void transition_to_login_mode(LoginState* ls) { } void finish_desktop_session(LoginState* ls) { - montauk::user::clear_session(); montauk::memset(ls->password, 0, sizeof(ls->password)); ls->password_len = 0; gui::mtk::text_input_reset(ls->password_input); @@ -196,7 +195,6 @@ bool try_login(LoginState* ls) { return false; } - montauk::user::set_session(ls->username); return true; } diff --git a/programs/src/login/main.cpp b/programs/src/login/main.cpp index cc0849b..21e6d91 100644 --- a/programs/src/login/main.cpp +++ b/programs/src/login/main.cpp @@ -22,7 +22,6 @@ static void maybe_run_setup_session() { montauk::fmkdir("0:/users"); montauk::user::create_user(user, display, "", role); - montauk::user::set_session(user); doc.destroy(); montauk::abi::SpawnCapabilities caps{}; @@ -41,8 +40,6 @@ static void maybe_run_setup_session() { montauk::waitpid(pid); terminate_desktop_session(pid); } - - montauk::user::clear_session(); } static void initialize_login_mode(LoginState* ls) { diff --git a/template/docs/syscalls.md b/template/docs/syscalls.md index 1b7874f..323b83c 100644 --- a/template/docs/syscalls.md +++ b/template/docs/syscalls.md @@ -568,7 +568,7 @@ montauk::config::save("desktop", &doc); Header: `montauk/user.h` -User authentication and session management with SHA-256 password hashing. +User authentication and current-user helpers with SHA-256 password hashing. ```cpp bool user::authenticate(const char* username, const char* password); @@ -577,8 +577,6 @@ bool user::create_user(const char* username, const char* display_name, bool user::delete_user(const char* username); bool user::change_password(const char* username, const char* new_password); -void user::set_session(const char* username); // Log in -void user::clear_session(); // Log out bool user::get_session_username(char* buf, int sz); // Get current process user bool user::get_home_dir(char* buf, int sz); // Get current process home directory ``` diff --git a/template/sysroot/include/montauk/user.h b/template/sysroot/include/montauk/user.h index 855d0a7..37259c5 100644 --- a/template/sysroot/include/montauk/user.h +++ b/template/sysroot/include/montauk/user.h @@ -328,22 +328,7 @@ namespace user { return false; } - // ---- Session state and current user helpers ---- - - // Persist login session state after successful login. - // Current processes should use getuser() for their active username. - inline void set_session(const char* username) { - montauk::toml::Doc doc; - doc.init(); - config::set_string(&doc, "session.username", username); - config::save("session", &doc); - doc.destroy(); - } - - // Clear the session (on logout). - inline void clear_session() { - montauk::fdelete("0:/config/session.toml"); - } + // ---- Current user helpers ---- // Read the current process username into buf. Returns true if one is set. inline bool get_session_username(char* buf, int bufSz) { diff --git a/template/sysroot/include/montauk/wifi.h b/template/sysroot/include/montauk/wifi.h index 69adc5a..ec71373 100644 --- a/template/sysroot/include/montauk/wifi.h +++ b/template/sysroot/include/montauk/wifi.h @@ -17,7 +17,7 @@ * a raw PSK). Anyone who can read 0:/config can read the keys. * * No default copy of this file ships in the image, deliberately. Every other - * config an app writes (bluetooth.toml, display.toml, session.toml) is + * config an app writes (bluetooth.toml, display.toml) is * created on demand for the same reason: a shipped copy is laid down again * by anything that refreshes the system files, and it would overwrite the * networks the user had saved.