Commit graph

4 commits

Author SHA1 Message Date
Elle Mouton
a802759f4e
session: add session ID to group ID indexes
This commit adds two new indexes to the session store. One from session
ID to group ID and one from groupID to a set of session IDs. This commit
only adds the new logic and starts writing the the new indexes from the
`StoreSession` method. The next commit will add a migration to back-fill
the new indexes.
2023-08-30 12:34:28 +02:00
Elle Mouton
c8b78bd10d
session: add new ID-to-key index
This commit does a few things:

1. Instead of deriving IDs using the first 4 bytes of the session's
   serialised local pub key, we instead use bytes [1:5] in order to skip
   the first byte which is either 0x02 or 0x03. This results in a
   greater entropy set.
2. We also add a new index from ID to key and we write to this index
   each time a new session is added.
3. We add a `ReserveNewSessionID` method to the session store which will
   grind through private keys until it finds one that does not clash
   with the current ID set.
4. A migration is added to back-fill the ID-to-key index. If any old
   sessions are found that _do_ have a colliding ID, they are sorted by
   created time and all but the newest session is revoked. Only an entry
   for the newest session will be added to the ID-to-key index.
2023-08-30 11:46:33 +02:00
Elle Mouton
92575c8ed7
session: update the session Store interface 2023-08-25 14:20:12 +02:00
Oliver Gugger
f6568ab8e8
session: add session package 2021-11-24 13:44:25 -05:00