persistRefreshedCredential writes a renewed refreshable credential back to the storage form it already lived in. Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep in sync.
(hostname, username string, credential gh.Credential, secure bool)
| 538 | // Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep |
| 539 | // in sync. |
| 540 | func (c *AuthConfig) persistRefreshedCredential(hostname, username string, credential gh.Credential, secure bool) error { |
| 541 | if secure { |
| 542 | if err := c.setRefreshableInKeyring(hostname, username, credential); err != nil { |
| 543 | return err |
| 544 | } |
| 545 | } else { |
| 546 | c.setRefreshableInConfig(hostname, username, credential) |
| 547 | } |
| 548 | |
| 549 | return ghConfig.Write(c.cfg) |
| 550 | } |
| 551 | |
| 552 | // refreshableTokenRecord is the on-disk and keyring JSON shape of a refreshable credential. It exists solely so the |
| 553 | // storage helpers can marshal and unmarshal the persisted fields; it never crosses an AuthConfig method boundary, |
no test coverage detected