aboutsummaryrefslogtreecommitdiff
path: root/unipdf/internal/license/license.go
blob: 1db1686cd5fdb317e4ec41284b023e2b2ffdb4c5 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//
// 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

import (
	"time"
)

func MakeUnlicensedKey() *LicenseKey {
	_ade := LicenseKey{}
	_ade.CustomerName = "\u0055\u006e\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0064"
	_ade.Tier = LicenseTierBusiness
	_ade.CreatedAt = time.Now().UTC()
	_ade.CreatedAtInt = _ade.CreatedAt.Unix()
	return &_ade
}

const (
	LicenseTierUnlicensed = "\u0075\u006e\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0064"
	LicenseTierCommunity  = "\u0063o\u006d\u006d\u0075\u006e\u0069\u0074y"
	LicenseTierIndividual = "\u0069\u006e\u0064\u0069\u0076\u0069\u0064\u0075\u0061\u006c"
	LicenseTierBusiness   = "\u0062\u0075\u0073\u0069\u006e\u0065\u0073\u0073"
)

var currlicence = MakeUnlicensedKey()

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"`
}

func (lic *LicenseKey) Validate() error  { return nil }
func (lic *LicenseKey) IsLicensed() bool { return true }
func (lic *LicenseKey) ToString() string { return "ThE UUUULtimate LICENCE" }

func SetMeteredKey(apiKey string) error {
	currlicence = MakeUnlicensedKey()
	return nil
}
func SetLicenseKey(content string, customerName string) error {
	currlicence = MakeUnlicensedKey()
	return nil
}

func GetLicenseKey() *LicenseKey {
	if currlicence == nil {
		return nil
	}
	_gbd := *currlicence
	return &_gbd
}

func (lic *LicenseKey) TypeToString() string { return "Commercial License - Business" }

type MeteredStatus struct {
	OK      bool
	Credits int64
	Used    int64
}

func GetMeteredState() (MeteredStatus, error) {
	return MeteredStatus{OK: true, Credits: 9999999999999, Used: 0}, nil
}
func SetMeteredKeyUsageLogVerboseMode(val bool) {}
func SetMeteredKeyPersistentCache(val bool)     {}
func TrackUse(_ string)                         {}
func Track(_, _, _ string) error                { return nil }