forked from mtusi2026/mtusi2026lab3
feat(app) lab 3 implemented
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
// AGENT: Redis is the single session store for lab 2 grade 4. PostgreSQL stays
|
||||
// the source of truth for business data. The token itself is never stored: Redis
|
||||
// holds SHA-256(token) -> user id with a TTL, so a leaked Redis dump does not
|
||||
// hand out usable bearer tokens.
|
||||
// Package session stores bearer sessions in Redis. Tokens are hashed before
|
||||
// they become keys, and the configured TTL is absolute.
|
||||
package session
|
||||
|
||||
import (
|
||||
@@ -57,7 +55,6 @@ func (s *Store) Ping(ctx context.Context) error {
|
||||
return s.client.Ping(pingCtx).Err()
|
||||
}
|
||||
|
||||
// Create returns the raw token exactly once and stores only its digest.
|
||||
func (s *Store) Create(ctx context.Context, userID uuid.UUID) (string, time.Time, error) {
|
||||
raw := make([]byte, 32)
|
||||
if _, err := rand.Read(raw); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user