license

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package license implements tiered licensing for TTAL using Ed25519-signed JWTs.

It defines three tiers (free, pro, team) with per-tier limits on agents and teams. Licenses are stored as JWT files at ~/.config/ttal/license and validated against an embedded Ed25519 public key. The free tier requires no license file.

Plane: shared

Package license implements tiered licensing for TTAL using Ed25519-signed JWTs.

Tiers:

  • Free: 1 team, 2 agents, unlimited workers (no JWT required)
  • Pro: 1 team, unlimited agents ($100 lifetime)
  • Team: unlimited teams, unlimited agents ($200 lifetime)

License file: ~/.config/ttal/license JWT payload: { "sub": "<email>", "tier": "pro"|"team" } No expiration claim — all licenses are lifetime.

Index

Constants

View Source
const (
	FreeMaxAgents = 2
	FreeMaxTeams  = 1
	ProMaxTeams   = 1
)

Limits per tier.

Variables

This section is empty.

Functions

func Activate

func Activate(token string) error

Activate writes a JWT token to the license file.

func LicensePath

func LicensePath() (string, error)

LicensePath returns the path to the license file.

Types

type Claims

type Claims struct {
	Sub  string `json:"sub"`  // email or identifier
	Tier Tier   `json:"tier"` // "pro" or "team"
}

Claims is the JWT payload.

func Validate

func Validate(token string) (*Claims, error)

Validate parses and verifies a JWT token string.

type License

type License struct {
	Tier   Tier
	Claims *Claims // nil for free tier
}

License holds the validated license state.

func Load

func Load() (*License, error)

Load reads and validates the license file. Returns free tier if no license file exists.

func (*License) CheckAgentLimit

func (l *License) CheckAgentLimit(currentCount int) error

CheckAgentLimit returns an error if adding an agent would exceed the tier limit.

func (*License) CheckTeamLimit

func (l *License) CheckTeamLimit(teamCount int) error

CheckTeamLimit returns an error if the number of teams exceeds the tier limit.

func (*License) MaxAgents

func (l *License) MaxAgents() int

MaxAgents returns the agent limit for a tier. -1 means unlimited.

func (*License) MaxTeams

func (l *License) MaxTeams() int

MaxTeams returns the team limit for a tier. -1 means unlimited.

type Tier

type Tier string

Tier represents a licensing tier.

const (
	Free Tier = "free"
	Pro  Tier = "pro"
	Team Tier = "team"
)

Jump to

Keyboard shortcuts

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