Auth implemented

This commit is contained in:
AG
2025-10-13 18:18:34 +03:00
parent 6e587e8aa7
commit 60e9c24440
28 changed files with 1251 additions and 47 deletions

34
backend/dist/services/SessionService.js vendored Normal file
View File

@@ -0,0 +1,34 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionService = void 0;
// backend/src/services/SessionService.ts
const uuid_1 = require("uuid");
const sessions = new Map();
class SessionService {
static createSession() {
const id = (0, uuid_1.v4)();
const newSession = {
id,
isAuthenticated: false,
createdAt: new Date(),
};
sessions.set(id, newSession);
return newSession;
}
static getSession(id) {
return sessions.get(id);
}
static authenticateSession(id) {
const session = sessions.get(id);
if (session) {
session.isAuthenticated = true;
sessions.set(id, session);
return true;
}
return false;
}
static destroySession(id) {
sessions.delete(id);
}
}
exports.SessionService = SessionService;