Skip to content

fix(yubikey): polish enrollment UX — no duplicate footer, useful title, auto-load via SSH config#298

Merged
DevSecNinja merged 2 commits into
mainfrom
fix/yubikey-enroll-ux-polish
May 4, 2026
Merged

fix(yubikey): polish enrollment UX — no duplicate footer, useful title, auto-load via SSH config#298
DevSecNinja merged 2 commits into
mainfrom
fix/yubikey-enroll-ux-polish

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

Three follow-ups from real macOS dogfooding after enrolling on a fresh FIPS YubiKey.

1. Stop printing two "Next steps" blocks

The wizard wraps yk-ssh-new, but yk-ssh-new was unconditionally printing its own Next steps: footer. Result: every successful enrollment ended with both Next steps: (from yk-ssh-new) and Done. Next steps for serial … (from yk-enroll).

Fix: new --no-summary flag on yk-ssh-new. yk-enroll passes it. Bare yk-ssh-new invocations still get the footer.

2. Use the device type in the suggested GitHub title

Old: gh ssh-key add … --title "Jean-Pauls-Mini-yk-35984479" → user immediately replaced it with "YubiKey 5C NFC FIPS Keyring".

New: gh ssh-key add … --title "YubiKey 5C NFC FIPS @ Jean-Pauls-Mini"yk-enroll already knows device_type from step 2, so it just uses it. Bare yk-ssh-new (no wizard) shows <descriptive title> as a placeholder.

3. Auto-load the key via ~/.ssh/config (no manual ssh-add)

~/.ssh/config already has AddKeysToAgent yes, so once SSH tries an IdentityFile the key gets added to the agent automatically. But the template only emitted IdentityFile ~/.ssh/id_ed25519_sk (no suffix) — yk-enroll's per-serial files (id_ed25519_sk_<serial>) were invisible to SSH, so the user had to ssh-add manually.

Now home/private_dot_ssh/config.tmpl uses chezmoi's glob template function to enumerate every id_{ed25519,ecdsa}_sk* file in ~/.ssh/ and emits an IdentityFile line for each. yk-enroll's Done. block tells users to re-run chezmoi apply once after enrolling so the glob picks up the new key, and that step 2 is just ssh -T git@github.com rather than a manual ssh-add.

Verify

./tests/bash/run-tests.sh --test yk-ssh-new.bats --test yk-enroll.bats

24/24 green. New assertions:

  • yk-ssh-new: --no-summary suppresses Next steps footer
  • yk-enroll: full happy path now asserts (a) the device-type-based title appears, (b) yk-ssh-new's Next steps: is absent, (c) yk-enroll's Done. Next steps for serial is present

Files

  • home/dot_config/shell/functions/yk-ssh-new.sh--no-summary, friendlier footer
  • home/dot_config/fish/functions/yk_ssh_new.fish — same
  • home/dot_config/shell/functions/yk-enroll.sh — passes --no-summary, device-type title, chezmoi apply reminder
  • home/dot_config/fish/functions/yk_enroll.fish — same
  • home/private_dot_ssh/config.tmplglob for id_*_sk_* files
  • tests/bash/yk-enroll.bats + tests/bash/yk-ssh-new.bats — assertions added

…, auto-load via SSH config)

Three follow-ups from real macOS dogfooding after enrolling on a fresh

FIPS YubiKey:

1. Suppress yk-ssh-new's 'Next steps' footer when wrapped by yk-enroll.

   Output was duplicated: yk-ssh-new printed its own 'Next steps' block,

   then yk-enroll printed its 'Done. Next steps for serial' block. New

   --no-summary flag on yk-ssh-new lets yk-enroll own the summary.

2. Drop the unhelpful 'host-yk-serial' default title; use device type.

   Suggested title is now 'YubiKey 5C NFC FIPS @ Jean-Pauls-Mini' instead

   of '<host>-yk-<serial>'. The wizard already knows device_type from

   step 2, so use it. Bare yk-ssh-new (without yk-enroll) just shows

   '<descriptive title>' as a placeholder.

3. Auto-discover per-serial keys in ~/.ssh/config so ssh-add is unneeded.

   ~/.ssh/config already has 'AddKeysToAgent yes', so once SSH tries an

   IdentityFile the key auto-loads to the agent. The template only

   listed id_ed25519_sk (no suffix) though — yk-enroll's per-serial

   files (id_ed25519_sk_<serial>) weren't discovered, so the user had

   to run ssh-add manually. The template now uses chezmoi's glob

   function to enumerate every id_{ed25519,ecdsa}_sk* file and emit an

   IdentityFile line for each. yk-enroll's Done block tells users to

   re-run 'chezmoi apply' once after enrolling so the glob picks up the

   new key.

Tests: 24 cases green (1 new). yk-ssh-new gains a --no-summary test.

yk-enroll's happy-path test now also asserts the device-type-based

title, the absence of yk-ssh-new's 'Next steps:' footer, and the

presence of yk-enroll's 'Done. Next steps for serial' block.
@DevSecNinja DevSecNinja marked this pull request as ready for review May 4, 2026 10:34
@DevSecNinja DevSecNinja merged commit 82ecb92 into main May 4, 2026
16 checks passed
@DevSecNinja DevSecNinja deleted the fix/yubikey-enroll-ux-polish branch May 4, 2026 10:38
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