Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidExpireTime = errors.New("expire time must be in the future")
ErrInvalidExpireTime is returned when attempting to create a token with an expiration time in the past.
View Source
var ErrTokenExpired = errors.New("token expired")
ErrTokenExpired is returned when a token's expiration time has passed.
View Source
var ErrTokenNotFound = errors.New("token not found")
ErrTokenNotFound is returned when a token cannot be found in the database.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is the service that handles token generation and validation.
func (*Auth) CreateToken ¶
CreateToken creates a new token and stores it in the database.
type Repository ¶
type Repository interface {
// CreateToken stores a new token in the database.
CreateToken(ctx context.Context, tx *sql.Tx, token Token) error
// GetToken retrieves a token from the database by its hash.
GetToken(ctx context.Context, tx *sql.Tx, hash string) (*Token, error)
// DeleteToken removes a token from the database by its ID.
DeleteToken(ctx context.Context, tx *sql.Tx, id string) error
}
Repository provides an interface for token persistence operations.
Click to show internal directories.
Click to hide internal directories.