Telegram-FOSS-Team / Telegram-FOSS

Unofficial, FOSS-friendly fork of the original Telegram client for Android
GNU General Public License v2.0
2.88k stars 370 forks source link

Add an export/import feature #197

Open Bubu opened 6 years ago

Bubu commented 6 years ago

I have often wanted to have an export feature for telegram. This would I guess include signin information secret chat history, settings (those who are not synchronized) and secret chat keys.

The idea is to export all non-cloud data into a local file and being able to restore a new installation to the same state as the old.

I know this is a 'bigger' feature and we don't normally do these, hence I'd like to start a discussion who'd be interested in having such a feature.

I did this procedure manually by copying files around via adb to a new phone, so I know there are no keys bound to the actual phone hardware.

One open question is what would happen the same session is opened the from to different points and how we could prevent this from happening.

Bubu commented 6 years ago

One of the concerns is that putting this kind of information into a world-readable folder on the sd card would expose users to malware that's running on their phone or exploits, etc.

There are a few possible solutions for this I think:

Bubu commented 6 years ago

Let's gather what some other apps are doing:

n00bus commented 6 years ago

password - yus, solves some problems, but theoretically this kind of feature is a possible security hole. let's think about casual event. one uses simple pin for unlocking, his neighbour saw it and unlocks it, saves keys to sd, sends to himself, deletes file from history, no one knows keys are compromised. of course neighbour should be mitm (admin at work), but anyway it's easy and quick. also "security-wise" guys from original tg-project could force this project to change its name and icon when you go a bit far from upstream. just some thoughts.

Bubu commented 6 years ago

Here is why I think this feature is relevant for tg-foss:

Every user should be in control of his/her data. That means it shouldn't be kept hostage inside one installation on an app, in case you move to a new phone, just want a restorable backup of your secret chats or just want to reinstall a different tg version signed by someone else.

Unfortunately android doesn't provide a way to do this independently of each app, unless you are on a rooted device (and then it's still not very convenient).

The only solution for non-rooted users seems to be that each app implements such a backup/export/import feature.

There is adb backup but this never provided any useful results for me...

n00bus commented 6 years ago

i agree with necessity of backup feature almost everywhere. but theoretically it's a sandbox feature, when your keys are unique for each device and (ideally) can't be accessed by any 3dparty thing, while you can't make them non-valid/compromised. backups of secretchats - are up too users. transfering keys - can be dangerous.

Bubu commented 6 years ago

backups of secretchats - are up too users. transfering keys - can be dangerous.

Not sure if there is a way to "close" a secret chat before exporting it. I think there are two points to migrating a secret chat to a different device.

  1. keeping the history viewable and searchable inside tg app.
  2. keeping the chat 'open' for future comminication.

I think my usecase is mainly 1. (although having 2. is convenient.). So maybe this feature could 'close' secret chats somehow before exporting the history. Not sure if this is possible.

zarEclEC commented 6 years ago

you can use normal chats as crypted using my fork. Basically I'm crypting before sending to telegram

Miepee commented 4 years ago

Sorry for the bump. I'd be in favor to have the possibilty to export chats, especially secret chats. I'll soon be switching phones, and I'd like to not loose the chat history. Also, does anyone know if I'm able to get secret chats history via adb on a non-rooted device?

MatiasConTilde commented 4 years ago

I once migrated to a different phone by copying the whole /data telegram folder and it worked, but it had a bug that showed the messages in secret chat in a wrong oder, by putting all existing messages below and new messages above those (like if the were sent earlier than the pre-existing), so keep an eye out for this

ildar commented 4 years ago

Miepee was asking about non-rooted approach. Yet if you are migrating the phone, why'd you care about it's rooted or not? ;)

Miepee commented 4 years ago

Because I'm unable to root them. And I'd like too keep the chats, as they have some sentimental value for me.

fortizg commented 3 years ago

---Here comes another bump---

Hello there!! Here you have me, just another Telegram user, running it into some non-rooted OS, and looking for some help/resources so as to get secret chats safely exported/bkp'd.... with the intention of getting the non-cloud'd content restored into the same phone (which is urgently needing a software refresh). Yep, those conversations have a tremendous sentimental value for me as well.

@Bubu / @Miepee , did you happened to be lucky to find any workaround for getting that done?

Miepee commented 3 years ago

Nope, I did not.

Miepee commented 3 years ago

Sorry for the bump, but would it be possible to have #203 as a workaround until this gets implemented at least? Some backup solution is better than no backup solution at all IMO.

dm17 commented 2 weeks ago

Kind of important. Any other ways to retrieve messages from Telegram FOSS on android? Can we migrate the folder elsewhere and somehow exporting them without signing in? If a chat was deleted for everyone, then signing in will proliferate that change to said device ;)