mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 01:16:35 +03:00
Fix Session not being able to save auth_key=None
This commit is contained in:
parent
d788d30de2
commit
6a043b7371
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user