@fonderie/auth 7.3.5 → 7.4.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/brain/outcomes.md CHANGED
@@ -150,6 +150,7 @@ Raw SQL ships in `node_modules/@fonderie/auth/dist/migrations/sql/` — read it
150
150
  | POST | `/auth/mfa/disable` | `requireAuth → requireEmailLogin → requireVerified → validate(mfaTokenSchema) → mfa.disable` |
151
151
  | POST | `/auth/mfa/setup` | `requireAuth → requireEmailLogin → requireVerified → mfa.setup` |
152
152
  | POST | `/auth/mfa/verify` | `ipLimit('mfaVerify') → requireAnyAuth → requireEmailLogin → requireVerified → validate(mfaTokenSchema) → mfa.verify` |
153
+ | GET | `/auth/providers` | `async () => setApiResponse(HTTP.OK, 'AUTH_PROVIDERS', 'Sign-in methods available here', { providers: [...config.providers], })` |
153
154
  | POST | `/auth/refresh` | `validate(refreshSchema) → auth.refresh` |
154
155
  | POST | `/auth/register` | `ipLimit('register') → validate(registerSchema) → auth.register` |
155
156
  | GET | `/auth/send-verification` | `requireAnyAuth → auth.sendVerification` |
package/dist/index.cjs CHANGED
@@ -89,6 +89,7 @@ __export(index_exports, {
89
89
  module.exports = __toCommonJS(index_exports);
90
90
 
91
91
  // src/routes.ts
92
+ var import_core10 = require("@fonderie/core");
92
93
  var import_middlewares2 = require("@fonderie/core/middlewares");
93
94
 
94
95
  // src/middlewares/require-email-login.ts
@@ -2751,6 +2752,27 @@ function buildAuthRoutes(store, config, bus) {
2751
2752
  return [o.method ?? method, o.path ?? path, ...handlers];
2752
2753
  };
2753
2754
  const routes = [
2755
+ // Which sign-in methods this deployment can actually honour (Public).
2756
+ //
2757
+ // A frontend has to decide which buttons to draw, and the only honest
2758
+ // source is the side holding the credentials. The alternative — a
2759
+ // build-time flag in the app — stores the same fact twice and lets the
2760
+ // two disagree; the symptom is a user clicking a provider the server
2761
+ // cannot complete and landing on the provider's error page, which the
2762
+ // app cannot explain.
2763
+ //
2764
+ // Public and unauthenticated on purpose: the login screen needs it
2765
+ // before anyone has signed in. It discloses nothing a visitor could not
2766
+ // learn by looking at the buttons, and deliberately nothing else — no
2767
+ // client ids, no redirect URIs, no module inventory.
2768
+ R(
2769
+ "providers",
2770
+ "GET",
2771
+ "/auth/providers",
2772
+ async () => (0, import_core10.setApiResponse)(import_core10.HTTP.OK, "AUTH_PROVIDERS", "Sign-in methods available here", {
2773
+ providers: [...config.providers]
2774
+ })
2775
+ ),
2754
2776
  // Registration & Login (Public)
2755
2777
  R("register", "POST", "/auth/register", ipLimit("register"), (0, import_middlewares.validate)(registerSchema), auth.register),
2756
2778
  R("login", "POST", "/auth/login", ipLimit("login"), (0, import_middlewares.validate)(loginSchema), acctLimit("login"), auth.login),
@@ -2817,17 +2839,17 @@ function buildAuthRoutes(store, config, bus) {
2817
2839
  }
2818
2840
 
2819
2841
  // src/services/config-guard.ts
2820
- var import_core10 = require("@fonderie/core");
2842
+ var import_core11 = require("@fonderie/core");
2821
2843
  var MODULE = "@fonderie/auth";
2822
2844
  function collectAuthConfigProblems(config) {
2823
2845
  const problems = [];
2824
2846
  const secret = config.jwtSecret ?? "";
2825
- const secretProblem = (0, import_core10.secretStrengthProblem)(secret);
2847
+ const secretProblem = (0, import_core11.secretStrengthProblem)(secret);
2826
2848
  if (secretProblem === "too-short") {
2827
2849
  problems.push({
2828
2850
  module: MODULE,
2829
2851
  severity: "error",
2830
- message: `jwtSecret must be at least ${import_core10.MIN_SECRET_LENGTH} characters (got ${secret.length})`
2852
+ message: `jwtSecret must be at least ${import_core11.MIN_SECRET_LENGTH} characters (got ${secret.length})`
2831
2853
  });
2832
2854
  } else if (secretProblem === "placeholder") {
2833
2855
  problems.push({
@@ -2851,7 +2873,7 @@ function collectAuthConfigProblems(config) {
2851
2873
  severity: "error",
2852
2874
  message: "google OAuth is configured but clientId, clientSecret, or redirectUri is missing"
2853
2875
  });
2854
- } else if (import_core10.PLACEHOLDER_SECRET.test(clientSecret)) {
2876
+ } else if (import_core11.PLACEHOLDER_SECRET.test(clientSecret)) {
2855
2877
  problems.push({
2856
2878
  module: MODULE,
2857
2879
  severity: "error",