reports: Add LocationReport.key property for decrypted reports

This commit is contained in:
Mike A.
2024-07-21 21:22:30 +02:00
parent 03f00ee4a0
commit 9fb517b32f

View File

@@ -47,6 +47,16 @@ class LocationReport(HasHashedPublicKey):
"""See `HasHashedPublicKey.hashed_adv_key_bytes`."""
return self._hashed_adv_key
@property
def key(self) -> KeyPair:
"""`KeyPair` using which this report was decrypted."""
if not self.is_decrypted:
msg = "Full key is unavailable while the report is encrypted."
raise RuntimeError(msg)
assert self._decrypted_data is not None
return self._decrypted_data[0]
@property
def payload(self) -> bytes:
"""Full (partially encrypted) payload of the report, as retrieved from Apple."""