@startsimpli/auth 0.4.15 → 0.4.17

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.
Files changed (48) hide show
  1. package/README.md +191 -377
  2. package/package.json +25 -12
  3. package/src/__tests__/auth-backend-contract.test.ts +84 -0
  4. package/src/__tests__/auth-client-oauth-register.test.ts +5 -8
  5. package/src/__tests__/auth-functions.test.ts +0 -1
  6. package/src/__tests__/session-user-groups.test.ts +45 -0
  7. package/src/__tests__/useauth-shape-contract.test.ts +0 -1
  8. package/src/client/__tests__/mock-backend.test.ts +141 -0
  9. package/src/client/__tests__/secure-session-storage.test.ts +75 -0
  10. package/src/client/__tests__/secure-token-storage.test.ts +69 -0
  11. package/src/client/__tests__/session-storage.test.ts +118 -0
  12. package/src/client/__tests__/token-auth-core.test.ts +190 -0
  13. package/src/client/auth-client.ts +71 -11
  14. package/src/client/auth-context.tsx +94 -17
  15. package/src/client/backend.ts +67 -0
  16. package/src/client/functions.ts +38 -57
  17. package/src/client/index.ts +15 -0
  18. package/src/client/mock-backend.ts +255 -0
  19. package/src/client/optional-secure-store.ts +21 -0
  20. package/src/client/secure-session-storage.native.ts +53 -0
  21. package/src/client/secure-session-storage.ts +20 -0
  22. package/src/client/secure-token-storage.native.ts +55 -0
  23. package/src/client/secure-token-storage.ts +32 -0
  24. package/src/client/session-storage.ts +142 -0
  25. package/src/client/token-auth-core.ts +190 -0
  26. package/src/client/token.ts +18 -0
  27. package/src/client/use-auth.ts +6 -1
  28. package/src/components/forgot-password-form.tsx +97 -0
  29. package/src/components/index.ts +5 -1
  30. package/src/components/oauth-callback.tsx +5 -2
  31. package/src/components/reset-password-form.tsx +124 -0
  32. package/src/components/sign-in-form.tsx +125 -0
  33. package/src/components/signup-form.tsx +161 -0
  34. package/src/components/use-oauth-callback.ts +14 -2
  35. package/src/hooks/__tests__/use-domain-claims.test.tsx +95 -0
  36. package/src/hooks/__tests__/use-invitations.test.tsx +90 -0
  37. package/src/hooks/__tests__/use-membership.test.tsx +136 -0
  38. package/src/hooks/index.ts +34 -0
  39. package/src/hooks/use-domain-claims.ts +144 -0
  40. package/src/hooks/use-invitations.ts +138 -0
  41. package/src/hooks/use-membership.ts +192 -0
  42. package/src/index.ts +43 -1
  43. package/src/server/index.ts +4 -0
  44. package/src/types/index.ts +5 -1
  45. package/src/utils/api-error.ts +54 -0
  46. package/src/utils/central-auth.ts +91 -0
  47. package/src/utils/index.ts +1 -0
  48. package/src/utils/validation.ts +10 -21
@@ -54,18 +54,13 @@ export const passwordSchema = z
54
54
  );
55
55
 
56
56
  /**
57
- * Password confirmation schema
58
- * Validates password and confirmation match
57
+ * Password schema (alias retained for back-compat — passwordConfirm dropped
58
+ * from create-account/reset/change flows since browsers + password managers
59
+ * make the second field pure friction). startsim-nbq.
59
60
  */
60
- export const passwordConfirmSchema = z
61
- .object({
62
- password: passwordSchema,
63
- passwordConfirm: z.string(),
64
- })
65
- .refine((data) => data.password === data.passwordConfirm, {
66
- message: PasswordErrorCode.MISMATCH,
67
- path: ['passwordConfirm'],
68
- });
61
+ export const passwordConfirmSchema = z.object({
62
+ password: passwordSchema,
63
+ });
69
64
 
70
65
  /**
71
66
  * Password reset request schema
@@ -78,16 +73,10 @@ export const passwordResetRequestSchema = z.object({
78
73
  /**
79
74
  * Password reset confirm schema
80
75
  */
81
- export const passwordResetConfirmSchema = z
82
- .object({
83
- token: z.string().min(1, { message: 'Token is required' }),
84
- password: passwordSchema,
85
- passwordConfirm: z.string(),
86
- })
87
- .refine((data) => data.password === data.passwordConfirm, {
88
- message: PasswordErrorCode.MISMATCH,
89
- path: ['passwordConfirm'] as const,
90
- });
76
+ export const passwordResetConfirmSchema = z.object({
77
+ token: z.string().min(1, { message: 'Token is required' }),
78
+ password: passwordSchema,
79
+ });
91
80
 
92
81
  /**
93
82
  * Email verification request schema