license

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: BSD-3-Clause Imports: 7 Imported by: 5

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