goon/mobile/src/storage.ts
goon-foss ad0284585b Initial commit
Goon — self-hosted aggregator for adult-content scene metadata.

Indexes scenes from TPDB, StashDB, and 30+ public adult tube sites.
Cross-source deduplication via perceptual hash + Levenshtein distance.
FastAPI backend + APScheduler worker + React Native (Expo) mobile client.

FOSS, ad-free, donation-funded. See README for details.
2026-05-20 10:10:22 +02:00

26 lines
785 B
TypeScript

import * as SecureStore from 'expo-secure-store';
const URL_KEY = 'goon.backend_url';
const API_KEY = 'goon.api_key';
export interface Credentials {
baseUrl: string;
apiKey: string;
}
export async function loadCredentials(): Promise<Credentials | null> {
const baseUrl = await SecureStore.getItemAsync(URL_KEY);
const apiKey = await SecureStore.getItemAsync(API_KEY);
if (!baseUrl || !apiKey) return null;
return { baseUrl, apiKey };
}
export async function saveCredentials(c: Credentials): Promise<void> {
await SecureStore.setItemAsync(URL_KEY, c.baseUrl);
await SecureStore.setItemAsync(API_KEY, c.apiKey);
}
export async function clearCredentials(): Promise<void> {
await SecureStore.deleteItemAsync(URL_KEY);
await SecureStore.deleteItemAsync(API_KEY);
}