Expand description
Operator-key load/generate (C2 of plans/next-gen-deployment.md).
Provides the Ed25519 keypair the operator uses to sign artifacts it owns (today: B10 revenue-policy DSSE; future: revision manifests, audit-log tips). Key material lives on the operator’s filesystem and is created on first use; rotation is out of scope for C2 v1 — that’s the Trust plan.
§Key location
The path is resolved in this order:
$GTC_OPERATOR_KEY_PATHif set (caller wants a non-default location, e.g. a vault-mounted tmpfs path or a CI fixture).~/.greentic/operator/key.pemon POSIX/Windows.- Error — no home directory and no env override.
Companion file: <key.pem>.pub (SPKI PEM). It is derived from the
private key, written next to it on generation, and cross-checked on
subsequent loads — if a .pub exists but does not match the canonical
id derived from the private key, the load fails. A stale .pub from a
prior .pem always indicates operator-side tampering or a partial
rotation; deriving silently from the private key would mask it.
§File modes
On POSIX, the private key is written with mode 0600 and the public
key with mode 0644. On platforms without std::os::unix::fs, the
permissions fall through to the OS default.
Structs§
- Operator
Key - The operator’s signing key + its derived id, ready for DSSE signing.
Enums§
Constants§
- OPERATOR_
KEY_ PATH_ ENV - Override for the operator key path. When set, takes precedence over the
~/.greentic/operator/key.pemdefault.
Functions§
- load_
existing_ only - Load an existing operator key, failing with
NotFoundif no key file is present. Does not generate. Use this from CLI verbs that should refuse to act on an unbootstrapped operator (e.g.bundles add/update— generating a throwaway key as a side-effect of abundles addthat then fails the trust-root precondition is confusing and leaves unexpected state on disk). - load_
or_ generate - Load the operator key from the resolved path, generating a fresh keypair if the file does not yet exist.
- load_
or_ generate_ at - Like
load_or_generatebut with an explicit path (tests + callers that already resolved the path themselves). - read_
signing_ key_ at - Read an existing signing key at an explicit path (e.g.
--signing-key) with the same hardening asload_existing_only: symlink-ancestor gate,O_NOFOLLOWopen, regular-file + mode (0600) checks, and a pre-sizedZeroizingread. Returns(private_pem, key_id). Unlikeload_existing, it writes NO.pubsibling — the path is caller-supplied, so regenerating a public file next to it would litter unexpected state. The mode/symlink enforcement is Unix-only (a no-op on other platforms, matchingread_existing_securely). - resolve_
path - Resolve the path the operator key should live at without touching disk.