reconciler

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func (r *Reconciler) MintRef(ref manifest.KeyRef, passphrase string) (*MintedKey, error)

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.

func (*Reconciler) RecordExisting added in v0.1.3

func (r *Reconciler) RecordExisting(ref manifest.KeyRef) (bool, error)

RecordExisting records one key that is on disk with no inventory record (an adopted key, say) and saves the inventory. It mints nothing. It reports whether it recorded the key; false when it was already recorded, absent, or unreadable.

Jump to

Keyboard shortcuts

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