mirror of
https://github.com/tiennm99/llmapikey.git
synced 2026-06-18 00:48:03 +00:00
02fa52ccf9
- Next.js 15 App Router (JS+JSDoc): landing, auth-gated dashboard, docs - GitHub OAuth via Supabase; identity anchored on numeric provider_id - key provisioning: reserve-then-mint-persist-compensate, one key per account - api_keys in unexposed llmapikey schema via direct Postgres; RLS deny-all - live minting gated behind PROVISIONING_ENABLED; Vercel auto-deploy disabled - unit tests (mask, request-body), RLS deny-all test, reconcile script
24 lines
758 B
JavaScript
24 lines
758 B
JavaScript
"use client";
|
|
|
|
import { createBrowserClient } from "@supabase/ssr";
|
|
|
|
/**
|
|
* Browser Supabase client — anon key only.
|
|
*
|
|
* SCOPE: auth UI only (sign-in / sign-out / session). This client MUST NEVER be
|
|
* used to read or write `llmapikey.api_keys`; that table is server-only and the
|
|
* anon role is denied by RLS. See lib/supabase/server-client.js.
|
|
*
|
|
* @returns {import('@supabase/supabase-js').SupabaseClient}
|
|
*/
|
|
export function createBrowserSupabaseClient() {
|
|
const url = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
const anonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY;
|
|
if (!url || !anonKey) {
|
|
throw new Error(
|
|
"Missing NEXT_PUBLIC_SUPABASE_URL or NEXT_PUBLIC_SUPABASE_ANON_KEY",
|
|
);
|
|
}
|
|
return createBrowserClient(url, anonKey);
|
|
}
|