@mesob/auth-hono 0.1.1 → 0.2.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/README.md +1 -1
- package/dist/{index-CScADcDn.d.ts → index-DCxsFKQ2.d.ts} +7 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +540 -379
- package/dist/index.js.map +1 -1
- package/dist/lib/cookie.d.ts +1 -1
- package/dist/lib/error-handler.d.ts +5 -0
- package/dist/lib/error-handler.js +99 -0
- package/dist/lib/error-handler.js.map +1 -0
- package/dist/lib/normalize-user.d.ts +1 -1
- package/dist/lib/openapi-config.d.ts +1 -1
- package/dist/lib/openapi-config.js +6 -1
- package/dist/lib/openapi-config.js.map +1 -1
- package/dist/lib/phone-validation.d.ts +15 -0
- package/dist/lib/phone-validation.js +15 -0
- package/dist/lib/phone-validation.js.map +1 -0
- package/dist/lib/session.d.ts +1 -1
- package/dist/lib/tenant.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -131,7 +131,7 @@ const result = await authClient['sign-in'].$post({
|
|
|
131
131
|
- `POST /sign-up` - Sign up with email/phone
|
|
132
132
|
- `POST /sign-in` - Sign in
|
|
133
133
|
- `POST /sign-out` - Sign out
|
|
134
|
-
- `POST /check-
|
|
134
|
+
- `POST /check-account` - Check if account exists
|
|
135
135
|
|
|
136
136
|
### Profile
|
|
137
137
|
- `GET /me` - Get current user
|
|
@@ -2,6 +2,8 @@ import * as hono from 'hono';
|
|
|
2
2
|
import { OpenAPIHono } from '@hono/zod-openapi';
|
|
3
3
|
import { D as Database } from './index-ULpI-i0z.js';
|
|
4
4
|
|
|
5
|
+
type SessionStatus = 'valid' | 'no_cookie' | 'invalid_session' | 'user_not_found' | 'error';
|
|
6
|
+
|
|
5
7
|
type AuthEnv = {
|
|
6
8
|
Variables: {
|
|
7
9
|
config: AuthConfig;
|
|
@@ -10,6 +12,7 @@ type AuthEnv = {
|
|
|
10
12
|
userId?: string;
|
|
11
13
|
user?: User;
|
|
12
14
|
session?: Session;
|
|
15
|
+
sessionStatus?: SessionStatus;
|
|
13
16
|
};
|
|
14
17
|
};
|
|
15
18
|
|
|
@@ -68,8 +71,10 @@ type VerificationConfig = {
|
|
|
68
71
|
resendInterval?: string;
|
|
69
72
|
sendVerificationOTP?: (params: SendVerificationOTPParams) => Promise<void> | void;
|
|
70
73
|
};
|
|
74
|
+
type PhoneConfig = VerificationConfig & {
|
|
75
|
+
phoneRegex?: RegExp | string;
|
|
76
|
+
};
|
|
71
77
|
type EmailConfig = VerificationConfig;
|
|
72
|
-
type PhoneConfig = VerificationConfig;
|
|
73
78
|
type SessionConfig = {
|
|
74
79
|
/** Default session duration (e.g., '7d', '30d'). Default: '7d' */
|
|
75
80
|
expiresIn: string;
|
|
@@ -134,4 +139,4 @@ type MesobAuth = {
|
|
|
134
139
|
sessionMiddleware: hono.MiddlewareHandler;
|
|
135
140
|
};
|
|
136
141
|
|
|
137
|
-
export type { AuthConfig as A, MesobAuth as M,
|
|
142
|
+
export type { AuthConfig as A, MesobAuth as M, SessionStatus as S, User as U, SendVerificationOTPParams as a, Session as b, SessionConfig as c };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AuthConfig, M as MesobAuth } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { A as AuthConfig, M as MesobAuth } from './index-DCxsFKQ2.js';
|
|
2
|
+
export { a as SendVerificationOTPParams, b as Session, S as SessionStatus, U as User } from './index-DCxsFKQ2.js';
|
|
3
3
|
import { D as Database } from './index-ULpI-i0z.js';
|
|
4
4
|
export { c as createDatabase } from './index-ULpI-i0z.js';
|
|
5
5
|
export { cleanupExpiredData, cleanupExpiredSessions, cleanupExpiredVerifications } from './lib/cleanup.js';
|