Skip to content

Commit

Permalink
reports: Add LocationReport.key property for decrypted reports
Browse files Browse the repository at this point in the history
  • Loading branch information
malmeloo committed Jul 21, 2024
1 parent 03f00ee commit 9fb517b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions findmy/reports/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ def hashed_adv_key_bytes(self) -> bytes:
"""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."""
Expand Down

0 comments on commit 9fb517b

Please sign in to comment.