license

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 22 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// LicenseKeyPropertyKey is the database property key used to persist the Keygen license key.
	LicenseKeyPropertyKey = "obot-license-key"

	// CommunityLicenseKeyPropertyKey is the database property key used to persist the Obot Community license key issued
	// at registration, so deleting a license key that replaced it falls back to it.
	CommunityLicenseKeyPropertyKey = "obot-community-license-key"

	// LicenseMachineIDPropertyKey is the database property key used to persist the Keygen machine fingerprint.
	LicenseMachineIDPropertyKey = "obot-license-machine-id"

	// EnterpriseAuthProvidersEntitlement is required to enable enterprise auth providers.
	EnterpriseAuthProvidersEntitlement = "OBOT_ENTERPRISE_AUTH_PROVIDERS"

	// EnterpriseEntitlement is required to enable enterprise edition.
	EnterpriseEntitlement = "OBOT_ENTERPRISE"

	// CommunityEntitlement is required to enable community edition.
	CommunityEntitlement = "OBOT_COMMUNITY"

	// CloudEntitlement identifies Obot Cloud deployments.
	CloudEntitlement = "OBOT_CLOUD"

	// EnterpriseModelProvidersEntitlement is required to enable enterprise model providers.
	EnterpriseModelProvidersEntitlement = "OBOT_ENTERPRISE_MODEL_PROVIDERS"
)

Variables

View Source
var (
	// ErrNotConfigured indicates license validation was requested without enough Keygen configuration.
	ErrNotConfigured = errors.New("license provider is not configured")

	// ErrLicenseKeyViaConfiguration indicates the license key is managed by startup configuration.
	ErrLicenseKeyViaConfiguration = errors.New("license key is configured at startup")

	// ErrInvalidLicense indicates Keygen rejected the provided license key.
	ErrInvalidLicense = errors.New("license key is invalid")

	// ErrLicenseCheckFailed indicates Keygen didn't give a verdict on a license key.
	ErrLicenseCheckFailed = errors.New("failed to check license key")
)

Functions

func EntitlementsMissing added in v0.28.2

func EntitlementsMissing(ctx context.Context, entitlements gatewayclient.EntitlementProvider, requiredEntitlements []string) (bool, error)

EntitlementsMissing reports whether the environment's entitlements lack a feature that requiredEntitlements, a provider manifest's license codes, require.

func Usage added in v0.28.2

Usage is what the environment uses against its limits, for display and the over-limit clock: the users and devices there are now, and the compute in the EntitlementUsage read from c. The leader of a billed environment keeps that count, so it can lag behind writes, and it's 0 where nothing counts it. A write is never admitted against it.

Types

type Config

type Config struct {
	LicenseKey string `usage:"Keygen license key for this Obot installation"`
}

Config contains the Keygen settings needed to validate an Obot license.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(ctx context.Context, gatewayClient *client.Client, config Config) (*Provider, error)

NewProvider creates a Keygen-backed license provider.

func (*Provider) Entitlements

func (p *Provider) Entitlements(ctx context.Context) (types.Entitlements, error)

Entitlements returns the license's features and its user and device limits. A license limits nothing else.

func (*Provider) HasValidLicense

func (p *Provider) HasValidLicense(ctx context.Context) (bool, error)

func (*Provider) LicenseKey

func (p *Provider) LicenseKey(ctx context.Context) (string, error)

func (*Provider) LicenseKeyViaConfiguration

func (p *Provider) LicenseKeyViaConfiguration() bool

func (*Provider) MachineFingerprint added in v0.26.0

func (p *Provider) MachineFingerprint() string

MachineFingerprint returns the existing persisted installation identity.

func (*Provider) RemoveLicenseKey

func (p *Provider) RemoveLicenseKey(ctx context.Context) error

RemoveLicenseKey removes the license key in effect. Removing a license key that replaced a registered Community key falls back to the Community key, and removing the Community key itself leaves the installation unregistered.

func (*Provider) SetCommunityLicenseKey added in v0.28.0

func (p *Provider) SetCommunityLicenseKey(ctx context.Context, licenseKey string) error

SetCommunityLicenseKey stores the Obot Community license key issued at registration like SetLicenseKey, and keeps it to fall back to when a license key added later is deleted.

func (*Provider) SetLicenseKey

func (p *Provider) SetLicenseKey(ctx context.Context, licenseKey string) error

SetLicenseKey stores the license key after Keygen accepts it. It returns ErrInvalidLicense when Keygen rejects the key and ErrLicenseCheckFailed when Keygen didn't give a verdict.

func (*Provider) Validate added in v0.23.2

func (p *Provider) Validate(ctx context.Context) error

type ProviderEntitlementGate

type ProviderEntitlementGate struct {
	// contains filtered or unexported fields
}

ProviderEntitlementGate refuses gated paths while a configured auth provider needs a feature the entitlements lack.

func NewProviderEntitlementGate

func NewProviderEntitlementGate(entitlements gatewayclient.EntitlementProvider, client kclient.Client) *ProviderEntitlementGate

func (*ProviderEntitlementGate) Check

func (g *ProviderEntitlementGate) Check(req *http.Request) error

type Violation added in v0.25.0

type Violation struct {
	Type      string `json:"type"`
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name,omitempty"`
	Message   string `json:"message,omitempty"`
}

Violation is a configured auth provider that needs a feature the entitlements lack, a limit usage is over, or a restriction.

func LimitViolations added in v0.28.2

func LimitViolations(granted types.Entitlements, used types.EntitlementsUsage) []Violation

LimitViolations returns a violation for each of granted's limits that used is over. A nil limit is unlimited. The messages leave out the numbers, since members see them too.

func Violations added in v0.28.2

func Violations(ctx context.Context, c kclient.Client, granted types.Entitlements, used types.EntitlementsUsage) ([]Violation, error)

Violations returns the configured auth providers that need a feature granted lacks, and the limits used is over.

Jump to

Keyboard shortcuts

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