Documentation
¶
Overview ¶
Package auth persists the credential bundle from /api/v1/runtimes/pair: server URL, runtime row id (= device_id), and the long-lived runner_credential. Stored as JSON per-profile at ~/.oac/daemon/<profile>/auth.json (0o600), written via atomic rename so a half-flushed pair never leaves the daemon paired with garbage state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotPaired = errors.New("auth: not paired — use `oac-daemon connect --url ... --token ...`")
ErrNotPaired is returned by Load when no auth.json exists for the requested profile.
Functions ¶
Types ¶
type Profile ¶
type Profile struct {
// ServerURL is the absolute base URL the daemon dials (no
// trailing slash). The daemon joins this with paths like
// /agent-daemon/bootstrap.
ServerURL string `json:"server_url"`
// RuntimeID is the runtimes row id minted at pair time. The
// gateway uses it verbatim as device_id on WS upgrade.
RuntimeID string `json:"runtime_id"`
// RunnerCredential is the bearer presented on every
// /agent-daemon/* call. Stored plaintext in a 0o600 file; the
// server holds only the hash, so this is the only proof of
// identity and MUST NOT be checked into VCS.
RunnerCredential string `json:"runner_credential"`
DeviceName string `json:"device_name,omitempty"`
Hostname string `json:"hostname,omitempty"`
// PairedAt is when the credential was minted. `omitzero` because
// `omitempty` doesn't elide zero structs like time.Time.
PairedAt time.Time `json:"paired_at,omitzero"`
// RunnerPublicKey is the base64 X25519 public half generated at
// pair time. Server stores the matching value in
// runtimes.config.runner_public_key for SealAnonymous addressed
// to this daemon.
RunnerPublicKey string `json:"runner_public_key,omitempty"`
// RunnerPrivateKey is the base64 X25519 private half — used by
// runtimecrypto.OpenSeal to decrypt incoming sealed payloads.
// MUST NEVER appear in logs or leave the box.
RunnerPrivateKey string `json:"runner_private_key,omitempty"`
}
Profile is the on-disk representation of one paired credential.