简体   繁体   English

Telegram TDLib Android:如何存储 apiId 和 apiHash?

[英]Telegram TDLib Android : How to store apiId and apiHash?

I am trying to build an android telegram client using the famous TDLib .我正在尝试使用著名的TDLib构建一个 android 电报客户端。 Unfortunately, I could not find any good tutorials or documentation about using this library in android.不幸的是,我在 android 中找不到任何关于使用这个库的好的教程或文档。 But, I've understood how the library works from the Java examples.但是,我从Java示例中了解了该库的工作原理。

The problem is when implementing the library, I've to pass the api_id and api_hash to TDLib .问题是在实现库时,我必须将api_idapi_hashTDLib I think these variables must be unknown to others, as this can reused for malicious purposes.我认为这些变量对其他人来说一定是未知的,因为这可以被用于恶意目的。

As the documentation does not provide any best practices about storing the api_id and api_hash , How can I make them unavailable to the public and securely manage it in the android app?由于文档没有提供有关存储api_idapi_hash的任何最佳实践,我怎样才能使它们对公众不可用并在 android 应用程序中安全地管理它?

From the developer of TDLib来自 TDLib 的开发者

On Android the values can't be accessed without root permissions if they are stored in any reasonable way.在 Android 上,如果它们以任何合理的方式存储,则无法在没有 root 权限的情况下访问这些值。 From the other side, they can be extracted from the app's memory with root permissions.另一方面,可以从具有root权限的应用程序的memory中提取它们。 So you can't do much besides storing them in the apps binary and obfuscating them in any simple way.因此,除了将它们存储在应用程序二进制文件中并以任何简单的方式混淆它们之外,您无能为力。

and he says, if someone extracts the key and uses it for a malicious purpose, only the user is blocked他说,如果有人提取密钥并将其用于恶意目的,则只有用户被阻止

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM