forked from mtusi2026/mtusi2026lab2
22 lines
448 B
Go
22 lines
448 B
Go
package session
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
type Session struct {
|
|
UserID string `json:"user_id"`
|
|
ExpiresAt time.Time `json:"expires_at"`
|
|
}
|
|
|
|
var ErrNotFound = errors.New("session: not found")
|
|
|
|
type Store interface {
|
|
Save(ctx context.Context, tokenHash []byte, s Session) error
|
|
Get(ctx context.Context, tokenHash []byte) (Session, error)
|
|
Delete(ctx context.Context, tokenHash []byte) error
|
|
Ping(ctx context.Context) error
|
|
}
|