Replace the count of logouts with a random value (part of #256)
check / check (push) Canceled after 0s

The session manager now keeps a random value from crypto/rand in the
logout table, made when the table has none and replaced by each logout.
A session carries the value current at its login and is refused when it
differs. A lost state directory now ends every login session, and no
logout can make an ended one work again, as a count starting from 0
could. README.md and the Manager doc comment say the check for a logout
compares no time, while a session's expiry still compares the clock.

Model: opus-5-5
This commit is contained in:
2026-10-15 17:00:58 +00:00
parent fd4517c6d9
commit f63ebf57ba
5 changed files with 82 additions and 66 deletions
+4 -5
View File
@@ -177,11 +177,10 @@ CREATE TABLE IF NOT EXISTS cache_stats (
);
INSERT OR IGNORE INTO cache_stats (id) VALUES (1);
-- Count of logouts. Each logout adds one; a login session carries the count
-- at its login and is refused once the count has changed, so logging out ends
-- every login session.
-- A random value that a login session carries from its login. pixa makes it
-- when the table has no row, and each logout replaces it; a login session
-- carrying another value is refused, so logging out ends every login session.
CREATE TABLE IF NOT EXISTS logout (
id INTEGER PRIMARY KEY CHECK (id = 1),
logout_count INTEGER NOT NULL DEFAULT 0
logout_value TEXT NOT NULL
);
INSERT OR IGNORE INTO logout (id) VALUES (1);