12 lines
36 KiB
Go
Raw Normal View History

2021-03-16 20:51:18 +00:00
//
// 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/
2021-07-30 17:03:26 +00:00
package license ;import (_ea "bytes";_g "compress/gzip";_d "crypto";_ae "crypto/aes";_gec "crypto/cipher";_eaf "crypto/rand";_eg "crypto/rsa";_bb "crypto/sha256";_cgf "crypto/sha512";_bdd "crypto/x509";_gc "encoding/base64";_bd "encoding/binary";_cg "encoding/hex";_cc "encoding/json";_fg "encoding/pem";_b "errors";_bg "fmt";_ce "github.com/unidoc/unioffice";_gf "github.com/unidoc/unioffice/common";_a "io";_ab "io/ioutil";_df "log";_gd "net";_de "net/http";_geb "os";_da "path/filepath";_f "regexp";_ge "sort";_c "strings";_fe "sync";_dd "time";);func (_gg *LicenseKey )ToString ()string {if _gg ._fcc {return "M\u0065t\u0065\u0072\u0065\u0064\u0020\u0073\u0075\u0062s\u0063\u0072\u0069\u0070ti\u006f\u006e";};_eaeb :=_bg .Sprintf ("\u004ci\u0063e\u006e\u0073\u0065\u0020\u0049\u0064\u003a\u0020\u0025\u0073\u000a",_gg .LicenseId );_eaeb +=_bg .Sprintf ("\u0043\u0075s\u0074\u006f\u006de\u0072\u0020\u0049\u0064\u003a\u0020\u0025\u0073\u000a",_gg .CustomerId );_eaeb +=_bg .Sprintf ("\u0043u\u0073t\u006f\u006d\u0065\u0072\u0020N\u0061\u006de\u003a\u0020\u0025\u0073\u000a",_gg .CustomerName );_eaeb +=_bg .Sprintf ("\u0054i\u0065\u0072\u003a\u0020\u0025\u0073\n",_gg .Tier );_eaeb +=_bg .Sprintf ("\u0043r\u0065a\u0074\u0065\u0064\u0020\u0041\u0074\u003a\u0020\u0025\u0073\u000a",_gf .UtcTimeFormat (_gg .CreatedAt ));if _gg .ExpiresAt .IsZero (){_eaeb +="\u0045x\u0070i\u0072\u0065\u0073\u0020\u0041t\u003a\u0020N\u0065\u0076\u0065\u0072\u000a";}else {_eaeb +=_bg .Sprintf ("\u0045x\u0070i\u0072\u0065\u0073\u0020\u0041\u0074\u003a\u0020\u0025\u0073\u000a",_gf .UtcTimeFormat (_gg .ExpiresAt ));};_eaeb +=_bg .Sprintf ("\u0043\u0072\u0065\u0061\u0074\u006f\u0072\u003a\u0020\u0025\u0073\u0020<\u0025\u0073\u003e\u000a",_gg .CreatorName ,_gg .CreatorEmail );return _eaeb ;};type meteredStatusResp struct{Valid bool `json:"valid"`;OrgCredits int64 `json:"org_credits"`;OrgUsed int64 `json:"org_used"`;OrgRemaining int64 `json:"org_remaining"`;};var _abe *_eg .PublicKey ;type LicenseKey struct{LicenseId string `json:"license_id"`;CustomerId string `json:"customer_id"`;CustomerName string `json:"customer_name"`;Tier string `json:"tier"`;CreatedAt _dd .Time `json:"-"`;CreatedAtInt int64 `json:"created_at"`;ExpiresAt _dd .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"`;_fcc bool ;_gbb string ;};func MakeUnlicensedKey ()*LicenseKey {_fcb :=LicenseKey {};_fcb .CustomerName ="\u0055\u006e\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0064";_fcb .Tier =LicenseTierUnlicensed ;_fcb .CreatedAt =_dd .Now ().UTC ();_fcb .CreatedAtInt =_fcb .CreatedAt .Unix ();return &_fcb ;};func _efc (_db string ,_dbg []byte )(string ,error ){_ad ,_ :=_fg .Decode ([]byte (_db ));if _ad ==nil {return "",_bg .Errorf ("\u0050\u0072\u0069\u0076\u004b\u0065\u0079\u0020\u0066a\u0069\u006c\u0065\u0064");};_ff ,_dbe :=_bdd .ParsePKCS1PrivateKey (_ad .Bytes );if _dbe !=nil {return "",_dbe ;};_efe :=_cgf .New ();_efe .Write (_dbg );_bbd :=_efe .Sum (nil );_aba ,_dbe :=_eg .SignPKCS1v15 (_eaf .Reader ,_ff ,_d .SHA512 ,_bbd );if _dbe !=nil {return "",_dbe ;};_bbc :=_gc .StdEncoding .EncodeToString (_dbg );_bbc +="\u000a\u002b\u000a";_bbc +=_gc .StdEncoding .EncodeToString (_aba );return _bbc ,nil ;};func GenRefId (prefix string )(string ,error ){var _ebdb _ea .Buffer ;_ebdb .WriteString (prefix );_gdd :=make ([]byte ,8+16);_dgab :=_dd .Now ().UTC ().UnixNano ();_bd .BigEndian .PutUint64 (_gdd ,uint64 (_dgab ));_ ,_acgb :=_eaf .Read (_gdd [8:]);if _acgb !=nil {return "",_acgb ;};_ebdb .WriteString (_cg .EncodeToString (_gdd ));return _ebdb .String (),nil ;};var _bgg stateLoader =defaultStateHolder {};type meteredClient struct{_bga string ;_ddf string ;_af *_de .Client ;};type meteredUsageCheckinResp struct{Instance string `json:"inst"`;Next string `json:"next"`;Success bool `json:"success"`;Message string `json:"message"`;RemainingDocs int `json:"rd"`;L