'use strict';

var chunkCD77U7LZ_js = require('../chunk-CD77U7LZ.js');
var chunk6W5BMXJG_js = require('../chunk-6W5BMXJG.js');
var chunkO26VCNS3_js = require('../chunk-O26VCNS3.js');
var chunkROEYW4A7_js = require('../chunk-ROEYW4A7.js');
var chunkDUHZ7VZP_js = require('../chunk-DUHZ7VZP.js');
var chunkSVWQN2LR_js = require('../chunk-SVWQN2LR.js');
require('../chunk-DGUM43GV.js');

// src/auth/server.ts
async function validateApiAuth(request) {
  try {
    const token = chunkDUHZ7VZP_js.getTokenFromRequest(request);
    if (!token) return null;
    const secret = process.env.JWT_SECRET || "your-secret-key";
    const payload = await chunkDUHZ7VZP_js.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;
  }
}

Object.defineProperty(exports, "createAnalyticsAdapter", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createAnalyticsAdapter; }
});
Object.defineProperty(exports, "createDefaultBaseConfig", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createDefaultBaseConfig; }
});
Object.defineProperty(exports, "createDefaultLoginConfig", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createDefaultLoginConfig; }
});
Object.defineProperty(exports, "createDefaultRegisterConfig", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createDefaultRegisterConfig; }
});
Object.defineProperty(exports, "createLoginHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createLoginHandler; }
});
Object.defineProperty(exports, "createLoginOptionsHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createLoginOptionsHandler; }
});
Object.defineProperty(exports, "createLogoutHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createLogoutHandler; }
});
Object.defineProperty(exports, "createLogoutOptionsHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createLogoutOptionsHandler; }
});
Object.defineProperty(exports, "createMeHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createMeHandler; }
});
Object.defineProperty(exports, "createMeOptionsHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createMeOptionsHandler; }
});
Object.defineProperty(exports, "createRegisterHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createRegisterHandler; }
});
Object.defineProperty(exports, "createRegisterOptionsHandler", {
  enumerable: true,
  get: function () { return chunkCD77U7LZ_js.createRegisterOptionsHandler; }
});
Object.defineProperty(exports, "createAuthMiddleware", {
  enumerable: true,
  get: function () { return chunk6W5BMXJG_js.createAuthMiddleware; }
});
Object.defineProperty(exports, "API_ROUTES", {
  enumerable: true,
  get: function () { return chunkO26VCNS3_js.API_ROUTES; }
});
Object.defineProperty(exports, "BaseApiClient", {
  enumerable: true,
  get: function () { return chunkO26VCNS3_js.BaseApiClient; }
});
Object.defineProperty(exports, "STORAGE_KEYS", {
  enumerable: true,
  get: function () { return chunkO26VCNS3_js.STORAGE_KEYS; }
});
Object.defineProperty(exports, "useAuth", {
  enumerable: true,
  get: function () { return chunkROEYW4A7_js.useAuth; }
});
Object.defineProperty(exports, "useAuthForm", {
  enumerable: true,
  get: function () { return chunkROEYW4A7_js.useAuthForm; }
});
Object.defineProperty(exports, "DrizzleAuthService", {
  enumerable: true,
  get: function () { return chunkDUHZ7VZP_js.DrizzleAuthService; }
});
Object.defineProperty(exports, "generateToken", {
  enumerable: true,
  get: function () { return chunkDUHZ7VZP_js.generateToken; }
});
Object.defineProperty(exports, "getTokenFromRequest", {
  enumerable: true,
  get: function () { return chunkDUHZ7VZP_js.getTokenFromRequest; }
});
Object.defineProperty(exports, "hashPassword", {
  enumerable: true,
  get: function () { return chunkDUHZ7VZP_js.hashPassword; }
});
Object.defineProperty(exports, "verifyJwtToken", {
  enumerable: true,
  get: function () { return chunkDUHZ7VZP_js.verifyJwtToken; }
});
Object.defineProperty(exports, "verifyPassword", {
  enumerable: true,
  get: function () { return chunkDUHZ7VZP_js.verifyPassword; }
});
Object.defineProperty(exports, "account", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.account; }
});
Object.defineProperty(exports, "accountRelations", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.accountRelations; }
});
Object.defineProperty(exports, "session", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.session; }
});
Object.defineProperty(exports, "sessionRelations", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.sessionRelations; }
});
Object.defineProperty(exports, "user", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.user; }
});
Object.defineProperty(exports, "userRelations", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.userRelations; }
});
Object.defineProperty(exports, "userRole", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.userRole; }
});
Object.defineProperty(exports, "verifications", {
  enumerable: true,
  get: function () { return chunkSVWQN2LR_js.verifications; }
});
exports.validateApiAuth = validateApiAuth;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map