export { createAnalyticsAdapter, createDefaultBaseConfig, createDefaultLoginConfig, createDefaultRegisterConfig, createLoginHandler, createLoginOptionsHandler, createLogoutHandler, createLogoutOptionsHandler, createMeHandler, createMeOptionsHandler, createRegisterHandler, createRegisterOptionsHandler } from '../chunk-QAT2RWAO.mjs';
export { createAuthMiddleware } from '../chunk-ESRCX5TQ.mjs';
export { API_ROUTES, BaseApiClient, STORAGE_KEYS } from '../chunk-HEMA7SWK.mjs';
export { useAuth, useAuthForm } from '../chunk-KGRQNEIR.mjs';
import { getTokenFromRequest, verifyJwtToken } from '../chunk-OCR5DS4C.mjs';
export { DrizzleAuthService, generateToken, getTokenFromRequest, hashPassword, verifyJwtToken, verifyPassword } from '../chunk-OCR5DS4C.mjs';
export { account, accountRelations, session, sessionRelations, user, userRelations, userRole, verifications } from '../chunk-AIKEVVDR.mjs';
import '../chunk-BJTO5JO5.mjs';

// src/auth/server.ts
async function validateApiAuth(request) {
  try {
    const token = getTokenFromRequest(request);
    if (!token) return null;
    const secret = process.env.JWT_SECRET || "your-secret-key";
    const payload = await verifyJwtToken(token, secret);
    if (!payload || !payload.userId) return null;
    return {
      id: payload.userId,
      email: payload.email,
      username: payload.username,
      role: payload.role
    };
  } catch (error) {
    console.error("API \u8EAB\u4EFD\u9A8C\u8BC1\u5931\u8D25:", error);
    return null;
  }
}
async function validateApiAuthNumeric(request) {
  const user2 = await validateApiAuth(request);
  if (!user2) return null;
  return {
    ...user2,
    id: parseInt(user2.id, 10)
  };
}

export { validateApiAuth, validateApiAuthNumeric };
//# sourceMappingURL=index.mjs.map
//# sourceMappingURL=index.mjs.map