added email verification

This commit is contained in:
andrei-mihnea-cerbu
2025-02-04 19:08:34 +02:00
parent 9baec7a7cb
commit dcf505c89b
67 changed files with 3922 additions and 3638 deletions
+31 -31
View File
@@ -1,43 +1,43 @@
import { SocketCommunicatorBase } from "./socket_communicator/socket_communicator_base";
import { SocketCommunicatorBase } from './socket_communicator/socket_communicator_base'
interface Connection {
communicator: SocketCommunicatorBase;
communicator: SocketCommunicatorBase
}
export class ConnectionManager {
private readonly connections: { [key: string]: Connection };
private readonly connections: { [key: string]: Connection }
constructor() {
this.connections = {};
constructor() {
this.connections = {}
}
// Adds a new communicator, keyed by both IP and port
addConnection(ip: string, port: number, communicator: SocketCommunicatorBase): void {
const key = `${ip}:${port}`
// Store the communicator along with the client's public and private keys
this.connections[key] = {
communicator,
}
}
// Adds a new communicator, keyed by both IP and port
addConnection(ip: string, port: number, communicator: SocketCommunicatorBase): void {
const key = `${ip}:${port}`;
// Store the communicator along with the client's public and private keys
this.connections[key] = {
communicator
};
// Removes a communicator based on IP and port
removeCommunicator(ip: string, port: number): void {
const key = `${ip}:${port}`
if (this.connections[key]) {
delete this.connections[key]
}
}
// Removes a communicator based on IP and port
removeCommunicator(ip: string, port: number): void {
const key = `${ip}:${port}`;
if (this.connections[key]) {
delete this.connections[key];
}
}
// Retrieves a communicator based on IP and port
getCommunicator(ip: string, port: number): SocketCommunicatorBase | null {
const key = `${ip}:${port}`
return this.connections[key] ? this.connections[key].communicator : null
}
// Retrieves a communicator based on IP and port
getCommunicator(ip: string, port: number): SocketCommunicatorBase | null {
const key = `${ip}:${port}`;
return this.connections[key] ? this.connections[key].communicator : null;
}
// Checks if a communicator exists for a given IP and port
communicatorExists(ip: string, port: number): boolean {
const key = `${ip}:${port}`;
return this.connections[key] !== undefined;
}
// Checks if a communicator exists for a given IP and port
communicatorExists(ip: string, port: number): boolean {
const key = `${ip}:${port}`
return this.connections[key] !== undefined
}
}