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)
| 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. |
| 395 | func 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 |
no test coverage detected