Skip to content

[Enhancement/Bug] Fix Session Persistence (Chat/Keys loss) & Add International Phone Support #1

Description

@SkobkaDev418

We need to improve the core authentication and data handling logic to make the messenger stable and accessible globally. Currently, there are two major issues blocking user experience:

🔐 Session Persistence & Key Management (Critical Bug)

Users lose their chat history and encryption keys upon re-login or app restart.
Problem: The client-side encryption key (AES-256) is not properly restored from local storage after a new session starts.
Result: Previous messages become unreadable or disappear entirely.
Goal: Ensure that the encryption key is securely derived or restored upon login so that all historical messages can be decrypted correctly.

🌍 International Phone Number Support

Currently, the system seems optimized for +7 (Russia) numbers only.
Problem: Users with other country codes cannot register or log in properly.
Goal: Update the backend (server.js) and frontend validation to accept any valid international phone number (like Telegram does).
Technical Note: We should remove hardcoded checks for specific prefixes and use a more flexible validation regex (e.g., ^+[1-9]\d{1,14}$).

Tasks for Contributors:

Frontend (antiscam.html): Fix the logic for saving/restoring the encryption key in localStorage or IndexedDB.
Backend (server.js): Update the /api/auth/register and /api/auth/login-password endpoints to handle international phone formats.
Database: Ensure the SQLite schema handles phone numbers as strings without length restrictions that might cut off long international numbers.
Testing: Verify that a user can log out, close the browser, log back in, and still see their old chats decrypted correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions