agent

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTL = 60 * time.Second

DefaultTTL is the ticket lifetime; the proxy renews at half of it.

View Source
const Protocol = 1

Protocol is the wire protocol version this ticket store serves.

Variables

This section is empty.

Functions

func SessionOwner added in v0.10.0

func SessionOwner(id string, keys [][]byte) string

SessionOwner verifies an issuer-routing ID, including predecessor keys. Legacy IDs have no routing hint and remain local, failing closed elsewhere.

Types

type Session

type Session struct {
	ID        string
	Ticket    Ticket
	ExpiresAt time.Time
}

Session is a server-side attach record: the id the proxy renews and releases by, plus a snapshot of the ticket it was minted from.

type Store

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

Store mints, validates and tracks ticket sessions in memory. Sessions end with the process; clients fall back to the console path (documented in the indicator contract — no silent persistence is claimed).

func NewOwnedStore added in v0.10.0

func NewOwnedStore(owner string) *Store

NewOwnedStore retains grants on their issuer. Signed routing IDs allow any API replica to forward lifecycle calls without trusting caller-chosen hosts.

func NewStore

func NewStore() *Store

NewStore returns a Store with the default TTL and real clock.

func (*Store) Active

func (s *Store) Active(workspaceUID string) int

Active counts live (unexpired) sessions bound to a workspace UID. Expired records are swept as observed, never resurrected.

func (*Store) Lookup

func (s *Store) Lookup(id string) (*Session, bool)

Lookup returns the live session record for renew/release correlation.

func (*Store) Mint

func (s *Store) Mint(workspaceUID, workspaceGeneration, participant string, epoch uint64, keys [][]byte) (id, ticket string, err error)

Mint creates a session and returns its id plus the signed ticket string ("id.payload.signature"). The ticket's SessionID is empty: it binds the live claim, correlated server-side by id.

func (*Store) Parse

func (s *Store) Parse(signed string, keys [][]byte) (Ticket, error)

Parse validates signature (any rotation key) and expiry, returning the ticket payload. It does not check workspace binding — the caller does.

func (*Store) Release

func (s *Store) Release(id string)

func (*Store) ReleaseBound added in v0.10.0

func (s *Store) ReleaseBound(id, uid, generation string) bool

ReleaseBound is idempotent for missing IDs; a mismatched binding is refused.

func (*Store) Renew

func (s *Store) Renew(id string) (time.Time, bool)

Renew extends a live session by one TTL. Expired or unknown ids fail closed (the proxy drops the bridge; the viewer re-attaches).

func (*Store) RenewBound added in v0.10.0

func (s *Store) RenewBound(id, uid, generation string) bool

RenewBound atomically checks the current provisioning binding before renewal.

type Ticket

type Ticket struct {
	WorkspaceUID        string `json:"workspaceUid"`
	WorkspaceGeneration string `json:"workspaceGeneration"`
	SessionID           string `json:"sessionId"`
	Participant         string `json:"participant"`
	Role                string `json:"role"`
	ControlEpoch        uint64 `json:"controlEpoch"`
	Audience            string `json:"audience"`
	IssuedAtNs          int64  `json:"issuedAtNs"`
	ExpiresAtNs         int64  `json:"expiresAtNs"`
}

Ticket binds one attach grant. JSON tags are camelCase to match the guest agent's wire structs exactly.

Jump to

Keyboard shortcuts

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