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

Function credentialFromRefreshable

internal/config/refreshable.go:396–406  ·  view source on GitHub ↗

credentialFromRefreshable projects a renewed RefreshableCredential onto the universal gh.Credential shape, tagging it with the given source. Timestamps are cloned so the result never aliases the input's *time.Time values.

(renewed gh.RefreshableCredential, source string)

Source from the content-addressed store, hash-verified

394// credentialFromRefreshable projects a renewed RefreshableCredential onto the universal gh.Credential shape, tagging it
395// with the given source. Timestamps are cloned so the result never aliases the input's *time.Time values.
396func credentialFromRefreshable(renewed gh.RefreshableCredential, source string) gh.Credential {
397 return gh.Credential{
398 Source: source,
399 Token: renewed.AccessToken,
400 RefreshToken: renewed.RefreshToken,
401 ExpiresIn: renewed.ExpiresIn,
402 RefreshTokenExpiresIn: renewed.RefreshTokenExpiresIn,
403 ExpiresAt: cloneTime(renewed.ExpiresAt),
404 RefreshTokenExpiresAt: cloneTime(renewed.RefreshTokenExpiresAt),
405 }
406}
407
408// refreshCredentialForUser renews the given refreshable credential when its access token is expiring and persists the
409// renewal to the same storage the credential already lives in. The caller supplies the already-resolved credential. It

Callers 2

LogoutWithCredentialMethod · 0.85

Calls 1

cloneTimeFunction · 0.85

Tested by

no test coverage detected