Documentation
¶
Index ¶
- Constants
- type Session
- type Store
- func (s *Store) Active(workspaceUID string) int
- func (s *Store) Lookup(id string) (*Session, bool)
- func (s *Store) Mint(workspaceUID, workspaceGeneration, participant string, epoch uint64, ...) (id, ticket string, err error)
- func (s *Store) Parse(signed string, keys [][]byte) (Ticket, error)
- func (s *Store) Release(id string)
- func (s *Store) Renew(id string) (time.Time, bool)
- type Ticket
Constants ¶
const DefaultTTL = 60 * time.Second
DefaultTTL is the ticket lifetime; the proxy renews at half of it.
const Protocol = 1
Protocol is the wire protocol version this ticket store serves.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
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 NewStore ¶
func NewStore() *Store
NewStore returns a Store with the default TTL and real clock.
func (*Store) Active ¶
Active counts live (unexpired) sessions bound to a workspace UID. Expired records are swept as observed, never resurrected.
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.
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.