Documentation
¶
Overview ¶
Package auth manages agent tokens, run-scoped worker tokens and peer credential checks (RFC 5.4, 8.2).
Index ¶
Constants ¶
const HumanPrincipal = "human"
HumanPrincipal is the token name for the human (CLI, hooks, status line).
const RunTokenPrefix = "run_"
RunTokenPrefix marks worker run tokens.
Variables ¶
var ErrAuth = errors.New("authentication failed")
ErrAuth is returned for any authentication failure.
Functions ¶
func EnsureToken ¶
EnsureToken creates name's token file (0600) if it is missing and returns it.
Types ¶
type Principal ¶
type Principal struct {
Agent string // agent id, or "human"
Origin string // interactive | cli | worker | human
RunID string // set for worker run tokens
Hop int // hop of the message the run is handling
Thread string // thread of the message the run is handling
}
Principal is an authenticated caller.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry validates tokens. Agent tokens come from files; run tokens are minted per run and revoked when the run ends.
func (*Registry) Authenticate ¶
Authenticate checks {agent, token}. origin is the client's claimed origin for agent tokens ("interactive" or "cli"); it is ignored for run tokens.