@fonderie/auth 7.13.0 → 7.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3212,20 +3212,27 @@ function collectAuthConfigProblems(config) {
3212
3212
  problems.push({
3213
3213
  module: MODULE,
3214
3214
  severity: "error",
3215
- message: `jwtSecret must be at least ${MIN_SECRET_LENGTH} characters (got ${secret.length})`
3215
+ message: `jwtSecret must be at least ${MIN_SECRET_LENGTH} characters (got ${secret.length})`,
3216
+ domain: "auth",
3217
+ reason: "JWT_SECRET_TOO_SHORT",
3218
+ metadata: { min: MIN_SECRET_LENGTH, got: secret.length }
3216
3219
  });
3217
3220
  } else if (secretProblem === "placeholder") {
3218
3221
  problems.push({
3219
3222
  module: MODULE,
3220
3223
  severity: "error",
3221
- message: "jwtSecret looks like a placeholder or dev-default value"
3224
+ message: "jwtSecret looks like a placeholder or dev-default value",
3225
+ domain: "auth",
3226
+ reason: "JWT_SECRET_PLACEHOLDER"
3222
3227
  });
3223
3228
  }
3224
3229
  if (config.secureCookies === false) {
3225
3230
  problems.push({
3226
3231
  module: MODULE,
3227
3232
  severity: process.env["NODE_ENV"] === "production" ? "error" : "warning",
3228
- message: "secureCookies is false \u2014 auth cookies may be sent over non-HTTPS connections in production"
3233
+ message: "secureCookies is false \u2014 auth cookies may be sent over non-HTTPS connections in production",
3234
+ domain: "auth",
3235
+ reason: "INSECURE_COOKIES"
3229
3236
  });
3230
3237
  }
3231
3238
  if (config.google) {
@@ -3234,13 +3241,17 @@ function collectAuthConfigProblems(config) {
3234
3241
  problems.push({
3235
3242
  module: MODULE,
3236
3243
  severity: "error",
3237
- message: "google OAuth is configured but clientId, clientSecret, or redirectUri is missing"
3244
+ message: "google OAuth is configured but clientId, clientSecret, or redirectUri is missing",
3245
+ domain: "auth",
3246
+ reason: "GOOGLE_INCOMPLETE"
3238
3247
  });
3239
3248
  } else if (PLACEHOLDER_SECRET.test(clientSecret)) {
3240
3249
  problems.push({
3241
3250
  module: MODULE,
3242
3251
  severity: "error",
3243
- message: "google.clientSecret looks like a placeholder or dev-default value"
3252
+ message: "google.clientSecret looks like a placeholder or dev-default value",
3253
+ domain: "auth",
3254
+ reason: "GOOGLE_SECRET_PLACEHOLDER"
3244
3255
  });
3245
3256
  }
3246
3257
  }
@@ -3250,20 +3261,26 @@ function collectAuthConfigProblems(config) {
3250
3261
  problems.push({
3251
3262
  module: MODULE,
3252
3263
  severity: "error",
3253
- message: "apple OAuth is configured but clientId, teamId, keyId, privateKey, or redirectUri is missing"
3264
+ message: "apple OAuth is configured but clientId, teamId, keyId, privateKey, or redirectUri is missing",
3265
+ domain: "auth",
3266
+ reason: "APPLE_INCOMPLETE"
3254
3267
  });
3255
3268
  } else if (!/-----BEGIN [A-Z ]*PRIVATE KEY-----/.test(a.privateKey)) {
3256
3269
  problems.push({
3257
3270
  module: MODULE,
3258
3271
  severity: "error",
3259
- message: "apple.privateKey does not look like a PEM .p8 key (expected `-----BEGIN PRIVATE KEY-----`)"
3272
+ message: "apple.privateKey does not look like a PEM .p8 key (expected `-----BEGIN PRIVATE KEY-----`)",
3273
+ domain: "auth",
3274
+ reason: "APPLE_KEY_NOT_PEM"
3260
3275
  });
3261
3276
  }
3262
3277
  if (a.nativeClientIds?.some((id) => !id || id.trim() === "" || id.includes("*"))) {
3263
3278
  problems.push({
3264
3279
  module: MODULE,
3265
3280
  severity: "error",
3266
- message: "apple.nativeClientIds must be exact bundle ids \u2014 empty or wildcard entries would accept identity tokens minted for other apps"
3281
+ message: "apple.nativeClientIds must be exact bundle ids \u2014 empty or wildcard entries would accept identity tokens minted for other apps",
3282
+ domain: "auth",
3283
+ reason: "APPLE_NATIVE_IDS_INVALID"
3267
3284
  });
3268
3285
  }
3269
3286
  }
@@ -3271,14 +3288,18 @@ function collectAuthConfigProblems(config) {
3271
3288
  problems.push({
3272
3289
  module: MODULE,
3273
3290
  severity: process.env["NODE_ENV"] === "production" ? "error" : "warning",
3274
- message: "mfa is enabled without mfaSecretKey \u2014 TOTP secrets are stored plaintext at rest; set a 32-byte key (openssl rand -hex 32)"
3291
+ message: "mfa is enabled without mfaSecretKey \u2014 TOTP secrets are stored plaintext at rest; set a 32-byte key (openssl rand -hex 32)",
3292
+ domain: "auth",
3293
+ reason: "MFA_KEY_MISSING"
3275
3294
  });
3276
3295
  }
3277
3296
  if (config.mfaSecretKey && !/^[0-9a-fA-F]{64}$/.test(config.mfaSecretKey)) {
3278
3297
  problems.push({
3279
3298
  module: MODULE,
3280
3299
  severity: "error",
3281
- message: "mfaSecretKey must be 64 hex characters (32 bytes, e.g. `openssl rand -hex 32`)"
3300
+ message: "mfaSecretKey must be 64 hex characters (32 bytes, e.g. `openssl rand -hex 32`)",
3301
+ domain: "auth",
3302
+ reason: "MFA_KEY_INVALID"
3282
3303
  });
3283
3304
  }
3284
3305
  return problems;
@@ -3490,7 +3511,7 @@ var AuthModule = class {
3490
3511
  name = "@fonderie/auth";
3491
3512
  // Baked in at build time by tsup.base, so the operator's Modules page can
3492
3513
  // say what is actually deployed rather than 'not reported'.
3493
- version = "7.13.0";
3514
+ version = "7.14.1";
3494
3515
  // Users, sessions, login history, suspend — only through @fonderie/admin.
3495
3516
  describeAdmin() {
3496
3517
  return { routes: describeAuthAdminRoutes(this.store) };