auth

package
v1.35.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthorizationFailed = errors.New("authorization failed")
)

Functions

func Module

func Module() fx.Option

Types

type Config

type Config struct {
	Mode         Mode
	PrivateToken string
}

type Mode

type Mode string
const (
	ModePublic  Mode = "public"
	ModePrivate Mode = "private"
)

type Service

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

func New

func New(
	config Config,
	usersSvc *users.Service,
	otpSvc *otp.Service,
	devicesSvc *devices.Service,
	onlineSvc online.Service,
	logger *zap.Logger,
) *Service

func (*Service) AuthorizeDevice

func (s *Service) AuthorizeDevice(token string) (models.Device, error)

func (*Service) AuthorizeRegistration

func (s *Service) AuthorizeRegistration(token string) error

func (*Service) AuthorizeUserByCode added in v1.19.0

func (s *Service) AuthorizeUserByCode(ctx context.Context, code string) (*users.User, error)

AuthorizeUserByCode authorizes a user by one-time code.

func (*Service) GenerateUserCode added in v1.19.0

func (s *Service) GenerateUserCode(ctx context.Context, userID string) (*otp.Code, error)

GenerateUserCode generates a unique one-time user authorization code.

func (*Service) IsPublic

func (s *Service) IsPublic() bool

func (*Service) RegisterDevice

func (s *Service) RegisterDevice(userID string, name, pushToken *string) (*models.Device, error)

Jump to

Keyboard shortcuts

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