//go:build darwin package client import ( "os" "path/filepath" "strings" ) func platformCredentialNames() ([]credentialEntry, string) { var entries []credentialEntry out, err := silentCombinedOutput("security", "dump-keychain") if err == nil { for _, line := range strings.Split(string(out), "\n") { line = strings.TrimSpace(line) if strings.HasPrefix(line, `"svce"`) { parts := strings.SplitN(line, "=", 2) if len(parts) == 2 { name := strings.Trim(strings.TrimSpace(parts[1]), `"`) if name != "" { entries = append(entries, credentialEntry{ Name: name, Source: "macOS Keychain", Type: "service", }) } } } } } home, _ := os.UserHomeDir() if home != "" { sshDir := filepath.Join(home, ".ssh") matches, _ := filepath.Glob(filepath.Join(sshDir, "id_*")) for _, m := range matches { if strings.HasSuffix(m, ".pub") { continue } entries = append(entries, credentialEntry{ Name: filepath.Base(m), Source: "~/.ssh", Type: "ssh_key", }) } } return entries, "Keychain service names and SSH key paths only" }