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

Method credential

internal/config/refreshable.go:741–751  ·  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

739// (the access token becomes Token). Refresh metadata is carried verbatim, cloning the timestamps so the result never
740// aliases the record's *time.Time values.
741func (r refreshableTokenRecord) credential(source string) gh.Credential {
742 return gh.Credential{
743 Source: source,
744 Token: r.AccessToken,
745 RefreshToken: r.RefreshToken,
746 ExpiresIn: r.ExpiresIn,
747 RefreshTokenExpiresIn: r.RefreshTokenExpiresIn,
748 ExpiresAt: cloneTime(r.ExpiresAt),
749 RefreshTokenExpiresAt: cloneTime(r.RefreshTokenExpiresAt),
750 }
751}
752
753// recordFromCredential projects a gh.Credential onto the persisted record shape, dropping the runtime-only Source and
754// 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