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)
| 712 | // Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep |
| 713 | // in sync. |
| 714 | func (c *AuthConfig) persistRefreshedCredential(hostname, username string, credential gh.Credential, secure bool) error { |
| 715 | if secure { |
| 716 | if err := c.setRefreshableInKeyring(hostname, username, credential); err != nil { |
| 717 | return err |
| 718 | } |
| 719 | } else { |
| 720 | c.setRefreshableInConfig(hostname, username, credential) |
| 721 | } |
| 722 | |
| 723 | return ghConfig.Write(c.cfg) |
| 724 | } |
| 725 | |
| 726 | // refreshableTokenRecord is the on-disk and keyring JSON shape of a refreshable credential. It exists solely so the |
| 727 | // storage helpers can marshal and unmarshal the persisted fields; it never crosses an AuthConfig method boundary, |
no test coverage detected