Documentation
¶
Index ¶
- func ApplyFreemiusEvent(store *Store, ev FreemiusWebhookEvent) error
- func EncodeJSON(w interface{ ... }, v any) error
- func IssueToken(rec *LicenseRecord, key ed25519.PrivateKey) (string, entitlement.State, error)
- func Listen(addr string, handler http.Handler) error
- type Config
- type FreemiusWebhookEvent
- type LicenseRecord
- type PackageOffer
- type Server
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyFreemiusEvent ¶
func ApplyFreemiusEvent(store *Store, ev FreemiusWebhookEvent) error
ApplyFreemiusEvent updates license state from a webhook (idempotent).
func EncodeJSON ¶
EncodeJSON writes v as JSON to w.
func IssueToken ¶
func IssueToken(rec *LicenseRecord, key ed25519.PrivateKey) (string, entitlement.State, error)
IssueToken signs an entitlement JWT for a license record.
Types ¶
type Config ¶
type Config struct {
Addr string
WebhookSecret string
SigningKey ed25519.PrivateKey
Version string
}
Config configures the control plane HTTP server.
func LoadConfig ¶
LoadConfig reads server config from environment.
type FreemiusWebhookEvent ¶
type FreemiusWebhookEvent struct {
EventID string `json:"event_id,omitempty"`
Event string `json:"event"`
LicenseKey string `json:"license_key"`
Plan string `json:"plan"`
UserID string `json:"user_id"`
Email string `json:"email"`
}
FreemiusWebhookEvent is the sandbox webhook payload shape.
type LicenseRecord ¶
type LicenseRecord struct {
LicenseKey string
Plan entitlement.Plan
Subject string
Entitlements []string
Revoked bool
Version int
}
LicenseRecord is the server-side view of a Freemius license.
type PackageOffer ¶
type PackageOffer struct {
Name string `json:"name"`
Description string `json:"description"`
Entitlements []string `json:"entitlements"`
}
PackageOffer is a catalog entry returned by the API.
func PackageCatalog ¶
func PackageCatalog() []PackageOffer
PackageCatalog returns curated package metadata for GET /v1/packages.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the control plane HTTP API.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds license records in memory (Phase 1; Postgres in production).
func (*Store) GetLicense ¶
func (s *Store) GetLicense(key string) (*LicenseRecord, bool)
func (*Store) MarkWebhookSeen ¶
func (*Store) RevokeLicense ¶
func (*Store) UpsertLicense ¶
func (s *Store) UpsertLicense(rec LicenseRecord)
Click to show internal directories.
Click to hide internal directories.