(raw: Record<string, unknown>)
| 235 | } |
| 236 | |
| 237 | function readCodexAuthTokens(raw: Record<string, unknown>): CodexAuthTokens { |
| 238 | const tokenObject = isRecord(raw.tokens) ? raw.tokens : {}; |
| 239 | return { |
| 240 | accessToken: firstString(tokenObject.access_token), |
| 241 | idToken: firstString(tokenObject.id_token), |
| 242 | refreshToken: firstString(tokenObject.refresh_token), |
| 243 | accountId: firstString(tokenObject.account_id, raw.account_id), |
| 244 | lastRefresh: firstString(raw.last_refresh), |
| 245 | }; |
| 246 | } |
| 247 | |
| 248 | function readJwtExpiryMs(payload: Record<string, any> | null): number | null { |
| 249 | const rawExp = payload?.exp; |
no test coverage detected