mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Securejoin: store bobstate in database instead of context
The state bob needs to maintain during a secure-join process when exchanging messages used to be stored on the context. This means if the process was killed this state was lost and the securejoin process would fail. Moving this state into the database should help this. This still only allows a single securejoin process at a time, this may be relaxed in the future. For now any previous securejoin process that was running is killed if a new one is started (this was already the case). This can remove some of the complexity around BobState handling: since the state is in the database we can already make state interactions transactional and correct. We no longer need the mutex around the state handling. This means the BobStateHandle construct that was handling the interactions between always having a valid state and handling the mutex is no longer needed, resulting in some nice simplifications. Part of #2777.
This commit is contained in:
@@ -168,6 +168,14 @@ CREATE TABLE tokens (
|
||||
timestamp INTEGER DEFAULT 0
|
||||
);
|
||||
|
||||
-- The currently running securejoin protocols, joiner-side.
|
||||
-- CREATE TABLE bobstate (
|
||||
-- id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
-- invite TEXT NOT NULL,
|
||||
-- next_step INTEGER NOT NULL,
|
||||
-- chat_id INTEGER NOT NULL
|
||||
-- );
|
||||
|
||||
CREATE TABLE locations (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
latitude REAL DEFAULT 0.0,
|
||||
|
||||
Reference in New Issue
Block a user