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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-DGAy45G2.js';
2
2
  export { C as CauthyApiError, a as CauthyConfigError, b as CauthyOptions, c as CauthySystem, J as JsonValue, N as NewMember, O as Organization, d as OrganizationMember, P as PermissionOf, e as Permitted, f as Policy, g as PolicyPermission, h as PolicyRole, i as PublicSession, j as PushPolicyOptions, R as RoleOf, S as Session, k as SessionOrganization, l as SessionStatus, m as SessionUser, n as SystemKey, o as SystemOptions, p as can, q as createSystem, r as definePolicy, s as policySource, t as pullPolicy, u as pushPolicy } from './system-DTIeDXDP.js';
3
3
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.js';
4
- export { A as AuthField, F as FieldProblem, M as MIN_PASSWORD, c as checkCode, a as checkEmail, b as checkName, d as checkNewPassword, e as checkPassword } from './validate-BTRit1O1.js';
4
+ export { A as AuthField, F as FieldProblem, M as MIN_PASSWORD, c as checkCode, a as checkEmail, b as checkName, d as checkNewPassword, e as checkPassword } from './validate-YbEfIzfl.js';
5
5
  import { JWTVerifyGetKey } from 'jose';
6
6
 
7
7
  interface ConnectOptions {
@@ -33,10 +33,16 @@ interface Connected {
33
33
  /** Shown this once: Cauthy keeps only its hash. */
34
34
  clientSecret: string;
35
35
  redirectUris: string[];
36
+ /**
37
+ * The subscription to events, when `eventsUrl` was given. Its `secret` signs
38
+ * the HMAC header (X-Cauthy-Signature) and is shown this once; `auth.webhook`
39
+ * does not need it, as it verifies by Cauthy's published keys.
40
+ */
36
41
  webhook: {
37
42
  id: string;
38
43
  url: string;
39
44
  events: string[];
45
+ secret: string;
40
46
  } | null;
41
47
  /**
42
48
  * Everything the application sets: what Cauthy answered, plus CAUTHY_SECRET,
package/dist/index.js CHANGED
@@ -543,7 +543,9 @@ function createSystem(given = {}) {
543
543
  async function fail(res, what) {
544
544
  const body = await res.json().catch(() => null);
545
545
  const first = body?.errors?.[0];
546
- throw new CauthyApiError(res.status, first?.code ?? "error", `Cauthy refused ${what} (${res.status}): ${first?.message ?? res.statusText}`);
546
+ const code = typeof body?.error === "string" ? body.error : first?.code;
547
+ const message = typeof body?.error === "string" ? body.error_description : first?.message;
548
+ throw new CauthyApiError(res.status, code ?? "error", `Cauthy refused ${what} (${res.status}): ${message ?? res.statusText}`);
547
549
  }
548
550
  let held;
549
551
  let asking;
@@ -653,8 +655,8 @@ function createSystem(given = {}) {
653
655
  }
654
656
 
655
657
  // src/validate.ts
656
- var MIN_PASSWORD = 8;
657
- var MAX_PASSWORD = 256;
658
+ var MIN_PASSWORD = 12;
659
+ var MAX_PASSWORD = 128;
658
660
  var MAX_NAME = 120;
659
661
  var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
660
662
  function checkEmail(value) {