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)
| 606 | // called under the refresh lock). Each delete is best effort so a missing record or unavailable keyring does not stop |
| 607 | // the others. |
| 608 | func (c *AuthConfig) removeCredentialForUser(hostname, username string) error { |
| 609 | _ = keyring.Delete(refreshableServiceName(hostname), username) |
| 610 | _ = keyring.Delete(keyringServiceName(hostname), username) |
| 611 | _ = c.cfg.Remove(refreshablePath(hostname, username)) |
| 612 | _ = c.cfg.Remove([]string{hostsKey, hostname, usersKey, username, oauthTokenKey}) |
| 613 | return ghConfig.Write(c.cfg) |
| 614 | } |
| 615 | |
| 616 | // persistRefreshedCredential writes a renewed refreshable credential back to the storage form it already lived in. |
| 617 | // 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