2018-08-03 10:18:53 +00:00

38 lines
719 B
Go

/*
* This file is subject to the terms and conditions defined in
* file 'LICENSE.md', which is part of this source code package.
*/
// Package license helps manage commercial licenses and check if they are valid for the version of unidoc used.
package license
// Defaults to the open source license.
var licenseKey *LicenseKey = MakeUnlicensedKey()
// Sets and validates the license key.
func SetLicenseKey(content string) error {
lk, err := licenseKeyDecode(content)
if err != nil {
return err
}
err = lk.Validate()
if err != nil {
return err
}
licenseKey = &lk
return nil
}
func GetLicenseKey() *LicenseKey {
if licenseKey == nil {
return nil
}
// Copy.
lk2 := *licenseKey
return &lk2
}