license

package
v0.0.0-...-79996cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package license holds functions related to paid product activation.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRegisteredFeature = errors.New("feature not available")
)

Errors

Functions

func AdminGenerateKeys

func AdminGenerateKeys() (*ecdsa.PrivateKey, error)

AdminGenerateKeys generates the ECDSA public and private key pair for the admin side of creating signed license files.

func AdminLoadPrivateKey

func AdminLoadPrivateKey(privateFile string) (*ecdsa.PrivateKey, error)

AdminLoadPrivateKey loads the private key from disk.

func AdminLoadPublicKey

func AdminLoadPublicKey(publicFile string) (*ecdsa.PublicKey, error)

AdminLoadPublicKey loads the private key from disk.

func AdminSignRegistration

func AdminSignRegistration(key *ecdsa.PrivateKey, reg Registration) (string, error)

AdminSignRegistration signs the registration object.

func AdminWriteKeys

func AdminWriteKeys(key *ecdsa.PrivateKey, privateFile, publicFile string) error

AdminWriteKeys writes the admin signing key to .pem files on disk.

func IsRegistered

func IsRegistered() bool

IsRegistered returns a boolean answer: is the product registered?

func ParsePublicKeyPEM

func ParsePublicKeyPEM(keytext string) (*ecdsa.PublicKey, error)

ParsePublicKeyPEM loads a public key from PEM format.

Types

type Registration

type Registration struct {
	Name  string `json:"name"`
	Email string `json:"email"`
	jwt.StandardClaims
}

Registration object encoded into a license key file.

func GetRegistration

func GetRegistration() (Registration, error)

GetRegistration returns the currently registered user, by checking for the license.key file in the profile folder.

func UploadLicenseFile

func UploadLicenseFile(filename string) (Registration, error)

UploadLicenseFile handles the user selecting the license key file, and it is validated and ingested.

func Validate

func Validate(publicKey *ecdsa.PublicKey, tokenString string) (Registration, error)

Validate the registration is signed by the appropriate public key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL