license

package
v0.0.0-...-e99cc0b Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSignature indicates the license signature is invalid.
	ErrInvalidSignature = errors.New("Invalid signature")

	// ErrMalformedLicense indicates the license file is malformed.
	ErrMalformedLicense = errors.New("Malformed License")
)

Functions

This section is empty.

Types

type License

type License struct {
	Iss string          `json:"iss,omitempty"` // Issued By
	Cus string          `json:"cus,omitempty"` // Customer ID
	Sub string          `json:"sub,omitempty"` // Subscriber ID
	Typ string          `json:"typ,omitempty"` // License Type
	Lim int             `json:"lim,omitempty"` // License Limit (e.g. Seats)
	Iat time.Time       `json:"iat,omitempty"` // Issued At
	Exp time.Time       `json:"exp,omitempty"` // Expires At
	Dat json.RawMessage `json:"dat,omitempty"` // Metadata
}

License defines a software license key.

func Decode

func Decode(data []byte, publicKey ed25519.PublicKey) (*License, error)

Decode decodes the PEM encoded license key and verifies the content signature using the ed25519 public key.

func DecodeFile

func DecodeFile(path string, publicKey ed25519.PublicKey) (*License, error)

DecodeFile decodes the PEM encoded license file and verifies the content signature using the ed25519 public key.

func (*License) Encode

func (l *License) Encode(privateKey ed25519.PrivateKey) ([]byte, error)

Encode generates returns a PEM encoded license key that is signed with the ed25519 private key.

func (*License) Expired

func (l *License) Expired() bool

Expired returns true if the license is expired.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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