athenad: get ES256 key (#36845)

* fix

* why not format

* fix typing

* cast
This commit is contained in:
Shane Smiskol
2025-12-11 18:00:43 -08:00
committed by GitHub
parent c61ed10015
commit edede31c32
3 changed files with 12 additions and 11 deletions
+6 -4
View File
@@ -7,9 +7,10 @@ from openpilot.system.version import get_version
API_HOST = os.getenv('API_HOST', 'https://api.commadotai.com')
# name : jwt signature algorithm
KEYS = {"id_rsa" : "RS256",
"id_ecdsa" : "ES256"}
# name: jwt signature algorithm
KEYS = {"id_rsa": "RS256",
"id_ecdsa": "ES256"}
class Api:
def __init__(self, dongle_id):
@@ -50,7 +51,8 @@ def api_get(endpoint, method='GET', timeout=None, access_token=None, **params):
return requests.request(method, API_HOST + "/" + endpoint, timeout=timeout, headers=headers, params=params)
def get_key_pair():
def get_key_pair() -> tuple[str, str, str] | tuple[None, None, None]:
for key in KEYS:
if os.path.isfile(Paths.persist_root() + f'/comma/{key}') and os.path.isfile(Paths.persist_root() + f'/comma/{key}.pub'):
with open(Paths.persist_root() + f'/comma/{key}') as private, open(Paths.persist_root() + f'/comma/{key}.pub') as public: