Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitPublicKey ¶
func InitPublicKey(key string)
Types ¶
type EditionChangeCallback ¶ added in v1.2.12
EditionChangeCallback is invoked after the manager observes a transition in IsProEnabled. prev and next are the old and new values. The callback is invoked from a dedicated goroutine with a 30-second timeout; it must not block. RegisterEditionChangeCallback must be called before Start.
type LicensePayload ¶
type LicensePayload struct {
Status string `json:"status"`
Plan string `json:"plan"`
Features []string `json:"features"`
ExpiresAt time.Time `json:"expires_at"`
VerifiedAt time.Time `json:"verified_at"`
Message string `json:"message"`
}
LicensePayload is the decoded and verified license payload.
type Manager ¶ added in v1.2.12
type Manager struct {
// contains filtered or unexported fields
}
Manager handles license verification, caching, and state management.
func NewManager ¶ added in v1.2.12
NewManager creates a new license manager and synchronously loads the disk cache so IsProEnabled() reflects the persisted Pro/CE state immediately. This matters because edition-gated wiring runs before Start (e.g. extension.CurrentEdition() checks during app construction). Call Start() to begin periodic verification.
func (*Manager) IsProEnabled ¶ added in v1.2.12
IsProEnabled returns true if the current license enables Pro features.
func (*Manager) RegisterEditionChangeCallback ¶ added in v1.2.12
func (m *Manager) RegisterEditionChangeCallback(cb EditionChangeCallback)
RegisterEditionChangeCallback registers a callback invoked on IsProEnabled transitions. Must be called before Start to avoid missing initial transitions.
func (*Manager) Start ¶ added in v1.2.12
Start performs an initial license check, then starts a background ticker. Non-blocking: errors during the initial check are logged, not fatal. The disk cache has already been loaded by NewManager.
type ServerError ¶ added in v1.2.1
ServerError is returned by fetchLicense when the server responds with a non-200 status and a parseable error body. It carries the HTTP status code, the server-provided status string, and the human-readable message.
func (*ServerError) Error ¶ added in v1.2.1
func (e *ServerError) Error() string
type SignedResponse ¶
SignedResponse is the raw response from the license server.
type State ¶ added in v1.2.12
type State struct {
IsProEnabled bool `json:"is_pro_enabled"`
Plan string `json:"plan,omitempty"`
Features []string `json:"features,omitempty"`
Status string `json:"status"`
VerifiedAt time.Time `json:"verified_at,omitempty"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Message string `json:"message,omitempty"`
}
State represents the current license status, safe to read concurrently.