License tiers.
const ( LicenseTierUnlicensed = "unlicensed" LicenseTierCommunity = "community" LicenseTierIndividual = "individual" LicenseTierBusiness = "business" )
func GenRefId(prefix string) (string, error)
func SetLegacyLicenseKey(s string) error
SetLegacyLicenseKey installs a legacy license code. License codes issued prior to June 2019. Will be removed at some point in a future major version.
func SetLicenseKey(content string, customerName string) error
SetLicenseKey sets and validates the license key.
func SetMeteredKey(apiKey string) error
SetMeteredKey sets the metered License API key required for SaaS operation. Document usage is reported periodically for the product to function correctly.
func SetMeteredKeyPersistentCache(val bool)
SetMeteredKeyPersistentCache sets the current License API Key persistent cache status.
func SetMeteredKeyUsageLogVerboseMode(val bool)
SetMeteredKeyUsageLogVerboseMode sets the current License API Key usage log verbose mode.
func Track(docKey string, useKey string, docName string) error
func TrackUse(useKey string)
LegacyLicense holds the old-style unioffice license information.
type LegacyLicense struct { Name string Signature string `json:",omitempty"` Expiration time.Time LicenseType LegacyLicenseType }
func (l LegacyLicense) Verify(pubKey *rsa.PublicKey) error
Verify verifies a license by checking the license content and signature against a public key.
LegacyLicenseType is the type of license
type LegacyLicenseType byte
LicenseKey represents a loaded license key.
type LicenseKey struct { LicenseId string `json:"license_id"` CustomerId string `json:"customer_id"` CustomerName string `json:"customer_name"` Tier string `json:"tier"` CreatedAt time.Time `json:"-"` CreatedAtInt int64 `json:"created_at"` ExpiresAt time.Time `json:"-"` ExpiresAtInt int64 `json:"expires_at"` CreatedBy string `json:"created_by"` CreatorName string `json:"creator_name"` CreatorEmail string `json:"creator_email"` UniPDF bool `json:"unipdf"` UniOffice bool `json:"unioffice"` UniHTML bool `json:"unihtml"` Trial bool `json:"trial"` // For trial licenses. // contains filtered or unexported fields }
func GetLicenseKey() *LicenseKey
func MakeUnlicensedKey() *LicenseKey
MakeUnlicensedKey returns a default key.
func (k *LicenseKey) IsLicensed() bool
IsLicensed returns true if the k is licensed.
func (k *LicenseKey) ToString() string
ToString returns a string summary of the license key.
func (k *LicenseKey) TypeToString() string
TypeToString returns a readable string representing the license key type.
func (k *LicenseKey) Validate() error
Validate returns nil if the license key is valid, otherwise an error is returned.
MeteredStatus represents the current document usage state.
type MeteredStatus struct { OK bool Credits int64 Used int64 }
func GetMeteredState() (MeteredStatus, error)
GetMeteredState checks the currently used metered document usage status, documents used and credits available. If there are documents not reported, it reports them first.