tesla-fleet-api 0.8.2__tar.gz → 0.8.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {tesla_fleet_api-0.8.2/tesla_fleet_api.egg-info → tesla_fleet_api-0.8.3}/PKG-INFO +1 -1
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/setup.py +1 -1
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/const.py +1 -1
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/teslafleetapi.py +10 -5
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/vehiclesigned.py +6 -6
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3/tesla_fleet_api.egg-info}/PKG-INFO +1 -1
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/LICENSE +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/README.md +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/setup.cfg +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/__init__.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/charging.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/energy.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/energyspecific.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/exceptions.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/partner.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/__init__.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/__init__.pyi +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/car_server_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/common_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/errors_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/keys_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/signatures_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/universal_message_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/vcsec_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/vehicle_pb2.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/ratecalculator.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/teslafleetoauth.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/teslafleetopensource.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/teslemetry.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/tessie.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/user.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/vehicle.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/vehiclespecific.py +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api.egg-info/SOURCES.txt +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api.egg-info/dependency_links.txt +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api.egg-info/requires.txt +0 -0
- {tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api.egg-info/top_level.txt +0 -0
@@ -30,7 +30,7 @@ class TeslaFleetApi:
|
|
30
30
|
session: aiohttp.ClientSession
|
31
31
|
headers: dict[str, str]
|
32
32
|
refresh_hook: Awaitable | None = None
|
33
|
-
|
33
|
+
private_key: ec.EllipticCurvePrivateKey | None = None
|
34
34
|
|
35
35
|
def __init__(
|
36
36
|
self,
|
@@ -164,11 +164,11 @@ class TeslaFleetApi:
|
|
164
164
|
async def get_private_key(self, path: str = "private_key.pem") -> ec.EllipticCurvePrivateKey:
|
165
165
|
"""Get or create the private key."""
|
166
166
|
if not exists(path):
|
167
|
-
self.
|
167
|
+
self.private_key = ec.generate_private_key(
|
168
168
|
ec.SECP256R1(), default_backend()
|
169
169
|
)
|
170
170
|
# save the key
|
171
|
-
pem = self.
|
171
|
+
pem = self.private_key.private_bytes(
|
172
172
|
encoding=serialization.Encoding.PEM,
|
173
173
|
format=serialization.PrivateFormat.TraditionalOpenSSL,
|
174
174
|
encryption_algorithm=serialization.NoEncryption(),
|
@@ -189,5 +189,10 @@ class TeslaFleetApi:
|
|
189
189
|
|
190
190
|
if not isinstance(value, ec.EllipticCurvePrivateKey):
|
191
191
|
raise AssertionError("Loaded key is not an EllipticCurvePrivateKey")
|
192
|
-
self.
|
193
|
-
return self.
|
192
|
+
self.private_key = value
|
193
|
+
return self.private_key
|
194
|
+
|
195
|
+
@property
|
196
|
+
def has_private_key(self) -> bool:
|
197
|
+
"""Check if the private key has been set."""
|
198
|
+
return self.private_key is not None
|
@@ -154,7 +154,7 @@ class Session:
|
|
154
154
|
class VehicleSigned(VehicleSpecific):
|
155
155
|
"""Class describing the Tesla Fleet API vehicle endpoints and commands for a specific vehicle with command signing."""
|
156
156
|
|
157
|
-
|
157
|
+
private_key: ec.EllipticCurvePrivateKey
|
158
158
|
_public_key: bytes
|
159
159
|
_from_destination: bytes
|
160
160
|
_sessions: dict[int, Session]
|
@@ -164,13 +164,13 @@ class VehicleSigned(VehicleSpecific):
|
|
164
164
|
):
|
165
165
|
super().__init__(parent, vin)
|
166
166
|
if key:
|
167
|
-
self.
|
168
|
-
elif parent._parent.
|
169
|
-
self.
|
167
|
+
self.private_key = key
|
168
|
+
elif parent._parent.private_key:
|
169
|
+
self.private_key = parent._parent.private_key
|
170
170
|
else:
|
171
171
|
raise ValueError("No private key.")
|
172
172
|
|
173
|
-
self._public_key = self.
|
173
|
+
self._public_key = self.private_key.public_key().public_bytes(
|
174
174
|
encoding=Encoding.X962, format=PublicFormat.UncompressedPoint
|
175
175
|
)
|
176
176
|
self._from_destination = randbytes(16)
|
@@ -200,7 +200,7 @@ class VehicleSigned(VehicleSpecific):
|
|
200
200
|
vehicle_public_key = info.publicKey
|
201
201
|
|
202
202
|
# Derive shared key from private key _key and vehicle public key
|
203
|
-
shared = self.
|
203
|
+
shared = self.private_key.exchange(
|
204
204
|
ec.ECDH(),
|
205
205
|
ec.EllipticCurvePublicKey.from_encoded_point(
|
206
206
|
ec.SECP256R1(), vehicle_public_key
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api/pb2/universal_message_pb2.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{tesla_fleet_api-0.8.2 → tesla_fleet_api-0.8.3}/tesla_fleet_api.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|