@pithy-sh/auth 0.7.0 → 0.9.0
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/README.md +4 -0
- package/dist/caller/certificate.d.ts +83 -0
- package/dist/caller/certificate.d.ts.map +1 -0
- package/dist/caller/certificate.js +92 -0
- package/dist/caller/request.d.ts +66 -0
- package/dist/caller/request.d.ts.map +1 -0
- package/dist/caller/request.js +71 -0
- package/dist/caller/token.d.ts +130 -0
- package/dist/caller/token.d.ts.map +1 -0
- package/dist/caller/token.js +207 -0
- package/dist/capability.d.ts +44 -1
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +7 -4
- package/dist/data/betterAuth.d.ts +1 -1
- package/dist/data/betterAuth.d.ts.map +1 -1
- package/dist/data/betterAuth.js +1 -1
- package/dist/data/tables.d.ts +1 -1
- package/dist/http/adminRoutes.d.ts.map +1 -1
- package/dist/http/adminRoutes.js +39 -8
- package/dist/http/credentialResign.d.ts +46 -0
- package/dist/http/credentialResign.d.ts.map +1 -0
- package/dist/http/credentialResign.js +203 -0
- package/dist/http/devLoginRoute.d.ts.map +1 -1
- package/dist/http/devLoginRoute.js +12 -5
- package/dist/http/errorCallbackUrl.d.ts.map +1 -1
- package/dist/http/errorCallbackUrl.js +15 -9
- package/dist/http/middleware.d.ts.map +1 -1
- package/dist/http/middleware.js +66 -15
- package/dist/http/providerRefusal.d.ts +8 -7
- package/dist/http/providerRefusal.d.ts.map +1 -1
- package/dist/http/providerRefusal.js +29 -32
- package/dist/http/resolve.d.ts.map +1 -1
- package/dist/http/resolve.js +18 -3
- package/dist/http/responses.d.ts +52 -0
- package/dist/http/responses.d.ts.map +1 -1
- package/dist/http/responses.js +25 -1
- package/dist/http/routes.d.ts.map +1 -1
- package/dist/http/routes.js +60 -9
- package/dist/http/schemas.d.ts +1 -1
- package/dist/http/schemas.js +1 -1
- package/dist/instance/auth.d.ts +1225 -2
- package/dist/instance/auth.d.ts.map +1 -1
- package/dist/instance/auth.js +6 -2
- package/dist/instance/jwksReencryption.d.ts +75 -0
- package/dist/instance/jwksReencryption.d.ts.map +1 -0
- package/dist/instance/jwksReencryption.js +160 -0
- package/dist/instance/providerSignInGate.d.ts +7 -6
- package/dist/instance/providerSignInGate.d.ts.map +1 -1
- package/dist/instance/providerSignInGate.js +16 -14
- package/dist/instance/providers.d.ts.map +1 -1
- package/dist/instance/providers.js +2 -1
- package/dist/instance/secrets.d.ts +168 -1
- package/dist/instance/secrets.d.ts.map +1 -1
- package/dist/instance/secrets.js +86 -3
- package/dist/instance/sessionSecrets.d.ts +45 -0
- package/dist/instance/sessionSecrets.d.ts.map +1 -0
- package/dist/instance/sessionSecrets.js +29 -0
- package/dist/migrations/0001_init.d.ts.map +1 -1
- package/dist/migrations/0003_account_issuer_nullable.d.ts +5 -0
- package/dist/migrations/0003_account_issuer_nullable.d.ts.map +1 -0
- package/dist/migrations/0003_account_issuer_nullable.js +131 -0
- package/dist/migrations/set.d.ts +2 -1
- package/dist/migrations/set.d.ts.map +1 -1
- package/dist/migrations/set.js +4 -2
- package/dist/seeds/devSession.d.ts.map +1 -1
- package/dist/seeds/devSession.js +2 -1
- package/dist/test-utils/liveApp.d.ts +5 -0
- package/dist/test-utils/liveApp.d.ts.map +1 -1
- package/dist/test-utils/liveApp.js +3 -3
- package/dist/test-utils/schemaDrift.d.ts +49 -0
- package/dist/test-utils/schemaDrift.d.ts.map +1 -0
- package/dist/test-utils/schemaDrift.js +35 -0
- package/dist/test-utils/scopedBackend.d.ts +183 -0
- package/dist/test-utils/scopedBackend.d.ts.map +1 -0
- package/dist/test-utils/scopedBackend.js +160 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/docs/server-authoritative.md +182 -0
- package/package.json +14 -11
- package/src/caller/certificate.ts +133 -0
- package/src/caller/request.ts +84 -0
- package/src/caller/token.ts +276 -0
- package/src/capability.ts +65 -4
- package/src/data/betterAuth.ts +2 -1
- package/src/http/adminRoutes.ts +46 -10
- package/src/http/credentialResign.ts +268 -0
- package/src/http/devLoginRoute.ts +19 -6
- package/src/http/errorCallbackUrl.ts +21 -13
- package/src/http/middleware.ts +100 -35
- package/src/http/providerRefusal.ts +30 -32
- package/src/http/resolve.ts +27 -3
- package/src/http/responses.ts +54 -0
- package/src/http/routes.ts +97 -11
- package/src/http/schemas.ts +1 -1
- package/src/instance/auth.ts +22 -4
- package/src/instance/jwksReencryption.ts +206 -0
- package/src/instance/providerSignInGate.ts +23 -21
- package/src/instance/providers.ts +2 -1
- package/src/instance/secrets.ts +94 -1
- package/src/instance/sessionSecrets.ts +64 -0
- package/src/migrations/0001_init.ts +8 -10
- package/src/migrations/0003_account_issuer_nullable.ts +199 -0
- package/src/migrations/set.ts +3 -1
- package/src/seeds/devSession.ts +2 -1
- package/src/test-utils/liveApp.ts +8 -6
- package/src/test-utils/schemaDrift.ts +82 -0
- package/src/test-utils/scopedBackend.ts +136 -0
- package/src/version.generated.ts +1 -1
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
*
|
|
41
41
|
* | Code | Emitted only when |
|
|
42
42
|
* | --- | --- |
|
|
43
|
-
* | `account_not_linked` | a user row **did** match (`better-auth/dist/oauth2/link-account.mjs:
|
|
44
|
-
* | `signup_disabled` | **no** row matched (`:
|
|
43
|
+
* | `account_not_linked` | a user row **did** match (`better-auth/dist/oauth2/link-account.mjs:142`) |
|
|
44
|
+
* | `signup_disabled` | **no** row matched (`:257`) |
|
|
45
45
|
*
|
|
46
46
|
* Both leave through one line — `redirectOnError(result.error.split(" ").join("_"))`,
|
|
47
|
-
* `dist/api/routes/callback.mjs:
|
|
47
|
+
* `dist/api/routes/callback.mjs:197` — so from outside the Worker they are one question with two
|
|
48
48
|
* answers. Press the provider button, read the `Location` header, repeat: an account-enumeration oracle
|
|
49
49
|
* needing one GitHub account, no account on the target, and no page render. It works against the
|
|
50
50
|
* configuration the kit's own security guidance recommends (`allowSignUp: false`, #554), so the
|
|
@@ -75,9 +75,10 @@
|
|
|
75
75
|
* ## This module is the second line of defense, not the only one
|
|
76
76
|
*
|
|
77
77
|
* It reads the `Location` a refused callback answered with — which is the output of
|
|
78
|
-
* `redirectOnError`
|
|
79
|
-
*
|
|
80
|
-
*
|
|
78
|
+
* `redirectOnError` (`callback.mjs:78`), built on a value the caller supplied. 1.7.1 concatenated it raw;
|
|
79
|
+
* 1.7.11 parses it with `new URL` in `@better-auth/core`'s `appendQueryParams`, which sets the query
|
|
80
|
+
* before any fragment and throws on a `//` or `/\` input. It was walked around twice on 1.7.1, and the second bypass
|
|
81
|
+
* was the diagnosis: **every input shape where that construction and this parsing disagree is another one**, so patching the parsing
|
|
81
82
|
* again only moves the report later. `./errorCallbackUrl` therefore guards the value on the way *in*,
|
|
82
83
|
* and by the time this module runs the string being parsed is one the kit produced.
|
|
83
84
|
*
|
|
@@ -110,7 +111,7 @@ const NEUTRAL_PROVIDER_REFUSAL = "provider_sign_in_refused";
|
|
|
110
111
|
* `providerRefusal.test.ts` reads Better Auth's own `OAUTH_CALLBACK_ERROR_CODES`, scans the
|
|
111
112
|
* `result.error` literals out of `link-account.mjs`, and scans the `new APIError(…, { code })` sites in
|
|
112
113
|
* both codebases — `better-auth`'s on the callback's path and the kit's across this whole package,
|
|
113
|
-
* because `callback.mjs:
|
|
114
|
+
* because `callback.mjs:192` re-emits *anything* thrown inside `handleOAuthUserInfo` as `?error=`. Every
|
|
114
115
|
* code any of them can produce must appear here. A dependency bump that adds one turns that red, and
|
|
115
116
|
* somebody writes a verdict for it. So the roster records a *review*, and the review cannot silently fall
|
|
116
117
|
* behind the thing it reviews.
|
|
@@ -126,11 +127,11 @@ const NEUTRAL_PROVIDER_REFUSAL = "provider_sign_in_refused";
|
|
|
126
127
|
const PROVIDER_REFUSAL_VERDICTS = {
|
|
127
128
|
account_not_linked: {
|
|
128
129
|
collapse: true,
|
|
129
|
-
why: "link-account.mjs:
|
|
130
|
+
why: "link-account.mjs:142 — returned only inside `if (dbUser)`, so it is literally the statement that a row matched."
|
|
130
131
|
},
|
|
131
132
|
signup_disabled: {
|
|
132
133
|
collapse: true,
|
|
133
|
-
why: "link-account.mjs:
|
|
134
|
+
why: "link-account.mjs:257 — the `else` of that same branch, so it is literally the statement that none did."
|
|
134
135
|
},
|
|
135
136
|
EMAIL_NOT_VERIFIED: {
|
|
136
137
|
collapse: true,
|
|
@@ -138,15 +139,19 @@ const PROVIDER_REFUSAL_VERDICTS = {
|
|
|
138
139
|
},
|
|
139
140
|
unable_to_create_user: {
|
|
140
141
|
collapse: true,
|
|
141
|
-
why: "link-account.mjs:
|
|
142
|
+
why: "link-account.mjs:301/308 — the create path only, so it sits on the no-row side exactly as `signup_disabled` does. A fault rather than a refusal, and still an answer to the question being asked."
|
|
142
143
|
},
|
|
143
144
|
INVALID_PROFILE_FIELD: {
|
|
144
145
|
collapse: true,
|
|
145
|
-
why: "The kit's `user.update.before` hook, and **the branch it sits on was read wrong the first time.** `if (dbUser) {` opens at link-account.mjs:
|
|
146
|
+
why: "The kit's `user.update.before` hook, and **the branch it sits on was read wrong the first time.** `if (dbUser) {` opens at link-account.mjs:133 and the `if (!linkedAccount) {…} else {…}` pair sits *inside* it, so the ownership argument that carries `unable_to_update_account` does not reach here: the `updateUser` writes that can carry a provider's `name`/`image` are the `overrideUserInfo` write at :238, which runs after **either** sub-branch, and since 1.7.3 the `updateUserInfoOnLink` write at :189 on the branch that has just linked an account that did not exist a line earlier. What every path to it does share is `if (dbUser)`: a matched row. The other side of that branch calls `createUser`, where the kit's `user.create.before` **sanitizes** the same two fields instead of refusing them. So a hostile provider display name answers `?error=INVALID_PROFILE_FIELD` against an address that has a row and a completed sign-in against one that does not, which is the oracle with a different name on it."
|
|
146
147
|
},
|
|
147
148
|
validation_context_missing: {
|
|
148
149
|
collapse: true,
|
|
149
|
-
why: "internal-adapter.mjs:160 — raised when `getCurrentAuthContext()` fails inside `createUser`, and `createUser` is the no-row side. `updateUser` runs no such check (internal-adapter.mjs:
|
|
150
|
+
why: "internal-adapter.mjs:160 — raised when `getCurrentAuthContext()` fails inside `createUser`, and `createUser` is the no-row side. `updateUser` runs no such check (internal-adapter.mjs:616), so this code cannot be observed against an address that has a row: it is `signup_disabled`'s shape reached through the adopter's `validateUserInfo` option rather than through the sign-up policy."
|
|
151
|
+
},
|
|
152
|
+
unable_to_link_account: {
|
|
153
|
+
collapse: true,
|
|
154
|
+
why: "Two producers, and the verdict follows the one that reads our rows. `linkOAuthAccount` (link-account.mjs:45/68) answers it on `/link-social`, where the caller is signed in as the user being changed. But `handleOAuthUserInfo` answers it too, inside `if (dbUser)` when the account write fails (:171/:184), so on the social callback it says a row matched, and `unable_to_create_user` is its other half. Collapsing costs the signed-in linker a specific code for a fault. Letting it travel would cost the oracle. Corrected in #787; the earlier verdict read only the link flow."
|
|
150
155
|
},
|
|
151
156
|
no_code: {
|
|
152
157
|
collapse: false,
|
|
@@ -158,7 +163,7 @@ const PROVIDER_REFUSAL_VERDICTS = {
|
|
|
158
163
|
},
|
|
159
164
|
invalid_callback_request: {
|
|
160
165
|
collapse: false,
|
|
161
|
-
why: "callback.mjs:
|
|
166
|
+
why: "callback.mjs:54 — the callback's own query or body would not parse. Raised before `parseState`, so nothing had been read from anywhere yet."
|
|
162
167
|
},
|
|
163
168
|
oauth_provider_not_found: {
|
|
164
169
|
collapse: false,
|
|
@@ -190,15 +195,15 @@ const PROVIDER_REFUSAL_VERDICTS = {
|
|
|
190
195
|
},
|
|
191
196
|
email_not_verified: {
|
|
192
197
|
collapse: false,
|
|
193
|
-
why: "Better Auth's lower-case code, from `requireEmailVerification` (link-account.mjs:
|
|
198
|
+
why: "Better Auth's lower-case code, from `requireEmailVerification` (link-account.mjs:317) — which the kit does not set. Reachable for a registering and a returning user alike, so it names no row either way. Not to be confused with the kit's upper-case `EMAIL_NOT_VERIFIED` above; the two are different strings from different places and only one of them is the oracle."
|
|
194
199
|
},
|
|
195
200
|
unable_to_create_session: {
|
|
196
201
|
collapse: false,
|
|
197
|
-
why: "link-account.mjs:
|
|
202
|
+
why: "link-account.mjs:324 — after the user is resolved, so it is reached from both sides of the branch equally."
|
|
198
203
|
},
|
|
199
204
|
state_not_found: {
|
|
200
205
|
collapse: false,
|
|
201
|
-
why: "The request carried no state to parse. Raised at state.mjs:
|
|
206
|
+
why: "The request carried no state to parse. Raised at state.mjs:93, before any lookup."
|
|
202
207
|
},
|
|
203
208
|
state_mismatch: {
|
|
204
209
|
collapse: false,
|
|
@@ -222,7 +227,7 @@ const PROVIDER_REFUSAL_VERDICTS = {
|
|
|
222
227
|
},
|
|
223
228
|
account_hook_binding_conflict: {
|
|
224
229
|
collapse: false,
|
|
225
|
-
why: "link-account.mjs:
|
|
230
|
+
why: "link-account.mjs:175/231/291 — a hook moved the account binding out from under the write that had just been made. Raised on the link path, the sign-in path *and* the create path, so it is reached from both sides of `if (dbUser)` equally and names neither."
|
|
226
231
|
},
|
|
227
232
|
validation_source_missing: {
|
|
228
233
|
collapse: false,
|
|
@@ -230,11 +235,7 @@ const PROVIDER_REFUSAL_VERDICTS = {
|
|
|
230
235
|
},
|
|
231
236
|
validation_failed: {
|
|
232
237
|
collapse: false,
|
|
233
|
-
why: "validate-user-info.mjs:34 — the adopter's own `validateUserInfo` callback threw, and Better Auth fails closed. Called on the link path (link-account.mjs:
|
|
234
|
-
},
|
|
235
|
-
unable_to_link_account: {
|
|
236
|
-
collapse: false,
|
|
237
|
-
why: "callback.mjs:173/198, inside `if (link)` — reachable only on `/link-social`, where the caller is signed in as the user being changed. Telling somebody about their own account is not enumeration."
|
|
238
|
+
why: "validate-user-info.mjs:34 — the adopter's own `validateUserInfo` callback threw, and Better Auth fails closed. Called on the link path (link-account.mjs:24 and :148), the sign-in path (:192) and the create path (internal-adapter.mjs:164), so it is reachable whether or not a row matched. What that callback *returns* is the adopter's own code and travels off-roster, which is the same decision as for the provider's own `error` values."
|
|
238
239
|
},
|
|
239
240
|
email_does_not_match: {
|
|
240
241
|
collapse: false,
|
|
@@ -246,27 +247,23 @@ const PROVIDER_REFUSAL_VERDICTS = {
|
|
|
246
247
|
},
|
|
247
248
|
unable_to_update_account: {
|
|
248
249
|
collapse: false,
|
|
249
|
-
why: "link-account.mjs:
|
|
250
|
+
why: "link-account.mjs:227, inside `if (linkedAccount)` — reaching it requires an account row already binding this provider identity to this user, and the caller proved control of that identity at the provider to get here. Ownership, not a matched row. (This is the argument `INVALID_PROFILE_FIELD` was wrongly given: that code's write sits outside this branch.)"
|
|
250
251
|
},
|
|
251
252
|
account_ownership_conflict: {
|
|
252
253
|
collapse: false,
|
|
253
|
-
why: "link-account.mjs:
|
|
254
|
-
},
|
|
255
|
-
account_provider_conflict: {
|
|
256
|
-
collapse: false,
|
|
257
|
-
why: "link-account.mjs:42, guarded by `requireExactAccountBinding`, which is `opts.selectedUser || opts.requireExactAccountBinding` — neither of which `callback.mjs` passes. Keyed by the caller's own provider identity, as above."
|
|
254
|
+
why: "link-account.mjs:97, inside `if (opts.selectedUser && …)`. The lookup it reports on is keyed by the *provider* identity the caller has just proved control of, not by an address handed over — and the social callback passes no `selectedUser`, so this never reaches that redirect at all."
|
|
258
255
|
},
|
|
259
256
|
user_not_found: {
|
|
260
257
|
collapse: false,
|
|
261
|
-
why: "link-account.mjs:
|
|
258
|
+
why: "link-account.mjs:109 — `findUserById(opts.selectedUser.userId)`, so it answers about a user id the caller was already handed, on a flow the social callback does not enter. It reads a row by id, never by a provider-resolved address."
|
|
262
259
|
},
|
|
263
260
|
user_hook_selection_conflict: {
|
|
264
261
|
collapse: false,
|
|
265
|
-
why: "link-account.mjs:
|
|
262
|
+
why: "link-account.mjs:249, inside `if (opts.selectedUser …)`. A hook returned a different user than the one the caller picked from a list they had already been shown, and the social callback never picks one."
|
|
266
263
|
},
|
|
267
264
|
session_hook_user_conflict: {
|
|
268
265
|
collapse: false,
|
|
269
|
-
why: "link-account.mjs:
|
|
266
|
+
why: "link-account.mjs:328 — after the user is resolved and the session minted, under the same `requireExactAccountBinding` gate. Reached from both sides of `if (dbUser)` when it is reached at all, which on the social callback is never."
|
|
270
267
|
}
|
|
271
268
|
};
|
|
272
269
|
/** The codes this module refuses to let out. Derived from the roster, so the two cannot disagree. */
|
|
@@ -301,7 +298,7 @@ const PROVIDER_REFUSAL_ROSTER = PROVIDER_REFUSAL_VERDICTS;
|
|
|
301
298
|
*
|
|
302
299
|
* - **It need not be absolute.** `api/middlewares/origin-check.mjs` passes `allowRelativePaths: true`,
|
|
303
300
|
* `matchesOriginPattern` admits `/path?query`, `oauth2/state.mjs` stores the value as a bare
|
|
304
|
-
* `z.string().optional()`, and `redirectOnError`
|
|
301
|
+
* `z.string().optional()`, and `redirectOnError` keeps it root-relative. So a relative `Location` is a
|
|
305
302
|
* supported answer, and returning `undefined` to one sent the true code to the browser and wrote no
|
|
306
303
|
* audit row.
|
|
307
304
|
* - **`error` need not be the only one.** `redirectOnError` *appends* `&error=<code>`. An
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/http/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/http/resolve.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAK7E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,KAAK,YAAY,EAAY,MAAM,kBAAkB,CAAC;AAsB/D,2GAA2G;AAC3G,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,UAAU,CASvF;AA0BD,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAMnG"}
|
package/dist/http/resolve.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { authDatabase } from "../data/tables.js";
|
|
4
4
|
import { baseURLResolver } from "./baseUrl.js";
|
|
5
|
-
import { resolveAppleCredentials, resolveFacebookCredentials, resolveGithubCredentials, resolveGoogleCredentials,
|
|
5
|
+
import { resolveAppleCredentials, resolveFacebookCredentials, resolveGithubCredentials, resolveGoogleCredentials, resolveSessionSecrets } from "../instance/secrets.js";
|
|
6
6
|
import { makeSendAuthEmail } from "../email/send.js";
|
|
7
7
|
import { resolveProvider } from "../instance/providers.js";
|
|
8
8
|
import { makeAuth } from "../instance/auth.js";
|
|
9
|
+
import { ensureJwksSealedUnderCurrent } from "../instance/jwksReencryption.js";
|
|
9
10
|
import { InternalError } from "@pithy-sh/core/src/error/pithyError";
|
|
11
|
+
import { createWorkerLogger } from "@pithy-sh/core/src/logger/worker";
|
|
10
12
|
//#region src/http/resolve.ts
|
|
11
13
|
/**
|
|
12
14
|
* Build the Better-Auth instance for one request, memoized on the request context so the
|
|
@@ -61,8 +63,8 @@ async function buildAuthInstance(c, wiring) {
|
|
|
61
63
|
detail: "auth.compose did not resolve the email enqueue seam; ensure email() is composed."
|
|
62
64
|
});
|
|
63
65
|
const env = c.env;
|
|
64
|
-
const [
|
|
65
|
-
|
|
66
|
+
const [sessionSecrets, google, apple, facebook, github] = await Promise.all([
|
|
67
|
+
resolveSessionSecrets(env),
|
|
66
68
|
resolveProvider(cfg.google.enabled, () => resolveGoogleCredentials(env)),
|
|
67
69
|
resolveProvider(cfg.apple.enabled, () => resolveAppleCredentials(env)),
|
|
68
70
|
resolveProvider(cfg.facebook.enabled, () => resolveFacebookCredentials(env)),
|
|
@@ -70,11 +72,24 @@ async function buildAuthInstance(c, wiring) {
|
|
|
70
72
|
]);
|
|
71
73
|
const expiresMinutes = Math.max(1, Math.round(cfg.verificationExpiresIn / 60));
|
|
72
74
|
const d1 = resolveDb(c.env, cfg.database);
|
|
75
|
+
const secret = sessionSecrets.versions[sessionSecrets.currentVersion];
|
|
76
|
+
if (secret === void 0) throw new InternalError({
|
|
77
|
+
message: "Authentication is misconfigured.",
|
|
78
|
+
detail: "auth-session-secret resolved with no value at its current version"
|
|
79
|
+
});
|
|
80
|
+
await ensureJwksSealedUnderCurrent({
|
|
81
|
+
db: authDatabase(d1),
|
|
82
|
+
holder: cfg.database,
|
|
83
|
+
secrets: env.SECRETS,
|
|
84
|
+
versions: sessionSecrets,
|
|
85
|
+
log: (c.get("log") ?? createWorkerLogger({ name: "auth" })).child("auth")
|
|
86
|
+
});
|
|
73
87
|
const listener = wiring.onSessionRevoked;
|
|
74
88
|
return makeAuth({
|
|
75
89
|
db: authDatabase(d1),
|
|
76
90
|
...listener ? { onSessionRevoked: (session) => listener(session, d1) } : {},
|
|
77
91
|
secret,
|
|
92
|
+
sessionSecrets,
|
|
78
93
|
baseURL: baseURLResolver(cfg.baseURL)(c.req.raw),
|
|
79
94
|
locale: c.var.locale?.catalogLocale ?? null,
|
|
80
95
|
basePath: cfg.basePath,
|
package/dist/http/responses.d.ts
CHANGED
|
@@ -151,4 +151,56 @@ export declare const AdminDeviceRevokeResponse: z.ZodObject<{
|
|
|
151
151
|
removed: z.ZodBoolean;
|
|
152
152
|
}, z.core.$strip>;
|
|
153
153
|
export type AdminDeviceRevokeResponse = z.output<typeof AdminDeviceRevokeResponse>;
|
|
154
|
+
/** `POST {base}/token/rotate`. */
|
|
155
|
+
export declare const TokenRotateResponse: z.ZodObject<{
|
|
156
|
+
accessToken: z.ZodString;
|
|
157
|
+
refreshToken: z.ZodString;
|
|
158
|
+
expiresAt: z.ZodISODateTime;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type TokenRotateResponse = z.output<typeof TokenRotateResponse>;
|
|
161
|
+
/** One of the caller's own registered devices. */
|
|
162
|
+
export declare const MyDeviceView: z.ZodObject<{
|
|
163
|
+
id: z.ZodString;
|
|
164
|
+
userId: z.ZodString;
|
|
165
|
+
platform: z.ZodEnum<{
|
|
166
|
+
android: "android";
|
|
167
|
+
ios: "ios";
|
|
168
|
+
web: "web";
|
|
169
|
+
}>;
|
|
170
|
+
name: z.ZodNullable<z.ZodString>;
|
|
171
|
+
model: z.ZodNullable<z.ZodString>;
|
|
172
|
+
osVersion: z.ZodNullable<z.ZodString>;
|
|
173
|
+
appVersion: z.ZodNullable<z.ZodString>;
|
|
174
|
+
pushToken: z.ZodNullable<z.ZodString>;
|
|
175
|
+
lastIp: z.ZodNullable<z.ZodString>;
|
|
176
|
+
lastSeenAt: z.ZodISODateTime;
|
|
177
|
+
createdAt: z.ZodISODateTime;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export type MyDeviceView = z.output<typeof MyDeviceView>;
|
|
180
|
+
/** `GET {base}/devices`. */
|
|
181
|
+
export declare const MyDevicesResponse: z.ZodObject<{
|
|
182
|
+
devices: z.ZodArray<z.ZodObject<{
|
|
183
|
+
id: z.ZodString;
|
|
184
|
+
userId: z.ZodString;
|
|
185
|
+
platform: z.ZodEnum<{
|
|
186
|
+
android: "android";
|
|
187
|
+
ios: "ios";
|
|
188
|
+
web: "web";
|
|
189
|
+
}>;
|
|
190
|
+
name: z.ZodNullable<z.ZodString>;
|
|
191
|
+
model: z.ZodNullable<z.ZodString>;
|
|
192
|
+
osVersion: z.ZodNullable<z.ZodString>;
|
|
193
|
+
appVersion: z.ZodNullable<z.ZodString>;
|
|
194
|
+
pushToken: z.ZodNullable<z.ZodString>;
|
|
195
|
+
lastIp: z.ZodNullable<z.ZodString>;
|
|
196
|
+
lastSeenAt: z.ZodISODateTime;
|
|
197
|
+
createdAt: z.ZodISODateTime;
|
|
198
|
+
}, z.core.$strip>>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export type MyDevicesResponse = z.output<typeof MyDevicesResponse>;
|
|
201
|
+
/** `POST {base}/devices/revoke`. */
|
|
202
|
+
export declare const MyDeviceRevokeResponse: z.ZodObject<{
|
|
203
|
+
revoked: z.ZodNumber;
|
|
204
|
+
}, z.core.$strip>;
|
|
205
|
+
export type MyDeviceRevokeResponse = z.output<typeof MyDeviceRevokeResponse>;
|
|
154
206
|
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/http/responses.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwCxB,kDAAkD;AAClD,eAAO,MAAM,aAAa;;;;;;;;;iBAiBsF,CAAC;AACjH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAE3D,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB;;;;;;;;iBAUiF,CAAC;AAC/G,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE,0GAA0G;AAC1G,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;iBAawF,CAAC;AACrH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAE/D,gCAAgC;AAChC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;iBAKQ,CAAC;AACxC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAoDrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAY3B,CAAC;AACJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,kCAAkC;AAClC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;iBAKY,CAAC;AAC9C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;iBAEsB,CAAC;AACvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEvE,wDAAwD;AACxD,eAAO,MAAM,yBAAyB;;;iBAKoE,CAAC;AAC3G,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/http/responses.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwCxB,kDAAkD;AAClD,eAAO,MAAM,aAAa;;;;;;;;;iBAiBsF,CAAC;AACjH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAE3D,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB;;;;;;;;iBAUiF,CAAC;AAC/G,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE,0GAA0G;AAC1G,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;iBAawF,CAAC;AACrH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAE/D,gCAAgC;AAChC,eAAO,MAAM,kBAAkB;;;;;;;;;;;;iBAKQ,CAAC;AACxC,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAoDrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAY3B,CAAC;AACJ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,kCAAkC;AAClC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;iBAKY,CAAC;AAC9C,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEzE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;iBAEsB,CAAC;AACvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEvE,wDAAwD;AACxD,eAAO,MAAM,yBAAyB;;;iBAKoE,CAAC;AAC3G,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAQnF,kCAAkC;AAClC,eAAO,MAAM,mBAAmB;;;;iBAYqF,CAAC;AACtH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEvE,kDAAkD;AAClD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;iBAcwC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,YAAY,CAAC,CAAC;AAEzD,4BAA4B;AAC5B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;iBAIqB,CAAC;AACpD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,oCAAoC;AACpC,eAAO,MAAM,sBAAsB;;iBAEyE,CAAC;AAC7G,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/dist/http/responses.js
CHANGED
|
@@ -119,5 +119,29 @@ const AdminDeviceRevokeResponse = z.object({
|
|
|
119
119
|
revoked: RevokedCount,
|
|
120
120
|
removed: z.boolean().describe("Whether a device row was deleted. False when the user had no such device.")
|
|
121
121
|
}).describe("How many sessions the device revocation ended, and whether the registry row went with them.");
|
|
122
|
+
/** `POST {base}/token/rotate`. */
|
|
123
|
+
const TokenRotateResponse = z.object({
|
|
124
|
+
accessToken: z.string().describe("A fresh short-lived access token (a JWT) for the `Authorization: Bearer` header."),
|
|
125
|
+
refreshToken: z.string().describe("The successor refresh credential: a new session token. The one presented is spent, and presenting it again past a short grace window revokes the whole family."),
|
|
126
|
+
expiresAt: z.iso.datetime().describe("When the successor session lapses, ISO-8601.")
|
|
127
|
+
}).describe("The rotated credential pair: a new access token and the session token that replaces the one presented.");
|
|
128
|
+
/** One of the caller's own registered devices. */
|
|
129
|
+
const MyDeviceView = z.object({
|
|
130
|
+
id: z.string().describe("The client-generated device id it registered at sign-in."),
|
|
131
|
+
userId: z.string().describe("The owning user's id: always the caller's own."),
|
|
132
|
+
platform: DevicePlatform.describe("The platform the device registered as."),
|
|
133
|
+
name: z.string().nullable().describe("The device's human label, or null."),
|
|
134
|
+
model: z.string().nullable().describe("The hardware model, or null."),
|
|
135
|
+
osVersion: z.string().nullable().describe("The device OS version at last sign-in, or null."),
|
|
136
|
+
appVersion: z.string().nullable().describe("The client app version at last sign-in, or null."),
|
|
137
|
+
pushToken: z.string().nullable().describe("The APNs or FCM push token the device registered, or null."),
|
|
138
|
+
lastIp: z.string().nullable().describe("The client IP at the device's most recent sign-in, or null."),
|
|
139
|
+
lastSeenAt: z.iso.datetime().describe("When the device was last seen, ISO-8601."),
|
|
140
|
+
createdAt: z.iso.datetime().describe("When the device first registered, ISO-8601.")
|
|
141
|
+
}).describe("One device registered to the caller's own account.");
|
|
142
|
+
/** `GET {base}/devices`. */
|
|
143
|
+
const MyDevicesResponse = z.object({ devices: z.array(MyDeviceView).describe("Every device registered to the caller, most recently seen first.") }).describe("The caller's own registered devices.");
|
|
144
|
+
/** `POST {base}/devices/revoke`. */
|
|
145
|
+
const MyDeviceRevokeResponse = z.object({ revoked: RevokedCount }).describe("How many of the device's sessions the revocation signed out. The device's row goes with them.");
|
|
122
146
|
//#endregion
|
|
123
|
-
export { AdminDeviceRevokeResponse, AdminDeviceView, AdminDevicesResponse, AdminRevokeResponse, AdminSessionView, AdminUserResponse, AdminUserView, AdminUsersResponse };
|
|
147
|
+
export { AdminDeviceRevokeResponse, AdminDeviceView, AdminDevicesResponse, AdminRevokeResponse, AdminSessionView, AdminUserResponse, AdminUserView, AdminUsersResponse, MyDeviceRevokeResponse, MyDeviceView, MyDevicesResponse, TokenRotateResponse };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAQ7E,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAuHtF"}
|
package/dist/http/routes.js
CHANGED
|
@@ -9,18 +9,28 @@ import { collapseProviderRefusal } from "./providerRefusal.js";
|
|
|
9
9
|
import { getAuthInstance, resolveDb } from "./resolve.js";
|
|
10
10
|
import { requireAuth } from "./middleware.js";
|
|
11
11
|
import { consumeSession, findConsumedToken, pruneConsumedTokens, recordConsumedToken, revokeFamily } from "../token/rotation.js";
|
|
12
|
+
import { MyDeviceRevokeResponse, MyDevicesResponse, TokenRotateResponse } from "./responses.js";
|
|
12
13
|
import { RevokeDeviceBody } from "./schemas.js";
|
|
13
14
|
import { registerAuthAdminRoutes } from "./adminRoutes.js";
|
|
14
15
|
import { guardErrorCallbackURL } from "./errorCallbackUrl.js";
|
|
15
16
|
import { apiErrorToPithy } from "./errors.js";
|
|
16
17
|
import { NotFoundError, UnauthorizedError } from "@pithy-sh/core/src/error/pithyError";
|
|
17
18
|
import { TURNSTILE_LOGIN_ACTION } from "@pithy-sh/turnstile/src/config/config";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
19
|
+
import { describeRoute } from "@pithy-sh/core/src/http/routeSpec";
|
|
20
|
+
import { validate } from "@pithy-sh/core/src/http/validation";
|
|
20
21
|
import { STORED_IMAGE_HEADERS, storedImageBytes } from "@pithy-sh/core/src/image/storedImage";
|
|
21
22
|
import { requireSameOrigin } from "@pithy-sh/core/src/http/sameOrigin";
|
|
22
23
|
import { turnstile } from "@pithy-sh/turnstile/src/http/middleware";
|
|
23
24
|
//#region src/http/routes.ts
|
|
25
|
+
/**
|
|
26
|
+
* What a route answers when the answer is Better Auth's: the catch-all, and the two endpoints of its that
|
|
27
|
+
* are mounted ahead of it for a gate. Its wire is its own contract (`handleBetterAuth` says why), so the
|
|
28
|
+
* kit's contract points at it rather than restating it.
|
|
29
|
+
*/
|
|
30
|
+
const BETTER_AUTH_ANSWER = {
|
|
31
|
+
description: "Better Auth's own answer. See its endpoint reference.",
|
|
32
|
+
contentType: "application/json"
|
|
33
|
+
};
|
|
24
34
|
function db(c, wiring) {
|
|
25
35
|
return authDatabase(resolveDb(c.env, wiring.config.database));
|
|
26
36
|
}
|
|
@@ -65,14 +75,55 @@ function createAuthRoutes(wiring) {
|
|
|
65
75
|
app.use(`${base}/sign-in/magic-link`, guard);
|
|
66
76
|
app.use(`${base}/email-otp/send-verification-otp`, guard);
|
|
67
77
|
}
|
|
68
|
-
app.post(`${base}/token/rotate`,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
app.post(`${base}/token/rotate`, describeRoute({
|
|
79
|
+
summary: "Trade the current refresh credential for a new access token and its successor.",
|
|
80
|
+
description: "The presented session is spent. Presenting it again after a short grace window is read as theft, and revokes every session descended from the same sign-in.",
|
|
81
|
+
verification: ["bearer", "session"],
|
|
82
|
+
responses: { 200: TokenRotateResponse }
|
|
83
|
+
}), csrf, (c) => rotateToken(c, wiring));
|
|
84
|
+
app.get(`${base}/devices`, describeRoute({
|
|
85
|
+
summary: "List the caller's own registered devices.",
|
|
86
|
+
verification: ["bearer", "session"],
|
|
87
|
+
responses: { 200: MyDevicesResponse }
|
|
88
|
+
}), requireAuth(), (c) => listMyDevices(c, wiring));
|
|
89
|
+
app.post(`${base}/devices/revoke`, describeRoute({
|
|
90
|
+
summary: "Sign out one of the caller's own devices and forget it.",
|
|
91
|
+
verification: ["bearer", "session"],
|
|
92
|
+
responses: { 200: MyDeviceRevokeResponse }
|
|
93
|
+
}), requireAuth(), csrf, validate("json", RevokeDeviceBody), (c) => revokeMyDevice(c, wiring, c.req.valid("json")));
|
|
94
|
+
app.post(`${base}/link-social`, describeRoute({
|
|
95
|
+
summary: "Connect another sign-in provider to the caller's account.",
|
|
96
|
+
description: "Better Auth's endpoint, behind a kit gate: the caller must have signed in within the last fifteen minutes, or it is refused with `auth/session_not_fresh`.",
|
|
97
|
+
verification: ["bearer", "session"],
|
|
98
|
+
responses: { 200: BETTER_AUTH_ANSWER }
|
|
99
|
+
}), requireFreshAuthentication("link"), (c) => handleBetterAuth(c, wiring));
|
|
100
|
+
app.post(`${base}/unlink-account`, describeRoute({
|
|
101
|
+
summary: "Disconnect a sign-in provider from the caller's account.",
|
|
102
|
+
description: "Better Auth's endpoint, behind a kit gate: the caller must have signed in within the last fifteen minutes, or it is refused with `auth/session_not_fresh`.",
|
|
103
|
+
verification: ["bearer", "session"],
|
|
104
|
+
responses: { 200: BETTER_AUTH_ANSWER }
|
|
105
|
+
}), requireFreshAuthentication("unlink"), (c) => handleBetterAuth(c, wiring));
|
|
106
|
+
app.get(`${base}${PROFILE_IMAGE_PATH}`, describeRoute({
|
|
107
|
+
summary: "Read the caller's own stored picture.",
|
|
108
|
+
description: "A picture linked from a provider, or stored as a vector, is not served here and answers 404. The response is private and immutable: the URL a client is handed carries the picture's version.",
|
|
109
|
+
verification: ["bearer", "session"],
|
|
110
|
+
responses: { 200: {
|
|
111
|
+
description: "The caller's stored picture, as PNG, JPEG or WebP bytes.",
|
|
112
|
+
contentType: "image/*"
|
|
113
|
+
} }
|
|
114
|
+
}), requireAuth(), (c) => serveMyImage(c, wiring));
|
|
74
115
|
registerAuthAdminRoutes(wiring)(app);
|
|
75
|
-
app.all(`${base}/*`, (
|
|
116
|
+
app.all(`${base}/*`, describeRoute({
|
|
117
|
+
summary: "Everything else under the auth path, answered by Better Auth.",
|
|
118
|
+
description: "Sign-in, sign-up, verification, OAuth callbacks, sign-out, `/token`, `/jwks` and the rest of Better Auth's endpoints. Which credential an endpoint takes, if any, is its own decision.",
|
|
119
|
+
verification: [
|
|
120
|
+
"public",
|
|
121
|
+
"session",
|
|
122
|
+
"bearer"
|
|
123
|
+
],
|
|
124
|
+
methods: ["get", "post"],
|
|
125
|
+
responses: { 200: BETTER_AUTH_ANSWER }
|
|
126
|
+
}), (c) => handleBetterAuth(c, wiring));
|
|
76
127
|
};
|
|
77
128
|
}
|
|
78
129
|
/** The statuses that mean somebody was turned away, rather than that something is broken. */
|
package/dist/http/schemas.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
/**
|
|
5
5
|
* The request schemas for the auth routes Pithy owns. Validation happens at the HTTP boundary
|
|
6
|
-
* (CLAUDE.md §Zod), declared on the route line with `
|
|
6
|
+
* (CLAUDE.md §Zod), declared on the route line with `validate(target, Schema)` — so
|
|
7
7
|
* reading `routes.ts` and `adminRoutes.ts` tells you what each route accepts without opening a handler.
|
|
8
8
|
*
|
|
9
9
|
* Only Pithy's own routes appear here. Everything under `basePath` that Better Auth owns validates
|
package/dist/http/schemas.js
CHANGED
|
@@ -6,7 +6,7 @@ import { MAX_PAGE_SIZE } from "@pithy-sh/core/src/data/cursor";
|
|
|
6
6
|
//#region src/http/schemas.ts
|
|
7
7
|
/**
|
|
8
8
|
* The request schemas for the auth routes Pithy owns. Validation happens at the HTTP boundary
|
|
9
|
-
* (CLAUDE.md §Zod), declared on the route line with `
|
|
9
|
+
* (CLAUDE.md §Zod), declared on the route line with `validate(target, Schema)` — so
|
|
10
10
|
* reading `routes.ts` and `adminRoutes.ts` tells you what each route accepts without opening a handler.
|
|
11
11
|
*
|
|
12
12
|
* Only Pithy's own routes appear here. Everything under `basePath` that Better Auth owns validates
|