Documentation
¶
Index ¶
- Constants
- Variables
- func GetDeviceID(appID string, userID string, configDir string) (string, error)
- type Checker
- type Service
- func (s *Service) ActivateAndStoreLicense(ctx context.Context, licenseKey string, username string) (*models.ProductLicense, error)
- func (s *Service) DeleteLicense(ctx context.Context, licenseKey string) error
- func (s *Service) GetAllLicenses(ctx context.Context) ([]*models.ProductLicense, error)
- func (s *Service) GetLicenseByKey(ctx context.Context, licenseKey string) (*models.ProductLicense, error)
- func (s *Service) HasPremiumAccess(ctx context.Context) (bool, error)
- func (s *Service) RefreshAllLicenses(ctx context.Context) error
- func (s *Service) ValidateAndStoreLicense(ctx context.Context, licenseKey string, username string) (*models.ProductLicense, error)
- func (s *Service) ValidateLicenses(ctx context.Context) (bool, error)
- type ValidationChecker
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 ¶
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
func NewLicenseChecker ¶
func NewLicenseChecker(service ValidationChecker) *Checker
func (*Checker) StartPeriodicChecks ¶
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 (*Service) GetAllLicenses ¶
func (*Service) GetLicenseByKey ¶
func (*Service) HasPremiumAccess ¶
HasPremiumAccess checks if the user has premium access
func (*Service) RefreshAllLicenses ¶
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
Click to show internal directories.
Click to hide internal directories.