api_token

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTokenNotFound = errors.New("token não encontrado")
	ErrTokenExpired  = errors.New("token expirado")
	ErrTokenInactive = errors.New("token inativo")
)

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(repo storage.APITokenRepository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, userID, name string, expiresAt *time.Time) (model.APIToken, string, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) GenerateToken

func (s *Service) GenerateToken() (plainToken string, hash string)

func (*Service) ListByUser

func (s *Service) ListByUser(ctx context.Context, userID string) ([]model.APIToken, error)

func (*Service) Update

func (s *Service) Update(ctx context.Context, token model.APIToken) (model.APIToken, error)

func (*Service) ValidateToken

func (s *Service) ValidateToken(ctx context.Context, plainToken string) (model.APIToken, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL