Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkDatabaseEncryptionKey returns "Failed to parse JSON object as TDLib request: Wrong padding length" #970

Closed
alexander-akhmetov opened this issue Mar 24, 2020 · 2 comments

Comments

@alexander-akhmetov
Copy link

Hello,

I use JSON interface to interact with tdlib and with some keys (for example, changeme123 :) ) checkDatabaseEncryptionKey method returns Failed to parse JSON object as TDLib request: Wrong padding length (checked with tdlib v1.6.0):

{
    "@type": "error", 
    "code": 400, 
    "message": "Failed to parse JSON object as TDLib request: Wrong padding length"
}

Should encryption_key be passed as a base64 encoded string? I see this message in tdlib in base64 related code. Also, in td_api.tl encryption_key parameter has type bytes, but in the documentation it's string.

Also, the python example uses key parameter, not encryption_key. Which one is correct?

Thank you.

@levlam
Copy link
Contributor

levlam commented Mar 24, 2020

Should encryption_key be passed as a base64 encoded string?

Yes, in JSON interface there is no way to pass arbitrary binary data, so all bytes fields must be encoded with base64.

Also, in td_api.tl encryption_key parameter has type bytes, but in the documentation it's string.

The documentation available on-site is generated for native C++ interface, which uses std::string for arbitrary binary strings of type bytes. I will try to fix this and to keep in the documentation the difference between string and bytes.

Also, the python example uses key parameter, not encryption_key. Which one is correct?

The Python example is incorrect. Thanks for noticing this. I will fix the example.

@alexander-akhmetov
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants