Clean up the code

This commit is contained in:
2025-09-06 12:33:57 +03:00
Unverified
parent c88015ae39
commit 27666594ff
35 changed files with 28 additions and 2390 deletions
+1 -30
View File
@@ -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();
// }
}
-17
View File
@@ -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 = '';
}
+3 -5
View File
@@ -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 };
}
}