# Wallet

Wallet is a private, cross-device document library for CalCorp.

## Prerequisites

1. PocketBase must be running at `https://data.cal3.dev`.
2. The first setup requires a PocketBase superuser email and password. These are used only by the bootstrap script and are never included in the browser app.
3. The static app must be served over HTTP(S), for example with VS Code Live Server or the deployed address `https://wallet.app.cal3.dev`.

## Initialize PocketBase

Run this from the project root:

```bash
PB_URL=https://data.cal3.dev \
PB_ADMIN_EMAIL=admin@example.com \
PB_ADMIN_PASSWORD='your-admin-password' \
node scripts/bootstrap-pocketbase.mjs
```

The script uses the existing PocketBase Auth collection (default: `users`) without modifying it, then creates `wallet_profiles`, `wallet_documents`, and `wallet_document_files` with per-user access rules. Set `PB_AUTH_COLLECTION` if your existing Auth collection has another name. Direct SQL is intentionally not used because PocketBase collection rules and auth fields must be created through its API/migration format.

## Run locally

Open the folder with VS Code Live Server and visit its HTTP URL. Do not open `index.html` with `file://`; service workers and PWA installation require HTTP(S).

Registration is disabled by default in `config.js`:

```js
allowRegistration: false
```

Create the first user through PocketBase Admin, or temporarily set this flag to `true` during initial setup.
