feat(companion): on-device room login with saved passwords

Log in to a room server from the device UI with no phone app: picking a
room prompts for its password (blank allowed for open rooms), and a
context-menu "Login..." allows re-login. Successful passwords are
persisted to a dedicated /room_pw file so a previously-used room logs
back in after reboot without retyping; a failed login forgets the
(now-stale) saved password so the next attempt prompts again.

The room-password file is written via a temp file + atomic rename
(new DataStore::commitFile helper), matching the crash-safety of
contacts/channels persistence.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-26 10:55:24 +02:00
co-authored by Claude Opus 4.8
parent 57774d41f3
commit be9f3db8c6
9 changed files with 267 additions and 2 deletions
+5
View File
@@ -46,6 +46,11 @@ public:
File openRead(const char* filename);
File openRead(FILESYSTEM* fs, const char* filename);
File openWrite(const char* filename);
// Atomically replace final_path with a fully-written temp file (see
// openWrite()). Use for small custom records that want the same crash-safety
// as contacts/channels: write everything to a .tmp, then commit. Returns
// false if the swap fails (the previous good file is left untouched).
bool commitFile(const char* tmp_path, const char* final_path);
bool removeFile(const char* filename);
bool removeFile(FILESYSTEM* fs, const char* filename);
uint32_t getStorageUsedKb() const;