HomeUniDoc
...

Package license

Overview ▾

Constants

License tiers.

const (
    LicenseTierUnlicensed = "unlicensed"
    LicenseTierCommunity  = "community"
    LicenseTierIndividual = "individual"
    LicenseTierBusiness   = "business"
)

func SetLicenseKey

func SetLicenseKey(content string, customerName string) error

SetLicenseKey sets and validates the license key.

func SetMeteredKey

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 Track

func Track(docKey string, useKey string) error

func TrackUse

func TrackUse(useKey string)

type LicenseKey

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

func GetLicenseKey() *LicenseKey

func MakeUnlicensedKey

func MakeUnlicensedKey() *LicenseKey

MakeUnlicensedKey returns a default key.

func (*LicenseKey) IsLicensed

func (k *LicenseKey) IsLicensed() bool

IsLicensed returns true if the k is licensed.

func (*LicenseKey) ToString

func (k *LicenseKey) ToString() string

ToString returns a string summary of the license key.

func (*LicenseKey) TypeToString

func (k *LicenseKey) TypeToString() string

TypeToString returns a readable string representing the license key type.

func (*LicenseKey) Validate

func (k *LicenseKey) Validate() error

Validate returns nil if the license key is valid, otherwise an error is returned.

type MeteredStatus

MeteredStatus represents the current document usage state.

type MeteredStatus struct {
    OK      bool
    Credits int64
    Used    int64
}

func GetMeteredState

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.