Documentation
¶
Index ¶
- Constants
- Variables
- func FromJSON(jsonBytes []byte) (*lic.License, error)
- func Sign(privkey ed25519.PrivateKey, pubkey ed25519.PublicKey, license *lic.License) (*lic.SignedLicense, error)
- func SignedLicenseFromJSON(jsonBytes []byte) (*lic.SignedLicense, error)
- func SignedLicenseToJSON(signedLicense *lic.SignedLicense) ([]byte, error)
- func ToJSON(license *lic.License) ([]byte, error)
- func Verify(pubkey ed25519.PublicKey, signedLicense *lic.SignedLicense) error
- type KeyPair
Constants ¶
View Source
const ( // TimeFormat is the time format we use for licenses. Also note // that we always use the UTC form of dates. TimeFormat = time.RFC3339 )
Variables ¶
View Source
var ( // ErrUnableToVerifyCreatedSignature indicates that we failed to verify a // signature we just created with Sign(). Most likely due to mismatched // public and private key. ErrUnableToVerifyCreatedSignature = errors.New("mismatched public and private key") // ErrFailedToVerifySignature indicates that Verify() failed to verify the signature. ErrFailedToVerifySignature = errors.New("failed to verify signature") // ErrLicenseExpired indicates that the license is expired. ErrLicenseExpired = errors.New("license is expired") // ErrFailedToParseExpiryDate indicates that the expiry date is not formatted properly. // It should be formatted according to RFC3339. ErrFailedToParseExpiryDate = errors.New("failed to parse expiry date") )
Functions ¶
func Sign ¶
func Sign(privkey ed25519.PrivateKey, pubkey ed25519.PublicKey, license *lic.License) (*lic.SignedLicense, error)
Sign a license key to produce a SignedLicense.
func SignedLicenseFromJSON ¶
func SignedLicenseFromJSON(jsonBytes []byte) (*lic.SignedLicense, error)
SignedLicenseFromJSON reads a license from JSON
func SignedLicenseToJSON ¶
func SignedLicenseToJSON(signedLicense *lic.SignedLicense) ([]byte, error)
SignedLicenseToJSON returns a signed license as JSON
Types ¶
Click to show internal directories.
Click to hide internal directories.