stellar-drive 1.2.28 → 1.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +146 -20
  2. package/dist/auth/deviceVerification.d.ts +39 -29
  3. package/dist/auth/deviceVerification.d.ts.map +1 -1
  4. package/dist/auth/deviceVerification.js +84 -63
  5. package/dist/auth/deviceVerification.js.map +1 -1
  6. package/dist/auth/resolveAuthState.d.ts.map +1 -1
  7. package/dist/auth/resolveAuthState.js +20 -0
  8. package/dist/auth/resolveAuthState.js.map +1 -1
  9. package/dist/auth/singleUser.d.ts.map +1 -1
  10. package/dist/auth/singleUser.js +32 -88
  11. package/dist/auth/singleUser.js.map +1 -1
  12. package/dist/bin/install-pwa.d.ts.map +1 -1
  13. package/dist/bin/install-pwa.js +3297 -966
  14. package/dist/bin/install-pwa.js.map +1 -1
  15. package/dist/demo.d.ts +7 -0
  16. package/dist/demo.d.ts.map +1 -1
  17. package/dist/demo.js +49 -1
  18. package/dist/demo.js.map +1 -1
  19. package/dist/engine.d.ts.map +1 -1
  20. package/dist/engine.js +42 -0
  21. package/dist/engine.js.map +1 -1
  22. package/dist/entries/toast.d.ts +12 -0
  23. package/dist/entries/toast.d.ts.map +1 -0
  24. package/dist/entries/toast.js +11 -0
  25. package/dist/entries/toast.js.map +1 -0
  26. package/dist/kit/confirm.d.ts +1 -1
  27. package/dist/kit/confirm.d.ts.map +1 -1
  28. package/dist/kit/confirm.js +2 -2
  29. package/dist/kit/confirm.js.map +1 -1
  30. package/dist/kit/server.js +2 -2
  31. package/dist/kit/server.js.map +1 -1
  32. package/dist/realtime.d.ts.map +1 -1
  33. package/dist/realtime.js +58 -1
  34. package/dist/realtime.js.map +1 -1
  35. package/dist/schema.d.ts.map +1 -1
  36. package/dist/schema.js +1 -0
  37. package/dist/schema.js.map +1 -1
  38. package/dist/stores/toast.d.ts +40 -0
  39. package/dist/stores/toast.d.ts.map +1 -0
  40. package/dist/stores/toast.js +39 -0
  41. package/dist/stores/toast.js.map +1 -0
  42. package/package.json +17 -1
  43. package/src/components/GlobalToast.svelte +251 -0
  44. package/src/components/OfflineBanner.svelte +123 -0
  45. package/src/components/OfflineToast.svelte +168 -0
package/README.md CHANGED
@@ -52,7 +52,7 @@ Building offline-first sync is notoriously difficult. stellar-drive handles the
52
52
  - **Diagnostics** -- Comprehensive runtime diagnostics covering sync, queue, realtime, conflicts, egress, and network state.
53
53
  - **Debug utilities** -- Opt-in debug logging and `window` debug utilities for browser console inspection during development.
54
54
  - **SvelteKit integration** (optional) -- Layout helpers, server handlers, email confirmation, service worker lifecycle, and auth hydration.
55
- - **PWA scaffolding CLI** -- `stellar-drive install pwa` generates a complete SvelteKit PWA project (34+ files) with an interactive walkthrough.
55
+ - **PWA scaffolding CLI** -- `stellar-drive install pwa` generates a fully wired SvelteKit PWA skeleton (51 files) with auth, PIN gate, device verification, profile page, demo mode, adaptive navbar, and PWA plumbing pre-connected.
56
56
 
57
57
  ### Use cases
58
58
 
@@ -402,31 +402,156 @@ See [API Reference -- Vite Plugin](./API_REFERENCE.md#vite-plugin-stellarpwa) fo
402
402
 
403
403
  ### Install PWA
404
404
 
405
- Scaffold a complete offline-first SvelteKit PWA project with an interactive walkthrough:
405
+ Scaffold a complete offline-first SvelteKit PWA skeleton with an interactive walkthrough:
406
406
 
407
407
  ```bash
408
408
  npx stellar-drive install pwa
409
409
  ```
410
410
 
411
- The wizard prompts for:
411
+ Run this in an empty directory. The wizard collects four inputs, installs dependencies, and writes 51 files — a fully wired skeleton that passes `npm run validate` and `npm run cleanup` out of the box.
412
+
413
+ #### Wizard prompts
412
414
 
413
415
  | Prompt | Required | Description |
414
416
  |--------|----------|-------------|
415
- | App Name | Yes | Full app name (e.g., "Stellar Planner") |
416
- | Short Name | Yes | Short name for PWA home screen (under 12 chars) |
417
- | Prefix | Yes | Lowercase key for localStorage, caches, SW, and Supabase table names (auto-suggested from name) |
418
- | Description | No | App description (default: "A self-hosted offline-first PWA") |
419
-
420
- Generates **34+ files** for a production-ready SvelteKit 2 + Svelte 5 project:
421
-
422
- - **Config files (8):** `vite.config.ts`, `tsconfig.json`, `svelte.config.js`, `eslint.config.js`, `.prettierrc`, `.prettierignore`, `knip.json`, `.gitignore`
423
- - **Documentation (3):** `README.md`, `ARCHITECTURE.md`, `FRAMEWORKS.md`
424
- - **Static assets (13):** `manifest.json`, `offline.html`, placeholder SVG icons, email template placeholders
425
- - **Database (1):** `supabase-schema.sql` with helper functions, example tables, and `trusted_devices` table
426
- - **Source files (2):** `src/app.html` (PWA-ready with iOS meta tags, SW registration), `src/app.d.ts`
427
- - **Route files (16):** Root layout, login, setup, profile, protected area, API endpoints, catch-all redirect
428
- - **Library (1):** `src/lib/types.ts` with re-exports and app-specific type stubs
429
- - **Git hooks (1):** `.husky/pre-commit` with lint + format + validate
417
+ | App Name | Yes | Full app name (e.g., "Stellar Planner"). Used in page titles, manifest, and email templates. |
418
+ | Short Name | Yes | Condensed name for the PWA home-screen icon (12 chars max). |
419
+ | Prefix | Yes | Lowercase key used for localStorage, caches, the service worker scope, and Supabase table prefixes. Auto-suggested from the app name. |
420
+ | Description | No | One-line description shown in the manifest (default: `"A self-hosted offline-first PWA"`). |
421
+
422
+ #### What gets generated 51 files
423
+
424
+ **Project config (10)**
425
+
426
+ | File | Purpose |
427
+ |------|---------|
428
+ | `package.json` | All deps and scripts pre-configured: `dev`, `build`, `validate`, `cleanup` |
429
+ | `vite.config.ts` | `stellarPWA` plugin wired with your prefix; schema generation enabled |
430
+ | `tsconfig.json` | Extends SvelteKit's generated config with strict mode |
431
+ | `svelte.config.js` | `adapter-auto` + `vitePreprocess` |
432
+ | `eslint.config.js` | TypeScript-aware ESLint with Svelte plugin |
433
+ | `.prettierrc` | Consistent formatting rules |
434
+ | `.prettierignore` | Ignores build artifacts and generated files |
435
+ | `knip.json` | Dead-code detection configured for SvelteKit |
436
+ | `.gitignore` | Node, SvelteKit, and environment file ignores |
437
+ | `.env.example` | Template for `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY` |
438
+
439
+ **Documentation (3)**
440
+
441
+ | File | Purpose |
442
+ |------|---------|
443
+ | `README.md` | Project-level readme linking architecture and framework docs |
444
+ | `ARCHITECTURE.md` | Directory layout, data flow, and module responsibilities |
445
+ | `FRAMEWORKS.md` | Technology choices, rationale, and Svelte 5 rune patterns |
446
+
447
+ **Git hooks (1)**
448
+
449
+ | File | Purpose |
450
+ |------|---------|
451
+ | `.husky/pre-commit` | Runs `npm run cleanup && npm run validate && git add -u` before every commit |
452
+
453
+ **Static assets (12)**
454
+
455
+ | File | Purpose |
456
+ |------|---------|
457
+ | `static/manifest.json` | PWA manifest with all icon sizes and display settings |
458
+ | `static/offline.html` | Offline fallback shown by the service worker |
459
+ | `static/icons/app.svg` | Green primary app icon (letter placeholder) |
460
+ | `static/icons/app-dark.svg` | Dark variant for light-mode context |
461
+ | `static/icons/maskable.svg` | Maskable icon for Android home screens |
462
+ | `static/icons/favicon.svg` | Browser tab favicon |
463
+ | `static/icons/monochrome.svg` | Monochrome icon for notification badges |
464
+ | `static/icons/splash.svg` | Splash screen icon |
465
+ | `static/icons/apple-touch.svg` | iOS Add-to-Home-Screen icon |
466
+ | `static/signup-email.html` | Signup confirmation email template |
467
+ | `static/change-email.html` | Email change confirmation template |
468
+ | `static/device-verification-email.html` | Device trust OTP email template |
469
+
470
+ **App core (2)**
471
+
472
+ | File | Purpose |
473
+ |------|---------|
474
+ | `src/app.html` | PWA shell: iOS meta tags, theme color, service-worker registration script |
475
+ | `src/app.d.ts` | SvelteKit ambient types (`App.Locals`, `App.PageData`) |
476
+
477
+ **Routes (16)**
478
+
479
+ | Route | File(s) | What it does |
480
+ |-------|---------|-------------|
481
+ | Root layout | `+layout.ts`, `+layout.svelte` | Engine bootstrap, auth resolution, adaptive navbar (top on desktop / bottom on mobile), sync status, offline toast, demo banner, PWA update prompt |
482
+ | Home | `+page.svelte` | Protected placeholder — add your app content here |
483
+ | Error | `+error.svelte` | SvelteKit error page with retry and home link |
484
+ | Login | `login/+page.svelte` | PIN-based login, device linking, device verification email flow, BroadcastChannel handshake, persistent lockout countdown |
485
+ | Email confirm | `confirm/+page.svelte` | Verifies Supabase email OTP, broadcasts `AUTH_CONFIRMED` to the login tab, then closes or redirects |
486
+ | Setup (initial) | `setup/+page.ts`, `setup/+page.svelte` | Multi-step wizard: Supabase credentials → validate → deploy schema → create account. Guarded by `resolveSetupAccess()` — only accessible before a user account exists. |
487
+ | Reconfigure | `setup/Reconfigure.svelte` | Single-page re-setup form for changing credentials after initial setup. Accessible from the profile settings. |
488
+ | Profile | `profile/+page.svelte` | Full settings hub: display name, email change (with re-verification), PIN/code change, trusted devices list with revocation, debug mode toggle, diagnostics dashboard (sync, realtime, queue, egress, errors), reset database |
489
+ | Demo | `demo/+page.svelte` | Toggle demo mode on/off with explanation and confirmation; triggers full page reload |
490
+ | Privacy policy | `policy/+page.svelte` | Static placeholder — replace with your actual policy |
491
+ | Config API | `api/config/+server.ts` | Returns `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY` to the client |
492
+ | Setup deploy | `api/setup/deploy/+server.ts` | Writes `.env` during initial setup, creates Supabase auth user + pushes schema SQL |
493
+ | Setup validate | `api/setup/validate/+server.ts` | Validates Supabase credentials without writing anything |
494
+ | Catch-all | `[...catchall]/+page.server.ts` | 302 redirect to `/` for unknown URLs |
495
+
496
+ **Library (7)**
497
+
498
+ | File | Purpose |
499
+ |------|---------|
500
+ | `src/lib/routes.ts` | `ROUTES` constants for all app paths — single source of truth |
501
+ | `src/lib/schema.ts` | Example schema with two tables (`items`, `settings`); replace with your domain schema |
502
+ | `src/lib/types.generated.ts` | Placeholder for Vite-plugin-generated TypeScript interfaces |
503
+ | `src/lib/types.ts` | App-specific type stubs and re-exports |
504
+ | `src/lib/components/UpdatePrompt.svelte` | PWA update prompt that appears when a new service worker is waiting |
505
+ | `src/lib/demo/mockData.ts` | Mock data seeded into the demo database on each page load |
506
+ | `src/lib/demo/config.ts` | Demo configuration wired into `initEngine()` |
507
+
508
+ #### What's pre-wired
509
+
510
+ The skeleton is not just file stubs — the entire auth and engine lifecycle is already connected:
511
+
512
+ - **Engine bootstrap** — `initEngine()` in `+layout.ts` with your prefix, name, and demo config; `initConfig()` pulls Supabase credentials from `/api/config` at runtime
513
+ - **Auth resolution** — `resolveRootLayout()` in the layout load determines `authMode` (`'none'` | `'offline'` | `'demo'`) and redirects unauthenticated users to login
514
+ - **Single-user PIN gate** — login page handles first-time setup detection, `unlockSingleUser`, `setupSingleUser` inside the login flow, device linking, and persistent lockout
515
+ - **Device verification** — email OTP flow fully wired through login → confirm → BroadcastChannel → login tab reaction
516
+ - **Setup wizard** — multi-step Supabase credential entry, live validation, schema deploy, and user account creation; guarded so it only appears before initial setup
517
+ - **Profile page** — change name, email (with re-verification cooldown and resend), PIN, revoke trusted devices, toggle debug mode, full diagnostics panel, and reset database
518
+ - **Demo mode** — sandboxed IndexedDB, zero Supabase calls, mock profile, seeded data; toggle from `/demo` or profile settings
519
+ - **Adaptive navbar** — top bar on ≥768px, fixed bottom bar on mobile; active state driven by SvelteKit's `page` store; Dynamic Island safe area padding
520
+ - **PWA plumbing** — service worker via `stellarPWA` Vite plugin, Web App Manifest, offline fallback, `UpdatePrompt` for background updates, iOS splash/touch icons
521
+ - **Email templates** — Supabase-compatible HTML templates for signup, email change, and device verification; drop-in replacements for the default Supabase emails
522
+
523
+ #### Design theme
524
+
525
+ The skeleton uses a minimal green theme derived from the email templates:
526
+
527
+ | Token | Value | Use |
528
+ |-------|-------|-----|
529
+ | Primary | `#6B9E6B` | Buttons, active nav, focus rings, borders |
530
+ | Card background | `#0f0f1e` | Modal and card surfaces |
531
+ | Page background | `#111116` | App background |
532
+ | Card border | `#3d5a3d` | Card outlines |
533
+ | Text | `#f0f0ff` | Primary text |
534
+ | Text secondary | `#c8c8e0` | Descriptions, labels |
535
+ | Text muted | `#7878a0` | Hints, timestamps |
536
+
537
+ All colors are CSS custom properties — override `:root` in your app's global CSS to adopt any theme.
538
+
539
+ #### Building on the skeleton
540
+
541
+ After scaffolding, the typical customisation path is:
542
+
543
+ 1. **Define your schema** — edit `src/lib/schema.ts` to replace the example tables with your domain entities; the Vite plugin auto-generates TypeScript interfaces and pushes Supabase migrations on `npm run dev`
544
+ 2. **Add app pages** — create new routes under `src/routes/`; import stores and CRUD helpers from `stellar-drive`
545
+ 3. **Wire stores** — in `+page.svelte`, create collection/detail stores with `createCollectionStore` / `createDetailStore` and refresh them with `onSyncComplete`
546
+ 4. **Customise the navbar** — the root layout's navbar lists only the home and profile links; add your app's sections to the `navItems` array in `+layout.svelte`
547
+ 5. **Replace placeholder content** — swap the privacy policy text, update icon SVGs with your actual branding, and fill in the demo mock data with representative records
548
+ 6. **Set environment variables** — copy `.env.example` to `.env` and add your Supabase project URL and publishable key; run the setup wizard on first launch to push the schema
549
+
550
+ #### Prerequisites
551
+
552
+ - Node.js ≥ 18
553
+ - A [Supabase](https://supabase.com) project (free tier is sufficient)
554
+ - `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY` from the Supabase dashboard (Settings → API)
430
555
 
431
556
  ---
432
557
 
@@ -450,7 +575,8 @@ Import only what you need:
450
575
  | `stellar-drive/config` | Runtime config management (`initConfig`, `getConfig`, `setConfig`, `getDexieTableFor`) |
451
576
  | `stellar-drive/vite` | Vite plugin (`stellarPWA`) for service worker builds, asset manifests, and schema auto-generation |
452
577
  | `stellar-drive/kit` | SvelteKit helpers: server route factories, layout loaders, email confirmation, SW lifecycle, auth hydration |
453
- | `stellar-drive/components/*` | Svelte components: `SyncStatus`, `DeferredChangesBanner`, `DemoBanner`, `DemoBlockedMessage` |
578
+ | `stellar-drive/toast` | Toast notifications: `addToast`, `dismissToast`, `toastStore`, `ToastVariant` type |
579
+ | `stellar-drive/components/*` | Svelte components: `SyncStatus`, `DeferredChangesBanner`, `DemoBanner`, `DemoBlockedMessage`, `OfflineToast`, `GlobalToast` |
454
580
 
455
581
  ### Key categories at a glance
456
582
 
@@ -460,7 +586,7 @@ Import only what you need:
460
586
 
461
587
  **CRUD and queries:** `engineCreate`, `engineUpdate`, `engineDelete`, `engineIncrement`, `engineBatchWrite`, `engineGetOrCreate`, `queryAll`, `queryOne`, `engineGet`, `markEntityModified`
462
588
 
463
- **Authentication:** `resolveAuthState`, `signOut`, `getValidSession`, `setupSingleUser`, `unlockSingleUser`, `lockSingleUser`, `resetSingleUser`, device verification functions, display helpers (`resolveFirstName`, `resolveUserId`, `resolveAvatarInitial`)
589
+ **Authentication:** `resolveAuthState`, `signOut`, `getValidSession`, `setupSingleUser`, `unlockSingleUser`, `lockSingleUser` (voluntary soft-lock only — use `signOut` in `onAuthKicked`), `resetSingleUser`, device verification functions, display helpers (`resolveFirstName`, `resolveUserId`, `resolveAvatarInitial`)
464
590
 
465
591
  **Reactive stores:** `syncStatusStore`, `authState`, `isAuthenticated`, `userDisplayInfo`, `isOnline`, `remoteChangesStore`, `createCollectionStore`, `createDetailStore`, `onSyncComplete`, `onRealtimeDataUpdate`
466
592
 
@@ -16,11 +16,13 @@
16
16
  * days (default: 90). The `last_used_at` column is refreshed on each
17
17
  * successful login via {@link touchTrustedDevice}.
18
18
  * - **OTP flow**: Uses Supabase `signInWithOtp()` with `shouldCreateUser: false`
19
- * to send a magic link email. The confirm page verifies the token and trusts
20
- * both the originating device and the confirming device.
21
- * - **Cross-device verification**: The originating device's ID is stored in
22
- * `user_metadata` as `pending_{prefix}_device_id` so the confirm page can trust it
23
- * even when opened on a different device (e.g., phone).
19
+ * to send a magic link email. The originating device's ID and label are
20
+ * embedded directly in the `emailRedirectTo` URL as query params
21
+ * (`pending_device_id`, `pending_device_label`). The confirm page reads them
22
+ * from the URL and trusts exactly that device no shared mutable state.
23
+ * - **Cross-device verification**: Because the device ID travels inside the
24
+ * email link itself, each OTP is 1:1 with its originating device. Concurrent
25
+ * OTPs from multiple devices are fully isolated with no race condition.
24
26
  *
25
27
  * ## Database Schema
26
28
  *
@@ -48,6 +50,12 @@
48
50
  * and security. Reduce this for higher-security applications.
49
51
  * - **RLS**: The `trusted_devices` table should have Row Level Security
50
52
  * policies ensuring users can only read/write their own device records.
53
+ * - **URL param trust**: `pending_device_id` travels in the email link URL.
54
+ * It controls only which device is trusted after a valid `token_hash`
55
+ * verification — not whether trust is granted at all. Tampering with this
56
+ * param requires intercepting the email delivery chain, which already gives
57
+ * full account compromise via the token itself. `pending_device_label` is
58
+ * capped at 100 characters before storage to prevent oversized DB writes.
51
59
  *
52
60
  * @module deviceVerification
53
61
  * @see {@link singleUser} for how device verification integrates into the auth flow
@@ -130,7 +138,7 @@ export declare function isDeviceTrusted(userId: string): Promise<boolean>;
130
138
  * await trustCurrentDevice(user.id);
131
139
  * ```
132
140
  *
133
- * @see {@link trustPendingDevice} for trusting a remote device via user_metadata
141
+ * @see {@link trustPendingDevice} for trusting the originating device after OTP confirmation
134
142
  */
135
143
  export declare function trustCurrentDevice(userId: string): Promise<void>;
136
144
  /**
@@ -185,12 +193,13 @@ export declare function removeTrustedDevice(id: string): Promise<void>;
185
193
  /**
186
194
  * Send a device verification OTP email to the user.
187
195
  *
188
- * This function performs two actions:
189
- * 1. **Stores pending device info** in Supabase `user_metadata` so that the
190
- * confirm page can trust the originating device even if the link is opened
191
- * on a different device.
192
- * 2. **Sends an OTP email** via `signInWithOtp()` with `shouldCreateUser: false`
193
- * to prevent account creation through this endpoint.
196
+ * Builds an `emailRedirectTo` URL containing the originating device's ID and
197
+ * label as query params (`pending_device_id`, `pending_device_label`), then
198
+ * sends an OTP email via `signInWithOtp()` with `shouldCreateUser: false` to
199
+ * prevent account creation through this endpoint.
200
+ *
201
+ * Each email is 1:1 with the device that sent it — no shared `user_metadata`
202
+ * field, so concurrent OTPs from multiple devices cannot interfere.
194
203
  *
195
204
  * The existing session is intentionally kept alive so that
196
205
  * {@link pollDeviceVerification} can continue checking trust status.
@@ -211,35 +220,36 @@ export declare function sendDeviceVerification(email: string): Promise<{
211
220
  error: string | null;
212
221
  }>;
213
222
  /**
214
- * Trust the pending device stored in `user_metadata`.
223
+ * Trust the device that originated a verification OTP.
215
224
  *
216
- * Called from the confirm page after a device OTP is verified. This function
217
- * trusts the ORIGINATING device (the one that entered the PIN and triggered
218
- * verification), not necessarily the device opening the confirmation link.
225
+ * Called from the confirm page after a device OTP is verified. Accepts the
226
+ * originating device ID and label directly from the email redirect URL — no
227
+ * shared `user_metadata` field, so concurrent OTPs from multiple devices
228
+ * each trust only their own originating device.
219
229
  *
220
230
  * ## Cross-Device Flow
221
231
  *
222
- * 1. Device A enters the PIN -> untrusted -> OTP sent, device A's ID stored
223
- * in `user_metadata.pending_{prefix}_device_id`.
224
- * 2. User opens the OTP link on Device B (or Device A).
225
- * 3. This function reads `pending_{prefix}_device_id` from metadata and trusts Device A.
226
- * 4. Device A polls via {@link pollDeviceVerification} and discovers it's now trusted.
227
- * 5. Only Device A is trusted — the confirming device (B) is NOT added, since
228
- * the user never signed into the app on that device.
232
+ * 1. Device A sends OTP redirect URL contains Device A's ID as query params.
233
+ * 2. User opens the link (on Device A or Device B).
234
+ * 3. Confirm page passes `pendingDeviceId` / `pendingDeviceLabel` here.
235
+ * 4. This function upserts only Device A into `trusted_devices`.
236
+ * 5. Device A polls via {@link pollDeviceVerification} and discovers it's now trusted.
237
+ *
238
+ * If `pendingDeviceId` is not provided (edge case: old-format links), falls
239
+ * back to trusting the current device.
229
240
  *
230
- * If no `pending_{prefix}_device_id` is found in metadata (same-browser case where the
231
- * link was opened in the same browser), falls back to trusting the current
232
- * device only.
241
+ * @param pendingDeviceId - Device ID from the email redirect URL query param.
242
+ * @param pendingDeviceLabel - Device label from the email redirect URL query param.
233
243
  *
234
244
  * @example
235
245
  * ```ts
236
246
  * // Called from the /confirm page after OTP verification:
237
- * await trustPendingDevice();
247
+ * await trustPendingDevice(pendingDeviceId, pendingDeviceLabel);
238
248
  * ```
239
249
  *
240
- * @see {@link sendDeviceVerification} which stores the pending device ID
250
+ * @see {@link sendDeviceVerification} which embeds the device ID in the redirect URL
241
251
  */
242
- export declare function trustPendingDevice(): Promise<void>;
252
+ export declare function trustPendingDevice(pendingDeviceId?: string, pendingDeviceLabel?: string): Promise<void>;
243
253
  /**
244
254
  * Verify a device verification OTP token hash from an email link.
245
255
  *
@@ -1 +1 @@
1
- {"version":3,"file":"deviceVerification.d.ts","sourceRoot":"","sources":["../../src/auth/deviceVerification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAuE9C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAyBvC;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS/C;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiCtE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BtE;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBtE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAoBhF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAanE;AAMD;;;;;;;;;;;;;;;;;;;;;;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BG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAoBhF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAanE;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAkD7F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,kBAAkB,CACtC,eAAe,CAAC,EAAE,MAAM,EACxB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CA0Df;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAmB3F;AAMD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
@@ -16,11 +16,13 @@
16
16
  * days (default: 90). The `last_used_at` column is refreshed on each
17
17
  * successful login via {@link touchTrustedDevice}.
18
18
  * - **OTP flow**: Uses Supabase `signInWithOtp()` with `shouldCreateUser: false`
19
- * to send a magic link email. The confirm page verifies the token and trusts
20
- * both the originating device and the confirming device.
21
- * - **Cross-device verification**: The originating device's ID is stored in
22
- * `user_metadata` as `pending_{prefix}_device_id` so the confirm page can trust it
23
- * even when opened on a different device (e.g., phone).
19
+ * to send a magic link email. The originating device's ID and label are
20
+ * embedded directly in the `emailRedirectTo` URL as query params
21
+ * (`pending_device_id`, `pending_device_label`). The confirm page reads them
22
+ * from the URL and trusts exactly that device no shared mutable state.
23
+ * - **Cross-device verification**: Because the device ID travels inside the
24
+ * email link itself, each OTP is 1:1 with its originating device. Concurrent
25
+ * OTPs from multiple devices are fully isolated with no race condition.
24
26
  *
25
27
  * ## Database Schema
26
28
  *
@@ -48,6 +50,12 @@
48
50
  * and security. Reduce this for higher-security applications.
49
51
  * - **RLS**: The `trusted_devices` table should have Row Level Security
50
52
  * policies ensuring users can only read/write their own device records.
53
+ * - **URL param trust**: `pending_device_id` travels in the email link URL.
54
+ * It controls only which device is trusted after a valid `token_hash`
55
+ * verification — not whether trust is granted at all. Tampering with this
56
+ * param requires intercepting the email delivery chain, which already gives
57
+ * full account compromise via the token itself. `pending_device_label` is
58
+ * capped at 100 characters before storage to prevent oversized DB writes.
51
59
  *
52
60
  * @module deviceVerification
53
61
  * @see {@link singleUser} for how device verification integrates into the auth flow
@@ -57,6 +65,7 @@ import { supabase } from '../supabase/client';
57
65
  import { getDeviceId, waitForDeviceId } from '../deviceId';
58
66
  import { debugLog, debugWarn, debugError } from '../debug';
59
67
  import { isDemoMode } from '../demo';
68
+ import { getDb, TABLE } from '../database';
60
69
  /** Default number of days a device remains trusted before requiring re-verification. */
61
70
  const DEFAULT_TRUST_DURATION_DAYS = 90;
62
71
  // =============================================================================
@@ -268,7 +277,7 @@ export async function isDeviceTrusted(userId) {
268
277
  * await trustCurrentDevice(user.id);
269
278
  * ```
270
279
  *
271
- * @see {@link trustPendingDevice} for trusting a remote device via user_metadata
280
+ * @see {@link trustPendingDevice} for trusting the originating device after OTP confirmation
272
281
  */
273
282
  export async function trustCurrentDevice(userId) {
274
283
  if (isDemoMode())
@@ -404,12 +413,13 @@ export async function removeTrustedDevice(id) {
404
413
  /**
405
414
  * Send a device verification OTP email to the user.
406
415
  *
407
- * This function performs two actions:
408
- * 1. **Stores pending device info** in Supabase `user_metadata` so that the
409
- * confirm page can trust the originating device even if the link is opened
410
- * on a different device.
411
- * 2. **Sends an OTP email** via `signInWithOtp()` with `shouldCreateUser: false`
412
- * to prevent account creation through this endpoint.
416
+ * Builds an `emailRedirectTo` URL containing the originating device's ID and
417
+ * label as query params (`pending_device_id`, `pending_device_label`), then
418
+ * sends an OTP email via `signInWithOtp()` with `shouldCreateUser: false` to
419
+ * prevent account creation through this endpoint.
420
+ *
421
+ * Each email is 1:1 with the device that sent it — no shared `user_metadata`
422
+ * field, so concurrent OTPs from multiple devices cannot interfere.
413
423
  *
414
424
  * The existing session is intentionally kept alive so that
415
425
  * {@link pollDeviceVerification} can continue checking trust status.
@@ -431,23 +441,35 @@ export async function sendDeviceVerification(email) {
431
441
  return { error: null };
432
442
  try {
433
443
  /* Ensure the IDB recovery attempt has completed so the device ID we
434
- embed in user_metadata is the recovered UUID, not a fresh one. */
444
+ embed in the redirect URL is the recovered UUID, not a fresh one. */
435
445
  await waitForDeviceId();
436
- /* Store the pending device info in user_metadata so the confirm page
437
- can trust THIS device even if the link is opened on a different one.
438
- This enables the cross-device verification pattern. */
439
446
  const deviceId = getDeviceId();
440
447
  const deviceLabel = getDeviceLabel();
441
- const prefix = getEngineConfig().prefix;
442
- await supabase.auth.updateUser({
443
- data: {
444
- [`pending_${prefix}_device_id`]: deviceId,
445
- [`pending_${prefix}_device_label`]: deviceLabel
446
- }
448
+ /* Build a redirect URL with the originating device's ID baked in as
449
+ query params. Each OTP email is 1:1 with the device that sent it —
450
+ no shared user_metadata field, no race condition possible. */
451
+ const path = getEngineConfig().auth?.confirmRedirectPath || '/confirm';
452
+ const base = typeof window !== 'undefined' ? `${window.location.origin}${path}` : path;
453
+ const redirectUrl = new URL(base);
454
+ redirectUrl.searchParams.set('pending_device_id', deviceId);
455
+ redirectUrl.searchParams.set('pending_device_label', deviceLabel);
456
+ /* Write app_name and app_domain just before sending the OTP so that
457
+ email templates ({{ .Data.app_name }}, {{ .Data.app_domain }}) resolve
458
+ to the correct app. This is the only safe place to write these fields —
459
+ doing it at unlock time would clobber them with whichever app ran last,
460
+ since both apps share the same Supabase user. */
461
+ const { name: appName, domain: appDomain } = getEngineConfig();
462
+ await supabase.auth
463
+ .updateUser({ data: { app_name: appName, app_domain: appDomain } })
464
+ .catch((e) => {
465
+ debugWarn('[DeviceVerification] Failed to set app metadata before OTP:', e);
447
466
  });
448
467
  const { error } = await supabase.auth.signInWithOtp({
449
468
  email,
450
- options: { shouldCreateUser: false }
469
+ options: {
470
+ shouldCreateUser: false,
471
+ emailRedirectTo: redirectUrl.toString()
472
+ }
451
473
  });
452
474
  if (error) {
453
475
  debugError('[DeviceVerification] Send OTP failed:', error.message);
@@ -462,35 +484,36 @@ export async function sendDeviceVerification(email) {
462
484
  }
463
485
  }
464
486
  /**
465
- * Trust the pending device stored in `user_metadata`.
487
+ * Trust the device that originated a verification OTP.
466
488
  *
467
- * Called from the confirm page after a device OTP is verified. This function
468
- * trusts the ORIGINATING device (the one that entered the PIN and triggered
469
- * verification), not necessarily the device opening the confirmation link.
489
+ * Called from the confirm page after a device OTP is verified. Accepts the
490
+ * originating device ID and label directly from the email redirect URL — no
491
+ * shared `user_metadata` field, so concurrent OTPs from multiple devices
492
+ * each trust only their own originating device.
470
493
  *
471
494
  * ## Cross-Device Flow
472
495
  *
473
- * 1. Device A enters the PIN -> untrusted -> OTP sent, device A's ID stored
474
- * in `user_metadata.pending_{prefix}_device_id`.
475
- * 2. User opens the OTP link on Device B (or Device A).
476
- * 3. This function reads `pending_{prefix}_device_id` from metadata and trusts Device A.
477
- * 4. Device A polls via {@link pollDeviceVerification} and discovers it's now trusted.
478
- * 5. Only Device A is trusted — the confirming device (B) is NOT added, since
479
- * the user never signed into the app on that device.
496
+ * 1. Device A sends OTP redirect URL contains Device A's ID as query params.
497
+ * 2. User opens the link (on Device A or Device B).
498
+ * 3. Confirm page passes `pendingDeviceId` / `pendingDeviceLabel` here.
499
+ * 4. This function upserts only Device A into `trusted_devices`.
500
+ * 5. Device A polls via {@link pollDeviceVerification} and discovers it's now trusted.
480
501
  *
481
- * If no `pending_{prefix}_device_id` is found in metadata (same-browser case where the
482
- * link was opened in the same browser), falls back to trusting the current
483
- * device only.
502
+ * If `pendingDeviceId` is not provided (edge case: old-format links), falls
503
+ * back to trusting the current device.
504
+ *
505
+ * @param pendingDeviceId - Device ID from the email redirect URL query param.
506
+ * @param pendingDeviceLabel - Device label from the email redirect URL query param.
484
507
  *
485
508
  * @example
486
509
  * ```ts
487
510
  * // Called from the /confirm page after OTP verification:
488
- * await trustPendingDevice();
511
+ * await trustPendingDevice(pendingDeviceId, pendingDeviceLabel);
489
512
  * ```
490
513
  *
491
- * @see {@link sendDeviceVerification} which stores the pending device ID
514
+ * @see {@link sendDeviceVerification} which embeds the device ID in the redirect URL
492
515
  */
493
- export async function trustPendingDevice() {
516
+ export async function trustPendingDevice(pendingDeviceId, pendingDeviceLabel) {
494
517
  if (isDemoMode())
495
518
  return;
496
519
  try {
@@ -499,45 +522,43 @@ export async function trustPendingDevice() {
499
522
  debugWarn('[DeviceVerification] trustPendingDevice: no user');
500
523
  return;
501
524
  }
502
- const prefix = getEngineConfig().prefix;
503
- const pendingDeviceId = user.user_metadata?.[`pending_${prefix}_device_id`];
504
- const pendingDeviceLabel = user.user_metadata?.[`pending_${prefix}_device_label`];
505
525
  if (!pendingDeviceId) {
506
- /* No pending device — fall back to trusting the current device.
507
- This handles the same-browser case where the OTP link is opened
508
- in the same browser that initiated verification. */
526
+ /* No pending device ID in URL — fall back to trusting the current device.
527
+ Covers same-browser flows and any old-format links. */
509
528
  await trustCurrentDevice(user.id);
529
+ try {
530
+ await getDb().table(TABLE.SINGLE_USER_CONFIG).delete('device_revoked');
531
+ }
532
+ catch (e) {
533
+ debugWarn('[DeviceVerification] Failed to clear revocation flag:', e);
534
+ }
510
535
  return;
511
536
  }
512
537
  const now = new Date().toISOString();
513
- /* Trust the originating device (the one that entered the PIN) by
514
- upserting its device ID into the trusted_devices table.
515
- We intentionally do NOT trust the confirming device here — the device
516
- opening the email link is just a messenger (e.g. Firefox on desktop
517
- confirming for a mobile PWA). Only devices the user actually signs
518
- into should appear as trusted. */
538
+ /* Cap label length it comes from a URL param and should not be stored
539
+ verbatim at arbitrary length. getDeviceLabel() produces ~20 chars in
540
+ practice; 100 is generous while preventing oversized DB writes. */
541
+ const safeLabel = (pendingDeviceLabel || 'Unknown device').slice(0, 100);
519
542
  const { error: upsertError } = await supabase.from('trusted_devices').upsert({
520
543
  user_id: user.id,
521
544
  device_id: pendingDeviceId,
522
- device_label: pendingDeviceLabel || 'Unknown device',
545
+ device_label: safeLabel,
523
546
  app_prefix: getAppPrefix(),
524
547
  trusted_at: now,
525
548
  last_used_at: now
526
549
  }, { onConflict: 'user_id,device_id,app_prefix' });
527
550
  if (upsertError) {
528
551
  debugError('[DeviceVerification] trustPendingDevice upsert failed:', upsertError.message);
552
+ return;
529
553
  }
530
- else {
531
- debugLog('[DeviceVerification] Pending device trusted:', pendingDeviceLabel);
554
+ debugLog('[DeviceVerification] Device trusted:', pendingDeviceLabel || pendingDeviceId);
555
+ // Clear any stale revocation flag now that this device is trusted
556
+ try {
557
+ await getDb().table(TABLE.SINGLE_USER_CONFIG).delete('device_revoked');
558
+ }
559
+ catch (e) {
560
+ debugWarn('[DeviceVerification] Failed to clear revocation flag:', e);
532
561
  }
533
- /* Clear pending device from metadata to prevent stale references.
534
- Setting to null removes the keys from user_metadata. */
535
- await supabase.auth.updateUser({
536
- data: {
537
- [`pending_${prefix}_device_id`]: null,
538
- [`pending_${prefix}_device_label`]: null
539
- }
540
- });
541
562
  }
542
563
  catch (e) {
543
564
  debugError('[DeviceVerification] trustPendingDevice error:', e);
@@ -1 +1 @@
1
- {"version":3,"file":"deviceVerification.js","sourceRoot":"","sources":["../../src/auth/deviceVerification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,C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