seiichiro0185 / sailotp

A Sailfish Google Authenticator Implementation
https://www.seiichiro0185.org/sailfish:apps:sailotp:start
Other
49 stars 25 forks source link

Recovering database from soft-bricked device #71

Closed MaGetzUb closed 1 year ago

MaGetzUb commented 1 year ago

I recently soft-bricked my phone, and I would like to recover the otp database somehow. Is this achievable via Sailfish recovery mode, or am I out of luck? If it's possible, where is the database stored exactly and/or what other steps might I need to take? My unix/linux knowledge is quite limited, so if there's obvious file location I need to check feel free to enlighten me. 😄

seiichiro0185 commented 1 year ago

The Database is stored at the following Path (maybe change defaultuser to nemo if its an older install):

/home/defaultuser/.local/share/harbour-sailotp/harbour-sailotp/QML/OfflineStorage/Databases

There should be a File ending in .sqlite in this Path. This is a standard SQLite-File and can be opened with sqlite3. The Tokens are stored in the Table"OTPStorage"

If you want to "transplant" it to a new device you can copy the whole Folder /home/defaultuser/.local/share/harbour-sailotp/ to the same location on the new Device, and SailOTP should recognize it.

MaGetzUb commented 1 year ago

Thank you so much! I did copy the whole home directory on a memory card earlier today, but I just wanted to be sure the database was somewhere under the home directory.

MaGetzUb commented 1 year ago

Can this sqlite3 database be converted into .otpm format, what at least Microsoft's authenticator seem to use?

seiichiro0185 commented 1 year ago

I don't know the otpm format, but as long as it is open/documented enough a conversion could in theory be possible. The sqlite-DB contains the Data in a structured and readble form, so a script or program could read them from the sqlite and write them to a new format.

I don't know if there are any scripts / tools that do this yet (I don't know of any), but at least with the data format SailOTP uses at the moment it is possible, if someone was to invest the time to create such a tool.

seiichiro0185 commented 1 year ago

Just a small heads up for anyone finding this issue later - starting with SailOTP-Version 1.11.1 the database will be in /home/defaultuser/.local/share/org.seiichiro0185/harbour-sailotp//QML/OfflineStorage/Databases/ Everything else bsides this path does still hold true (just use the new path everywhere the old one is mentioned)

Since the original question is answered here I'll close the issue