aboutsummaryrefslogtreecommitdiff
path: root/unipdf/common/license/license.go
blob: 83f0b1fdd8d41e3b09048809aee662a97d43a4e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

// Package license helps manage commercial licenses and check if they are valid for the version of unipdf used.
package license

import _e "github.com/unidoc/unipdf/v4/internal/license"

// LicenseKey represents a loaded license key.
type LicenseKey = _e.LicenseKey

func SetMeteredKeyUsageLogVerboseMode(val bool) { _e.SetMeteredKeyUsageLogVerboseMode(val) }

// SetMeteredKeyPersistentCache sets the metered License API Key persistent cache.
// Default value 'true', set to `false` will report the usage immediately to license server,
// this can be used when there's no access to persistent data storage.
func SetMeteredKeyPersistentCache(val bool) { _e.SetMeteredKeyPersistentCache(val) }

const (
	LicenseTierUnlicensed = _e.LicenseTierUnlicensed
	LicenseTierCommunity  = _e.LicenseTierCommunity
	LicenseTierIndividual = _e.LicenseTierIndividual
	LicenseTierBusiness   = _e.LicenseTierBusiness
)

// SetMeteredKey sets the metered API key required for SaaS operation.
// Document usage is reported periodically for the product to function correctly.
func SetMeteredKey(apiKey string) error { return _e.SetMeteredKey(apiKey) }

// SetLicenseKey sets and validates the license key.
func SetLicenseKey(content string, customerName string) error {
	return _e.SetLicenseKey(content, customerName)
}

// GetMeteredState checks the currently used metered document usage status,
// documents used and credits available.
func GetMeteredState() (_e.MeteredStatus, error) {
	return _e.MeteredStatus{
		Credits: 999999999999,
		OK:      true,
		Used:    0,
	}, nil
}

// MakeUnlicensedKey returns a default key.
func MakeUnlicensedKey() *LicenseKey { return _e.MakeUnlicensedKey() }

// GetLicenseKey returns the currently loaded license key.
func GetLicenseKey() *LicenseKey { return _e.GetLicenseKey() }