Audit changes.

This commit is contained in:
jdl
2026-06-13 18:03:44 +02:00
parent 0cd5982a3f
commit 8983c0d651
4 changed files with 19 additions and 7 deletions

View File

@@ -134,14 +134,25 @@ func (a *API) Session_SignIn(pwd string) (Session, error) {
defer a.sessionsMu.Unlock()
s := &Session{
SessionID: idgen.NewToken(),
SignedIn: true,
CreatedAt: time.Now(),
LastSeenAt: time.Now(),
}
a.sessions[s.SessionID] = s
return *s, nil
}
func (a *API) Session_InvalidateAll() Session {
a.sessionsMu.Lock()
defer a.sessionsMu.Unlock()
clear(a.sessions)
s := &Session{
SessionID: idgen.NewToken(),
LastSeenAt: time.Now(),
}
a.sessions[s.SessionID] = s
return *s
}
// sweepSessions periodically evicts sessions past their TTL. Without it, a
// signed-in session whose ID is never presented again would linger forever
// (Session_Get only evicts on a lookup of that same ID).

View File

@@ -11,7 +11,5 @@ type Peer = db.Peer
type Session struct {
SessionID string
SignedIn bool
CreatedAt time.Time
LastSeenAt time.Time
}