WipeCredentialsFile removes ~/.pad/credentials.json entirely. Distinct from CredentialStore.Delete (which removes a single server's entry) — used by tests and any future "pad auth wipe" that wants a clean slate. Silently succeeds if the file is already absent.
()
| 237 | // — used by tests and any future "pad auth wipe" that wants a clean |
| 238 | // slate. Silently succeeds if the file is already absent. |
| 239 | func WipeCredentialsFile() error { |
| 240 | path, err := credentialsPath() |
| 241 | if err != nil { |
| 242 | return err |
| 243 | } |
| 244 | if err := os.Remove(path); err != nil && !os.IsNotExist(err) { |
| 245 | return fmt.Errorf("delete credentials: %w", err) |
| 246 | } |
| 247 | return nil |
| 248 | } |
| 249 | |
| 250 | // normalizeServerURL canonicalizes a server URL for use as a credential |
| 251 | // key. Trailing slash and surrounding whitespace are stripped; nothing |