Files
bo3-js/js/core/AuthStub.js
usernames122 d9d5460856 Add launchable
2025-10-23 20:58:19 +02:00

29 lines
982 B
JavaScript

// For whoever is going to use this engine later, please modify this file to actually do authentication.
export class Auth {
/**
* Verifies a session token and returns a user ID.
* In this dummy version, it just returns a random numeric ID.
*
* @param {string} token - The player's session token.
* @returns {number|null} - The verified user ID, or null if invalid.
*/
verifySessionToken(token) {
// Dummy implementation: always "verifies" successfully.
if (token === "fake") return null; // Simulate invalid token
return Math.floor(Math.random() * 1000);
}
/**
* Gets a user's display name by their ID.
* Replace this with a real lookup (e.g., database or API call).
*
* @param {number|string} userId - The player's user ID.
* @returns {string} - The player's display name.
*/
getUserNameById(userId) {
// Dummy implementation
return `User${userId}`;
}
}