Commit graph

17 commits

Author SHA1 Message Date
Elle Mouton
3b5007c399
session: ensure past linked sessions are not active
This commit adds logic to the CreateSession method that checks that a
all the past sessions in a linked set are no longer active.
2023-08-30 12:34:29 +02:00
Elle Mouton
71cac8672f
session: add a CheckSessionGroupPredicate method
This method can be used to check that each session in a group passes for
a given predicate.
2023-08-30 12:34:29 +02:00
Elle Mouton
cc95a01923
session: add GetGroupID and GetSessionIDs methods
This commit adds new getters: `GetGroupID` and `GetSessionIDs` to the
session store which can be used to query the newly added indexes to get
the associated group ID for a session ID or the associated set of
session IDs for a group ID.
2023-08-30 12:34:28 +02:00
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
4bd8a5c03a
session: add GroupID field to Session
Add the new `GroupID1` field to the `Session` struct and ensure that the
new fields are properly serialised and deserialised.  The `GroupID` is
the ID of the first Session in a set of linked sessions.
2023-08-30 11:46:33 +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
d3a262600f
session: separate methods for creating vs updating a session 2023-08-25 16:02:13 +02:00
Elle Mouton
92575c8ed7
session: update the session Store interface 2023-08-25 14:20:12 +02:00
Elle Mouton
f9ffc0cdef
session: add GetSession method 2023-01-27 06:47:13 +02:00
Elle Mouton
b73c3699d6
session: add RevokedAt field
This commit adds a RevokedAt field to the Session structure and sets the
value of the field to the current time when RevokeSession is called.
2023-01-10 10:43:26 +02:00
Oliver Gugger
1444e7a180
multi: bump all dependencies to latest versions 2022-06-24 16:18:14 +02:00
Oliver Gugger
472d8f4602
multi: persist remote static key for handshakev2
This commit re-enables the second handshake for LNC.
2022-06-23 10:32:43 +02:00
Oliver Gugger
30d13ff7bb
Revert "multi: persist remote static key for handshakev2"
This reverts commit 31713c6e3d.
We will bump LNC to the latest version once the Terminal Web UI is ready
to persist the keys as well.
2022-04-20 14:42:26 +02:00
Elle Mouton
31713c6e3d
multi: persist remote static key for handshakev2
In this commit, we update the go mod to point to the version of LNC that
contains the logic for handshake version 2. This requires that we pass
in a call back that LNC can call to persist the remote static key once
it is received. This then needs to be provided each time we start up the
session again.
2022-04-19 09:49:08 +02:00
Oliver Gugger
46e9424bdf
Revert "multi: persist remote static key for handshakev2"
This reverts commit a2f1245020.
PR #342 was merged by accident before being fully reviewed and before
all dependent PRs were merged. Reverting.
2022-03-21 21:59:43 +01:00
Elle Mouton
a2f1245020
multi: persist remote static key for handshakev2
In this commit, we update the go mod to point to the version of LNC that
contains the logic for handshake version 2. This requires that we pass
in a call back that LNC can call to persist the remote static key once
it is received. This then needs to be provided each time we start up the
session again.
2022-03-21 14:18:40 +02:00
Oliver Gugger
f6568ab8e8
session: add session package 2021-11-24 13:44:25 -05:00