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

Function readCodexAuthState

packages/codex-native-api/src/auth_state.ts:62–84  ·  view source on GitHub ↗
(
  authPathOrOptions: string | { authPath?: string; env?: NodeJS.ProcessEnv } = {},
)

Source from the content-addressed store, hash-verified

60}
61
62export function readCodexAuthState(
63 authPathOrOptions: string | { authPath?: string; env?: NodeJS.ProcessEnv } = {},
64): CodexAuthState | null {
65 const authPath = resolveRequestedAuthPath(authPathOrOptions);
66 const raw = readJsonObject(authPath);
67 if (!raw) {
68 return null;
69 }
70 const tokens = readCodexAuthTokens(raw);
71 const tokenIdentity = extractCodexTokenIdentity({
72 accessToken: tokens.accessToken,
73 idToken: tokens.idToken,
74 accountId: tokens.accountId,
75 authMode: firstString(raw.auth_mode),
76 });
77 const identity = buildCodexAuthIdentity(raw, tokenIdentity, authPath);
78 return {
79 authPath,
80 raw,
81 tokens,
82 identity,
83 };
84}
85
86export function readCodexAccountIdentity(
87 authPathOrOptions: string | { authPath?: string; env?: NodeJS.ProcessEnv } = {},

Callers 1

readCodexAccountIdentityFunction · 0.70

Calls 6

resolveRequestedAuthPathFunction · 0.70
readJsonObjectFunction · 0.70
readCodexAuthTokensFunction · 0.70
firstStringFunction · 0.70
buildCodexAuthIdentityFunction · 0.70

Tested by

no test coverage detected