purgeRefreshableForLogin removes any refreshable credential for the user during a non-refreshable login so the two credential forms cannot coexist. A surviving refreshable record outranks the freshly stored token during activation, so a removal that silently failed would let login report success whi
(hostname, username string)
| 194 | // errRefreshableNotFound here, so the check stays silent exactly where a delete error would be spurious. Only a record |
| 195 | // that genuinely survives removal resolves without error and is surfaced. |
| 196 | func (c *AuthConfig) purgeRefreshableForLogin(hostname, username string) error { |
| 197 | // Best-effort removal in both stores, matching loginRefreshable's symmetric cleanup. |
| 198 | _ = c.cfg.Remove(refreshablePath(hostname, username)) |
| 199 | _ = keyringDelete(refreshableServiceName(hostname), username) |
| 200 | |
| 201 | if _, _, err := c.refreshableForUser(hostname, username); err == nil { |
| 202 | return errors.New("could not remove the existing refreshable credential, which would shadow this login") |
| 203 | } |
| 204 | return nil |
| 205 | } |
| 206 | |
| 207 | // purgeNonExpiringForRefreshableLogin removes any non-expiring credential for the user during a refreshable login so |
| 208 | // the two credential forms cannot coexist. The ordinary keyring is now resolved before the refreshable credential, so |
no test coverage detected