mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 05:19:41 +00:00
Fix Session not being able to save auth_key=None
This commit is contained in:
@@ -123,7 +123,8 @@ class JsonSession:
|
||||
'time_offset': self.time_offset,
|
||||
'server_address': self.server_address,
|
||||
'auth_key_data':
|
||||
b64encode(self.auth_key.key).decode('ascii')
|
||||
b64encode(self.auth_key.key).decode('ascii')\
|
||||
if self.auth_key else None
|
||||
}, file)
|
||||
|
||||
def delete(self):
|
||||
@@ -160,8 +161,9 @@ class JsonSession:
|
||||
# FIXME We need to import the AuthKey here or otherwise
|
||||
# we get cyclic dependencies.
|
||||
from ..crypto import AuthKey
|
||||
key = b64decode(data['auth_key_data'])
|
||||
result.auth_key = AuthKey(data=key)
|
||||
if data['auth_key_data'] is not None:
|
||||
key = b64decode(data['auth_key_data'])
|
||||
result.auth_key = AuthKey(data=key)
|
||||
|
||||
except (json.decoder.JSONDecodeError, UnicodeDecodeError):
|
||||
# TODO Backwards-compatibility code
|
||||
|
Reference in New Issue
Block a user