Help us shape the future of Go! Take the 2026 Go Developer Survey

license

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: GPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProductNamePremium = "premium-access"
)

Variables

View Source
var (
	ErrDodoClientNotConfigured = errors.New("dodo client not configured")
	ErrLicenseNotActive        = errors.New("license is not active")
)

Functions

func GetDeviceID

func GetDeviceID(appID string, userID string, configDir string) (string, error)

Types

type Checker

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

func NewLicenseChecker

func NewLicenseChecker(service ValidationChecker) *Checker

func (*Checker) StartPeriodicChecks

func (lc *Checker) StartPeriodicChecks(ctx context.Context)

type Service

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

Service handles license operations

func NewLicenseService

func NewLicenseService(repo *database.LicenseRepo, dodoClient *dodo.Client, configDir string) *Service

NewLicenseService creates a new license service

func (*Service) ActivateAndStoreLicense

func (s *Service) ActivateAndStoreLicense(ctx context.Context, licenseKey string, username string) (*models.ProductLicense, error)

ActivateAndStoreLicense activates a license key and stores it if valid

func (*Service) DeleteLicense

func (s *Service) DeleteLicense(ctx context.Context, licenseKey string) error

func (*Service) GetAllLicenses

func (s *Service) GetAllLicenses(ctx context.Context) ([]*models.ProductLicense, error)

func (*Service) GetLicenseByKey

func (s *Service) GetLicenseByKey(ctx context.Context, licenseKey string) (*models.ProductLicense, error)

func (*Service) HasPremiumAccess

func (s *Service) HasPremiumAccess(ctx context.Context) (bool, error)

HasPremiumAccess checks if the user has premium access

func (*Service) RefreshAllLicenses

func (s *Service) RefreshAllLicenses(ctx context.Context) error

RefreshAllLicenses validates all stored licenses against the Dodo API

func (*Service) ValidateAndStoreLicense

func (s *Service) ValidateAndStoreLicense(ctx context.Context, licenseKey string, username string) (*models.ProductLicense, error)

ValidateAndStoreLicense validates a license key and stores it if valid

func (*Service) ValidateLicenses

func (s *Service) ValidateLicenses(ctx context.Context) (bool, error)

ValidateLicenses validates all stored licenses against the Dodo API

type ValidationChecker

type ValidationChecker interface {
	ValidateLicenses(ctx context.Context) (bool, error)
}

Jump to

Keyboard shortcuts

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