runInteractiveSetup orchestrates the complete interactive setup wizard
(force bool, seedTTL int, algorithm string, digits int)
| 13 | |
| 14 | // runInteractiveSetup orchestrates the complete interactive setup wizard |
| 15 | func runInteractiveSetup(force bool, seedTTL int, algorithm string, digits int) { |
| 16 | printWelcome() |
| 17 | |
| 18 | // Step 1: Check if already initialized |
| 19 | if err := checkInitialization(force); err != nil { |
| 20 | fatal(err) |
| 21 | } |
| 22 | |
| 23 | // Step 2: Choose authentication mode |
| 24 | authMode, err := promptAuthMode() |
| 25 | if err != nil { |
| 26 | fatal(err) |
| 27 | } |
| 28 | |
| 29 | // Step 3: Execute authentication initialization |
| 30 | fmt.Println() |
| 31 | printStepHeader(3, 8, "Initialize Authentication") |
| 32 | if authMode == "touchid" { |
| 33 | initTouchIDMode(force) |
| 34 | } else { |
| 35 | initOTPMode(force, seedTTL, algorithm, digits) |
| 36 | } |
| 37 | |
| 38 | // Step 4: Binary installation |
| 39 | fmt.Println() |
| 40 | printStepHeader(4, 8, "Binary Installation") |
| 41 | if err := ensureBinaryInstalled(); err != nil { |
| 42 | fmt.Printf("⚠️ Warning: Binary installation failed: %v\n", err) |
| 43 | fmt.Println("You can install manually with:") |
| 44 | fmt.Println(" sudo cp fssh /usr/local/bin/") |
| 45 | fmt.Println() |
| 46 | } |
| 47 | |
| 48 | // Step 5: Import SSH keys |
| 49 | fmt.Println() |
| 50 | printStepHeader(5, 8, "Import SSH Keys") |
| 51 | if err := importSSHKeys(); err != nil { |
| 52 | fmt.Printf("⚠️ Warning: SSH key import failed: %v\n", err) |
| 53 | fmt.Println("You can import keys later with: fssh import") |
| 54 | fmt.Println() |
| 55 | } |
| 56 | |
| 57 | // Step 6: Configure LaunchAgent |
| 58 | fmt.Println() |
| 59 | printStepHeader(6, 8, "Configure LaunchAgent (Auto-start)") |
| 60 | if err := setupLaunchAgent(); err != nil { |
| 61 | fmt.Printf("⚠️ Warning: LaunchAgent setup failed: %v\n", err) |
| 62 | fmt.Println("You can configure manually later") |
| 63 | fmt.Println() |
| 64 | } |
| 65 | |
| 66 | // Step 7: Start Agent |
| 67 | fmt.Println() |
| 68 | printStepHeader(7, 8, "Start SSH Agent") |
| 69 | if err := startAgent(); err != nil { |
| 70 | fmt.Printf("⚠️ Warning: Agent startup failed: %v\n", err) |
| 71 | fmt.Println("You can start manually with: fssh agent") |
| 72 | fmt.Println() |
no test coverage detected