File size: 1,649 Bytes
5bd4e3a
 
 
 
 
1444c0a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# @projectos/wallet

Personal-use wallet backend (TEST mode only): double-entry ledger, Stripe test funding
(Checkout / PaymentIntents + signature-verified webhooks), QR-invoice payment routing,
Supabase persistence. See root README "Wallet service" section.

## Web UI

| Page | Purpose |
|---|---|
| `/` | Wallet: balance, add funds (Stripe Checkout), pay invoice by QR payload, transactions, app links |
| `/devices` | Add / remove phones and devices (phone numbers normalised to E.164). Requires sign-in |
| `/settings` | Enter Stripe **test** keys and Supabase URL + service role key, test each connection, switch storage. Requires sign-in |
| `/funding/success`, `/funding/cancel` | Stripe Checkout return pages |

### Admin passcode and secrets

* Set `ADMIN_PASSCODE` (env / Space secret). Without it `/settings` and `/devices` are disabled.
* Secrets typed on `/settings` are held server-side only. They are never returned to the browser (only a masked tail),
  never logged, and error text is redacted. Live Stripe keys (`sk_live_`/`rk_live_`) are refused.
* To survive restarts the server writes them as Hugging Face **Space secrets** using `HF_SPACE_TOKEN` + the
  Space-provided `SPACE_ID` (the Space restarts after a save). Without a token they stay in memory only.
  Prefer a fine-grained token limited to this Space.
* With `WALLET_STORE=memory` balances and devices reset on restart. Run the SQL in `supabase/migrations/`
  (downloadable from `/settings`), then switch storage to `supabase` for durable data.
* `/wallet/test-credit` (signed in) adds simulated test credit so the wallet can be exercised before Stripe is configured.