next-auth-mfelfelani72 0.0.54 → 0.0.56

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 CHANGED
File without changes
@@ -33,7 +33,8 @@ export function loginHandler(apiUrl) {
33
33
  const redirectTo = returnTo || lastVisited || "/";
34
34
  const res = NextResponse.json(Object.assign(Object.assign({}, data), { redirectTo }));
35
35
  const cookieOptions = {
36
- secure: process.env.NODE_ENV === "production",
36
+ // secure: process.env.NODE_ENV === "production",
37
+ secure: false,
37
38
  sameSite: "strict",
38
39
  path: "/",
39
40
  maxAge: 60 * 60 * 24 * 7,
@@ -6,7 +6,7 @@
6
6
  * @Description: Register handler with Next.js native cookies
7
7
  */
8
8
  import { cookies } from "next/headers";
9
- import { NextResponse, } from "next/server";
9
+ import { NextResponse } from "next/server";
10
10
  // Functions
11
11
  import { cns } from "forma-li";
12
12
  export function registerHandler(apiUrl) {
@@ -14,20 +14,14 @@ export function registerHandler(apiUrl) {
14
14
  var _a, _b, _c, _d;
15
15
  try {
16
16
  const body = await req.json();
17
- const { name, email, password, confirmPassword, } = body;
18
- if (!email ||
19
- !password ||
20
- !confirmPassword) {
17
+ const { name, email, password, confirmPassword } = body;
18
+ if (!email || !password || !confirmPassword) {
21
19
  return NextResponse.json({
22
20
  message: "Email and password are required",
23
21
  success: false,
24
22
  errors: {
25
- email: !email
26
- ? "Email is required"
27
- : undefined,
28
- password: !password
29
- ? "Password is required"
30
- : undefined,
23
+ email: !email ? "Email is required" : undefined,
24
+ password: !password ? "Password is required" : undefined,
31
25
  confirmPassword: !confirmPassword
32
26
  ? "Confirm password is required"
33
27
  : undefined,
@@ -62,8 +56,7 @@ export function registerHandler(apiUrl) {
62
56
  }, { status: 400 });
63
57
  }
64
58
  const nameFromEmail = email.split("@")[0];
65
- const displayName = nameFromEmail.charAt(0).toUpperCase() +
66
- nameFromEmail.slice(1);
59
+ const displayName = nameFromEmail.charAt(0).toUpperCase() + nameFromEmail.slice(1);
67
60
  const payload = {
68
61
  name: displayName,
69
62
  email: email.trim().toLowerCase(),
@@ -84,14 +77,11 @@ export function registerHandler(apiUrl) {
84
77
  success: false,
85
78
  }, { status: 500 });
86
79
  }
87
- if (data.success &&
88
- ((_b = (_a = data.data) === null || _a === void 0 ? void 0 : _a.token) === null || _b === void 0 ? void 0 : _b.access_token)) {
80
+ if (data.success && ((_b = (_a = data.data) === null || _a === void 0 ? void 0 : _a.token) === null || _b === void 0 ? void 0 : _b.access_token)) {
89
81
  const cookieStore = await cookies();
90
82
  const returnTo = (_c = cookieStore.get("returnTo")) === null || _c === void 0 ? void 0 : _c.value;
91
83
  const lastVisited = (_d = cookieStore.get("lastVisited")) === null || _d === void 0 ? void 0 : _d.value;
92
- const redirectTo = returnTo ||
93
- lastVisited ||
94
- "/";
84
+ const redirectTo = returnTo || lastVisited || "/";
95
85
  console.log("AUTH REGISTER REDIRECT:", {
96
86
  returnTo,
97
87
  lastVisited,
@@ -99,23 +89,20 @@ export function registerHandler(apiUrl) {
99
89
  });
100
90
  const res = NextResponse.json(Object.assign(Object.assign({}, data), { redirectTo }));
101
91
  const cookieOptions = {
102
- secure: process.env.NODE_ENV ===
103
- "production",
92
+ secure: false,
93
+ // process.env.NODE_ENV ===
94
+ // "production",
104
95
  sameSite: "strict",
105
96
  path: "/",
106
97
  maxAge: 60 * 60 * 24 * 7,
107
98
  };
108
99
  // Auth token
109
100
  res.cookies.set(Object.assign(Object.assign({ name: "app_key", value: JSON.stringify({
110
- tk: data.data.token
111
- .access_token,
112
- ud: data.data.user.uuid ||
113
- data.data.user.id,
101
+ tk: data.data.token.access_token,
102
+ ud: data.data.user.uuid || data.data.user.id,
114
103
  }) }, cookieOptions), { httpOnly: false }));
115
104
  // Token type
116
- res.cookies.set(Object.assign(Object.assign({ name: "key_type", value: data.data.token
117
- .token_type ||
118
- "Bearer" }, cookieOptions), { httpOnly: false }));
105
+ res.cookies.set(Object.assign(Object.assign({ name: "key_type", value: data.data.token.token_type || "Bearer" }, cookieOptions), { httpOnly: false }));
119
106
  // User
120
107
  res.cookies.set(Object.assign(Object.assign({ name: "user", value: JSON.stringify(data.data.user) }, cookieOptions), { httpOnly: false }));
121
108
  // Authentication state
@@ -127,8 +114,7 @@ export function registerHandler(apiUrl) {
127
114
  catch (err) {
128
115
  console.error("Registration error:", err);
129
116
  return NextResponse.json({
130
- message: err.message ||
131
- "Internal server error",
117
+ message: err.message || "Internal server error",
132
118
  success: false,
133
119
  }, { status: 500 });
134
120
  }
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "next-auth-mfelfelani72",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
7
- "dist"
7
+ "dist",
8
+ "styles"
8
9
  ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./theme.css": "./styles/themes/auth-contract.css"
16
+ },
9
17
  "private": false,
10
18
  "dependencies": {
11
19
  "axios": "^1.19.0",
@@ -0,0 +1,283 @@
1
+ /*
2
+ |--------------------------------------------------------------------------
3
+ | Auth Theme
4
+ |--------------------------------------------------------------------------
5
+ |
6
+ | Default theme for the Auth package.
7
+ | Host applications can override these --auth-* variables later.
8
+ |
9
+ |--------------------------------------------------------------------------
10
+ */
11
+
12
+ :root {
13
+ /*
14
+ |--------------------------------------------------------------------------
15
+ | Base
16
+ |--------------------------------------------------------------------------
17
+ */
18
+
19
+ --auth-color-theme: rgba(31, 30, 46, 1);
20
+ --auth-color-background: rgba(31, 30, 46, 1);
21
+ --auth-color-background-light: rgba(40, 38, 58, 1);
22
+
23
+ /*
24
+ |--------------------------------------------------------------------------
25
+ | Warning
26
+ |--------------------------------------------------------------------------
27
+ */
28
+
29
+ --auth-color-warning-600: rgba(215, 187, 30, 1);
30
+ --auth-color-warning-500: rgba(215, 187, 30, 1);
31
+ --auth-color-warning-400: rgba(229, 205, 67, 1);
32
+ --auth-color-warning-300: rgba(234, 215, 105, 1);
33
+ --auth-color-warning-200: rgba(239, 225, 142, 1);
34
+ --auth-color-warning-100: rgba(245, 235, 180, 1);
35
+ --auth-color-warning-50: rgba(245, 235, 180, 1);
36
+
37
+ /*
38
+ |--------------------------------------------------------------------------
39
+ | Success
40
+ |--------------------------------------------------------------------------
41
+ */
42
+
43
+ --auth-color-success-600: rgba(45, 215, 30, 1);
44
+ --auth-color-success-500: rgba(45, 215, 30, 1);
45
+ --auth-color-success-400: rgba(80, 229, 67, 1);
46
+ --auth-color-success-300: rgba(115, 234, 105, 1);
47
+ --auth-color-success-200: rgba(150, 239, 142, 1);
48
+ --auth-color-success-100: rgba(185, 245, 180, 1);
49
+ --auth-color-success-50: rgba(220, 250, 217, 1);
50
+
51
+ /*
52
+ |--------------------------------------------------------------------------
53
+ | Error
54
+ |--------------------------------------------------------------------------
55
+ */
56
+
57
+ --auth-color-error-600: rgba(215, 30, 30, 1);
58
+ --auth-color-error-500: rgba(215, 30, 30, 1);
59
+ --auth-color-error-400: rgba(229, 67, 67, 1);
60
+ --auth-color-error-300: rgba(234, 105, 105, 1);
61
+ --auth-color-error-200: rgba(239, 142, 142, 1);
62
+ --auth-color-error-100: rgba(245, 180, 180, 1);
63
+ --auth-color-error-50: rgba(250, 217, 217, 1);
64
+
65
+ /*
66
+ |--------------------------------------------------------------------------
67
+ | Secondary
68
+ |--------------------------------------------------------------------------
69
+ */
70
+
71
+ --auth-color-secondary-600: rgba(145, 118, 234, 1);
72
+ --auth-color-secondary-500: rgba(145, 118, 234, 1);
73
+ --auth-color-secondary-400: rgba(180, 162, 241, 1);
74
+ --auth-color-secondary-300: rgba(195, 181, 244, 1);
75
+ --auth-color-secondary-200: rgba(225, 218, 249, 1);
76
+ --auth-color-secondary-100: rgba(240, 236, 252, 1);
77
+ --auth-color-secondary-50: rgba(247, 246, 254, 1);
78
+
79
+ /*
80
+ |--------------------------------------------------------------------------
81
+ | Neutral
82
+ |--------------------------------------------------------------------------
83
+ */
84
+
85
+ --auth-color-neutral-600: rgba(10, 10, 15, 1);
86
+ --auth-color-neutral-500: rgba(31, 30, 46, 1);
87
+ --auth-color-neutral-400: rgba(76, 75, 88, 1);
88
+ --auth-color-neutral-300: rgba(121, 120, 130, 1);
89
+ --auth-color-neutral-200: rgba(165, 165, 171, 1);
90
+ --auth-color-neutral-100: rgba(210, 210, 213, 1);
91
+ --auth-color-neutral-50: rgba(242, 242, 243, 1);
92
+
93
+ /*
94
+ |--------------------------------------------------------------------------
95
+ | Primary
96
+ |--------------------------------------------------------------------------
97
+ */
98
+
99
+ --auth-color-primary-600: rgba(204, 110, 60, 1);
100
+ --auth-color-primary-500: rgba(204, 110, 60, 1);
101
+ --auth-color-primary-400: rgba(229, 124, 67, 1);
102
+ --auth-color-primary-300: rgba(234, 150, 105, 1);
103
+ --auth-color-primary-200: rgba(239, 176, 142, 1);
104
+ --auth-color-primary-100: rgba(245, 203, 180, 1);
105
+ --auth-color-primary-50: rgba(250, 229, 217, 1);
106
+
107
+ /*
108
+ |--------------------------------------------------------------------------
109
+ | Tertiary
110
+ |--------------------------------------------------------------------------
111
+ */
112
+
113
+ --auth-color-tertiary-600: rgba(83, 145, 208, 1);
114
+ --auth-color-tertiary-500: rgba(83, 145, 208, 1);
115
+ --auth-color-tertiary-400: rgba(117, 167, 217, 1);
116
+ --auth-color-tertiary-300: rgba(152, 189, 227, 1);
117
+ --auth-color-tertiary-200: rgba(186, 211, 236, 1);
118
+ --auth-color-tertiary-100: rgba(221, 233, 246, 1);
119
+ --auth-color-tertiary-50: rgba(237, 244, 250, 1);
120
+ }
121
+
122
+ /*
123
+ |--------------------------------------------------------------------------
124
+ | Tailwind Theme
125
+ |--------------------------------------------------------------------------
126
+ */
127
+
128
+ @theme inline {
129
+ /*
130
+ |--------------------------------------------------------------------------
131
+ | Base
132
+ |--------------------------------------------------------------------------
133
+ */
134
+
135
+ --color-theme: var(--auth-color-theme);
136
+ --color-background: var(--auth-color-background);
137
+ --color-background-light: var(--auth-color-background-light);
138
+
139
+ /*
140
+ |--------------------------------------------------------------------------
141
+ | Primary
142
+ |--------------------------------------------------------------------------
143
+ */
144
+
145
+ --color-primary-50: var(--auth-color-primary-50);
146
+ --color-primary-100: var(--auth-color-primary-100);
147
+ --color-primary-200: var(--auth-color-primary-200);
148
+ --color-primary-300: var(--auth-color-primary-300);
149
+ --color-primary-400: var(--auth-color-primary-400);
150
+ --color-primary-500: var(--auth-color-primary-500);
151
+ --color-primary-600: var(--auth-color-primary-600);
152
+
153
+ /*
154
+ |--------------------------------------------------------------------------
155
+ | Secondary
156
+ |--------------------------------------------------------------------------
157
+ */
158
+
159
+ --color-secondary-50: var(--auth-color-secondary-50);
160
+ --color-secondary-100: var(--auth-color-secondary-100);
161
+ --color-secondary-200: var(--auth-color-secondary-200);
162
+ --color-secondary-300: var(--auth-color-secondary-300);
163
+ --color-secondary-400: var(--auth-color-secondary-400);
164
+ --color-secondary-500: var(--auth-color-secondary-500);
165
+ --color-secondary-600: var(--auth-color-secondary-600);
166
+
167
+ /*
168
+ |--------------------------------------------------------------------------
169
+ | Tertiary
170
+ |--------------------------------------------------------------------------
171
+ */
172
+
173
+ --color-Tertiary-50: var(--auth-color-tertiary-50);
174
+ --color-Tertiary-100: var(--auth-color-tertiary-100);
175
+ --color-Tertiary-200: var(--auth-color-tertiary-200);
176
+ --color-Tertiary-300: var(--auth-color-tertiary-300);
177
+ --color-Tertiary-400: var(--auth-color-tertiary-400);
178
+ --color-Tertiary-500: var(--auth-color-tertiary-500);
179
+ --color-Tertiary-600: var(--auth-color-tertiary-600);
180
+
181
+ /*
182
+ |--------------------------------------------------------------------------
183
+ | Neutral
184
+ |--------------------------------------------------------------------------
185
+ */
186
+
187
+ --color-Neutral-50: var(--auth-color-neutral-50);
188
+ --color-Neutral-100: var(--auth-color-neutral-100);
189
+ --color-Neutral-200: var(--auth-color-neutral-200);
190
+ --color-Neutral-300: var(--auth-color-neutral-300);
191
+ --color-Neutral-400: var(--auth-color-neutral-400);
192
+ --color-Neutral-500: var(--auth-color-neutral-500);
193
+ --color-Neutral-600: var(--auth-color-neutral-600);
194
+
195
+ /*
196
+ |--------------------------------------------------------------------------
197
+ | Success
198
+ |--------------------------------------------------------------------------
199
+ */
200
+
201
+ --color-Success-50: var(--auth-color-success-50);
202
+ --color-Success-100: var(--auth-color-success-100);
203
+ --color-Success-200: var(--auth-color-success-200);
204
+ --color-Success-300: var(--auth-color-success-300);
205
+ --color-Success-400: var(--auth-color-success-400);
206
+ --color-Success-500: var(--auth-color-success-500);
207
+ --color-Success-600: var(--auth-color-success-600);
208
+
209
+ /*
210
+ |--------------------------------------------------------------------------
211
+ | Warning
212
+ |--------------------------------------------------------------------------
213
+ */
214
+
215
+ --color-Warning-50: var(--auth-color-warning-50);
216
+ --color-Warning-100: var(--auth-color-warning-100);
217
+ --color-Warning-200: var(--auth-color-warning-200);
218
+ --color-Warning-300: var(--auth-color-warning-300);
219
+ --color-Warning-400: var(--auth-color-warning-400);
220
+ --color-Warning-500: var(--auth-color-warning-500);
221
+ --color-Warning-600: var(--auth-color-warning-600);
222
+
223
+ /*
224
+ |--------------------------------------------------------------------------
225
+ | Error
226
+ |--------------------------------------------------------------------------
227
+ */
228
+
229
+ --color-Error-50: var(--auth-color-error-50);
230
+ --color-Error-100: var(--auth-color-error-100);
231
+ --color-Error-200: var(--auth-color-error-200);
232
+ --color-Error-300: var(--auth-color-error-300);
233
+ --color-Error-400: var(--auth-color-error-400);
234
+ --color-Error-500: var(--auth-color-error-500);
235
+ --color-Error-600: var(--auth-color-error-600);
236
+
237
+ /*
238
+ |--------------------------------------------------------------------------
239
+ | Fonts
240
+ |--------------------------------------------------------------------------
241
+ */
242
+
243
+ --font-spaceGrotesk: spaceGrotesk;
244
+ --font-satoshi: satoshi;
245
+ --font-iranSans: iranSans;
246
+
247
+ /*
248
+ |--------------------------------------------------------------------------
249
+ | Responsive
250
+ |--------------------------------------------------------------------------
251
+ */
252
+
253
+ --breakpoint-small: 725px;
254
+ --breakpoint-medium: 925px;
255
+ --breakpoint-large: 1175px;
256
+ --breakpoint-extra: 1480px;
257
+
258
+ --breakpoint-watch: 12.5rem;
259
+ --breakpoint-xs: 20rem;
260
+ --breakpoint-xss: 22.5rem;
261
+ --breakpoint-sm: 23.5rem;
262
+ --breakpoint-md: 30rem;
263
+ --breakpoint-mdd: 33.75rem;
264
+ --breakpoint-lg: 40rem;
265
+ --breakpoint-xl: 48rem;
266
+ --breakpoint-xll: 62rem;
267
+ --breakpoint-2xl: 64rem;
268
+ --breakpoint-3xl: 80rem;
269
+ --breakpoint-4xl: 90rem;
270
+ --breakpoint-5xl: 120rem;
271
+ --breakpoint-6xl: 160rem;
272
+ --breakpoint-7xl: 240rem;
273
+ --breakpoint-8xl: 480rem;
274
+
275
+ /*
276
+ |--------------------------------------------------------------------------
277
+ | Spacing
278
+ |--------------------------------------------------------------------------
279
+ */
280
+
281
+ --spacing-default: 2rem;
282
+ --spacing-app-width: 96rem;
283
+ }
@@ -1,30 +0,0 @@
1
- import { z } from "zod";
2
- declare const serverSchema: z.ZodObject<{
3
- AUTH_SECRET: z.ZodString;
4
- DATABASE_URL: z.ZodString;
5
- NEXTAUTH_URL: z.ZodOptional<z.ZodString>;
6
- }, z.core.$strip>;
7
- declare const clientSchema: z.ZodObject<{
8
- NEXT_PUBLIC_APP_URL: z.ZodString;
9
- NEXT_PUBLIC_API_URL: z.ZodString;
10
- }, z.core.$strip>;
11
- export type ServerEnv = z.infer<typeof serverSchema>;
12
- export type ClientEnv = z.infer<typeof clientSchema>;
13
- declare class EnvManager {
14
- private _server;
15
- private _client;
16
- private _serverValidationErrors;
17
- private _clientValidationErrors;
18
- private _initialized;
19
- private validate;
20
- get server(): ServerEnv;
21
- get client(): ClientEnv;
22
- isServerValid(): boolean;
23
- isClientValid(): boolean;
24
- getServerErrors(): z.ZodError | null;
25
- getClientErrors(): z.ZodError | null;
26
- reset(): void;
27
- }
28
- export declare const env: EnvManager;
29
- export declare function checkEnv(): boolean;
30
- export {};
@@ -1,129 +0,0 @@
1
- // src/config/env.ts
2
- import { z } from "zod";
3
- // Define schemas
4
- const serverSchema = z.object({
5
- AUTH_SECRET: z.string().min(32, "AUTH_SECRET must be at least 32 characters"),
6
- DATABASE_URL: z.string().url("DATABASE_URL must be a valid URL"),
7
- NEXTAUTH_URL: z.string().url().optional(),
8
- });
9
- const clientSchema = z.object({
10
- NEXT_PUBLIC_APP_URL: z.string().url("NEXT_PUBLIC_APP_URL must be a valid URL"),
11
- NEXT_PUBLIC_API_URL: z.string().url("NEXT_PUBLIC_API_URL must be a valid URL"),
12
- });
13
- // Helper to safely validate
14
- function validateEnv(schema, env) {
15
- const result = schema.safeParse(env);
16
- if (result.success) {
17
- return { success: true, data: result.data };
18
- }
19
- return { success: false, errors: result.error };
20
- }
21
- // Lazy validation - only runs when accessed
22
- class EnvManager {
23
- constructor() {
24
- this._server = null;
25
- this._client = null;
26
- this._serverValidationErrors = null;
27
- this._clientValidationErrors = null;
28
- this._initialized = false;
29
- }
30
- validate() {
31
- if (this._initialized)
32
- return;
33
- // Validate server env
34
- const serverResult = validateEnv(serverSchema, process.env);
35
- if (serverResult.success) {
36
- this._server = serverResult.data;
37
- }
38
- else {
39
- this._serverValidationErrors = serverResult.errors;
40
- }
41
- // Validate client env
42
- const clientResult = validateEnv(clientSchema, process.env);
43
- if (clientResult.success) {
44
- this._client = clientResult.data;
45
- }
46
- else {
47
- this._clientValidationErrors = clientResult.errors;
48
- }
49
- this._initialized = true;
50
- }
51
- get server() {
52
- var _a;
53
- this.validate();
54
- if (this._server) {
55
- return this._server;
56
- }
57
- throw new Error(`Missing or invalid server environment variables:\n` +
58
- ((_a = this._serverValidationErrors) === null || _a === void 0 ? void 0 : _a.issues.map(i => ` - ${i.path.join('.')}: ${i.message}`).join('\n')) +
59
- `\n\nPlease add these to your .env.local file.`);
60
- }
61
- get client() {
62
- var _a;
63
- this.validate();
64
- if (this._client) {
65
- return this._client;
66
- }
67
- throw new Error(`Missing or invalid client environment variables:\n` +
68
- ((_a = this._clientValidationErrors) === null || _a === void 0 ? void 0 : _a.issues.map(i => ` - ${i.path.join('.')}: ${i.message}`).join('\n')) +
69
- `\n\nPlease add these to your .env.local file.`);
70
- }
71
- // Check if all env vars are valid without throwing
72
- isServerValid() {
73
- this.validate();
74
- return this._server !== null;
75
- }
76
- isClientValid() {
77
- this.validate();
78
- return this._client !== null;
79
- }
80
- // Get validation errors without throwing
81
- getServerErrors() {
82
- this.validate();
83
- return this._serverValidationErrors;
84
- }
85
- getClientErrors() {
86
- this.validate();
87
- return this._clientValidationErrors;
88
- }
89
- // Reset validation (useful for testing)
90
- reset() {
91
- this._initialized = false;
92
- this._server = null;
93
- this._client = null;
94
- this._serverValidationErrors = null;
95
- this._clientValidationErrors = null;
96
- }
97
- }
98
- // Singleton instance
99
- export const env = new EnvManager();
100
- // Helper for package consumers to check their env
101
- export function checkEnv() {
102
- const errors = [];
103
- if (!env.isServerValid()) {
104
- const serverErrors = env.getServerErrors();
105
- if (serverErrors) {
106
- errors.push('Server environment variables:');
107
- serverErrors.issues.forEach(issue => {
108
- errors.push(` - ${issue.path.join('.')}: ${issue.message}`);
109
- });
110
- }
111
- }
112
- if (!env.isClientValid()) {
113
- const clientErrors = env.getClientErrors();
114
- if (clientErrors) {
115
- errors.push('Client environment variables:');
116
- clientErrors.issues.forEach(issue => {
117
- errors.push(` - ${issue.path.join('.')}: ${issue.message}`);
118
- });
119
- }
120
- }
121
- if (errors.length > 0) {
122
- console.warn('⚠️ Environment variable validation issues found:');
123
- console.warn(errors.join('\n'));
124
- console.warn('\nPlease add the required variables to your .env.local file');
125
- return false;
126
- }
127
- console.log('✅ All environment variables are valid!');
128
- return true;
129
- }
@@ -1,11 +0,0 @@
1
- export declare class AuthCore {
2
- private config;
3
- constructor();
4
- login(email: string, password: string): Promise<{
5
- user: {
6
- email: string;
7
- };
8
- token: string;
9
- }>;
10
- }
11
- export declare const auth: AuthCore;
package/dist/core/auth.js DELETED
@@ -1,33 +0,0 @@
1
- // src/core/auth.ts
2
- import { env } from '../configs/env';
3
- export class AuthCore {
4
- constructor() {
5
- try {
6
- // Accessing env.server will trigger validation
7
- const server = env.server;
8
- const client = env.client;
9
- this.config = {
10
- secret: server.AUTH_SECRET,
11
- databaseUrl: server.DATABASE_URL,
12
- appUrl: client.NEXT_PUBLIC_APP_URL,
13
- apiUrl: client.NEXT_PUBLIC_API_URL,
14
- };
15
- }
16
- catch (error) {
17
- // Re-throw with clear message
18
- if (error instanceof Error) {
19
- throw new Error(`Auth package initialization failed: ${error.message}`);
20
- }
21
- throw error;
22
- }
23
- }
24
- async login(email, password) {
25
- // Your login logic
26
- console.log('Using config:', {
27
- appUrl: this.config.appUrl,
28
- apiUrl: this.config.apiUrl,
29
- });
30
- return { user: { email }, token: 'fake-token' };
31
- }
32
- }
33
- export const auth = new AuthCore();