mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +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,
|
'time_offset': self.time_offset,
|
||||||
'server_address': self.server_address,
|
'server_address': self.server_address,
|
||||||
'auth_key_data':
|
'auth_key_data':
|
||||||
b64encode(self.auth_key.key).decode('ascii')
|
b64encode(self.auth_key.key).decode('ascii')\
|
||||||
|
if self.auth_key else None
|
||||||
}, file)
|
}, file)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
|
@ -160,8 +161,9 @@ class JsonSession:
|
||||||
# FIXME We need to import the AuthKey here or otherwise
|
# FIXME We need to import the AuthKey here or otherwise
|
||||||
# we get cyclic dependencies.
|
# we get cyclic dependencies.
|
||||||
from ..crypto import AuthKey
|
from ..crypto import AuthKey
|
||||||
key = b64decode(data['auth_key_data'])
|
if data['auth_key_data'] is not None:
|
||||||
result.auth_key = AuthKey(data=key)
|
key = b64decode(data['auth_key_data'])
|
||||||
|
result.auth_key = AuthKey(data=key)
|
||||||
|
|
||||||
except (json.decoder.JSONDecodeError, UnicodeDecodeError):
|
except (json.decoder.JSONDecodeError, UnicodeDecodeError):
|
||||||
# TODO Backwards-compatibility code
|
# TODO Backwards-compatibility code
|
||||||
|
|
Loading…
Reference in New Issue
Block a user