Documentation ¶
Overview ¶
Package licensing implements WunderGraph license management functions
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoPublicKey indicates no public key is available to validate licenses ErrNoPublicKey = errors.New("public key for license signature is not available") // ErrNoLicenseFound is returned when trying to load a stored license and no data is found ErrNoLicenseFound = errors.New("no license found") // ErrLicenseExpired is returned from Manager.Check() when the stored license is expired ErrLicenseExpired = errors.New("license is expired") )
Functions ¶
This section is empty.
Types ¶
type ErrInvalidLicense ¶
type ErrInvalidLicense struct {
Err error
}
ErrInvalidLicense signals that the underlying error was caused by an invalid license key
func (*ErrInvalidLicense) Error ¶
func (e *ErrInvalidLicense) Error() string
func (*ErrInvalidLicense) Unwrap ¶
func (e *ErrInvalidLicense) Unwrap() error
type License ¶
type License struct { // ID is the unique license ID ID uuid.UUID `json:"u"` // Email used to register the license Email string `json:"e"` // ExpiresAt is the license expiration date ExpiresAt time.Time `json:"exp"` }
License represents decoded license data
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager stores and loads license from the system. To initialize a Manager, call NewManager()
func NewManager ¶
NewManager initializes a new Manager with the given public key
func (*Manager) LicenseCheck ¶
func (*Manager) Read ¶
Read reads the stored license, if any. If no license is found, it returns ErrNoLicenseFound. If the license is invalid, the error type will be ErrInvalidLicense. Note that no expiration checks are performed by Read().
func (*Manager) Remove ¶
Remove removes an existing license from the store. If there's no license stored, it returns an error.