Skip to content

feat(secrets,cli): S5 (part) — secrets keygen age keypair - #39

Merged
gustavobertoi merged 1 commit into
mainfrom
nightly/S5-keygen
Jun 29, 2026
Merged

feat(secrets,cli): S5 (part) — secrets keygen age keypair#39
gustavobertoi merged 1 commit into
mainfrom
nightly/S5-keygen

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

Chunk S5 (part) — secrets keygen

The offline onboarding companion to the SOPS+age provider (S2): generate the local age identity SOPS_AGE_KEY_FILE points at — no account, fully in-process (filippo.io/age, pure-Go, static-binary safe).

  • secrets.GenerateAgeKey(){Identity, Recipient} + AgeKeyFileContents().
  • CLI secrets keygen [-o FILE]: with -o writes the key 0600 (+ a SOPS_AGE_KEY_FILE hint); without, prints the key to stdout and the recipient to stderr (pipe-safe). --json supported. Replaces the keygen stub; secrets login (keyring) stays stubbed for the rest of S5.

Tests

Generated identity round-trips through age.ParseX25519Identity → same recipient; two calls differ; key-file shape; CLI writes a 0600 file with the recipient comment + SOPS hint.

Note: local govulncheck flags go1.26.0 stdlib advisories (fixed in go1.26.3+) unrelated to this change; CI runs Go 1.25.x-latest where they don't apply (PR #37 just passed govulncheck). The age dep itself is clean (cross-compile OK).

Gate

make ci green (race).

🤖 Generated with Claude Code

… (spec 04)

The offline onboarding companion to the SOPS+age provider (S2): generate the
local age identity SOPS_AGE_KEY_FILE points at, no account, fully in-process
(filippo.io/age — pure Go, static-binary safe).

- secrets.GenerateAgeKey() → {Identity AGE-SECRET-KEY-…, Recipient age1…} +
  AgeKeyFileContents() (the `# public key:` + secret body `age-keygen` writes).
- CLI `secrets keygen [-o FILE]`: with -o writes the key 0600 (+ a
  SOPS_AGE_KEY_FILE export hint); without, prints the key to stdout and the
  public recipient to stderr (so a pipe captures only the key). --json supported.
  Replaces the keygen stub; `secrets login` (keyring) stays stubbed for the rest
  of S5.

Unit tests: generated identity round-trips through age.ParseX25519Identity and
yields the reported recipient; two calls differ; key-file body shape; CLI writes
a 0600 file with the recipient comment + SOPS hint.

Note: local govulncheck flags go1.26.0 stdlib advisories (fixed in go1.26.3+)
unrelated to this change; CI runs Go 1.25.x-latest where they don't apply.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gustavobertoi
gustavobertoi merged commit 6e897a2 into main Jun 29, 2026
2 checks passed
@gustavobertoi
gustavobertoi deleted the nightly/S5-keygen branch June 29, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant