@protobase/cli 0.63.0 → 0.63.1

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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.63.0";
2
+ var version = "0.63.1";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.63.0",
3
+ "version": "0.63.1",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,12 +42,12 @@
42
42
  "dependencies": {
43
43
  "@better-auth/core": "^1.7.12",
44
44
  "@hono/node-server": "^2.1.3",
45
- "@protobase/config": "0.63.0",
46
- "@protobase/layout": "0.63.0",
47
- "@protobase/query": "0.63.0",
48
- "@protobase/schema": "0.63.0",
49
- "@protobase/server": "0.63.0",
50
- "@protobase/ui": "0.63.0",
45
+ "@protobase/config": "0.63.1",
46
+ "@protobase/layout": "0.63.1",
47
+ "@protobase/query": "0.63.1",
48
+ "@protobase/schema": "0.63.1",
49
+ "@protobase/server": "0.63.1",
50
+ "@protobase/ui": "0.63.1",
51
51
  "@react-email/render": "^2.1.0",
52
52
  "@scalar/hono-api-reference": "^0.12.10",
53
53
  "@tailwindcss/vite": "^4.3.3",
@@ -22,7 +22,7 @@ Keep the client ID and secret for the next step.
22
22
 
23
23
  ## 2. Turn it on
24
24
 
25
- Put the client's ID and secret in the app's environment, and name Gmail in `auth.personalMail`. Gmail links through Google sign-in, so `socialProviders` has `google`; it also offers "Continue with Google" on the sign-in page. `encryptOAuthTokens` stores the tokens encrypted with the app's secret:
25
+ Put the client's ID and secret in the app's environment, and name Gmail in `auth.personalMail`. Gmail links through Google sign-in, so `socialProviders` has `google`; it also offers "Continue with Google" on the sign-in page. `encryptOAuthTokens` stores the tokens encrypted with the app's secret, and personal mail needs it:
26
26
 
27
27
  ```sh
28
28
  # .env
@@ -480,7 +480,8 @@ export default defineConfig(({ env }) => ({
480
480
  - The callback URL to register with GitHub is `<url>/api/auth/callback/github`, and the same path on each of the app's [other origins](#several-origins) it should sign in on. A GitHub OAuth App takes one callback URL, so it covers one origin; a GitHub App takes several. A GitHub App needs the Email addresses (read-only) account permission, or sign-in fails with `email_not_found`.
481
481
  - A provider is also a public sign-up: someone without an account gets one with the [default role](#roles). Without a default role the sign-up is refused.
482
482
  - `GET /api/auth/status` lists the provider ids as `socialProviders`.
483
- - `encryptOAuthTokens: true` stores the provider's access, refresh and ID tokens encrypted with the secret.
483
+ - `encryptOAuthTokens: true` stores the provider's access and refresh tokens encrypted with the secret. <gap>`encryptOAuthTokens` cannot protect the provider's ID token, which is stored as the provider gave it, because encrypting or dropping it is not implemented.</gap>
484
+ - The provider's tokens stay on the server: Better Auth's `/api/auth/get-access-token` and `/api/auth/refresh-token`, which would answer the browser with them, are turned off.
484
485
  - The `onUserCreated` [hook](#hooks) runs after any user is created, a social sign-up included (Better Auth's `databaseHooks.user.create.after`).
485
486
 
486
487
  ### Sign-in links and connected accounts
@@ -133,11 +133,11 @@ export default defineConfig(({ env }) => ({
133
133
  - **Type:** `'gmail'[]`
134
134
  - **Default:** none
135
135
 
136
- The mail providers people may link their own mailbox with, for the app's functions to send mail from it; each links through its sign-in provider in `socialProviders`, Gmail through `google`. See [From someone's own mailbox](../email.md#from-someones-own-mailbox).
136
+ The mail providers people may link their own mailbox with, for the app's functions to send mail from it; each links through its sign-in provider in `socialProviders`, Gmail through `google`. It needs [`auth.encryptOAuthTokens`](#authencryptoauthtokens): without it, startup stops, since the linked mailboxes' tokens would be stored in plain text. See [From someone's own mailbox](../email.md#from-someones-own-mailbox).
137
137
 
138
138
  ```ts
139
139
  export default defineConfig(({ env }) => ({
140
- auth: { socialProviders: { google: { clientId: env.GOOGLE_CLIENT_ID!, clientSecret: env.GOOGLE_CLIENT_SECRET! } }, personalMail: ['gmail'] },
140
+ auth: { socialProviders: { google: { clientId: env.GOOGLE_CLIENT_ID!, clientSecret: env.GOOGLE_CLIENT_SECRET! } }, personalMail: ['gmail'], encryptOAuthTokens: true },
141
141
  }))
142
142
  ```
143
143
 
@@ -146,7 +146,7 @@ export default defineConfig(({ env }) => ({
146
146
  - **Type:** `boolean`
147
147
  - **Default:** `false`
148
148
 
149
- Encrypts the OAuth access, refresh and ID tokens kept for social sign-ins, with the app's secret.
149
+ Encrypts the OAuth access and refresh tokens kept for social sign-ins, with the app's secret. [`auth.personalMail`](#authpersonalmail) needs it.
150
150
 
151
151
  ```ts
152
152
  export default defineConfig({ auth: { encryptOAuthTokens: true } })
@@ -240,7 +240,7 @@ export default defineFunction(async (request, { personalMail }) => {
240
240
  })
241
241
  ```
242
242
 
243
- - **Tokens:** the link is the sign-in provider's account Better Auth keeps for the person, with its access and refresh tokens (encrypted with `encryptOAuthTokens: true`). An access token that has expired is refreshed before the message goes out, and the new one is stored.
243
+ - **Tokens:** the link is the sign-in provider's account Better Auth keeps for the person, with its access and refresh tokens, encrypted: `auth.personalMail` needs `encryptOAuthTokens: true`, and startup stops without it. The tokens never leave the server. An access token that has expired is refreshed before the message goes out, and the new one is stored.
244
244
  - **When it cannot send:** `send` rejects with a `PersonalMailError` and sends nothing. Its `code` is `not_linked` when the person linked no mailbox, or signed in with Google without allowing it to send mail, and `link_expired` when the provider no longer honours the link, as when they revoked it or its refresh token expired: they connect it again. Thrown on, it answers the function's caller as a `409` problem with that `code` (`urn:protobase:problem:personal-mail-not-linked` or `-link-expired`), so the page can offer to link the mailbox:
245
245
 
246
246
  ```json