Comments (8)
Hi,
On which authorisation state does it fail? It should print it to the logs.
from python-telegram.
I have the same problem, here is logs: https://pastebin.com/qAUQr5Ck
from python-telegram.
I see, thanks for the logs. Probably it's related to the encryption key (parameter database_encryption_key
).
While it's not fixed in python-telegram
, can you try to make the database encryption key string longer? Probably you'll need to remove existing tdlib
database. By default python-telegram
keeps it in /tmp/.tdlib_files/
tg = Telegram(
database_encryption_key='...',
)
from python-telegram.
I have the exact same problem! Same error. Same stacktrace.
I have tried a long database_encryption_key
and a short one. No luck :(
Perhaps the protocol has changed? The underlying tdLib
library needs to be upgraded?
from python-telegram.
I see, thanks for the logs. Probably it's related to the encryption key (parameter
database_encryption_key
).While it's not fixed in
python-telegram
, can you try to make the database encryption key string longer? Probably you'll need to remove existingtdlib
database. By defaultpython-telegram
keeps it in/tmp/.tdlib_files/
tg = Telegram( database_encryption_key='...', )
It seems to be the parameter name being sent.
The example provided by tdlib uses key as parameter for checkDatabaseEncryptionKey
messages.
{'@type': 'checkDatabaseEncryptionKey', 'key': '...'}
While python-telegram is using encryption_key.
The documentation also mention encryption_key.
So, I made it work by changing the key name from encryption_key
to key
. I'm not sure if this is the proper solution but works for now.
from python-telegram.
The example provided by tdlib uses key as parameter for checkDatabaseEncryptionKey messages.
Hm, interesting! I'm not sure if it's a mistake or they are interchangeable. I will try to look into that.
I also found that in td_api.tl encryption_key
has type bytes
and in the documentation it is string
. They mentioned in one of the issues that bytes should be sent as base64 encoded string. The error original error message (Wrong padding length
) is also related to base64.
With base64 encoded string it seems to be working, but I don't know yet how to check if tdlib is using the correct and decoded from base64 key, or just the passed string:
def _send_encryption_key(self) -> AsyncResult:
logger.info('Sending encryption key')
key = self._database_encryption_key
if isinstance(key, str):
key = key.encode()
data = {
'@type': 'checkDatabaseEncryptionKey',
'encryption_key': base64.b64encode(key).decode(),
}
return self._send_data(data, result_id='updateAuthorizationState')
I asked a question in tdlib repository about base64
and difference between key
and encryption_key
: tdlib/td#970
Can somebody try to use the default key from the python-telegram examples (database_encryption_key='changeme1234'
) and an empty key (database_encryption_key=''
), please?
from python-telegram.
I asked a question in tdlib repository about base64 and difference between key and encryption_key: tdlib/td#970
Yes, it has bytes type and should be encoded using base64, I'll make changes to python-telegram.
While it's not fixed, you can try to do it on your side: use a different key with a different length or encode encryption key using base64 and pass it to Telegram:
import base64
...
encryption_key = base64.b64encode(b'secret').decode()
tg = Telegram(
...
database_encryption_key=encryption_key,
)
from python-telegram.
Released 0.12.0
(both the package and the docker image), if you still see the problem, please re-open the issue
from python-telegram.
Related Issues (20)
- Error occurred when tg.stop() HOT 1
- Add `py.typed` file HOT 2
- [Question] A way to understand if a message has been read (given the message_id and the chat_id) HOT 3
- How to create a new conversation ? HOT 1
- AttributeError: module 'signal' has no attribute 'SIGQUIT' HOT 2
- use parse_mode(MarkdownV2) in send_message HOT 2
- Not able to send message on Telegram channel HOT 2
- How to download photo from messagePhoto? HOT 1
- Where I can find last supported tdlib version HOT 3
- Does this client include `delete_file` functionality?
- tdlib fails with SIGSEGV in a simple* python script HOT 1
- bro how to run project
- issues with version
- issue related to windows
- AttributeError: module 'signal' has no attribute 'SIGQUIT' HOT 2
- Stuck on "Enter code:" HOT 1
- topics HOT 2
- OSError: libssl.so.1.1: cannot open shared object file: No such file or directory HOT 5
- Missing dependency on setuptools
- ARM architecture not supported on Mac OS X HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-telegram.