I have a project as graduation thesis. i have to write a password manager app. in this app, many users can create, login their account and manage their data such as facebook account, gmail, tiktok,... and required using SQLite Cipher to encrypt each user's data ( the key to encrypt data is hashed from user password) So , how can i do for creating each database for each user? The example,
- user A create his account: username A , password a12345. after A login, the database of A is A_db.db
- user B create his account: username B , password b12345. after B login, the database of b is B_db.db.
CodePudding user response:
You don't need a database per user. Each user will have it's own copy of the database in their platform (I guess you are planning to create an Android app from the tags). So, you must design the database so that each user will use its own copy independently of other users.
CodePudding user response:
Yes you could (technically) create a separate SQLite database for each user. An SQLite database is just a file. You give the filename when you open the DB. Multiple files with different names is simple to implement.
But probably you don't need to.
On Android, it is assumed that there is only one user of that given device. The Android platform (AFAIK) does not support multiple users / accounts. So ... assuming that this SQLite database is on the Android user's device, your problem simply does not arise.
If the databases are on a server ... will, not much is achieved by holding a separate database for each user. You can hold the information in one database: SQLite or something more robust / scalable.
The only case where it would make sense to have per-user SQLite databases for a password manager application is if this is if the app designed to run on an OS that supports multiple user accounts; e.g. Windows, Unix, Linux, Mac OS, etc. Then you can just put the database in each user's home directory ... or something like that.