diff --git a/pyrogram/client/methods/password/change_cloud_password.py b/pyrogram/client/methods/password/change_cloud_password.py index d7d0e1fa..6ae660f9 100644 --- a/pyrogram/client/methods/password/change_cloud_password.py +++ b/pyrogram/client/methods/password/change_cloud_password.py @@ -16,10 +16,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -import os -from hashlib import sha256 - -from pyrogram.api import functions, types from ...ext import BaseClient @@ -46,23 +42,25 @@ class ChangeCloudPassword(BaseClient): Raises: :class:`Error ` in case of a Telegram RPC error. """ - r = self.send(functions.account.GetPassword()) + raise NotImplementedError - if isinstance(r, types.account.Password): - current_password_hash = sha256(r.current_salt + current_password.encode() + r.current_salt).digest() - - new_salt = r.new_salt + os.urandom(8) - new_password_hash = sha256(new_salt + new_password.encode() + new_salt).digest() - - return self.send( - functions.account.UpdatePasswordSettings( - current_password_hash=current_password_hash, - new_settings=types.account.PasswordInputSettings( - new_salt=new_salt, - new_password_hash=new_password_hash, - hint=new_hint - ) - ) - ) - else: - return False + # r = self.send(functions.account.GetPassword()) + # + # if isinstance(r, types.account.Password): + # current_password_hash = sha256(r.current_salt + current_password.encode() + r.current_salt).digest() + # + # new_salt = r.new_salt + os.urandom(8) + # new_password_hash = sha256(new_salt + new_password.encode() + new_salt).digest() + # + # return self.send( + # functions.account.UpdatePasswordSettings( + # current_password_hash=current_password_hash, + # new_settings=types.account.PasswordInputSettings( + # new_salt=new_salt, + # new_password_hash=new_password_hash, + # hint=new_hint + # ) + # ) + # ) + # else: + # return False diff --git a/pyrogram/client/methods/password/enable_cloud_password.py b/pyrogram/client/methods/password/enable_cloud_password.py index 4eb8df6a..f5a71f4b 100644 --- a/pyrogram/client/methods/password/enable_cloud_password.py +++ b/pyrogram/client/methods/password/enable_cloud_password.py @@ -16,10 +16,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -import os -from hashlib import sha256 - -from pyrogram.api import functions, types from ...ext import BaseClient @@ -48,22 +44,24 @@ class EnableCloudPassword(BaseClient): Raises: :class:`Error ` in case of a Telegram RPC error. """ - r = self.send(functions.account.GetPassword()) + raise NotImplementedError - if isinstance(r, types.account.NoPassword): - salt = r.new_salt + os.urandom(8) - password_hash = sha256(salt + password.encode() + salt).digest() - - return self.send( - functions.account.UpdatePasswordSettings( - current_password_hash=salt, - new_settings=types.account.PasswordInputSettings( - new_salt=salt, - new_password_hash=password_hash, - hint=hint, - email=email - ) - ) - ) - else: - return False + # r = self.send(functions.account.GetPassword()) + # + # if isinstance(r, types.account.NoPassword): + # salt = r.new_salt + os.urandom(8) + # password_hash = sha256(salt + password.encode() + salt).digest() + # + # return self.send( + # functions.account.UpdatePasswordSettings( + # current_password_hash=salt, + # new_settings=types.account.PasswordInputSettings( + # new_salt=salt, + # new_password_hash=password_hash, + # hint=hint, + # email=email + # ) + # ) + # ) + # else: + # return False diff --git a/pyrogram/client/methods/password/remove_cloud_password.py b/pyrogram/client/methods/password/remove_cloud_password.py index 3dab720d..92ae666d 100644 --- a/pyrogram/client/methods/password/remove_cloud_password.py +++ b/pyrogram/client/methods/password/remove_cloud_password.py @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with Pyrogram. If not, see . -from hashlib import sha256 - -from pyrogram.api import functions, types from ...ext import BaseClient @@ -37,20 +34,22 @@ class RemoveCloudPassword(BaseClient): Raises: :class:`Error ` in case of a Telegram RPC error. """ - r = self.send(functions.account.GetPassword()) + raise NotImplementedError - if isinstance(r, types.account.Password): - password_hash = sha256(r.current_salt + password.encode() + r.current_salt).digest() - - return self.send( - functions.account.UpdatePasswordSettings( - current_password_hash=password_hash, - new_settings=types.account.PasswordInputSettings( - new_salt=b"", - new_password_hash=b"", - hint="" - ) - ) - ) - else: - return False + # r = self.send(functions.account.GetPassword()) + # + # if isinstance(r, types.account.Password): + # password_hash = sha256(r.current_salt + password.encode() + r.current_salt).digest() + # + # return self.send( + # functions.account.UpdatePasswordSettings( + # current_password_hash=password_hash, + # new_settings=types.account.PasswordInputSettings( + # new_salt=b"", + # new_password_hash=b"", + # hint="" + # ) + # ) + # ) + # else: + # return False