recordFromCredential projects a gh.Credential onto the persisted record shape, dropping the runtime-only Source and carrying the access token as AccessToken. It clones the timestamps so the record never aliases the credential's *time.Time values.
(credential gh.Credential)
| 754 | // carrying the access token as AccessToken. It clones the timestamps so the record never aliases the credential's |
| 755 | // *time.Time values. |
| 756 | func recordFromCredential(credential gh.Credential) refreshableTokenRecord { |
| 757 | return refreshableTokenRecord{ |
| 758 | AccessToken: credential.Token, |
| 759 | RefreshToken: credential.RefreshToken, |
| 760 | ExpiresIn: credential.ExpiresIn, |
| 761 | RefreshTokenExpiresIn: credential.RefreshTokenExpiresIn, |
| 762 | ExpiresAt: cloneTime(credential.ExpiresAt), |
| 763 | RefreshTokenExpiresAt: cloneTime(credential.RefreshTokenExpiresAt), |
| 764 | } |
| 765 | } |
| 766 | |
| 767 | // cloneTime returns a pointer to a copy of t, or nil when t is nil, so callers moving timestamps between the record |
| 768 | // and gh.Credential never share the underlying *time.Time. |