removeCredentialForUser deletes every stored credential record for the user on the host, covering both the refreshable and the non-expiring forms in both the keyring and the insecure config, then writes the config. It intentionally leaves the active-user pointer and the rest of the host configuratio
(hostname, username string)
| 527 | // called under the refresh lock). Each delete is best effort so a missing record or unavailable keyring does not stop |
| 528 | // the others. |
| 529 | func (c *AuthConfig) removeCredentialForUser(hostname, username string) error { |
| 530 | _ = keyring.Delete(refreshableServiceName(hostname), username) |
| 531 | _ = keyring.Delete(keyringServiceName(hostname), username) |
| 532 | _ = c.cfg.Remove(refreshablePath(hostname, username)) |
| 533 | _ = c.cfg.Remove([]string{hostsKey, hostname, usersKey, username, oauthTokenKey}) |
| 534 | return ghConfig.Write(c.cfg) |
| 535 | } |
| 536 | |
| 537 | // persistRefreshedCredential writes a renewed refreshable credential back to the storage form it already lived in. |
| 538 | // Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep |
no test coverage detected