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

Method credential

internal/config/refreshable.go:646–656  ·  view source on GitHub ↗

credential projects the stored record onto the universal gh.Credential shape, tagging it with the given source (the access token becomes Token). Refresh metadata is carried verbatim, cloning the timestamps so the result never aliases the record's *time.Time values.

(source string)

Source from the content-addressed store, hash-verified

644// (the access token becomes Token). Refresh metadata is carried verbatim, cloning the timestamps so the result never
645// aliases the record's *time.Time values.
646func (r refreshableTokenRecord) credential(source string) gh.Credential {
647 return gh.Credential{
648 Source: source,
649 Token: r.AccessToken,
650 RefreshToken: r.RefreshToken,
651 ExpiresIn: r.ExpiresIn,
652 RefreshTokenExpiresIn: r.RefreshTokenExpiresIn,
653 ExpiresAt: cloneTime(r.ExpiresAt),
654 RefreshTokenExpiresAt: cloneTime(r.RefreshTokenExpiresAt),
655 }
656}
657
658// recordFromCredential projects a gh.Credential onto the persisted record shape, dropping the runtime-only Source and
659// carrying the access token as AccessToken. It clones the timestamps so the record never aliases the credential's

Callers 2

refreshableFromConfigMethod · 0.95
refreshableFromKeyringFunction · 0.95

Calls 1

cloneTimeFunction · 0.85

Tested by

no test coverage detected