Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func HasFeature ¶
HasFeature returns true if the active licence includes the named feature.
func Init ¶
Init loads the licence key from the environment, validates it, logs the result, and stores it in global state. activeUsers is the current DB user count for seat check. Call once at startup after the DB is ready.
func IsProEnabled ¶
func IsProEnabled() bool
IsProEnabled returns true if a valid, non-expired Pro licence is active.
func SetForTest ¶
func SetForTest(token string)
SetForTest replaces the global licence state for unit tests. Pass an empty string to reset to OSS mode.
func SetPublicKeyForTest ¶
func SetPublicKeyForTest(pemBytes []byte)
SetPublicKeyForTest overrides the embedded production public key for unit tests. Pass nil to restore the production key.
Types ¶
type Licence ¶
Licence holds the decoded, verified claims from a Pro licence key.
func Load ¶
Load parses and cryptographically verifies a licence key string. Returns ErrNoLicence for empty input, ErrExpired for expired keys, ErrInvalidIssuer for wrong issuer, ErrMalformed for missing required claims. Any other error indicates a forged or corrupted token.
func (*Licence) SeatLimitExceeded ¶
SeatLimitExceeded returns true when activeUsers is within the seat limit. Returns false when the limit is exceeded (caller should warn, not crash).