From ee3e87a6ec19878d56e8f386b20c58e4d9b211b3 Mon Sep 17 00:00:00 2001 From: Dmitrii Morozov Date: Tue, 7 May 2024 17:15:25 +0200 Subject: Modules --- fortnite_client/device_auth.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 fortnite_client/device_auth.py (limited to 'fortnite_client/device_auth.py') diff --git a/fortnite_client/device_auth.py b/fortnite_client/device_auth.py new file mode 100644 index 0000000..4d46918 --- /dev/null +++ b/fortnite_client/device_auth.py @@ -0,0 +1,22 @@ +import json +import os + +__filename__ = 'device-auth.json' + +class DeviceAuth: + + def device_auth_file_exists(self): + return os.path.isfile(__filename__) + + def get_device_auth_details(self): + if os.path.isfile(__filename__): + with open(__filename__, 'r') as fp: + return json.load(fp) + return {} + + def store_device_auth_details(self, email, details): + existing = self.get_device_auth_details() + existing[email] = details + + with open(__filename__, 'w') as fp: + json.dump(existing, fp) \ No newline at end of file -- cgit v1.2.3