diff --git a/proton/keyring_linux/core/keyring_linux.py b/proton/keyring_linux/core/keyring_linux.py
index b162010..1ddef4d 100644
--- a/proton/keyring_linux/core/keyring_linux.py
+++ b/proton/keyring_linux/core/keyring_linux.py
@@ -24,6 +24,7 @@
along with ProtonVPN. If not, see .
"""
import json
+import base64
import logging
import keyring
@@ -65,7 +66,7 @@ def _get_item(self, key):
raise KeyError(key)
try:
- return json.loads(stored_data)
+ return json.loads(base64.b64decode(stored_data).decode("utf-8"))
except json.JSONDecodeError as excp:
# Delete data (it's invalid anyway)
self._del_item(key)
@@ -82,7 +83,8 @@ def _del_item(self, key):
raise KeyringError(excp) from excp
def _set_item(self, key, value):
- json_data = json.dumps(value)
+ value = json.dumps(value)
+ json_data = base64.b64encode(value.encode("utf-8")).decode("utf-8")
try:
self.__keyring_backend.set_password(
self.KEYRING_SERVICE,
diff --git a/proton/keyring_linux/secretservice/secretservice_backend.py b/proton/keyring_linux/secretservice/secretservice_backend.py
index 3a9bac1..2f5fa98 100644
--- a/proton/keyring_linux/secretservice/secretservice_backend.py
+++ b/proton/keyring_linux/secretservice/secretservice_backend.py
@@ -19,6 +19,7 @@
along with ProtonVPN. If not, see .
"""
import json
+import base64
import logging
import keyring
@@ -70,7 +71,7 @@ def _get_item(self, key):
raise KeyError(key)
try:
- return json.loads(stored_data)
+ return json.loads(base64.b64decode(stored_data).decode("utf-8"))
except json.JSONDecodeError:
# gnome-keyring has a bug when processing new lines.
# Anytime we store the data to the keyring, we store all newlines in