[skip ci] Initial commit — CodexBar Mobile Expo app
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import * as SecureStore from "expo-secure-store";
|
||||
|
||||
const KEYS = {
|
||||
CODEX_AUTH: "codexbar_codex_auth",
|
||||
CLAUDE_SESSION_KEY: "codexbar_claude_session_key",
|
||||
} as const;
|
||||
|
||||
export async function saveCodexAuth(auth: {
|
||||
accessToken: string;
|
||||
accountId?: string;
|
||||
}): Promise<void> {
|
||||
await SecureStore.setItemAsync(KEYS.CODEX_AUTH, JSON.stringify(auth));
|
||||
}
|
||||
|
||||
export async function loadCodexAuth(): Promise<{
|
||||
accessToken: string;
|
||||
accountId?: string;
|
||||
} | null> {
|
||||
const raw = await SecureStore.getItemAsync(KEYS.CODEX_AUTH);
|
||||
if (!raw) return null;
|
||||
return JSON.parse(raw) as { accessToken: string; accountId?: string };
|
||||
}
|
||||
|
||||
export async function saveClaudeSessionKey(key: string): Promise<void> {
|
||||
await SecureStore.setItemAsync(KEYS.CLAUDE_SESSION_KEY, key);
|
||||
}
|
||||
|
||||
export async function loadClaudeSessionKey(): Promise<string | null> {
|
||||
return SecureStore.getItemAsync(KEYS.CLAUDE_SESSION_KEY);
|
||||
}
|
||||
|
||||
export async function clearCodexAuth(): Promise<void> {
|
||||
await SecureStore.deleteItemAsync(KEYS.CODEX_AUTH);
|
||||
}
|
||||
|
||||
export async function clearClaudeSessionKey(): Promise<void> {
|
||||
await SecureStore.deleteItemAsync(KEYS.CLAUDE_SESSION_KEY);
|
||||
}
|
||||
Reference in New Issue
Block a user