Versions in this module Expand all Collapse all v1 v1.0.0 Dec 2, 2026 Changes in this version + const DefaultHTTPTimeout + const LicenseFileExtension + const LicenseFileMediaType + const MaxLicenseFileBytes + const MaxMeterUses + const Version + var ErrBadSignature = &Error + var ErrBusy = &Error + var ErrCodeExpired = &Error + var ErrDevice = &Error + var ErrInvalidAmount = &Error + var ErrInvalidEmail = &Error + var ErrInvalidKey = &Error + var ErrInvalidLease = &Error + var ErrInvalidURL = &Error + var ErrLimit = &Error + var ErrMalformed = &Error + var ErrNetwork = &Error + var ErrNoKey = &Error + var ErrNoMeter = &Error + var ErrNotALicenseFile = &Error + var ErrNotLicensed = &Error + var ErrOfflineLimit = &Error + var ErrOutdated = &Error + var ErrPickupDisabled = &Error + var ErrRevoked = &Error + var ErrRevokedFile = &Error + var ErrStorage = &Error + var ErrTooManyAttempts = &Error + var ErrTooManyCodes = &Error + var ErrTryAgain = &Error + var ErrUnknownKey = &Error + var ErrUpgrade = &Error + var ErrUsedUp = &Error + var ErrUserCodeInvalid = &Error + var ErrUserCodeRequired = &Error + var ErrUserEmailMismatch = &Error + var ErrUserEmailRequired = &Error + var ErrWrongCode = &Error + var ErrWrongProduct = &Error + func DefaultStoragePath(product string) string + func Grants(entitlements map[string]Entitlement, code string) bool + type ActivateOption func(*activateOptions) + func WithCode(code string) ActivateOption + func WithEmail(email string) ActivateOption + type Code string + const CodeBadSignature + const CodeBusy + const CodeCodeExpired + const CodeDevice + const CodeInvalidAmount + const CodeInvalidEmail + const CodeInvalidKey + const CodeInvalidLease + const CodeInvalidURL + const CodeLimit + const CodeMalformed + const CodeNetwork + const CodeNoKey + const CodeNoMeter + const CodeNotALicenseFile + const CodeNotLicensed + const CodeOfflineLimit + const CodeOutdated + const CodePickupDisabled + const CodeRevoked + const CodeRevokedFile + const CodeStorage + const CodeTooManyAttempts + const CodeTooManyCodes + const CodeTryAgain + const CodeUnknownKey + const CodeUpgrade + const CodeUsedUp + const CodeUserCodeInvalid + const CodeUserCodeRequired + const CodeUserEmailMismatch + const CodeUserEmailRequired + const CodeWrongCode + const CodeWrongProduct + type ConfigError struct + Reason string + func (e *ConfigError) Error() string + type DeviceKind string + const DeviceHostname + const DeviceMachine + type Entitlement struct + Flag bool + Kind EntitlementKind + Number float64 + Text string + type EntitlementKind int + const EntitlementFlag + const EntitlementNumber + const EntitlementText + type Error struct + Code Code + Err error + RetryAfter time.Duration + func (e *Error) Error() string + func (e *Error) Is(target error) bool + func (e *Error) Unwrap() error + type FileStorage struct + func NewFileStorage(path string) *FileStorage + func (s *FileStorage) Path() string + func (s *FileStorage) Read(readOnly bool) ([]byte, error) + func (s *FileStorage) Update(merge func(current []byte) ([]byte, error)) error + func (s *FileStorage) Write(data []byte) error + type Fingerprinter interface + Identify func(ctx context.Context) (Identity, error) + func DefaultFingerprinter() Fingerprinter + type HTTPDoer interface + Do func(req *http.Request) (*http.Response, error) + type Identity struct + Alternates []string + Fingerprint string + Kind DeviceKind + type ImportedLicenseFile struct + Kind LicenseFileKind + LicensedTo LicensedTo + type KeyModel string + const ModelPerpetual + const ModelSubscription + const ModelTimed + const ModelTrial + type KeyState string + const KeyActive + const KeyTrial + type License struct + func New(product, apiBaseURL, publicKeys string, opts ...Option) (*License, error) + func (l *License) Activate(ctx context.Context, key string, opts ...ActivateOption) error + func (l *License) Close(ctx context.Context) error + func (l *License) ConfirmPickUp(ctx context.Context, email, code string) ([]PickedKey, error) + func (l *License) Deactivate(ctx context.Context) (released bool, err error) + func (l *License) Has(ctx context.Context, code string) bool + func (l *License) ImportLicenseFile(ctx context.Context, content []byte, opts ...ActivateOption) (ImportedLicenseFile, error) + func (l *License) PickUp(ctx context.Context, email string) error + func (l *License) Refresh(ctx context.Context) Status + func (l *License) RemoveLicenseFile(ctx context.Context) error + func (l *License) Require(ctx context.Context, code string) error + func (l *License) RestoreByEmail(ctx context.Context, email, code string) error + func (l *License) StartTrial(ctx context.Context) Status + func (l *License) Status(ctx context.Context) Status + func (l *License) UpgradeURL(ctx context.Context, paymentLink string) (link string, ok bool, err error) + func (l *License) Use(ctx context.Context, meter string, n int64) (UseResult, error) + type LicenseFileKind string + const KeyFile + const OfflineFile + type LicensedTo struct + Email string + Name string + type MeterStatus struct + Left int64 + Offline int64 + Resets bool + Total int64 + Unsynced int64 + type MissingEntitlementError struct + Entitlement string + func (e *MissingEntitlementError) Error() string + type Option func(*config) + func WithClock(now func() time.Time) Option + func WithDeviceHold(hold bool) Option + func WithDeviceName(name string) Option + func WithFingerprinter(f Fingerprinter) Option + func WithHTTPClient(client HTTPDoer) Option + func WithHTTPTimeout(d time.Duration) Option + func WithLogger(logger *slog.Logger) Option + func WithMajor(major int) Option + func WithRevokedLicenseFiles(ids ...string) Option + func WithStash(s Stash) Option + func WithStorage(s Storage) Option + func WithStoragePath(path string) Option + type PickedKey struct + ActivationCode string + ActiveDevices int64 + DeviceLimit int64 + Entitlements map[string]Entitlement + ExpiresAt time.Time + Held bool + Key string + Model KeyModel + ModelName string + Sale *PickedSale + State KeyState + Versions *PickedVersions + type PickedSale struct + ID string + Index int64 + Size int64 + type PickedVersions struct + MaxMajor *int64 + MinMajor int64 + UpgradeUntil time.Time + type Reason string + const ReasonDevice + const ReasonOffline + const ReasonOutdated + const ReasonRevoked + const ReasonRevokedFile + const ReasonStorage + const ReasonTampered + const ReasonTrial + const ReasonUnknownKey + const ReasonUpgrade + type RegistryStash struct + func NewRegistryStash(product string) *RegistryStash + func (r *RegistryStash) ReadTrialStart() (time.Time, error) + func (r *RegistryStash) WriteTrialStart(start time.Time) error + func (r *RegistryStash) WriteTrialStart(time.Time) error + type Source string + const SourceFile + type Stash interface + ReadTrialStart func() (time.Time, error) + WriteTrialStart func(start time.Time) error + type State string + const Expired + const Invalid + const Licensed + const Trial + const Unknown + const Unlicensed + type Status struct + Entitlements map[string]Entitlement + Key string + LicensedTo *LicensedTo + Meters map[string]MeterStatus + Reason Reason + Source Source + Stalled bool + State State + Test bool + TrialDaysLeft int + TrialEndsAt time.Time + func (s Status) Equal(o Status) bool + type Storage interface + Read func(readOnly bool) ([]byte, error) + Write func(data []byte) error + type Updater interface + Update func(merge func(current []byte) ([]byte, error)) error + type UseResult struct + HasLeft bool + Left int64 + Offline bool