kitcn 0.33.6 → 0.33.7
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.
- package/CHANGELOG.md +20 -0
- package/dist/aggregate/index.d.ts +1 -1
- package/dist/auth/client/index.d.ts +45 -21
- package/dist/auth/client/index.js +203 -111
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/index.d.ts +19 -19
- package/dist/auth/start/index.js +134 -2
- package/dist/crpc/index.d.ts +2 -2
- package/dist/crpc/index.js +2 -2
- package/dist/{generated-contract-disabled-PdNGvNYP.d.ts → generated-contract-disabled-QZXEzUnd.d.ts} +26 -26
- package/dist/orm/index.d.ts +1 -1
- package/dist/orm/migrations/index.d.ts +1 -1
- package/dist/{query-options-DGG93--5.js → query-options-YkFvau71.js} +6 -2
- package/dist/react/index.js +149 -140
- package/dist/rsc/index.d.ts +1 -1
- package/dist/rsc/index.js +1 -1
- package/dist/solid/index.js +4 -1
- package/dist/{auth-store-x3_wvhTR.js → token-gate-CEzbXArg.js} +178 -1
- package/dist/{types-C7JkpfeY.d.ts → types-Bb0kwteA.d.ts} +5 -1
- package/dist/{where-clause-compiler-BzAJnWt4.d.ts → where-clause-compiler-DAqhUREe.d.ts} +144 -144
- package/package.json +1 -1
- package/skills/kitcn/references/features/auth.md +26 -8
package/package.json
CHANGED
|
@@ -363,7 +363,7 @@ All from `kitcn/react`:
|
|
|
363
363
|
|------|---------|-------------|
|
|
364
364
|
| `useAuth()` | `{ hasSession, isAuthenticated, isLoading }` | Full auth state |
|
|
365
365
|
| `useMaybeAuth()` | `boolean` | Has token (optimistic, may not be verified) |
|
|
366
|
-
| `useIsAuth()` | `boolean` | Server-verified authentication |
|
|
366
|
+
| `useIsAuth()` | `boolean` | Server-verified authentication (with `optimisticAuth`, also during the optimistic window) |
|
|
367
367
|
| `useAuthGuard()` | `() => boolean` | Guard mutations, returns true if blocked |
|
|
368
368
|
| `useConvexAuthRecovery()` | `{ recover, status, error }` | Rebind Convex auth after a transient token failure |
|
|
369
369
|
|
|
@@ -389,7 +389,7 @@ All from `kitcn/react`:
|
|
|
389
389
|
| Component | Renders when |
|
|
390
390
|
|-----------|-------------|
|
|
391
391
|
| `MaybeAuthenticated` | Has session token (optimistic) |
|
|
392
|
-
| `Authenticated` | Server-verified authenticated |
|
|
392
|
+
| `Authenticated` | Server-verified authenticated (with `optimisticAuth`, also during the optimistic window) |
|
|
393
393
|
| `MaybeUnauthenticated` | No session token (optimistic) |
|
|
394
394
|
| `Unauthenticated` | Server-verified not authenticated |
|
|
395
395
|
|
|
@@ -414,16 +414,34 @@ All from `kitcn/react`:
|
|
|
414
414
|
```
|
|
415
415
|
|
|
416
416
|
`optimisticAuth` only opens auth-bound query gates for a held, unexpired JWT;
|
|
417
|
-
expired, opaque, and refused tokens stay closed.
|
|
417
|
+
expired, opaque, and refused tokens stay closed. The window ends at the Convex
|
|
418
|
+
client's first auth result; use one `optimisticAuth` setting per client; no
|
|
419
|
+
optimism over a client the Start loader authenticated. Enable
|
|
418
420
|
`onTokenIdentityChange` to refuse a JWT whose `sub` or `sessionId` differs from
|
|
419
|
-
the document identity before Convex
|
|
420
|
-
|
|
421
|
+
the document identity (whatever its `exp`) before Convex, HTTP or the Start
|
|
422
|
+
loader sees it. On a trip, every mounted provider hands out no token and
|
|
423
|
+
publishes unauthenticated; each guarded one closes its client, then calls the
|
|
424
|
+
callback once, so reload the document there. Browser only, page-wide: later
|
|
425
|
+
providers start tripped, and a guarded one that mounts or shows again on a
|
|
426
|
+
tripped page also closes its client and calls the callback once. Enabling the
|
|
427
|
+
guard on a tripped page delivers that close and callback once too; sign-in
|
|
428
|
+
mutations fail with `TOKEN_IDENTITY_CHANGED`.
|
|
421
429
|
|
|
422
430
|
For multiple provider mounts, pass `tokenIdentityBaseline` as
|
|
423
|
-
`sub|sessionId`, or a getter returning the document's current identity.
|
|
424
|
-
|
|
431
|
+
`sub|sessionId`, or a getter returning the document's current identity. Every
|
|
432
|
+
admission (SSR, fresh and cached tokens, sign-in, HTTP, Start loader) binds a
|
|
433
|
+
token to the page identity, the provider's own baseline and every mounted
|
|
434
|
+
provider's current getter answer; an opaque session token is only exchanged,
|
|
435
|
+
never handed to Convex. Held tokens are reconciled when a provider joins the
|
|
436
|
+
page and at every admission. A page that never enables the guard is
|
|
437
|
+
unchanged; once a guarded provider establishes the page identity it persists
|
|
438
|
+
until reload, binding every provider and the Start loader, even after that
|
|
439
|
+
provider unmounts. Two kitcn versions or revisions on one page (dev HMR
|
|
440
|
+
across revisions included) are unsupported: no shared page identity until
|
|
441
|
+
reload.
|
|
425
442
|
`onTokenIdentityAdmitted(token)` observes admitted JWTs so the app can update
|
|
426
|
-
that shared baseline.
|
|
443
|
+
that shared baseline. Admission rechecks the baseline after the callback before
|
|
444
|
+
publishing or handing out the token. All three identity options require
|
|
427
445
|
`onTokenIdentityChange`.
|
|
428
446
|
|
|
429
447
|
For `@convex-dev/auth` (React Native):
|