MCPcopy Create free account
hub / github.com/cli/cli / persistRefreshedCredential

Method persistRefreshedCredential

internal/config/refreshable.go:540–550  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
540func (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,

Callers 1

Calls 3

WriteMethod · 0.65

Tested by

no test coverage detected