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

Method credential

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

565// (the access token becomes Token). Refresh metadata is carried verbatim, cloning the timestamps so the result never
566// aliases the record's *time.Time values.
567func (r refreshableTokenRecord) credential(source string) gh.Credential {
568 return gh.Credential{
569 Source: source,
570 Token: r.AccessToken,
571 RefreshToken: r.RefreshToken,
572 ExpiresIn: r.ExpiresIn,
573 RefreshTokenExpiresIn: r.RefreshTokenExpiresIn,
574 ExpiresAt: cloneTime(r.ExpiresAt),
575 RefreshTokenExpiresAt: cloneTime(r.RefreshTokenExpiresAt),
576 }
577}
578
579// recordFromCredential projects a gh.Credential onto the persisted record shape, dropping the runtime-only Source and
580// 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