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)
| 617 | // Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep |
| 618 | // in sync. |
| 619 | func (c *AuthConfig) persistRefreshedCredential(hostname, username string, credential gh.Credential, secure bool) error { |
| 620 | if secure { |
| 621 | if err := c.setRefreshableInKeyring(hostname, username, credential); err != nil { |
| 622 | return err |
| 623 | } |
| 624 | } else { |
| 625 | c.setRefreshableInConfig(hostname, username, credential) |
| 626 | } |
| 627 | |
| 628 | return ghConfig.Write(c.cfg) |
| 629 | } |
| 630 | |
| 631 | // refreshableTokenRecord is the on-disk and keyring JSON shape of a refreshable credential. It exists solely so the |
| 632 | // storage helpers can marshal and unmarshal the persisted fields; it never crosses an AuthConfig method boundary, |
no test coverage detected