|
7 | 7 | - Posture: interactive local experiential QA of the first live commercial (testnet) experience; app runs locally (`pnpm -C uapi dev:remote`) against the staging Supabase project; wallet network testnet4 |
8 | 8 | - Source-safety posture: source-safe evidence only; no secrets, protected source, provider payloads, wallet material, service-role keys, database credentials, or raw private prompts are serialized here. |
9 | 9 |
|
| 10 | +## Local-development auth environment (decided 2026-07-05) |
| 11 | + |
| 12 | +A DEDICATED Supabase project for local development, replacing the shared |
| 13 | +staging project for local QA. Topology law: `localhost:3000` for as much as |
| 14 | +possible; `testnet.bitcode.exchange` only for functionality Supabase's cloud |
| 15 | +must reach server-to-server. |
| 16 | + |
| 17 | +- **Auth URL configuration (new project):** Site URL `http://localhost:3000`; |
| 18 | + Redirect URLs (exact, query-free per the allow-list law): |
| 19 | + `http://localhost:3000/tps/supabase/callback` (+ `:3001` variant if used). |
| 20 | +- **Custom provider `custom:bitcode-bitcoin` (manual configuration):** |
| 21 | + - Authorization URL: `http://localhost:3000/tps/wallet/authorize` — |
| 22 | + BROWSER hop, so localhost works and the wallet-proof page runs local code |
| 23 | + with local wallets. |
| 24 | + - Token URL: `https://testnet.bitcode.exchange/api/wallet/oauth/token` — |
| 25 | + called SERVER-side by Supabase cloud; must be publicly reachable. |
| 26 | + - Userinfo URL: `https://testnet.bitcode.exchange/api/wallet/oauth/userinfo` |
| 27 | + — same server-side constraint. |
| 28 | + - JWKS URI: `https://testnet.bitcode.exchange/.well-known/jwks.json`. |
| 29 | + - Client ID `bitcode-bitcoin-wallet`; Allow users without email: on. |
| 30 | +- **Shared-secret law:** the authorization code is a stateless HMAC token, so |
| 31 | + ONE `BITCODE_BITCOIN_OAUTH_CLIENT_SECRET` value must be shared by (a) the |
| 32 | + provider Client Secret in the new Supabase project, (b) the |
| 33 | + `testnet.bitcode.exchange` deployment env, and (c) local `.env.local` — |
| 34 | + a locally minted code must verify at the testnet token endpoint. |
| 35 | +- **testnet host requirement:** `testnet.bitcode.exchange`'s env must accept |
| 36 | + the new project's callback as a redirect target |
| 37 | + (`NEXT_PUBLIC_SUPABASE_URL`/`SUPABASE_URL` pointing at the new project, or |
| 38 | + the project origin listed in `BITCODE_BITCOIN_OAUTH_ALLOWED_REDIRECT_ORIGINS`) |
| 39 | + — `isAllowedBitcoinWalletOAuthRedirectUri` reads those. |
| 40 | +- **Local `.env.local` switch:** `NEXT_PUBLIC_SUPABASE_URL` + anon key → the |
| 41 | + new project; `BITCODE_BITCOIN_OAUTH_CLIENT_SECRET` → the shared value. |
| 42 | +- **Browser prerequisite (root-caused 2026-07-05):** Chrome's "Pop-ups and |
| 43 | + redirects" must be allowed for the app origin — "Don't allow" silently |
| 44 | + cancels the programmatic `signInWithOAuth` navigation (URL built, request |
| 45 | + never leaves the page; the panel's 8s watchdog + manual-continuation link |
| 46 | + surface exactly this). |
| 47 | + |
10 | 48 | ## Testnet BTC resources |
11 | 49 |
|
12 | 50 | - Faucet (testnet4): https://coinfaucet.eu/en/btc-testnet4/ |
|
0 commit comments