Documentation
¶
Overview ¶
Package reconciler rebuilds the ~/.ssh tree from the manifest. Idempotent and non-destructive: it mints only missing keys - flagged needs-redeploy, never pretending a regenerated key is the lost original - re-renders config through the one renderer, fixes perms, and reports ssh -G validation. The snapshot/temp-residue sweep is the Facade's mutation guard, upstream of this, so it is not duplicated here.
Index ¶
- type MintedKey
- type ReconcileResult
- type Reconciler
- func (r *Reconciler) ExistingKeys(selector string) ([]manifest.KeyRef, error)
- func (r *Reconciler) Mint(selector, passphrase string, overwrite map[manifest.KeyRef]bool) ([]MintedKey, error)
- func (r *Reconciler) MintRef(ref manifest.KeyRef, passphrase string) (*MintedKey, error)
- func (r *Reconciler) Reconcile(dryRun bool, passphrase string) (*ReconcileResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MintedKey ¶
type MintedKey struct {
KeyName string
Profile string
Fingerprint string
Path string
// Fallback names the software type minted when the hardware *-sk type the
// manifest asks for had no security key to answer; "" otherwise.
Fallback string `json:",omitempty"`
}
MintedKey is one key generated during reconcile/keygen.
type ReconcileResult ¶
type ReconcileResult struct {
DryRun bool
Minted []MintedKey
ExistingKeys []string
Recorded []string // keys on disk that had no inventory record, now recorded
Config *configsvc.WriteResult
PermsFixed int
Snapshot *string
ValidationErrors map[string]string
Pinned map[string]int
}
ReconcileResult summarizes a reconcile run.
func (*ReconcileResult) Format ¶
func (r *ReconcileResult) Format() string
Format renders the human-readable summary (mirrors ReconcileResult.format).
type Reconciler ¶
type Reconciler struct {
// contains filtered or unexported fields
}
Reconciler reconciles the manifest into ~/.ssh.
func New ¶
func New(p paths.Paths, m *manifest.Manifest, inv *inventory.Inventory, emitUseKeychain bool) *Reconciler
New builds a Reconciler. emitUseKeychain matches the platform (macOS only), as elsewhere.
func (*Reconciler) ExistingKeys ¶
func (r *Reconciler) ExistingKeys(selector string) ([]manifest.KeyRef, error)
ExistingKeys lists the keys that already have a private key on disk, filtered to selector. Refs, not names: the caller prompts per key before overwriting one, and two profiles can hold the same name.
func (*Reconciler) Mint ¶
func (r *Reconciler) Mint(selector, passphrase string, overwrite map[manifest.KeyRef]bool) ([]MintedKey, error)
Mint is the targeted keygen primitive: mint missing keys for selector (all if empty), plus regenerate any key in overwrite (destructive; the caller snapshots first). No render.
overwrite is keyed by KeyRef, not by name. Key names are unique per profile, not globally - one person under two orgs uses the same file name in both - so a name-keyed set meant confirming "overwrite imani_github-ed25519" regenerated it in every profile that had one, destroying identities the user was never asked about.
func (*Reconciler) MintRef ¶
MintRef mints exactly one key, by reference. It returns nil when the private key is already on disk: a command that adds a key must never regenerate an identity that exists, since the replaced key is what remote targets trust.
func (*Reconciler) Reconcile ¶
func (r *Reconciler) Reconcile(dryRun bool, passphrase string) (*ReconcileResult, error)
Reconcile rebuilds the tree (mints missing keys, renders config, fixes perms, validates). With dryRun it only plans key work and previews the config write.