Versions in this module Expand all Collapse all v0 v0.3.0 Nov 27, 2026 Changes in this version + var ErrAgentKeyNotFound = errors.New("no stored key for agent") + var ErrAgentKeySignatureMismatch = errors.New("agent signature mismatch") + var ErrAgentKeyStoreUnavailable = errors.New("agent key store unavailable") + var ErrFingerprintMismatch = errors.New("fingerprint does not match the request") + var ErrJoinEncryptionKey = errors.New("the join request has no valid P-256 encryption key") + var ErrJoinSignature = errors.New("the join request is not signed by its key") + var ErrNoAcceptedAgent = errors.New("no accepted agent") + var ErrNoJoinTokens = errors.New("this controller takes no join") + var ErrNoPendingAgent = errors.New("no pending agent") + var ErrNotFound = errors.New("no admission record") + type AcceptedAgent struct + AcceptedAt time.Time + EncryptionKey string + Fingerprint string + Hostname string + JoinLabels map[string]string + JoinToken string + MachineID string + NATSUserKey string + PublicKey ed25519.PublicKey + SupersededKey ed25519.PublicKey + SupersededUntil time.Time + type AgentKeyStore interface + LookupAgentKey func(ctx context.Context, machineID string) (*AcceptedAgent, error) + type AgentUser func(req pki.JoinRequest) (pki.JoinNATS, error) + func StaticUser(user pki.JoinNATS) AgentUser + type CalloutRoles struct + Agent bus.Permissions + AgentTTL time.Duration + Join bus.Permissions + Tokens TokenChecker + type JoinListener func(subject string, queue string, handler nats.MsgHandler) (*nats.Subscription, error) + type JoinTokens interface + Consume func(ctx context.Context, token string) (jointoken.Token, error) + type KVStore interface + KVDelete func(ctx context.Context, bucket string, key string) error + KVGet func(ctx context.Context, bucket string, key string) (jetstream.KeyValueEntry, error) + KVKeys func(ctx context.Context, bucket string, filters ...string) ([]string, error) + KVPut func(ctx context.Context, bucket string, key string, value []byte) (uint64, error) + type Mint func(userKey string, machineID string) (string, error) + type NATSSubscriber interface + PublishCore func(ctx context.Context, subject string, data []byte) error + Subscribe func(ctx context.Context, subject string, handler natsclient.MsgHandler) (*nats.Subscription, error) + type PKIProvider interface + PublicKey func() ed25519.PublicKey + type PendingAgent struct + EncryptionKey string + Fingerprint string + Hostname string + JoinLabels map[string]string + MachineID string + NATSUserKey string + PublicKey []byte + RequestedAt time.Time + type Record struct + AdmittedAt time.Time + DecidedAt time.Time + EncryptionKey string + Fingerprint string + Hostname string + JoinLabels map[string]string + JoinToken string + MachineID string + Previous types.AdmissionState + PreviousFingerprint string + Reason string + RequestedAt time.Time + State types.AdmissionState + type Seen interface + AgentsLastSeen func(ctx context.Context) (map[string]time.Time, error) + ListAgents func(ctx context.Context) ([]job.AgentInfo, error) + type Timeline interface + WriteAgentTimelineEvent func(ctx context.Context, machineID, hostname, event, message string) error + type TokenChecker interface + Check func(ctx context.Context, token string) (jointoken.Token, error) + type Watcher struct + func NewWatcher(logger *slog.Logger, nc NATSSubscriber, enrollmentKV KVStore, ...) *Watcher + func (w *Watcher) AcceptAgent(ctx context.Context, machineID string) error + func (w *Watcher) Admit(ctx context.Context, machineID string, fingerprint string) error + func (w *Watcher) Callout(r CalloutRoles) natscallout.Decide + func (w *Watcher) Delete(ctx context.Context, machineID string) error + func (w *Watcher) DeleteStale(ctx context.Context, seen Seen, after time.Duration) ([]string, error) + func (w *Watcher) Get(ctx context.Context, machineID string) (Record, error) + func (w *Watcher) Join(ctx context.Context, req pki.JoinRequest) (ed25519.PublicKey, error) + func (w *Watcher) KeyStore() client.AgentKeyStore + func (w *Watcher) List(ctx context.Context) ([]Record, error) + func (w *Watcher) LookupAgentKey(ctx context.Context, machineID string) (*AcceptedAgent, error) + func (w *Watcher) Reject(ctx context.Context, machineID string, reason string) error + func (w *Watcher) RejectAgent(ctx context.Context, machineID string, reason string) error + func (w *Watcher) RemoveAgentKey(ctx context.Context, machineID string) error + func (w *Watcher) RenameAgentKey(ctx context.Context, machineID string, hostname string) error + func (w *Watcher) Revoke(ctx context.Context, machineID string) error + func (w *Watcher) RunStaleCleanup(ctx context.Context, seen Seen, after time.Duration) error + func (w *Watcher) ServeJoin(ctx context.Context, listen JoinListener, agent AgentUser) error + func (w *Watcher) ServeRenew(ctx context.Context, listen JoinListener, mint Mint) error + func (w *Watcher) ServeRotate(ctx context.Context, listen JoinListener) error + func (w *Watcher) SetAudit(a audit.Writer) + func (w *Watcher) SetJoinTokens(tokens JoinTokens) + func (w *Watcher) SetRotationGracePeriod(d time.Duration) + func (w *Watcher) SetTimeline(t Timeline) + func (w *Watcher) Start(ctx context.Context) error