@softure-ai/auth 0.1.12 → 0.2.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +40 -8
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/mailing/reset-mail.d.ts.map +1 -1
  6. package/dist/mailing/reset-mail.js +2 -2
  7. package/dist/mailing/reset-mail.js.map +1 -1
  8. package/dist/messages/index.d.ts +1 -97
  9. package/dist/messages/index.d.ts.map +1 -1
  10. package/dist/messages/index.js +2 -3
  11. package/dist/messages/index.js.map +1 -1
  12. package/dist/next/messages.d.ts +1 -1
  13. package/dist/next/messages.d.ts.map +1 -1
  14. package/dist/next/messages.js +2 -1
  15. package/dist/next/messages.js.map +1 -1
  16. package/dist/proxy/index.d.ts +5 -3
  17. package/dist/proxy/index.d.ts.map +1 -1
  18. package/dist/proxy/index.js +23 -3
  19. package/dist/proxy/index.js.map +1 -1
  20. package/dist/scripts/index.d.ts +1 -0
  21. package/dist/scripts/index.d.ts.map +1 -1
  22. package/dist/scripts/index.js +4 -2
  23. package/dist/scripts/index.js.map +1 -1
  24. package/dist/scripts/seed-account.d.ts +19 -0
  25. package/dist/scripts/seed-account.d.ts.map +1 -0
  26. package/dist/scripts/seed-account.js +95 -0
  27. package/dist/scripts/seed-account.js.map +1 -0
  28. package/dist/server/index.d.ts +1 -0
  29. package/dist/server/index.d.ts.map +1 -1
  30. package/dist/server/index.js +1 -0
  31. package/dist/server/index.js.map +1 -1
  32. package/dist/server/only-account.d.ts +21 -0
  33. package/dist/server/only-account.d.ts.map +1 -0
  34. package/dist/server/only-account.js +34 -0
  35. package/dist/server/only-account.js.map +1 -0
  36. package/module.json +2 -2
  37. package/package.json +7 -7
  38. package/src/index.ts +2 -2
  39. package/src/mailing/reset-mail.ts +2 -2
  40. package/src/messages/index.ts +2 -3
  41. package/src/next/messages.ts +2 -2
  42. package/src/proxy/index.ts +30 -6
  43. package/src/scripts/index.ts +4 -2
  44. package/src/scripts/seed-account.ts +108 -0
  45. package/src/server/index.ts +7 -0
  46. package/src/server/only-account.ts +50 -0
  47. package/dist/messages/pl.d.ts +0 -3
  48. package/dist/messages/pl.d.ts.map +0 -1
  49. package/dist/messages/pl.js +0 -92
  50. package/dist/messages/pl.js.map +0 -1
  51. package/src/messages/pl.ts +0 -93
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ Newest first. Each version lists what changed for an app that uses `@softure-ai/
4
4
  production, the version gets a line `verified in: <app>@<commit>` ([docs/05](../../docs/05-adoption-playbook.md),
5
5
  "Definition of done"). Versions before the first one below are described in their GitHub Releases (`auth@x.y.z`).
6
6
 
7
+ ## 0.2.0
8
+
9
+ - **Breaking (#446):** the built-in `pl` dictionary is gone; English is the only built-in copy and the fallback for
10
+ every other locale, which is now any BCP 47 tag. Migrate: an app that shows Polish keeps its own translation and
11
+ passes it as the overrides for its locale, `auth({ messages: { pl: myTranslation } })`; a key it leaves out reads
12
+ English.
13
+ - `createAuthGuard` with `redirect: "relative"` answers 307 inside Next's proxy instead of 500 (`Invalid URL`): the
14
+ login URL is built on the request URL's own origin, which Next sends to the browser path-only, as before (#452). An
15
+ app that went back to the absolute redirect with its stack's origin in `origins.trustedOrigins` can switch back.
16
+ - `createAuthGuard` drops Next's `_rsc` cache key from `next=` and keeps every other query parameter as the request
17
+ spelled it, so a signed-out client navigation no longer lands on `/page?_rsc=…` after sign-in (#424). An app that
18
+ strips `_rsc` before calling the guard can drop that.
19
+
20
+ ## 0.1.13
21
+
22
+ - `resolveOnlyAccount({ db, envName, env? })` in `@softure-ai/auth/server`: the account a local tool acts for, named by
23
+ an environment variable or the only one in the database; refuses `auth.account_unknown`, `auth.no_account` and
24
+ `auth.account_ambiguous` with a readable `message` (#411). An app drops its own copy of this lookup.
25
+ - `runSeedAccount({ config, env? })` in `@softure-ai/auth/scripts`: a development account from `SEED_EMAIL` /
26
+ `SEED_PASSWORD` through registration (the `onRegistered` hook runs), idempotent, refused under
27
+ `NODE_ENV=production`; returns the exit code (#411).
28
+ - The `@softure-ai/ui` peer range also accepts 0.2.0.
29
+
7
30
  ## 0.1.12
8
31
 
9
32
  - `createAuthGuard({ redirect: "relative" })` answers with a path-only `Location` (`/login?next=…`), so a stack on a
package/README.md CHANGED
@@ -54,7 +54,7 @@ import { cloudflareIp, overrideBuckets, security } from "@softure-ai/security";
54
54
 
55
55
  const config = defineSoftureConfig({
56
56
  database: { url: process.env.DATABASE_URL! },
57
- locale: "pl",
57
+ locale: "en",
58
58
  timezone: "Europe/Warsaw",
59
59
  appOrigin: process.env.APP_ORIGIN!,
60
60
  modules: [
@@ -93,7 +93,7 @@ export default config;
93
93
  | `passwordReset.send` | `(link, user, details) => Promise<void>` | none | Delivers reset links (section 4, "Password reset"). Without it password reset is off. |
94
94
  | `passwordReset.ttlMinutes` | `number` (5-1440) | `60` | How long a reset link works. |
95
95
  | `routes` | `{ login, register, changePassword, forgotPassword, resetPassword, afterLogin, afterLogout }` | `/login`, `/register`, `/account/password`, `/forgot-password`, `/reset-password`, `/`, `/login` | Where the pages are mounted and where users land. |
96
- | `messages` | partial `pl` / `en` dictionaries | built in | Copy overrides (section 9). |
96
+ | `messages` | partial dictionaries per locale (`en` built in; any other is the app's own translation) | built in | Copy overrides (section 9). |
97
97
 
98
98
  **Cookie.** Always `HttpOnly`, `SameSite=Lax`, `Path=/`, `Max-Age` = the TTL. A secure cookie gets
99
99
  the prefix browsers enforce: `__Host-softure_session` when it is host-only, `__Secure-softure_session`
@@ -198,8 +198,8 @@ Private prefixes still belong behind the route guard below; the option covers th
198
198
  (billing's payment page passes its parameters).
199
199
 
200
200
  **Route guard.** `createAuthGuard` returns `(request) => Response | null`: a redirect to the login
201
- page (with `?next=`) for a protected path without a session cookie, `null` otherwise. It only
202
- checks that the cookie is present, so **every private page and action still calls
201
+ page (with `?next=`, the path and query without Next's `_rsc` cache key) for a protected path without a session
202
+ cookie, `null` otherwise. It only checks that the cookie is present, so **every private page and action still calls
203
203
  `requireUser`**: the guard is a convenience, not the access check. Paths are compared decoded and
204
204
  lowercased (`/%61ccount` and `/ACCOUNT` are guarded like `/account`). It imports nothing from Next,
205
205
  so it chains with other proxy pieces:
@@ -259,8 +259,9 @@ never guarded, so `protect: ["/"]` cannot send the login page to itself. The cha
259
259
  stays guarded even under an excluded prefix.
260
260
 
261
261
  A stack the config cannot list (an integration run on a random port, a host added at deploy time)
262
- sets `redirect: "relative"`: the `Location` is the path only (`/login?next=%2Faccount`), so the browser
263
- stays on the host and port it used and no request header is read. An app whose image serves hosts it
262
+ sets `redirect: "relative"`: the login URL is built on the request URL's own origin, which Next's proxy sends to
263
+ the browser as the path only (`/login?next=%2Faccount`), so the browser stays on the host and port it used and no
264
+ request header is read. Outside Next's proxy the `Location` stays absolute on the request URL's origin. An app whose image serves hosts it
264
265
  does not know in advance can instead set the config's `origins.trustRequestHost` (core README).
265
266
 
266
267
  **Roles.** A role is a declared name (`admin`, plus `auth({ roles: ["editor"] })`) held by an
@@ -363,6 +364,35 @@ the first login. `isPasswordHash(value)` checks the format locally, exactly: a h
363
364
  a character outside base64url or a cost scrypt refuses is not a hash `hashPassword` writes, so the script refuses it
364
365
  instead of storing a hash no password matches.
365
366
 
367
+ **Development seed.** `runSeedAccount` from `@softure-ai/auth/scripts` creates a login account for local
368
+ development from `SEED_EMAIL` and `SEED_PASSWORD` through `registerUser`, so the app's `onRegistered` hook runs as
369
+ for a real sign-up, and ends the session registration opens:
370
+
371
+ ```ts
372
+ // scripts/seed.ts, run with `tsx scripts/seed.ts`
373
+ import { runSeedAccount } from "@softure-ai/auth/scripts";
374
+ import config from "../softure.config";
375
+
376
+ process.exitCode = await runSeedAccount({ config });
377
+ ```
378
+
379
+ It is idempotent: an account with that email is left as it is (its password is not reset), exit 0. A refusal names
380
+ the variable and the code (`SEED_PASSWORD is shorter than password.minLength (auth.password_too_short)`, closed
381
+ registration, an invalid email) and writes nothing; a hook that throws rolls the account back. It refuses to run with
382
+ `NODE_ENV=production`, needs the security buckets like any registration, and never prints the password.
383
+
384
+ **One account for a local tool.** `resolveOnlyAccount({ db, envName, env? })` from `@softure-ai/auth/server` gives
385
+ the account a local tool acts for (a stdio MCP server, a measurement or seed script): the id in `env[envName]`
386
+ (`process.env` by default), which must name an account, else the only account in the database. It returns
387
+ `{ ok: true, value: id }` or a refusal with a `message` for the person running the tool: `auth.account_unknown`,
388
+ `auth.no_account`, or `auth.account_ambiguous` when there are several accounts and none is named. It never picks the
389
+ first of several.
390
+
391
+ ```ts
392
+ const account = await resolveOnlyAccount({ db, envName: "MEASURE_USER_ID" });
393
+ if (!account.ok) throw new Error(account.message);
394
+ ```
395
+
366
396
  **Password reset.** Pass a sender, and the login form links to the request page. With
367
397
  `@softure-ai/mailing` enabled, `mailingResetSender()` is that sender:
368
398
 
@@ -502,6 +532,7 @@ its NFC form fails, then rehashes it in NFC.
502
532
  | Name | Required | Meaning |
503
533
  | --- | --- | --- |
504
534
  | `SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED` | no | `true` / `1` closes registration, `false` / `0` opens it, over the declared default. Any other value closes it and logs the variable name. When the app defines the switch in `@softure-ai/feature-switches`, that module reads this variable by its own rules (`on` / `off` too; an unreadable value gives the fail mode). |
535
+ | `SEED_EMAIL`, `SEED_PASSWORD` | for `runSeedAccount` | The development account the seed entry creates (section 4, "Development seed"). |
505
536
 
506
537
  ## 7. Switches
507
538
 
@@ -533,8 +564,9 @@ for the submit button's class), `submitVariant` (a `Button` variant, `primary` b
533
564
 
534
565
  ## 9. Copy
535
566
 
536
- `authMessages.en` and `authMessages.pl`, overridable per locale:
537
- `auth({ messages: { en: { login: { title: "Sign in to Acme" } } } })`. Groups: `fields`, `login`,
567
+ `authMessages.en` (English, the only built-in language), overridable per locale:
568
+ `auth({ messages: { en: { login: { title: "Sign in to Acme" } } } })`; another language is the app's own
569
+ translation under its locale, `auth({ messages: { de: authDe } })`. Groups: `fields`, `login`,
538
570
  `register`, `changePassword`, `forgotPassword`, `resetPassword`, `resetMail` (the reset mail of
539
571
  `mailingResetSender()`; `minutes` holds plural forms), `logout`, and `errors.{auth,security,core}` keyed by the error code
540
572
  (`auth.invalid_credentials` → `errors.auth.invalid_credentials`). `getAuthErrorMessage(messages, code)`
package/dist/index.js CHANGED
@@ -36,8 +36,8 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
36
36
  export const auth = defineModule({
37
37
  manifest: {
38
38
  id: MODULE_ID,
39
- version: "0.1.12",
40
- dependsOn: { security: "^0.1.0", mailing: "^0.1.0?", ops: "^0.1.0?" },
39
+ version: "0.2.0",
40
+ dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?" },
41
41
  dbSchema: "auth",
42
42
  tables: ["users", "sessions", "user_roles", "password_resets"],
43
43
  env: [
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qIAAqI;AACrI,4EAA4E;AAC5E,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE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M,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAQnG;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAehI;AAQD;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,mBAAmB,CAYxD"}
@@ -1,7 +1,7 @@
1
1
  // The password reset mail: rendered from auth's dictionaries in the app's locale and sent through
2
2
  // `@softure-ai/mailing`. A transactional mail: no unsubscribe link, never suppressed. The link is
3
3
  // placed by the code, never by a translatable string, so a copy override cannot drop it.
4
- import { formatMessage, selectPlural } from "@softure-ai/core";
4
+ import { formatMessage, selectMessages, selectPlural } from "@softure-ai/core";
5
5
  import { getSoftureConfig } from "@softure-ai/core/next";
6
6
  import { sendMail } from "@softure-ai/mailing/server";
7
7
  import { getAuthModule, getAuthOptions } from "../server/options.js";
@@ -31,7 +31,7 @@ export function renderPasswordResetMail(messages, locale, input) {
31
31
  /** The app's auth dictionary for `locale`, with its overrides applied. */
32
32
  function getMessages(config, locale) {
33
33
  // The module factory merged the dictionaries; their shape is the module's own.
34
- return getAuthModule(config).messages[locale];
34
+ return selectMessages(getAuthModule(config).messages, locale);
35
35
  }
36
36
  /**
37
37
  * A `passwordReset.send` that mails the link through `@softure-ai/mailing`:
@@ -1 +1 @@
1
- {"version":3,"file":"reset-mail.js","sourceRoot":"","sources":["../../src/mailing/reset-mail.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,kGAAkG;AAClG,yFAAyF;AACzF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAmC,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAA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AC;AACJ,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { AuthFormErrorCode } from "../contract.js";
2
2
  import { en } from "./en.js";
3
- /** Complete default dictionaries; apps pass partial overrides per locale. */
3
+ /** The built-in English dictionary; an app passes partial overrides or its own translation per locale. */
4
4
  export declare const authMessages: {
5
5
  en: {
6
6
  fields: {
@@ -98,102 +98,6 @@ export declare const authMessages: {
98
98
  };
99
99
  };
100
100
  };
101
- pl: {
102
- fields: {
103
- email: string;
104
- password: string;
105
- currentPassword: string;
106
- newPassword: string;
107
- newPasswordHint: string;
108
- consent: string;
109
- };
110
- login: {
111
- title: string;
112
- lead: string;
113
- submit: string;
114
- pending: string;
115
- noAccount: string;
116
- registerLink: string;
117
- forgotPassword: string;
118
- };
119
- register: {
120
- title: string;
121
- lead: string;
122
- submit: string;
123
- pending: string;
124
- hasAccount: string;
125
- loginLink: string;
126
- closedTitle: string;
127
- closedBody: string;
128
- };
129
- changePassword: {
130
- title: string;
131
- lead: string;
132
- submit: string;
133
- pending: string;
134
- success: string;
135
- };
136
- forgotPassword: {
137
- title: string;
138
- lead: string;
139
- submit: string;
140
- pending: string;
141
- sent: string;
142
- backToLogin: string;
143
- };
144
- resetPassword: {
145
- title: string;
146
- lead: string;
147
- submit: string;
148
- pending: string;
149
- success: string;
150
- invalidTitle: string;
151
- invalidBody: string;
152
- requestNew: string;
153
- };
154
- resetMail: {
155
- subject: string;
156
- greeting: string;
157
- intro: string;
158
- action: string;
159
- expiry: string;
160
- minutes: {
161
- one: string;
162
- few: string;
163
- many: string;
164
- other: string;
165
- };
166
- ignore: string;
167
- };
168
- logout: {
169
- submit: string;
170
- };
171
- errors: {
172
- auth: {
173
- invalid_credentials: string;
174
- email_invalid: string;
175
- email_taken: string;
176
- password_too_short: string;
177
- password_too_long: string;
178
- consent_required: string;
179
- registration_closed: string;
180
- current_password_invalid: string;
181
- password_unchanged: string;
182
- unauthenticated: string;
183
- forbidden: string;
184
- reset_token_invalid: string;
185
- password_reset_unavailable: string;
186
- };
187
- security: {
188
- rate_limited: string;
189
- client_unidentified: string;
190
- };
191
- core: {
192
- database_failed: string;
193
- unexpected: string;
194
- };
195
- };
196
- };
197
101
  };
198
102
  export type AuthMessages = typeof en;
199
103
  /** The copy for an error code; an unknown code gets the generic failure. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAG7B,6EAA6E;AAC7E,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAEvC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAI3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0GAA0G;AAC1G,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAEnC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAI3F"}
@@ -1,7 +1,6 @@
1
1
  import { en } from "./en.js";
2
- import { pl } from "./pl.js";
3
- /** Complete default dictionaries; apps pass partial overrides per locale. */
4
- export const authMessages = { en, pl };
2
+ /** The built-in English dictionary; an app passes partial overrides or its own translation per locale. */
3
+ export const authMessages = { en };
5
4
  /** The copy for an error code; an unknown code gets the generic failure. */
6
5
  export function getAuthErrorMessage(messages, code) {
7
6
  const [namespace, name] = code.split(".", 2);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAIvC,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,QAAsB,EAAE,IAAuB;IACjF,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAqB,CAAC;IACjE,MAAM,KAAK,GAAkD,QAAQ,CAAC,MAAqE,CAAC,SAAS,CAAC,CAAC;IACvJ,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;AAC1H,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B,0GAA0G;AAC1G,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,EAAE,EAAE,CAAC;AAInC,4EAA4E;AAC5E,MAAM,UAAU,mBAAmB,CAAC,QAAsB,EAAE,IAAuB;IACjF,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAqB,CAAC;IACjE,MAAM,KAAK,GAAkD,QAAQ,CAAC,MAAqE,CAAC,SAAS,CAAC,CAAC;IACvJ,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;AAC1H,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { SoftureConfig } from "@softure-ai/core";
1
+ import { type SoftureConfig } from "@softure-ai/core";
2
2
  import type { AuthMessages } from "../messages/index.js";
3
3
  /** The module's copy in the app's locale, with the app's overrides applied. */
4
4
  export declare function getAuthMessages(config: SoftureConfig): AuthMessages;
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/next/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAGnE"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/next/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAGnE"}
@@ -1,7 +1,8 @@
1
+ import { selectMessages } from "@softure-ai/core";
1
2
  import { getAuthModule } from "../server/options.js";
2
3
  /** The module's copy in the app's locale, with the app's overrides applied. */
3
4
  export function getAuthMessages(config) {
4
5
  // The module factory merged the dictionaries; their shape is the module's own.
5
- return getAuthModule(config).messages[config.locale];
6
+ return selectMessages(getAuthModule(config).messages, config.locale);
6
7
  }
7
8
  //# sourceMappingURL=messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/next/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,+EAA+E;IAC/E,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAiB,CAAC;AACvE,CAAC"}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/next/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,+EAA+E;IAC/E,OAAO,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAiB,CAAC;AACvF,CAAC"}
@@ -20,9 +20,11 @@ export interface AuthGuardOptions {
20
20
  */
21
21
  readonly trustedOrigins?: readonly string[];
22
22
  /**
23
- * `"absolute"` (default): the login URL is built on the resolved origin (above). `"relative"`: the `Location` is
24
- * the path only (`/login?next=…`), so the browser stays on whatever host and port it used; for a stack served on
25
- * ports or hosts the config cannot list (an integration run on a random port).
23
+ * `"absolute"` (default): the login URL is built on the resolved origin (above). `"relative"`: it is built on the
24
+ * request URL's own origin, which Next's proxy sends to the browser as the path only (`/login?next=…`), so the
25
+ * browser stays on whatever host and port it used; for a stack served on ports or hosts the config cannot list (an
26
+ * integration run on a random port). Outside Next the `Location` stays absolute on that origin, which behind a
27
+ * reverse proxy is the internal one: keep the default there.
26
28
  */
27
29
  readonly redirect?: "absolute" | "relative";
28
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIrF,MAAM,WAAW,gBAAgB;IAC/B,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7C;AAKD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC;AAE9D,6GAA6G;AAC7G,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAoC3F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAiC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIrF,MAAM,WAAW,gBAAgB;IAC/B,kGAAkG;IAClG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7C;AAKD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC;AAE9D,6GAA6G;AAC7G,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAqC3F"}
@@ -45,13 +45,33 @@ export function createAuthGuard(config, options) {
45
45
  // Built on appOrigin, or on the request's public origin when the app trusts it: behind a proxy
46
46
  // the request URL carries an internal host, and request headers alone are never trusted.
47
47
  const login = new URL(routes.login, resolveAppOrigin(config, request, { trustedOrigins }));
48
- login.searchParams.set("next", `${url.pathname}${url.search}`);
48
+ login.searchParams.set("next", getReturnPath(url));
49
49
  if (options.redirect !== "relative")
50
50
  return Response.redirect(login, 307);
51
- // A path-only Location reads no request header at all; `Response.redirect` would need an absolute URL.
52
- return new Response(null, { status: 307, headers: { location: `${login.pathname}${login.search}` } });
51
+ // On the origin the request URL names, reading no request header. Next's proxy needs an absolute Location
52
+ // (a path-only one is a 500) and sends a same-host one to the browser path-only (#452).
53
+ return Response.redirect(new URL(`${login.pathname}${login.search}`, url.origin), 307);
53
54
  };
54
55
  }
56
+ /** Next's client-navigation cache key: meaningless to the page, so it never belongs in a return address. */
57
+ const NEXT_CACHE_KEY = "_rsc";
58
+ /**
59
+ * The path and query to come back to after sign-in, without Next's `_rsc`. The raw query segments are
60
+ * filtered rather than rebuilt, so every other parameter keeps the spelling the request gave it.
61
+ */
62
+ function getReturnPath(url) {
63
+ const segments = url.search.slice(1).split("&").filter((segment) => segment !== "" && !isNextCacheKey(segment));
64
+ return segments.length === 0 ? url.pathname : `${url.pathname}?${segments.join("&")}`;
65
+ }
66
+ function isNextCacheKey(segment) {
67
+ const name = segment.split("=", 1)[0] ?? "";
68
+ try {
69
+ return decodeURIComponent(name) === NEXT_CACHE_KEY;
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ }
55
75
  function normalizePrefix(prefix, kind) {
56
76
  if (!prefix.startsWith("/")) {
57
77
  throw new Error(`createAuthGuard: ${kind} path "${prefix}" must start with /`);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,gGAAgG;AAChG,mGAAmG;AACnG,sDAAsD;AACtD,EAAE;AACF,6FAA6F;AAC7F,6FAA6F;AAC7F,mGAAmG;AACnG,mGAAmG;AACnG,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA8B1E,+GAA+G;AAC/G,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAI1C,6GAA6G;AAC7G,MAAM,UAAU,eAAe,CAAC,MAAqB,EAAE,OAAyB;IAC9E,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,WAAW,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IAC3I,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,C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AM,IAAI,KAAK,CAAC,oCAAoC,KAAK,yDAAyD,CAAC,CAAC;IACtH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,QAAgB;IAClC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,6FAA6F;AAC7F,SAAS,YAAY,CAAC,QAAgB,EAAE,MAAc;IACpD,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,OAAO,CAAC,QAAgB,EAAE,MAAc;IAC/C,OAAO,MAAM,KAAK,GAAG,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;AACpF,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { createGrantRoleScript, createRevokeRoleScript, type RoleScriptArgs, type RoleScriptOptions } from "./role-scripts.js";
2
2
  export { createSetTemporaryPasswordScript, type TemporaryPasswordScriptArgs, type TemporaryPasswordScriptOptions, } from "./temporary-password.js";
3
+ export { runSeedAccount, type RunSeedAccountOptions } from "./seed-account.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/H,OAAO,EACL,gCAAgC,EAChC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,GACpC,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC/H,OAAO,EACL,gCAAgC,EAChC,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,GACpC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,5 +1,7 @@
1
- // `@softure-ai/auth/scripts`: ops scripts that grant and revoke roles and set a temporary password
2
- // (see the README, "Roles" and "Account recovery").
1
+ // `@softure-ai/auth/scripts`: ops scripts that grant and revoke roles and set a temporary password,
2
+ // and the development seed account
3
+ // (see the README, "Roles", "Account recovery" and "Development seed").
3
4
  export { createGrantRoleScript, createRevokeRoleScript } from "./role-scripts.js";
4
5
  export { createSetTemporaryPasswordScript, } from "./temporary-password.js";
6
+ export { runSeedAccount } from "./seed-account.js";
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oDAAoD;AACpD,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAA+C,MAAM,mBAAmB,CAAC;AAC/H,OAAO,EACL,gCAAgC,GAGjC,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scripts/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,mCAAmC;AACnC,wEAAwE;AACxE,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAA+C,MAAM,mBAAmB,CAAC;AAC/H,OAAO,EACL,gCAAgC,GAGjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAA8B,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type Clock, type SoftureConfig } from "@softure-ai/core";
2
+ import { type Database } from "@softure-ai/db";
3
+ import { type CliOutput } from "@softure-ai/db/cli";
4
+ export interface RunSeedAccountOptions {
5
+ readonly config: SoftureConfig;
6
+ /** Default: `process.env`. Reads `SEED_EMAIL`, `SEED_PASSWORD` and `NODE_ENV`. */
7
+ readonly env?: Readonly<Record<string, string | undefined>>;
8
+ /** An open database to use instead of the config's (tests); it is not closed. */
9
+ readonly database?: Database;
10
+ /** Default: the console. The password is never printed. */
11
+ readonly output?: CliOutput;
12
+ readonly clock?: Clock;
13
+ }
14
+ /**
15
+ * Creates the development account and returns the exit code: 0 created or already there, 1 refused
16
+ * or failed (nothing written), 2 `SEED_EMAIL` or `SEED_PASSWORD` missing.
17
+ */
18
+ export declare function runSeedAccount(options: RunSeedAccountOptions): Promise<number>;
19
+ //# sourceMappingURL=seed-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-account.d.ts","sourceRoot":"","sources":["../../src/scripts/seed-account.ts"],"names":[],"mappings":"AAQA,OAAO,EAAyC,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAStF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC5D,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB;AAeD;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyCpF"}
@@ -0,0 +1,95 @@
1
+ // A development login account from `SEED_EMAIL` and `SEED_PASSWORD`, created through the module's
2
+ // registration, so the app's `onRegistered` hook runs as for a real sign-up. Idempotent: an account
3
+ // with that email is left as it is. Not an ops script: it refuses to run with NODE_ENV=production.
4
+ //
5
+ // // scripts/seed.ts, run with `tsx scripts/seed.ts`
6
+ // import { runSeedAccount } from "@softure-ai/auth/scripts";
7
+ // import config from "../softure.config";
8
+ // process.exitCode = await runSeedAccount({ config });
9
+ import { errorLogLabel, safeError, systemClock } from "@softure-ai/core";
10
+ import { openCommandDatabase } from "@softure-ai/db";
11
+ import { EXIT_FAILED, EXIT_OK, EXIT_USAGE } from "@softure-ai/db/cli";
12
+ import { registerUser } from "../server/register.js";
13
+ import { logoutSession } from "../server/sessions.js";
14
+ import { normalizeEmail } from "../server/validation.js";
15
+ const NAME = "seed-account";
16
+ /** The rate limit key the seed counts registration attempts under. */
17
+ const SEED_CLIENT_KEY = "script:seed";
18
+ const REFUSALS = {
19
+ "auth.registration_closed": "registration is closed by a switch; open it for the seed run",
20
+ "auth.email_invalid": "SEED_EMAIL is not a valid email",
21
+ "auth.password_too_short": "SEED_PASSWORD is shorter than password.minLength",
22
+ "auth.password_too_long": "SEED_PASSWORD is longer than the module accepts",
23
+ "auth.consent_required": "registration requires consent",
24
+ };
25
+ const consoleOutput = {
26
+ log: (line) => console.log(line),
27
+ error: (line) => console.error(line),
28
+ };
29
+ /**
30
+ * Creates the development account and returns the exit code: 0 created or already there, 1 refused
31
+ * or failed (nothing written), 2 `SEED_EMAIL` or `SEED_PASSWORD` missing.
32
+ */
33
+ export async function runSeedAccount(options) {
34
+ const env = options.env ?? process.env;
35
+ const output = options.output ?? consoleOutput;
36
+ const email = env.SEED_EMAIL?.trim() ?? "";
37
+ const password = env.SEED_PASSWORD ?? "";
38
+ if (email === "" || password.trim() === "") {
39
+ output.error(`${NAME}: set SEED_EMAIL and SEED_PASSWORD to the development account's email and password`);
40
+ return EXIT_USAGE;
41
+ }
42
+ if (env.NODE_ENV === "production") {
43
+ output.error(`${NAME}: refused: NODE_ENV is production; the seed account is for development`);
44
+ return EXIT_FAILED;
45
+ }
46
+ const opened = await openDatabase(options);
47
+ if (!opened.ok) {
48
+ output.error(`${NAME}: ${opened.message}`);
49
+ return EXIT_FAILED;
50
+ }
51
+ try {
52
+ const ctx = { db: opened.db, clock: options.clock ?? systemClock, config: options.config };
53
+ const registered = await registerUser(ctx, { email, password, hasConsented: true, clientKey: SEED_CLIENT_KEY });
54
+ if (registered.ok) {
55
+ // Registration signs the account in; the seed only wants the account.
56
+ await logoutSession(ctx, registered.value.session.token);
57
+ output.log(`${NAME}: created the account ${registered.value.user.email}`);
58
+ return EXIT_OK;
59
+ }
60
+ if (registered.error === "auth.email_taken") {
61
+ output.log(`${NAME}: ${normalizeEmail(email)} is already there; nothing changed`);
62
+ return EXIT_OK;
63
+ }
64
+ const reason = registered.error === "security.rate_limited" ? "too many registrations from the seed; wait and run it again" : REFUSALS[registered.error];
65
+ output.error(`${NAME}: refused: ${reason} (${registered.error})`);
66
+ return EXIT_FAILED;
67
+ }
68
+ catch (error) {
69
+ output.error(`${NAME}: failed: ${describeFailure(error)}`);
70
+ return EXIT_FAILED;
71
+ }
72
+ finally {
73
+ await opened.close();
74
+ }
75
+ }
76
+ async function openDatabase(options) {
77
+ if (options.database !== undefined)
78
+ return { ok: true, db: options.database, close: () => Promise.resolve() };
79
+ if (options.config.database === null)
80
+ return { ok: false, message: "the config has no database; set database.url in softure.config" };
81
+ try {
82
+ const opened = await openCommandDatabase(options.config.database, { max: 1 });
83
+ return { ok: true, db: opened.handle.db, close: opened.close };
84
+ }
85
+ catch (error) {
86
+ return { ok: false, message: `could not open the database: ${describeFailure(error)}` };
87
+ }
88
+ }
89
+ /** The error message, except for database errors, whose message may carry query parameters (the password hash). */
90
+ function describeFailure(error) {
91
+ if (safeError(error).error === "core.database_failed")
92
+ return `database error (${errorLogLabel(error)})`;
93
+ return error instanceof Error ? error.message : String(error);
94
+ }
95
+ //# sourceMappingURL=seed-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-account.js","sourceRoot":"","sources":["../../src/scripts/seed-account.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,oGAAoG;AACpG,mGAAmG;AACnG,EAAE;AACF,uDAAuD;AACvD,+DAA+D;AAC/D,4CAA4C;AAC5C,yDAAyD;AACzD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAkC,MAAM,kBAAkB,CAAC;AACzG,OAAO,EAAE,mBAAmB,EAAiB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,YAAY,EAA0B,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAoB,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,IAAI,GAAG,cAAc,CAAC;AAC5B,sEAAsE;AACtE,MAAM,eAAe,GAAG,aAAa,CAAC;AAatC,MAAM,QAAQ,GAA6E;IACzF,0BAA0B,EAAE,8DAA8D;IAC1F,oBAAoB,EAAE,iCAAiC;IACvD,yBAAyB,EAAE,kDAAkD;IAC7E,wBAAwB,EAAE,iDAAiD;IAC3E,uBAAuB,EAAE,+BAA+B;CACzD,CAAC;AAEF,MAAM,aAAa,GAAc;IAC/B,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;IAChC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA8B;IACjE,MAAM,GAA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,EAAE,gEAAgE,EAAE,CAAC;IACtI,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9E,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,gCAAgC,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC1F,CAAC;AACH,CAAC;AAED,mHAAmH;AACnH,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,sBAAsB;QAAE,OAAO,mBAAmB,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC;IACzG,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { changePassword, type ChangePasswordErrorCode, type ChangePasswordInput, type ChangePasswordResult } from "./change-password.js";
2
2
  export { loginUser, type LoginInput, type LoginResult } from "./login.js";
3
+ export { resolveOnlyAccount, type OnlyAccountError, type OnlyAccountErrorCode, type OnlyAccountResult, type ResolveOnlyAccountOptions, } from "./only-account.js";
3
4
  export { getAuthOptions, getAuthRoutes, type AuthRoutes } from "./options.js";
4
5
  export { hashPassword, isPasswordHash, matchPassword, MAX_PASSWORD_LENGTH, needsRehash, verifyPassword, type PasswordMatch } from "./password.js";
5
6
  export { deliverPasswordReset, findPasswordResetUser, getPasswordResetLink, isPasswordResetEnabled, issuePasswordReset, prunePasswordResets, requestPasswordReset, resetPassword, RESET_TOKEN_PARAM, type PasswordResetRequestInput, type PasswordResetRequestResult, type ResetPasswordErrorCode, type ResetPasswordInput, type ResetPasswordResult, } from "./password-reset.js";