blob: e167a60030464daf2b1e2655ae2155b53655a842 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package auth
import (
"context"
"codeberg.org/snonux/player/internal/model"
)
// SessionManager is the abstraction for session lifecycle operations.
type SessionManager interface {
CreateSession(ctx context.Context, userID int64) (string, error)
ValidateSession(ctx context.Context, id string) (*model.Session, error)
DeleteSession(ctx context.Context, id string) error
Cleanup(ctx context.Context) error
}
// TokenManager is the abstraction for API token generation and hashing.
// Generate returns an error when the system random source fails so callers
// can surface the failure (e.g. via HTTP 500) instead of panicking.
type TokenManager interface {
Generate() (plaintext, hash string, err error)
Hash(plaintext string) string
}
|