Files
llmapikey/lib/supabase/browser-client.js
T
tiennm99 02fa52ccf9 feat: scaffold OpenRouter key giveaway site (gated, code-only)
- 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
2026-06-13 14:18:52 +07:00

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);
}