Documentation ¶
Index ¶
- Constants
- Variables
- type Service
- func (s *Service) CurrentUser(ctx context.Context) (*types.User, error)
- func (s *Service) GenerateToken(ctx context.Context, email string, duration time.Duration) (string, error)
- func (s *Service) Login(ctx context.Context, login types.LoginInput) (*types.JWT, error)
- func (s *Service) RefreshToken(ctx context.Context, data types.JWT) (*types.JWT, error)
- func (s *Service) SetCurrentUser(ctx context.Context, user *types.User) context.Context
- func (s *Service) Signup(ctx context.Context, newUser types.User, password string) (*types.JWT, error)
- func (s *Service) ValidateToken(ctx context.Context, tokenStr string) (*types.Claims, error)
Constants ¶
View Source
const (
UserKey key = iota
)
Variables ¶
View Source
var ( AccessTokenDuration = time.Hour * 24 * 30 // Token valid for 1 month RefreshTokenDuration = time.Hour * 24 * 365 // Refresh token valid for 1 year )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
Repository *repo.Repository
}
func Init ¶
func Init(repo *repo.Repository) *Service
func (*Service) CurrentUser ¶
func (*Service) GenerateToken ¶
func (*Service) RefreshToken ¶
func (*Service) SetCurrentUser ¶
Click to show internal directories.
Click to hide internal directories.