@mesob/auth-hono 0.0.3

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.
@@ -0,0 +1,71 @@
1
+ type User = {
2
+ id: string;
3
+ tenantId: string;
4
+ fullName: string;
5
+ email: string | null;
6
+ phone: string | null;
7
+ handle: string;
8
+ image: string | null;
9
+ emailVerified: boolean;
10
+ phoneVerified: boolean;
11
+ lastSignInAt: string | null;
12
+ };
13
+ type Session = {
14
+ id: string;
15
+ tenantId: string;
16
+ userId: string;
17
+ expiresAt: string;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ userAgent: string | null;
21
+ ip: string | null;
22
+ };
23
+ type ResendConfig = {
24
+ apiKey: string;
25
+ from: string;
26
+ frontendBaseUrl: string;
27
+ baseUrl?: string;
28
+ verificationSubject?: string;
29
+ resetPasswordSubject?: string;
30
+ verificationPath?: string;
31
+ resetPasswordPath?: string;
32
+ };
33
+ type SMSConfig = {
34
+ baseUrl: string;
35
+ identifierId: string;
36
+ senderName: string;
37
+ apiKey: string;
38
+ templateVerification?: string;
39
+ templateLogin?: string;
40
+ };
41
+ type EmailConfig = {
42
+ enabled: boolean;
43
+ verificationRequired: boolean;
44
+ verificationExpiresIn: string;
45
+ resetPasswordExpiresIn: string;
46
+ resend: ResendConfig;
47
+ };
48
+ type PhoneConfig = {
49
+ enabled: boolean;
50
+ verificationRequired: boolean;
51
+ otpLength: number;
52
+ otpExpiresIn: string;
53
+ maxAttempts: number;
54
+ smsConfig: SMSConfig;
55
+ };
56
+ type SessionConfig = {
57
+ expiresIn: string;
58
+ maxPerUser?: number;
59
+ };
60
+ type AuthConfig = {
61
+ connectionString: string;
62
+ secret: string;
63
+ basePath?: string;
64
+ enableTenant?: boolean;
65
+ tenantId?: string;
66
+ session: SessionConfig;
67
+ email: EmailConfig;
68
+ phone: PhoneConfig;
69
+ };
70
+
71
+ export type { AuthConfig as A, Session as S, User as U };
@@ -0,0 +1,18 @@
1
+ import { OpenAPIHono } from '@hono/zod-openapi';
2
+ import { A as AuthConfig, S as Session, U as User } from './index-CwcbaCwi.js';
3
+
4
+ declare const createAuthHandler: (config: AuthConfig) => OpenAPIHono<any, {}, "/">;
5
+ declare const createAuthRoutes: (config: AuthConfig) => OpenAPIHono<any, {}, "/">;
6
+
7
+ type JiretAuth = {
8
+ handler: ReturnType<typeof createAuthHandler>;
9
+ routes: ReturnType<typeof createAuthRoutes>;
10
+ getSession: (headers: Headers) => Promise<{
11
+ session: Session | null;
12
+ user: User | null;
13
+ sessionToken: string | null;
14
+ }>;
15
+ };
16
+ declare const jiretAuth: (config: AuthConfig) => JiretAuth;
17
+
18
+ export { AuthConfig, type JiretAuth, Session, User, jiretAuth };