MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / readCodexAuthTokens

Function readCodexAuthTokens

packages/codex-native-api/src/auth_state.ts:237–246  ·  view source on GitHub ↗
(raw: Record<string, unknown>)

Source from the content-addressed store, hash-verified

235}
236
237function 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
248function readJwtExpiryMs(payload: Record<string, any> | null): number | null {
249 const rawExp = payload?.exp;

Callers 1

readCodexAuthStateFunction · 0.70

Calls 2

isRecordFunction · 0.70
firstStringFunction · 0.70

Tested by

no test coverage detected