@softure-ai/auth 0.2.13 → 0.2.17

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 (58) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +16 -3
  3. package/dist/contract.d.ts +1 -1
  4. package/dist/contract.d.ts.map +1 -1
  5. package/dist/contract.js.map +1 -1
  6. package/dist/index.d.ts +11 -4
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/messages/en.d.ts +1 -0
  11. package/dist/messages/en.d.ts.map +1 -1
  12. package/dist/messages/en.js +1 -0
  13. package/dist/messages/en.js.map +1 -1
  14. package/dist/messages/index.d.ts +2 -1
  15. package/dist/messages/index.d.ts.map +1 -1
  16. package/dist/next/context.js +1 -1
  17. package/dist/next/context.js.map +1 -1
  18. package/dist/options.d.ts +39 -11
  19. package/dist/options.d.ts.map +1 -1
  20. package/dist/options.js +32 -6
  21. package/dist/options.js.map +1 -1
  22. package/dist/server/oidc/accounts.d.ts +1 -1
  23. package/dist/server/oidc/accounts.d.ts.map +1 -1
  24. package/dist/server/oidc/accounts.js +7 -1
  25. package/dist/server/oidc/accounts.js.map +1 -1
  26. package/dist/server/oidc/allowlist.d.ts +1 -1
  27. package/dist/server/oidc/allowlist.d.ts.map +1 -1
  28. package/dist/server/oidc/allowlist.js +3 -1
  29. package/dist/server/oidc/allowlist.js.map +1 -1
  30. package/dist/server/options.d.ts +2 -1
  31. package/dist/server/options.d.ts.map +1 -1
  32. package/dist/server/options.js +17 -1
  33. package/dist/server/options.js.map +1 -1
  34. package/dist/server/switches.d.ts +5 -0
  35. package/dist/server/switches.d.ts.map +1 -1
  36. package/dist/server/switches.js +7 -0
  37. package/dist/server/switches.js.map +1 -1
  38. package/dist/testing/account.d.ts.map +1 -1
  39. package/dist/testing/account.js +2 -2
  40. package/dist/testing/account.js.map +1 -1
  41. package/dist/testing/github-provider.d.ts +2 -0
  42. package/dist/testing/github-provider.d.ts.map +1 -1
  43. package/dist/testing/github-provider.js +2 -1
  44. package/dist/testing/github-provider.js.map +1 -1
  45. package/module.json +2 -1
  46. package/package.json +12 -2
  47. package/src/contract.ts +2 -1
  48. package/src/index.ts +3 -1
  49. package/src/messages/en.ts +1 -0
  50. package/src/messages/index.ts +1 -1
  51. package/src/next/context.ts +1 -1
  52. package/src/options.ts +48 -9
  53. package/src/server/oidc/accounts.ts +7 -2
  54. package/src/server/oidc/allowlist.ts +4 -2
  55. package/src/server/options.ts +19 -3
  56. package/src/server/switches.ts +8 -0
  57. package/src/testing/account.ts +2 -2
  58. package/src/testing/github-provider.ts +4 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,37 @@ 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.17
8
+
9
+ - **Open sign-up through a provider:** `openSignUp: true` on an OpenID Connect or GitHub provider lets any verified email
10
+ sign in without an allowlist, for a public product. A first sign-in creates an account only while the
11
+ `auth.registration_closed` switch is off; while it is on, a new identity gets the new error code
12
+ `auth.oidc_registration_closed` (English copy included, optional in `AuthMessages`) and existing accounts still sign
13
+ in. `createFakeGithubProvider({ openSignUp: true })` builds such a definition. Providers with an allowlist behave as
14
+ before.
15
+ - Migrate: nothing.
16
+
17
+ ## 0.2.16
18
+
19
+ - `./jobs` is declared Workers-safe (`softure.workers`, runtime-providers RP-4): its handlers run from the
20
+ Workers Cron Trigger of `@softure-ai/jobs/workers` as well as from the Node worker.
21
+ - Migrate: nothing.
22
+
23
+ ## 0.2.15
24
+
25
+ - The entries `./next` and `./ui` are declared Workers-safe too (runtime-providers RP-7); `./next` reaches the
26
+ database through `@softure-ai/db/request` (db `^0.1.15`).
27
+ - Migrate: nothing.
28
+
29
+ ## 0.2.14
30
+
31
+ - **Cloudflare Workers:** auth runs on `platform: { host: "cloudflare" }` (manifest `runtimes: ["node", "workers"]`); the
32
+ entries `.`, `./server` and `./proxy` are declared Workers-safe. Hashes keep the `scrypt$…` format on both runtimes.
33
+ - **Hash cost per runtime:** a `password.scrypt` field left out now takes the runtime's default (`SCRYPT_DEFAULTS`):
34
+ Node `{ 2 ** 17, 8, 1 }` as before, Workers `{ 2 ** 14, 8, 5 }` (OWASP's 16 MiB profile). `getAuthOptions(config)`
35
+ returns the resolved cost; `auth().options.password.scrypt` holds only what the app set. A login rehashes into the
36
+ runtime's cost, so users keep their passwords when an app moves hosts.
37
+
7
38
  ## 0.2.13
8
39
 
9
40
  - **Dependencies:** `zod` ^4.6.7 (was ^4.6.5), so a fresh install takes the fixed zod release.
package/README.md CHANGED
@@ -81,7 +81,7 @@ export default config;
81
81
  | Option | Type | Default | Meaning |
82
82
  | --- | --- | --- | --- |
83
83
  | `password.minLength` | `number` (8-128) | `10` | Shortest new password, in characters. The longest is 1024. |
84
- | `password.scrypt` | `{ cost, blockSize, parallelization }` | `{ 2 ** 17, 8, 1 }` | scrypt N, r, p (OWASP). Raising them rehashes each password at its owner's next login. Memory: 128 × N × r bytes per hash, so the default takes 128 MiB and about 0.4 s of one core; Node runs up to four hashes at once (its libuv pool, `UV_THREADPOOL_SIZE`), about 512 MiB at a burst of logins. On a small server, lower `cost` to `2 ** 16` (64 MiB) or `2 ** 15` (32 MiB) and leave the pool at four. |
84
+ | `password.scrypt` | `{ cost, blockSize, parallelization }` | Node: `{ 2 ** 17, 8, 1 }`; Workers: `{ 2 ** 14, 8, 5 }` | scrypt N, r, p (OWASP). A field left out takes the runtime's default (`SCRYPT_DEFAULTS`, from `platform` in the config). Changing them rehashes each password at its owner's next login. Memory: 128 × N × r bytes per hash, so the Node default takes 128 MiB and about 0.4 s of one core; Node runs up to four hashes at once (its libuv pool, `UV_THREADPOOL_SIZE`), about 512 MiB at a burst of logins. On a small server, lower `cost` to `2 ** 16` (64 MiB) or `2 ** 15` (32 MiB) and leave the pool at four. On Cloudflare Workers the default is OWASP's 16 MiB profile, since an isolate has 128 MB in all. |
85
85
  | `session.ttlDays` | `number` (1-365) | `30` | Session lifetime from login. It is not extended by use. |
86
86
  | `cookie.name` | `string` | `"softure_session"` | Base name of the session cookie (see below). |
87
87
  | `cookie.domain` | `string` | none (host-only) | Share the session with subdomains, e.g. `example.com` for the apex and `app.example.com`. |
@@ -167,7 +167,8 @@ the variables the provider names.
167
167
  `aud`/`azp`, `exp`, `iat`, `nonce`. Discovery must name the configured issuer and https endpoints (http only on
168
168
  localhost).
169
169
  - **Who may sign in.** `email_verified` is required, then the email must be in `allowedEmails` or its domain in
170
- `allowedDomains` (one of the two lists is required). For `https://accounts.google.com`, `requireHostedDomain`
170
+ `allowedDomains` (one of the two lists is required, unless `openSignUp: true` lets any verified email in; see
171
+ "Open sign-up" under GitHub sign-in). For `https://accounts.google.com`, `requireHostedDomain`
171
172
  defaults to true: a domain match also needs Google's `hd` claim to name that domain, because a consumer Google
172
173
  account can carry a verified address of any domain. A refused identity goes back to the login page with
173
174
  `?oidc_error=auth.oidc_not_allowed` and never gets an account.
@@ -187,7 +188,8 @@ the variables the provider names.
187
188
  `requireRole`, `adminEmails` and every module built on auth work unchanged. It answers a `303` to `next` (through
188
189
  `rewriteRedirect`), or to the login page with `?oidc_error=<code>`: `auth.oidc_failed` (the reason is in the log
189
190
  only: `OpenID Connect sign-in with google failed: id_token audience`), `auth.oidc_cancelled`,
190
- `auth.oidc_not_allowed`, `auth.oidc_no_account`, or a rate limit code.
191
+ `auth.oidc_not_allowed`, `auth.oidc_no_account`, `auth.oidc_registration_closed` (an `openSignUp` provider while
192
+ registration is closed), or a rate limit code.
191
193
  - **Passwords off.** `password: { enabled: false }` (needs a provider): `LoginPage` shows only the provider buttons,
192
194
  `loginUser` answers `auth.invalid_credentials`, registration is closed, password reset is off and the
193
195
  change-password page is not found (`changePassword` answers `auth.forbidden`).
@@ -240,6 +242,12 @@ workflow could not hold them as Environment secrets.
240
242
  - **Who may sign in.** Only verified emails count. The primary email is tried first, then any other verified email,
241
243
  and the first one that `allowedEmails` or `allowedDomains` accepts signs in (there is no hosted domain on GitHub).
242
244
  None: `auth.oidc_not_allowed`.
245
+ - **Open sign-up.** A public product sets `openSignUp: true` instead of an allowlist: any verified email signs in (the
246
+ primary one first). A first sign-in creates an account only while registration is open (the
247
+ `auth.registration_closed` switch, read with or without the password form); while it is closed, a new identity gets
248
+ `auth.oidc_registration_closed` and an account that already exists (linked, or with the same verified email) still
249
+ signs in. `onRegistered` runs with `consent: null`: show the terms next to the button. The option exists on OpenID
250
+ Connect providers too.
243
251
  - **Accounts.** The subject is the numeric GitHub account id, so a renamed login or a changed email keeps the account.
244
252
  The display name is the profile `name`, else the `login`. The log line reads `GitHub sign-in with github failed: …`.
245
253
  - **Tests.** `createFakeGithubProvider()` from `@softure-ai/auth/testing` is GitHub in memory (authorize check, token
@@ -865,6 +873,11 @@ Rate limit rows of `security` hold only SHA-256 prefixes of the email and user i
865
873
 
866
874
  ## 12. Limitations / known gaps
867
875
 
876
+ - On Cloudflare Workers (`platform: { host: "cloudflare" }`) the entries `.`, `./server` and `./proxy` run as on Node,
877
+ with the same `scrypt$…` hashes. A hash made at the Node default (128 MiB) may not verify in a 128 MB isolate: before
878
+ an app moves to Workers, lower `password.scrypt.cost` on the VPS to `2 ** 15` or below and let logins rehash, or keep
879
+ the old cost only for users who have not signed in since. Each login on Workers rehashes into the Workers cost.
880
+
868
881
  - Sessions have a fixed lifetime; there is no sliding renewal and no "remember me".
869
882
  - A password change keeps the session that made it (and ends every other one); the token itself
870
883
  is not rotated. The new password must differ from the current one (`auth.password_unchanged`). Login and register end the session the browser held before.
@@ -1,6 +1,6 @@
1
1
  import type { CoreErrorCode } from "@softure-ai/core";
2
2
  import type { SecurityErrorCode } from "@softure-ai/security";
3
- export type AuthErrorCode = "auth.invalid_credentials" | "auth.email_invalid" | "auth.email_taken" | "auth.password_too_short" | "auth.password_too_long" | "auth.consent_required" | "auth.registration_closed" | "auth.current_password_invalid" | "auth.password_unchanged" | "auth.unauthenticated" | "auth.forbidden" | "auth.reset_token_invalid" | "auth.password_reset_unavailable" | "auth.oidc_failed" | "auth.oidc_cancelled" | "auth.oidc_not_allowed" | "auth.oidc_no_account";
3
+ export type AuthErrorCode = "auth.invalid_credentials" | "auth.email_invalid" | "auth.email_taken" | "auth.password_too_short" | "auth.password_too_long" | "auth.consent_required" | "auth.registration_closed" | "auth.current_password_invalid" | "auth.password_unchanged" | "auth.unauthenticated" | "auth.forbidden" | "auth.reset_token_invalid" | "auth.password_reset_unavailable" | "auth.oidc_failed" | "auth.oidc_cancelled" | "auth.oidc_not_allowed" | "auth.oidc_no_account" | "auth.oidc_registration_closed";
4
4
  /** Why an OpenID Connect sign-in did not open a session; the login page shows it (`?oidc_error=`). */
5
5
  export type OidcSignInErrorCode = Extract<AuthErrorCode, `auth.oidc_${string}`>;
6
6
  /** Every code an auth form can show: its own, the rate limiter's and the generic ones. */
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,MAAM,aAAa,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GACxB,uBAAuB,GACvB,0BAA0B,GAC1B,+BAA+B,GAC/B,yBAAyB,GACzB,sBAAsB,GACtB,gBAAgB,GAChB,0BAA0B,GAC1B,iCAAiC,GACjC,kBAAkB,GAClB,qBAAqB,GACrB,uBAAuB,GACvB,sBAAsB,CAAC;AAE3B,sGAAsG;AACtG,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,aAAa,EAAE,aAAa,MAAM,EAAE,CAAC,CAAC;AAEhF,0FAA0F;AAC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,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,sCAAsC;AACtC,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;CAC9B;AAED,gGAAgG;AAChG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACvD,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,qGAAqG;IACrG,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,iBAAiB,GAAG,aAAa,GAAG,SAAS,CAAC;AAEjG;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC;IACzC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,uBAAuB,EAAE,aAAkC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAiFA,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAkFA,MAAM,CAAC,MAAM,uBAAuB,GAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -166,6 +166,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
166
166
  oidc_cancelled: string;
167
167
  oidc_not_allowed: string;
168
168
  oidc_no_account: string;
169
+ oidc_registration_closed: string;
169
170
  };
170
171
  security: {
171
172
  rate_limited: string;
@@ -181,9 +182,9 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
181
182
  enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
182
183
  minLength: import("zod").ZodDefault<import("zod").ZodNumber>;
183
184
  scrypt: import("zod").ZodPrefault<import("zod").ZodObject<{
184
- cost: import("zod").ZodDefault<import("zod").ZodNumber>;
185
- blockSize: import("zod").ZodDefault<import("zod").ZodNumber>;
186
- parallelization: import("zod").ZodDefault<import("zod").ZodNumber>;
185
+ cost: import("zod").ZodOptional<import("zod").ZodNumber>;
186
+ blockSize: import("zod").ZodOptional<import("zod").ZodNumber>;
187
+ parallelization: import("zod").ZodOptional<import("zod").ZodNumber>;
187
188
  }, import("zod/v4/core").$strict>>;
188
189
  }, import("zod/v4/core").$strict>>;
189
190
  session: import("zod").ZodPrefault<import("zod").ZodObject<{
@@ -213,6 +214,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
213
214
  allowedDomains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
214
215
  allowedEmails: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodEmail>>>;
215
216
  createAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
217
+ openSignUp: import("zod").ZodDefault<import("zod").ZodBoolean>;
216
218
  type: import("zod").ZodDefault<import("zod").ZodLiteral<"oidc">>;
217
219
  id: import("zod").ZodString;
218
220
  name: import("zod").ZodString;
@@ -230,6 +232,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
230
232
  allowedDomains: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
231
233
  allowedEmails: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodEmail>>>;
232
234
  createAccounts: import("zod").ZodDefault<import("zod").ZodBoolean>;
235
+ openSignUp: import("zod").ZodDefault<import("zod").ZodBoolean>;
233
236
  type: import("zod").ZodLiteral<"github">;
234
237
  id: import("zod").ZodString;
235
238
  name: import("zod").ZodString;
@@ -240,6 +243,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
240
243
  allowedDomains: string[];
241
244
  allowedEmails: string[];
242
245
  createAccounts: boolean;
246
+ openSignUp: boolean;
243
247
  type: "github";
244
248
  id: string;
245
249
  name: string;
@@ -251,6 +255,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
251
255
  allowedDomains: string[];
252
256
  allowedEmails: string[];
253
257
  createAccounts: boolean;
258
+ openSignUp: boolean;
254
259
  type: "oidc";
255
260
  id: string;
256
261
  name: string;
@@ -265,6 +270,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
265
270
  allowedDomains: string[];
266
271
  allowedEmails: string[];
267
272
  createAccounts: boolean;
273
+ openSignUp: boolean;
268
274
  type: "oidc";
269
275
  id: string;
270
276
  name: string;
@@ -279,6 +285,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
279
285
  allowedDomains: string[];
280
286
  allowedEmails: string[];
281
287
  createAccounts: boolean;
288
+ openSignUp: boolean;
282
289
  type: "github";
283
290
  id: string;
284
291
  name: string;
@@ -296,7 +303,7 @@ export declare const auth: import("@softure-ai/core").ModuleFactory<{
296
303
  export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
297
304
  export type { AuthErrorCode, AuthFormErrorCode, AuthFormField, AuthFormState, AuthUser, NewSession, OidcSignInErrorCode, RegisteredEvent, SignedIn, } from "./contract.js";
298
305
  export { authMessages, getAuthErrorMessage, type AuthMessages } from "./messages/index.js";
299
- export { OIDC_PROVIDER_ID_PATTERN, type AuthOptions, type AuthOptionsInput, type GithubProvider, type GithubProviderInput, type OidcProvider, type OidcProviderInput, type OnRegisteredHook, type OpenIdConnectProvider, type OpenIdConnectProviderInput, type RewriteRedirect, type RewriteRedirectContext, type ScryptParams, } from "./options.js";
306
+ export { OIDC_PROVIDER_ID_PATTERN, type AuthOptions, type AuthOptionsInput, type GithubProvider, type GithubProviderInput, type OidcProvider, type OidcProviderInput, type OnRegisteredHook, type OpenIdConnectProvider, type OpenIdConnectProviderInput, type RewriteRedirect, type RewriteRedirectContext, type ScryptParams, SCRYPT_DEFAULTS, } from "./options.js";
300
307
  export { consolePasswordResetSender, type PasswordResetDetails, type PasswordResetEnqueuer, type PasswordResetSender, } from "./password-reset-sender.js";
301
308
  export { getSessionCookie, type SessionCookie } from "./session-cookie.js";
302
309
  export { toSafeNextPath } from "./safe-next-path.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,2DAA2D;AAC3D,eAAO,MAAM,0BAA0B,6BAA6B,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,4CAA4C,CAAC;AAEjF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;iBACtB,KAAK,EAAE,CAAC;iBAAE,aAAa,EAAE,EAAE;iBAAE,GAAG,EAAE,IAAI;;;iBACzC,KAAK,EAAE,EAAE;iBAAE,aAAa,EAAE,EAAE;iBAAE,GAAG,EAAE,IAAI;;;iBAC7B,KAAK,EAAE,EAAE;iBAAE,aAAa,EAAE,EAAE;iBAAE,GAAG,EAAE,SAAS;;;iBAC1C,KAAK,EAAE,EAAE;iBAAE,aAAa,EAAE,EAAE;iBAAE,GAAG,EAAE,SAAS;;;iBAC7C,KAAK,EAAE,EAAE;iBAAE,aAAa,EAAE,EAAE;iBAAE,GAAG,EAAE,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qBAAqB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -40,7 +40,8 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
40
40
  export const auth = defineModule({
41
41
  manifest: {
42
42
  id: MODULE_ID,
43
- version: "0.2.13",
43
+ version: "0.2.17",
44
+ runtimes: ["node", "workers"],
44
45
  dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?", jobs: "^0.1.1?" },
45
46
  dbSchema: "auth",
46
47
  tables: ["users", "sessions", "user_roles", "password_resets", "identities", "oidc_states"],
@@ -81,7 +82,7 @@ export const auth = defineModule({
81
82
  });
82
83
  export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
83
84
  export { authMessages, getAuthErrorMessage } from "./messages/index.js";
84
- export { OIDC_PROVIDER_ID_PATTERN, } from "./options.js";
85
+ export { OIDC_PROVIDER_ID_PATTERN, SCRYPT_DEFAULTS, } from "./options.js";
85
86
  export { consolePasswordResetSender, } from "./password-reset-sender.js";
86
87
  export { getSessionCookie } from "./session-cookie.js";
87
88
  export { toSafeNextPath } from "./safe-next-path.js";
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,sGAAsG;AACtG,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,MA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
97
+ oidc_registration_closed: string;
97
98
  };
98
99
  security: {
99
100
  rate_limited: string;
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;IACb,MAAM;QACJ,KAAK;QACL,QAAQ;QACR,eAAe;QACf,WAAW;QACX,eAAe;QACf,OAAO;;IAET,KAAK;QACH,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,SAAS;QACT,YAAY;QACZ,cAAc;;IAEhB,QAAQ;QACN,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,UAAU;QACV,SAAS;QACT,WAAW;QACX,UAAU;;IAEZ,cAAc;QACZ,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,OAAO;;IAET,cAAc;QACZ,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,IAAI;QACJ,WAAW;;IAEb,aAAa;QACX,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,OAAO;QACP,YAAY;QACZ,WAAW;QACX,UAAU;;IAEZ,SAAS;QACP,OAAO;QACP,QAAQ;QACR,KAAK;QACL,MAAM;QACN,MAAM;QACN,qFAAqF;QACrF,OAAO;YAAI,GAAG;YAAoB,GAAG;YAAqB,IAAI;YAAqB,KAAK;;QACxF,MAAM;;IAER,MAAM;QACJ,MAAM;;IAER,IAAI;QACF,0FAA0F;QAC1F,UAAU;QACV,0DAA0D;QAC1D,OAAO;;IAET,MAAM;QACJ,IAAI;YACF,mBAAmB;YACnB,aAAa;YACb,WAAW;YACX,kBAAkB;YAClB,iBAAiB;YACjB,gBAAgB;YAChB,mBAAmB;YACnB,wBAAwB;YACxB,kBAAkB;YAClB,eAAe;YACf,SAAS;YACT,mBAAmB;YACnB,0BAA0B;YAC1B,WAAW;YACX,cAAc;YACd,gBAAgB;YAChB,eAAe;;QAEjB,QAAQ;YACN,YAAY;YACZ,mBAAmB;;QAErB,IAAI;YACF,eAAe;YACf,UAAU;;;CAGf,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;IACb,MAAM;QACJ,KAAK;QACL,QAAQ;QACR,eAAe;QACf,WAAW;QACX,eAAe;QACf,OAAO;;IAET,KAAK;QACH,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,SAAS;QACT,YAAY;QACZ,cAAc;;IAEhB,QAAQ;QACN,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,UAAU;QACV,SAAS;QACT,WAAW;QACX,UAAU;;IAEZ,cAAc;QACZ,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,OAAO;;IAET,cAAc;QACZ,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,IAAI;QACJ,WAAW;;IAEb,aAAa;QACX,KAAK;QACL,IAAI;QACJ,MAAM;QACN,OAAO;QACP,OAAO;QACP,YAAY;QACZ,WAAW;QACX,UAAU;;IAEZ,SAAS;QACP,OAAO;QACP,QAAQ;QACR,KAAK;QACL,MAAM;QACN,MAAM;QACN,qFAAqF;QACrF,OAAO;YAAI,GAAG;YAAoB,GAAG;YAAqB,IAAI;YAAqB,KAAK;;QACxF,MAAM;;IAER,MAAM;QACJ,MAAM;;IAER,IAAI;QACF,0FAA0F;QAC1F,UAAU;QACV,0DAA0D;QAC1D,OAAO;;IAET,MAAM;QACJ,IAAI;YACF,mBAAmB;YACnB,aAAa;YACb,WAAW;YACX,kBAAkB;YAClB,iBAAiB;YACjB,gBAAgB;YAChB,mBAAmB;YACnB,wBAAwB;YACxB,kBAAkB;YAClB,eAAe;YACf,SAAS;YACT,mBAAmB;YACnB,0BAA0B;YAC1B,WAAW;YACX,cAAc;YACd,gBAAgB;YAChB,eAAe;YACf,wBAAwB;;QAE1B,QAAQ;YACN,YAAY;YACZ,mBAAmB;;QAErB,IAAI;YACF,eAAe;YACf,UAAU;;;CAGf,CAAC"}
@@ -89,6 +89,7 @@ export const en = {
89
89
  oidc_cancelled: "Signing in was cancelled.",
90
90
  oidc_not_allowed: "This account may not sign in here.",
91
91
  oidc_no_account: "There is no account for this sign-in. Ask for access.",
92
+ oidc_registration_closed: "Registration is closed. Only existing accounts can sign in.",
92
93
  },
93
94
  security: {
94
95
  rate_limited: "Too many attempts. Wait a few minutes and try again.",
@@ -1 +1 @@
1
- {"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,UAAU;QACpB,eAAe,EAAE,kBAAkB;QACnC,WAAW,EAAE,cAAc;QAC3B,eAAe,EAAE,kCAAkC;QACnD,OAAO,EAAE,uDAAuD;KACjE;IACD,KAAK,EAAE;QACL,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,aAAa;QACtB,SAAS,EAAE,iBAAiB;QAC5B,YAAY,EAAE,YAAY;QAC1B,cAAc,EAAE,uBAAuB;KACxC;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,oBAAoB;QAC1B,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,WAAW;QACpB,UAAU,EAAE,0BAA0B;QACtC,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,wBAAwB;QACrC,UAAU,EAAE,4DAA4D;KACzE;IACD,cAAc,EAAE;QACd,KAAK,EAAE,iBAAiB;QACxB,IAAI,EAAE,6DAA6D;QACnE,MAAM,EAAE,iBAAiB;QACzB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,iCAAiC;KAC3C;IACD,cAAc,EAAE;QACd,KAAK,EAAE,qBAAqB;QAC5B,IAAI,EAAE,oFAAoF;QAC1F,MAAM,EAAE,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,2BAA2B;YAC3C,gBAAgB,EAAE,oCAAoC;YACtD,eAAe,EAAE,uDAAuD;YACxE,wBAAwB,EAAE,6DAA6D;SACxF;QACD,QAAQ,EAAE;YACR,YAAY,EAAE,sDAAsD;YACpE,mBAAmB,EAAE,oEAAoE;SAC1F;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,0DAA0D;YAC3E,UAAU,EAAE,0DAA0D;SACvE;KACF;CACF,CAAC"}
@@ -95,6 +95,7 @@ export declare const authMessages: {
95
95
  oidc_cancelled: string;
96
96
  oidc_not_allowed: string;
97
97
  oidc_no_account: string;
98
+ oidc_registration_closed: string;
98
99
  };
99
100
  security: {
100
101
  rate_limited: string;
@@ -109,7 +110,7 @@ export declare const authMessages: {
109
110
  };
110
111
  type EnglishMessages = typeof en;
111
112
  type AuthErrorCopy = EnglishMessages["errors"]["auth"];
112
- type OidcErrorName = "oidc_failed" | "oidc_cancelled" | "oidc_not_allowed" | "oidc_no_account";
113
+ type OidcErrorName = "oidc_failed" | "oidc_cancelled" | "oidc_not_allowed" | "oidc_no_account" | "oidc_registration_closed";
113
114
  /**
114
115
  * One locale's copy. The OpenID Connect keys (`oidc`, `errors.auth.oidc_*`) are optional, so a dictionary written
115
116
  * before them still compiles; a missing one reads the English copy.
@@ -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;AAE7B,0GAA0G;AAC1G,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAS,CAAC;AAEnC,KAAK,eAAe,GAAG,OAAO,EAAE,CAAC;AACjC,KAAK,aAAa,GAAG,eAAe,CAAC,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AAG,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,0BAA0B,CAAC;AAE5H;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG;IACpE,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;QACzD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC;KACjG,CAAC;CACH,CAAC;AAEF,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAE/E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAE3F"}
@@ -2,7 +2,7 @@
2
2
  // handle and the wall clock. Request scope (cookies, headers) stays in this folder.
3
3
  import { systemClock } from "@softure-ai/core";
4
4
  import { getSoftureConfig } from "@softure-ai/core/next";
5
- import { getConfiguredDatabase } from "@softure-ai/db";
5
+ import { getConfiguredDatabase } from "@softure-ai/db/request";
6
6
  export async function getAuthContext(config = getSoftureConfig()) {
7
7
  if (config.database === null) {
8
8
  throw new Error("@softure-ai/auth: softure.config.ts has no database; auth needs one");
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/next/context.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oFAAoF;AACpF,OAAO,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAM,GAAkB,gBAAgB,EAAE;IAC7E,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/next/context.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,oFAAoF;AACpF,OAAO,EAAE,WAAW,EAAsB,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAM,GAAkB,gBAAgB,EAAE;IAC7E,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,qBAAqB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AAC5C,CAAC"}
package/dist/options.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { FetchFunction, ModuleContext, SoftureConfig } from "@softure-ai/core";
1
+ import type { FetchFunction, ModuleContext, SoftureConfig, SoftureRuntime } from "@softure-ai/core";
2
2
  import type { Queryable } from "@softure-ai/db";
3
3
  import { z } from "zod";
4
4
  import type { RegisteredEvent } from "./contract.js";
@@ -9,6 +9,17 @@ import type { PasswordResetEnqueuer, PasswordResetSender } from "./password-rese
9
9
  * logins can take 512 MiB. A small server lowers `password.scrypt.cost` (README §3).
10
10
  */
11
11
  export declare const DEFAULT_SCRYPT_COST: number;
12
+ /** scrypt N, r and p: memory per hash is 128 * cost * blockSize bytes. */
13
+ export interface ScryptParams {
14
+ readonly cost: number;
15
+ readonly blockSize: number;
16
+ readonly parallelization: number;
17
+ }
18
+ /**
19
+ * The hash cost each runtime uses when the app sets none. Node: OWASP's first profile (128 MiB). Workers: OWASP's
20
+ * equivalent 16 MiB profile (N = 2^14, r = 8, p = 5), because a Workers isolate has 128 MB in all.
21
+ */
22
+ export declare const SCRYPT_DEFAULTS: Readonly<Record<SoftureRuntime, ScryptParams>>;
12
23
  /** Runs inside the registration transaction; a thrown error rolls the registration back. */
13
24
  export type OnRegisteredHook = (event: RegisteredEvent, ctx: ModuleContext<Queryable>) => Promise<void>;
14
25
  /** What a redirect rewrite gets besides the path. */
@@ -27,11 +38,6 @@ export interface RewriteRedirectContext {
27
38
  * keeps the channel tag. A result that is not a path on this app, or a failure, leaves auth's own path.
28
39
  */
29
40
  export type RewriteRedirect = (path: string, ctx: RewriteRedirectContext) => Promise<string> | string;
30
- declare const scryptSchema: z.ZodObject<{
31
- cost: z.ZodDefault<z.ZodNumber>;
32
- blockSize: z.ZodDefault<z.ZodNumber>;
33
- parallelization: z.ZodDefault<z.ZodNumber>;
34
- }, z.core.$strict>;
35
41
  /** A provider id: the path segment of its callback (`/api/auth/oidc/<id>/callback`) and the key of its identities. */
36
42
  export declare const OIDC_PROVIDER_ID_PATTERN: RegExp;
37
43
  /** An https URL, or http on the local machine (a development identity provider). */
@@ -40,6 +46,7 @@ declare const openIdConnectProviderSchema: z.ZodObject<{
40
46
  allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
41
47
  allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
42
48
  createAccounts: z.ZodDefault<z.ZodBoolean>;
49
+ openSignUp: z.ZodDefault<z.ZodBoolean>;
43
50
  type: z.ZodDefault<z.ZodLiteral<"oidc">>;
44
51
  id: z.ZodString;
45
52
  name: z.ZodString;
@@ -63,6 +70,7 @@ declare const githubProviderSchema: z.ZodObject<{
63
70
  allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
64
71
  allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
65
72
  createAccounts: z.ZodDefault<z.ZodBoolean>;
73
+ openSignUp: z.ZodDefault<z.ZodBoolean>;
66
74
  type: z.ZodLiteral<"github">;
67
75
  id: z.ZodString;
68
76
  name: z.ZodString;
@@ -74,6 +82,7 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
74
82
  allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
75
83
  allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
76
84
  createAccounts: z.ZodDefault<z.ZodBoolean>;
85
+ openSignUp: z.ZodDefault<z.ZodBoolean>;
77
86
  type: z.ZodDefault<z.ZodLiteral<"oidc">>;
78
87
  id: z.ZodString;
79
88
  name: z.ZodString;
@@ -91,6 +100,7 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
91
100
  allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
92
101
  allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
93
102
  createAccounts: z.ZodDefault<z.ZodBoolean>;
103
+ openSignUp: z.ZodDefault<z.ZodBoolean>;
94
104
  type: z.ZodLiteral<"github">;
95
105
  id: z.ZodString;
96
106
  name: z.ZodString;
@@ -101,6 +111,7 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
101
111
  allowedDomains: string[];
102
112
  allowedEmails: string[];
103
113
  createAccounts: boolean;
114
+ openSignUp: boolean;
104
115
  type: "github";
105
116
  id: string;
106
117
  name: string;
@@ -112,6 +123,7 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
112
123
  allowedDomains: string[];
113
124
  allowedEmails: string[];
114
125
  createAccounts: boolean;
126
+ openSignUp: boolean;
115
127
  type: "oidc";
116
128
  id: string;
117
129
  name: string;
@@ -126,6 +138,7 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
126
138
  allowedDomains: string[];
127
139
  allowedEmails: string[];
128
140
  createAccounts: boolean;
141
+ openSignUp: boolean;
129
142
  type: "oidc";
130
143
  id: string;
131
144
  name: string;
@@ -140,6 +153,7 @@ declare const oidcProviderSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject
140
153
  allowedDomains: string[];
141
154
  allowedEmails: string[];
142
155
  createAccounts: boolean;
156
+ openSignUp: boolean;
143
157
  type: "github";
144
158
  id: string;
145
159
  name: string;
@@ -163,9 +177,9 @@ export declare const authOptionsSchema: z.ZodObject<{
163
177
  enabled: z.ZodDefault<z.ZodBoolean>;
164
178
  minLength: z.ZodDefault<z.ZodNumber>;
165
179
  scrypt: z.ZodPrefault<z.ZodObject<{
166
- cost: z.ZodDefault<z.ZodNumber>;
167
- blockSize: z.ZodDefault<z.ZodNumber>;
168
- parallelization: z.ZodDefault<z.ZodNumber>;
180
+ cost: z.ZodOptional<z.ZodNumber>;
181
+ blockSize: z.ZodOptional<z.ZodNumber>;
182
+ parallelization: z.ZodOptional<z.ZodNumber>;
169
183
  }, z.core.$strict>>;
170
184
  }, z.core.$strict>>;
171
185
  session: z.ZodPrefault<z.ZodObject<{
@@ -195,6 +209,7 @@ export declare const authOptionsSchema: z.ZodObject<{
195
209
  allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
196
210
  allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
197
211
  createAccounts: z.ZodDefault<z.ZodBoolean>;
212
+ openSignUp: z.ZodDefault<z.ZodBoolean>;
198
213
  type: z.ZodDefault<z.ZodLiteral<"oidc">>;
199
214
  id: z.ZodString;
200
215
  name: z.ZodString;
@@ -212,6 +227,7 @@ export declare const authOptionsSchema: z.ZodObject<{
212
227
  allowedDomains: z.ZodDefault<z.ZodArray<z.ZodString>>;
213
228
  allowedEmails: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodEmail>>>;
214
229
  createAccounts: z.ZodDefault<z.ZodBoolean>;
230
+ openSignUp: z.ZodDefault<z.ZodBoolean>;
215
231
  type: z.ZodLiteral<"github">;
216
232
  id: z.ZodString;
217
233
  name: z.ZodString;
@@ -222,6 +238,7 @@ export declare const authOptionsSchema: z.ZodObject<{
222
238
  allowedDomains: string[];
223
239
  allowedEmails: string[];
224
240
  createAccounts: boolean;
241
+ openSignUp: boolean;
225
242
  type: "github";
226
243
  id: string;
227
244
  name: string;
@@ -233,6 +250,7 @@ export declare const authOptionsSchema: z.ZodObject<{
233
250
  allowedDomains: string[];
234
251
  allowedEmails: string[];
235
252
  createAccounts: boolean;
253
+ openSignUp: boolean;
236
254
  type: "oidc";
237
255
  id: string;
238
256
  name: string;
@@ -247,6 +265,7 @@ export declare const authOptionsSchema: z.ZodObject<{
247
265
  allowedDomains: string[];
248
266
  allowedEmails: string[];
249
267
  createAccounts: boolean;
268
+ openSignUp: boolean;
250
269
  type: "oidc";
251
270
  id: string;
252
271
  name: string;
@@ -261,6 +280,7 @@ export declare const authOptionsSchema: z.ZodObject<{
261
280
  allowedDomains: string[];
262
281
  allowedEmails: string[];
263
282
  createAccounts: boolean;
283
+ openSignUp: boolean;
264
284
  type: "github";
265
285
  id: string;
266
286
  name: string;
@@ -276,7 +296,15 @@ export declare const authOptionsSchema: z.ZodObject<{
276
296
  rewriteRedirect: z.ZodOptional<z.ZodCustom<RewriteRedirect, RewriteRedirect>>;
277
297
  }, z.core.$strict>;
278
298
  export type AuthOptionsInput = z.input<typeof authOptionsSchema>;
279
- export type AuthOptions = z.output<typeof authOptionsSchema>;
280
- export type ScryptParams = z.output<typeof scryptSchema>;
299
+ /** The options as `auth({ ... })` parsed them, before the runtime is known. */
300
+ export type ParsedAuthOptions = z.output<typeof authOptionsSchema>;
301
+ /** The options of the running app (`getAuthOptions`): the hash cost resolved for its runtime. */
302
+ export type AuthOptions = Omit<ParsedAuthOptions, "password"> & {
303
+ readonly password: Omit<ParsedAuthOptions["password"], "scrypt"> & {
304
+ readonly scrypt: ScryptParams;
305
+ };
306
+ };
307
+ /** `scrypt` with each unset field taken from the runtime's default. */
308
+ export declare function resolveScryptParams(scrypt: ParsedAuthOptions["password"]["scrypt"], runtime: SoftureRuntime): ScryptParams;
281
309
  export {};
282
310
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAG7F;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAU,CAAC;AAY3C,4FAA4F;AAC5F,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAExG,qDAAqD;AACrD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B;;;;OAIG;IACH,QA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Ac,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AAEhF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2H5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,+EAA+E;AAC/E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACnE,iGAAiG;AACjG,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG;IAC9D,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;KAAE,CAAC;CACtG,CAAC;AAEF,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,YAAY,CAO1H"}
package/dist/options.js CHANGED
@@ -6,6 +6,14 @@ import { ROLE_NAME_PATTERN } from "./roles.js";
6
6
  * logins can take 512 MiB. A small server lowers `password.scrypt.cost` (README §3).
7
7
  */
8
8
  export const DEFAULT_SCRYPT_COST = 2 ** 17;
9
+ /**
10
+ * The hash cost each runtime uses when the app sets none. Node: OWASP's first profile (128 MiB). Workers: OWASP's
11
+ * equivalent 16 MiB profile (N = 2^14, r = 8, p = 5), because a Workers isolate has 128 MB in all.
12
+ */
13
+ export const SCRYPT_DEFAULTS = Object.freeze({
14
+ node: Object.freeze({ cost: DEFAULT_SCRYPT_COST, blockSize: 8, parallelization: 1 }),
15
+ workers: Object.freeze({ cost: 2 ** 14, blockSize: 8, parallelization: 5 }),
16
+ });
9
17
  const MAX_EMAIL_LENGTH = 254;
10
18
  const COOKIE_NAME = /^[A-Za-z0-9_-]{1,64}$/;
11
19
  /** A legacy cookie may carry its own prefix (`__Host-session`) or a dot. */
@@ -18,6 +26,7 @@ const DOMAIN = /^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](
18
26
  function isPowerOfTwo(value) {
19
27
  return Number.isInteger(Math.log2(value));
20
28
  }
29
+ /** Each field left out takes the runtime's default (`SCRYPT_DEFAULTS`), resolved by `getAuthOptions`. */
21
30
  const scryptSchema = z.strictObject({
22
31
  /** N: CPU and memory cost, a power of two. */
23
32
  cost: z
@@ -26,11 +35,11 @@ const scryptSchema = z.strictObject({
26
35
  .min(2 ** 10)
27
36
  .max(2 ** 20)
28
37
  .refine(isPowerOfTwo, "must be a power of two")
29
- .default(DEFAULT_SCRYPT_COST),
38
+ .optional(),
30
39
  /** r: block size. */
31
- blockSize: z.number().int().min(1).max(32).default(8),
40
+ blockSize: z.number().int().min(1).max(32).optional(),
32
41
  /** p: parallelization. */
33
- parallelization: z.number().int().min(1).max(16).default(1),
42
+ parallelization: z.number().int().min(1).max(16).optional(),
34
43
  });
35
44
  const adminEmailSchema = z.string().trim().toLowerCase().max(MAX_EMAIL_LENGTH).pipe(z.email("must be an email address"));
36
45
  /**
@@ -82,6 +91,11 @@ const allowlistShape = {
82
91
  allowedEmails: z.array(adminEmailSchema).default([]),
83
92
  /** A first sign-in of an allowed identity without an account creates one (no password); false only links. */
84
93
  createAccounts: z.boolean().default(true),
94
+ /**
95
+ * Any verified email may sign in, with no allowlist (a public product's "Sign in with GitHub"). A first sign-in then
96
+ * creates an account only while registration is open (`auth.registration_closed`); an account it finds signs in.
97
+ */
98
+ openSignUp: z.boolean().default(false),
85
99
  };
86
100
  const providerIdSchema = z.string().regex(OIDC_PROVIDER_ID_PATTERN, "must be an id such as google (a-z first, then a-z, 0-9 or -, at most 32)");
87
101
  const authorizeParamsSchema = z.record(z.string().regex(/^[a-z_]{1,64}$/), z.string().max(512)).default({});
@@ -138,8 +152,8 @@ const oidcProviderSchema = z
138
152
  .transform((provider) => provider.type === "github"
139
153
  ? { ...provider, requireHostedDomain: false }
140
154
  : { ...provider, requireHostedDomain: provider.requireHostedDomain ?? provider.issuer === GOOGLE_ISSUER })
141
- .refine((provider) => provider.allowedDomains.length + provider.allowedEmails.length > 0, {
142
- message: "needs allowedDomains or allowedEmails: a sign-in through a provider is limited to them",
155
+ .refine((provider) => provider.openSignUp || provider.allowedDomains.length + provider.allowedEmails.length > 0, {
156
+ message: "needs allowedDomains or allowedEmails (or openSignUp: true): a sign-in through a provider is limited to them",
143
157
  path: ["allowedDomains"],
144
158
  });
145
159
  export const authOptionsSchema = z.strictObject({
@@ -152,7 +166,10 @@ export const authOptionsSchema = z.strictObject({
152
166
  enabled: z.boolean().default(true),
153
167
  /** Shortest password a user may set (characters). */
154
168
  minLength: z.number().int().min(8).max(128).default(10),
155
- /** Hash cost; memory per hash is 128 * cost * blockSize bytes. Raising it rehashes each password at its owner's next login. */
169
+ /**
170
+ * Hash cost; memory per hash is 128 * cost * blockSize bytes. A field left out takes the runtime's default
171
+ * (`SCRYPT_DEFAULTS`). Changing it rehashes each password at its owner's next login.
172
+ */
156
173
  scrypt: scryptSchema.prefault({}),
157
174
  })
158
175
  .prefault({}),
@@ -258,4 +275,13 @@ export const authOptionsSchema = z.strictObject({
258
275
  context.addIssue({ code: "custom", path: ["legacySession", "cookieName"], message: "must differ from the current session cookie's name" });
259
276
  }
260
277
  });
278
+ /** `scrypt` with each unset field taken from the runtime's default. */
279
+ export function resolveScryptParams(scrypt, runtime) {
280
+ const defaults = SCRYPT_DEFAULTS[runtime];
281
+ return {
282
+ cost: scrypt.cost ?? defaults.cost,
283
+ blockSize: scrypt.blockSize ?? defaults.blockSize,
284
+ parallelization: scrypt.parallelization ?? defaults.parallelization,
285
+ };
286
+ }
261
287
  //# sourceMappingURL=options.js.map