cauthy-auth 0.26.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.
@@ -6,8 +6,8 @@ interface FieldProblem {
6
6
  code: 'required' | 'invalid_email' | 'too_short' | 'too_long';
7
7
  message: string;
8
8
  }
9
- /** The shortest password Cauthy takes for a new account. */
10
- declare const MIN_PASSWORD = 8;
9
+ /** The shortest password Cauthy takes for a new account: the API's own floor. */
10
+ declare const MIN_PASSWORD = 12;
11
11
  declare function checkEmail(value: unknown): FieldProblem | null;
12
12
  /** A password being typed to sign in: only that there is one. */
13
13
  declare function checkPassword(value: unknown): FieldProblem | null;
@@ -6,8 +6,8 @@ interface FieldProblem {
6
6
  code: 'required' | 'invalid_email' | 'too_short' | 'too_long';
7
7
  message: string;
8
8
  }
9
- /** The shortest password Cauthy takes for a new account. */
10
- declare const MIN_PASSWORD = 8;
9
+ /** The shortest password Cauthy takes for a new account: the API's own floor. */
10
+ declare const MIN_PASSWORD = 12;
11
11
  declare function checkEmail(value: unknown): FieldProblem | null;
12
12
  /** A password being typed to sign in: only that there is one. */
13
13
  declare function checkPassword(value: unknown): FieldProblem | null;
package/dist/vue.d.mts CHANGED
@@ -4,7 +4,7 @@ export { Account, AccountSession, AuthError, AuthMethods, AuthResult, Passkey, P
4
4
  import { i as PublicSession } from './system-BxMsSIu1.mjs';
5
5
  export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-BxMsSIu1.mjs';
6
6
  import './theme.mjs';
7
- import './validate-BTRit1O1.mjs';
7
+ import './validate-YbEfIzfl.mjs';
8
8
  import 'jose';
9
9
 
10
10
  interface CauthyVueSession extends Pick<SessionStore, 'refresh' | 'signIn' | 'signOut' | 'accountUrl' | 'basePath'> {
package/dist/vue.d.ts CHANGED
@@ -4,7 +4,7 @@ export { Account, AccountSession, AuthError, AuthMethods, AuthResult, Passkey, P
4
4
  import { i as PublicSession } from './system-DTIeDXDP.js';
5
5
  export { P as PermissionOf, f as Policy, R as RoleOf, k as SessionOrganization, m as SessionUser, p as can, r as definePolicy } from './system-DTIeDXDP.js';
6
6
  import './theme.js';
7
- import './validate-BTRit1O1.js';
7
+ import './validate-YbEfIzfl.js';
8
8
  import 'jose';
9
9
 
10
10
  interface CauthyVueSession extends Pick<SessionStore, 'refresh' | 'signIn' | 'signOut' | 'accountUrl' | 'basePath'> {
package/dist/vue.js CHANGED
@@ -147,8 +147,8 @@ function fromWire(wire) {
147
147
  }
148
148
 
149
149
  // src/validate.ts
150
- var MIN_PASSWORD = 8;
151
- var MAX_PASSWORD = 256;
150
+ var MIN_PASSWORD = 12;
151
+ var MAX_PASSWORD = 128;
152
152
  var MAX_NAME = 120;
153
153
  var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
154
154
  function checkEmail(value) {
@@ -407,7 +407,7 @@ function createAuthClient(options = {}) {
407
407
  signUp: {
408
408
  email: (f) => post(
409
409
  "/sign-up/email",
410
- { email: f.email, password: f.password, name: f.name, organization: f.organization },
410
+ { email: f.email, password: f.password, name: f.name, organization: f.organization, acceptLegal: f.acceptLegal, consents: f.consents },
411
411
  firstProblem(checkName(f.name), checkEmail(f.email), checkNewPassword(f.password), checkOrganization(f.organization)),
412
412
  f.captchaToken
413
413
  )
@@ -440,6 +440,12 @@ function createAuthClient(options = {}) {
440
440
  return body && typeof body.account === "object" ? body.account : null;
441
441
  },
442
442
  update: (f) => post("/me", { name: f.name }, checkName(f.name)),
443
+ async legal() {
444
+ const body = await read("/me/legal");
445
+ if (!body) return { ok: false, error: { code: "not_signed_in", message: "Nobody is signed in." } };
446
+ return { ok: true, status: "ok", pending: Array.isArray(body.pending) ? body.pending : [] };
447
+ },
448
+ acceptLegal: (f = {}) => post("/me/legal/accept", { kinds: f.kinds ?? [] }, null),
443
449
  changePassword: (f) => {
444
450
  const bad = checkNewPassword(f.newPassword);
445
451
  return post("/me/password", { password: f.password, newPassword: f.newPassword }, bad ? { ...bad, field: "newPassword" } : null);