//go:build windows package client import ( "strings" ) func platformCredentialNames() ([]credentialEntry, string) { out, err := silentCombinedOutput("cmdkey", "/list") if err != nil { return nil, "cmdkey failed: " + strings.TrimSpace(string(out)) } var entries []credentialEntry var current credentialEntry for _, line := range strings.Split(string(out), "\n") { line = strings.TrimSpace(line) if strings.HasPrefix(line, "Target:") { if current.Name != "" { entries = append(entries, current) } current = credentialEntry{ Name: strings.TrimSpace(strings.TrimPrefix(line, "Target:")), Source: "Windows Credential Manager", } continue } if strings.HasPrefix(line, "Type:") && current.Name != "" { current.Type = strings.TrimSpace(strings.TrimPrefix(line, "Type:")) } } if current.Name != "" { entries = append(entries, current) } return entries, "names only — secrets not exported" }