mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-23 03:25:07 +03:00
Clean up the code
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
// import { showLogin } from "../navigation";
|
||||
import type { Headers } from "../core/types";
|
||||
|
||||
/**
|
||||
@@ -17,32 +16,4 @@ export function getAuthHeaders(token: string | null, json: boolean = true): Head
|
||||
headers['Authorization'] = `Bearer ${token}`;
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks authentication status on page load
|
||||
*/
|
||||
export async function checkAuthStatus(): Promise<void> {
|
||||
// For JWT, we don't have a persistent token on page load
|
||||
// So we'll just show the login form
|
||||
// showLogin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the current user and clears session data
|
||||
*/
|
||||
// export async function logout(): Promise<void> {
|
||||
// try {
|
||||
// await fetch(`${API_BASE_URL}/logout`, {
|
||||
// method: 'GET',
|
||||
// headers: getAuthHeaders()
|
||||
// });
|
||||
// } catch (error) {
|
||||
// console.error('Logout error:', error);
|
||||
// }
|
||||
|
||||
// currentUser = null;
|
||||
// authToken = null;
|
||||
// // showLogin();
|
||||
// clearAlerts();
|
||||
// }
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* @fileoverview Authentication system implementation
|
||||
* @description Handles user authentication, registration, and session management
|
||||
* @author Cursor
|
||||
* @version 1.0.0
|
||||
*/
|
||||
|
||||
import { id } from "../utils/utils";
|
||||
|
||||
/**
|
||||
* Clears all alert messages from authentication forms
|
||||
* @private
|
||||
*/
|
||||
export function clearAlerts(): void {
|
||||
id('login-alerts').innerHTML = '';
|
||||
id('register-alerts').innerHTML = '';
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { API_BASE_URL } from "../core/config";
|
||||
import { getAuthHeaders } from "./api";
|
||||
import { generateX25519KeyPair } from "../crypto/asymmetric";
|
||||
import { encryptBackupWithPassword, decryptBackupWithPassword, encodeBlob, decodeBlob } from "../crypto/backup";
|
||||
import { generateX25519KeyPair } from "../utils/crypto/asymmetric";
|
||||
import { encryptBackupWithPassword, decryptBackupWithPassword, encodeBlob, decodeBlob } from "../utils/crypto/backup";
|
||||
import { b64, ub64 } from "../utils/utils";
|
||||
import type { BackupBlob, UploadPublicKeyRequest } from "../core/types";
|
||||
|
||||
@@ -97,6 +97,4 @@ export async function ensureKeysOnLogin(password: string, token: string): Promis
|
||||
const encBlob = await encryptBackupWithPassword(password, { version: 1, privateKey: currentPrivateKey });
|
||||
await uploadBackupBlob(encodeBlob(encBlob), token);
|
||||
return { publicKey: currentPublicKey, privateKey: currentPrivateKey };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user