cauthy-auth 0.27.0 → 0.27.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.mjs CHANGED
@@ -495,7 +495,9 @@ function createSystem(given = {}) {
495
495
  async function fail(res, what) {
496
496
  const body = await res.json().catch(() => null);
497
497
  const first = body?.errors?.[0];
498
- throw new CauthyApiError(res.status, first?.code ?? "error", `Cauthy refused ${what} (${res.status}): ${first?.message ?? res.statusText}`);
498
+ const code = typeof body?.error === "string" ? body.error : first?.code;
499
+ const message = typeof body?.error === "string" ? body.error_description : first?.message;
500
+ throw new CauthyApiError(res.status, code ?? "error", `Cauthy refused ${what} (${res.status}): ${message ?? res.statusText}`);
499
501
  }
500
502
  let held;
501
503
  let asking;
@@ -605,8 +607,8 @@ function createSystem(given = {}) {
605
607
  }
606
608
 
607
609
  // src/validate.ts
608
- var MIN_PASSWORD = 8;
609
- var MAX_PASSWORD = 256;
610
+ var MIN_PASSWORD = 12;
611
+ var MAX_PASSWORD = 128;
610
612
  var MAX_NAME = 120;
611
613
  var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
612
614
  function checkEmail(value) {