In other words, client will login from different devices at the same time.
For now all user sessions are stored in Redis server using Django(Python) framework as backend. Other user info are stored in PostgreSQL database.
I am thinking about 2 approaches for exchanging public keys between client and server.
*client sends his login credentials and public key to the server, then server will verify the credentials, then*
1. Server add client's present pub key into his login session (redis server). Server will read client's pub key from Redis server to encrypt data. Later on, server will pass the encrypted to client.
2. Server add client's present pub key into PostgreSQL database with some columns, such as foreign_key to user_id, client_pub_key, valid_until, created_at. All the RSA key validation will be handled by the Django(Python) server. (I'm worried querying client RSA keys everytime from database will drag down the performance)
Which one do you think is modern, secure and fast for End-to-End encryption for user login from multiple devices?
Some better designs?
Appreciate your comments!