api

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditDetails

func AuditDetails(m map[string]any) string

AuditDetails flattens the lib's details map into the bounded audit column. Locally derived fields go first so a long remote error cannot displace the useful facts.

Types

type LoginRequest

type LoginRequest struct {
	Username     string `json:"username"`
	Password     string `json:"password"`
	CaptchaToken string `json:"captcha_token,omitempty"`
}

type MFARequest

type MFARequest struct {
	MFAToken string `json:"mfa_token"`
	Code     string `json:"code"`
}

type PinKeyRequest

type PinKeyRequest struct {
	PublicKey   string `json:"public_key"`
	Threshold   int    `json:"threshold"`
	TotalShares int    `json:"total_shares"`
}

type RemotePairRequest

type RemotePairRequest struct {
	RecoveryURL string `json:"recovery_url"`
	PairingCode string `json:"pairing_code"`
}

type ScheduleRequest

type ScheduleRequest struct {
	IntervalSec int64 `json:"interval_sec"`
}

type Server

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

func NewServer

func NewServer(cfg *config.Config, st store.Store) *Server

func (*Server) ApplyInstaller

func (s *Server) ApplyInstaller(ctx context.Context, raw []byte, check bool) (applysetup.Report, error)

Native provider readers consume this immutable record immediately; no restart or second database writer is needed to activate the configuration.

func (*Server) BeginShutdown

func (s *Server) BeginShutdown()

BeginShutdown makes readiness fail before the listener drains.

func (*Server) Connected

func (s *Server) Connected(endpointID string) bool

Connected reports whether an endpoint holds a live socket; tests and status screens use it.

func (*Server) RunLocalDocker

func (s *Server) RunLocalDocker(ctx context.Context) error

RunLocalDocker runs the existing authenticated agent against the local socket, inside the server process. No enrollment token, separate container or shell command is needed. Tenant authorization still gates every operator request.

func (*Server) RunPolicies

func (s *Server) RunPolicies(ctx context.Context, done chan<- struct{})

RunPolicies runs the update-policy scheduler until ctx ends: a tick a minute, each run in its own goroutine. done closes only once no run is in flight, so runServer can wait on it before the store closes.

func (*Server) RunServiceReadSummaries

func (s *Server) RunServiceReadSummaries(ctx context.Context, done chan<- struct{})

RunServiceReadSummaries writes one service_token.reads row per token per hour and once more at shutdown, on a context detached from the loop so the last flush lands. It closes done only when it returns; runServer waits on it before the store closes.

func (*Server) RunValidations

func (s *Server) RunValidations(ctx context.Context, done chan<- struct{})

RunValidations watches every settled apply until ctx ends (docs/application-schema.md, Health validation). A tick runs to its end, a rollback included, so done closes only between ticks and runServer can wait on it before the store closes.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) WaitDetached

func (s *Server) WaitDetached()

WaitDetached blocks until every request that detached from its connection has finished. It is called after http.Server.Shutdown and before the store is closed: pairing, the key pin and a deposit all keep writing after their connection is gone, and a closed store under them leaves a key pinned on disk with no row recording it.

type ThemeUpdateRequest

type ThemeUpdateRequest struct {
	Theme string `json:"theme"`
}

Jump to

Keyboard shortcuts

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