premium

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: 0BSD Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegisterPath = "/register"
	ValidatePath = "/validate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LicenseDto

type LicenseDto struct {
	LicenseKey string `json:"license_key" validate:"lemon_squeezy_license_key"`
	ServerHost string `json:"server_host" validate:"host"`
}

type LicenseServerClient

type LicenseServerClient interface {
	Register(licenseKey, serverHost string) error
	Validate(licenseKey, serverHost string) (*SignedLicenseToken, error)
}

type LicenseServerClientImpl

type LicenseServerClientImpl struct {
	Parent u.ComponentClient
}

func (*LicenseServerClientImpl) Register

func (l *LicenseServerClientImpl) Register(licenseKey, serverHost string) error

func (*LicenseServerClientImpl) Validate

func (l *LicenseServerClientImpl) Validate(licenseKey, serverHost string) (*SignedLicenseToken, error)

type LicenseToken

type LicenseToken struct {
	LicenseKey           string    `json:"license_key"`
	ServerHost           string    `json:"host"`
	IsSubscriptionActive bool      `json:"is_subscription_active"`
	ExpiresAt            time.Time `json:"expires_at"`
	InvalidReason        string    `json:"invalid_reason"`
}

type LicenseTokenCodec

type LicenseTokenCodec interface {
	EncodeLicenseToken(licenseToken LicenseToken) ([]byte, error)
	DecodeLicenseToken(payloadBytes []byte) (LicenseToken, error)
}

type LicenseTokenCodecImpl

type LicenseTokenCodecImpl struct{}

func (*LicenseTokenCodecImpl) DecodeLicenseToken

func (c *LicenseTokenCodecImpl) DecodeLicenseToken(payloadBytes []byte) (LicenseToken, error)

func (*LicenseTokenCodecImpl) EncodeLicenseToken

func (c *LicenseTokenCodecImpl) EncodeLicenseToken(licenseToken LicenseToken) ([]byte, error)

type SignedLicenseToken

type SignedLicenseToken struct {
	LicenseToken LicenseToken `json:"license_token"`
	Signature    []byte       `json:"signature"`
}

type SignedLicenseTokenService

type SignedLicenseTokenService interface {
	SignLicenseToken(privateKey ed25519.PrivateKey, licenseToken LicenseToken) ([]byte, error)
	VerifySignedLicenseTokenSignature(publicKey ed25519.PublicKey, signedLicenseToken *SignedLicenseToken) (bool, error)
}

type SignedLicenseTokenServiceImpl

type SignedLicenseTokenServiceImpl struct {
	Codec       LicenseTokenCodec
	BytesSigner u.BytesSigner
}

func (*SignedLicenseTokenServiceImpl) SignLicenseToken

func (s *SignedLicenseTokenServiceImpl) SignLicenseToken(privateKey ed25519.PrivateKey, licenseToken LicenseToken) ([]byte, error)

func (*SignedLicenseTokenServiceImpl) VerifySignedLicenseTokenSignature

func (s *SignedLicenseTokenServiceImpl) VerifySignedLicenseTokenSignature(publicKey ed25519.PublicKey, signedLicenseToken *SignedLicenseToken) (bool, error)

Jump to

Keyboard shortcuts

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