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

Function credentialFromRefreshable

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

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

Callers 1

Calls 1

cloneTimeFunction · 0.85

Tested by

no test coverage detected