123456789101112131415161718192021222324252627 |
- package auth
- import (
- "context"
- "errors"
- )
- var (
- ErrTokenExpired = errors.New("token has expired")
- ErrInvalidToken = errors.New("token is invalid")
- ErrTokenBlacklisted = errors.New("token has been revoked")
- )
- // Service defines the interface for authentication operations
- type Service interface {
- // GenerateToken creates a new authentication token for a user
- GenerateToken(ctx context.Context, clientID string) (string, error)
- // ValidateToken verifies a token and returns the client ID if valid
- ValidateToken(ctx context.Context, token string) (string, error)
- // RefreshToken creates a new token based on an existing valid token
- RefreshToken(ctx context.Context, token string) (string, error)
- // Logout invalidates a token
- Logout(ctx context.Context, token string) error
- }
|