feat(app) lab 3 implemented

This commit is contained in:
imadev
2026-10-30 18:11:30 +03:00
parent f731f9b460
commit 48a616e910
57 changed files with 1390 additions and 303 deletions
+2 -5
View File
@@ -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 {