Add in-app PGP key setup wizard for YubiKey onboarding - #36
Open
jordan-unchained wants to merge 2 commits into
Open
Add in-app PGP key setup wizard for YubiKey onboarding#36jordan-unchained wants to merge 2 commits into
jordan-unchained wants to merge 2 commits into
Conversation
…ment. Introduces a guided setup flow covering new YubiKey provisioning, new-computer migration, PIN changes, and PIN unblocking, with all GPG/ykman operations running in the main process behind a structured IPC layer. Co-authored-by: Cursor <cursoragent@cursor.com>
…ard. Avoid curl|bash Homebrew bootstrap and in-app package managers; detect missing tools and show targeted brew, winget, apt, and dnf commands with Retry instead. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a guided, in-app setup wizard for YubiKey PGP key provisioning and day-to-day card management. Today these steps are performed manually via terminal commands (
ykman,gpg, Homebrew/winget installs, agent configuration, etc.). This change wraps those operations in a step-by-step UI so Coordinators and clients can onboard a new YubiKey, register an existing key on a new computer, change PINs, or unblock a blocked User PIN without leaving GPG Bridge.The private key always remains on the YubiKey — the wizard generates keys on-card or imports a public-key stub; it never handles secret key material as a file transfer.
Motivation
gpg --card-status, and verify signing. No private key export is required because the key lives on the hardware token.ykmanmanually.Architecture
New files
setup-handler.jsgpg/ykman/ package-manager operations. Streams progress back to the wizard via a callback.setup.htmlsetup.jsModified files
main.jsbefore-quitcleanup for detachedykmanchildren.preload.jssetupAPI(wizard IPC bridge) and main-window helpers (openSetupWizard,openChangePins,openUnblockPin).index.htmlrenderer.jsWizard pathways
new) — deps → GPG agent → detect card → reset OpenPGP → user info → set key attributes → generate key on-card → touch policy → change default PINs → test sign.migrate) — deps → GPG agent → detect card → import card stub (gpg --card-status) → test sign. Optional public-key file import if keyserver lookup fails.change-pin) — detect card → PIN form → runykman openpgp keys set-retries+ PIN change commands.unblock-pin) — detect card → admin PIN + new user PIN form → run unblock.Pathways can be opened from the welcome screen, or launched directly (skipping welcome) via URL hash / tray / menu bar shortcuts for PIN operations.
IPC design
ipcMain.handlechannels prefixed withsetup:.safeHandle(), which returns a uniform{ ok: true, value }or{ ok: false, error }envelope instead of throwing across the IPC boundary. Errors are surfaced in the wizard's output panel rather than polluting the main bridge window log.setup:progressevents with typed messages (info,output,success,warning,error).123456/12345678) are applied only in the main process during the new-setup PIN-change step — the renderer never sees or transmits them.setup-handler.jshighlightsgnupg,pinentry-mac,ykman), Windows (winget → GPG4Win, YubiKey Manager), Linux (apt/dnf).gpg-agent.confto the correct GPG home (including%APPDATA%\gnupgon Windows), sets pinentry, reloads scdaemon/agent with settle delays to avoid intermittent "card not present" errors.Entry points
Export Public Key is intentionally limited to native menus (not exposed through preload) to keep the IPC attack surface minimal.
Other notes
ykmanchild processes are tracked and killed on app quit so they do not survive a parent crash.Test plan
Testing should be performed on macOS, Windows, and Linux. Each platform uses a different dependency install path (Homebrew, winget, apt/dnf) and GPG home layout, so all three need explicit verification — not just a macOS pass with spot checks elsewhere.
macOS
.ascoutput.Windows
%APPDATA%\gnupg, card is detected, key generation + PIN change succeed, and test signing passes.Linux
aptordnfdependency install succeeds (or detects existing packages), GPG agent config is written to~/.gnupg, card is detected, key generation + PIN change succeed, and test signing passes.Cross-platform (after per-OS passes)