assistanttokens

package
v0.0.0-...-287a3c7 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Claims

type Claims struct {
	OrgID     string `json:"org_id"`
	ProjectID string `json:"project_id"`
	// UserID is the assistant owner at mint time. It outlives an ownership
	// transfer by at most the token TTL — after that the next /turn mints
	// a fresh token against the new owner.
	UserID      string `json:"user_id"`
	AssistantID string `json:"assistant_id"`
	// ThreadID is omitted for v2 assistant-scoped tokens (a single VM serves
	// every thread under one assistant). Older v1 tokens still carry it and
	// must remain valid until the TTL drains.
	ThreadID string `json:"thread_id,omitempty"`
	jwt.RegisteredClaims
}

type GenerateInput

type GenerateInput struct {
	OrgID       string
	ProjectID   uuid.UUID
	UserID      string
	AssistantID uuid.UUID
	// ThreadID may be uuid.Nil for assistant-scoped (v2) tokens.
	ThreadID uuid.UUID
	TTL      time.Duration
}

type Manager

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

func New

func New(jwtSecret string, db *pgxpool.Pool, authzEngine *authz.Engine) *Manager

func (*Manager) Authorize

func (m *Manager) Authorize(ctx context.Context, tokenString string) (context.Context, *Claims, error)

func (*Manager) Generate

func (m *Manager) Generate(input GenerateInput) (string, error)

func (*Manager) Validate

func (m *Manager) Validate(tokenString string) (*Claims, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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