-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Setting a new password for 2FA #259
Comments
{"ok":true,"result":"An error occurred while deserializing TL parameters"} So… something went wrong there. I've never tried those requests myself so no idea. |
I found this after a while looking. |
i added 'hint' r = self.tgclient(account.GetPasswordRequest())
salt = r.new_salt
pw = 'secret'
pw_byte = pw.encode("UTF-8")
pw_salt = salt + pw_byte + salt
pw_hash = sha256(pw_salt).digest()
password_new = PasswordInputSettings(new_salt=salt, new_password_hash=password_new_hash, hint='hint')
r = self.tgclient(account.UpdatePasswordSettingsRequest(current_password_hash=bytes(0), new_settings=password_new) get error NEW_SALT_INVALID
|
Did you try using |
|
Hm… Besides, I noticed the |
Also check this code: if (!silent) {
passwordEntered = currentPassword != null || response instanceof TLRPC.TL_account_noPassword;
}
currentPassword = (TLRPC.account_Password) response;
waitingForEmail = currentPassword.email_unconfirmed_pattern.length() > 0;
byte[] salt = new byte[currentPassword.new_salt.length + 8];
Utilities.random.nextBytes(salt);
System.arraycopy(currentPassword.new_salt, 0, salt, 0, currentPassword.new_salt.length);
currentPassword.new_salt = salt; |
EXCELLENT! r = self.tgclient(account.GetPasswordRequest())
salt_new = r.new_salt
salt_random = os.urandom(8)
salt = salt_new + salt_random
pw = 'secret'
pw_byte = pw.encode("UTF-8")
pw_salt = salt + pw_byte + salt
pw_hash = sha256(pw_salt).digest()
password_new = PasswordInputSettings(new_salt=salt, new_password_hash=pw_hash, hint='hint')
r = self.tgclient(account.UpdatePasswordSettingsRequest(current_password_hash=salt, new_settings=password_new) |
It works? |
yes |
Awesome, would you like to write a wiki page for that yourself? Make a pull request with example code? Otherwise, I can do that for you, just saying this so that you can become a contributor. Glad you solved it. |
better you write a wiki |
Okay then I will do it) |
No set password for 2FA
More information
centos 7 x64
python 3.5.2
telethon 0.13.4
The text was updated successfully, but these errors were encountered: