Repository navigation
feat(cli): decrypt BLE packets in the cloud with ble decode - #58
Closed
buckleypaul wants to merge 1 commit into
Closed
buckleypaul wants to merge 1 commit into
buckleypaul wants to merge 1 commit into
Conversation
Adds synchronous cloud decryption, so nearby packets can be attributed
to devices without holding their keys.
- cloud.decode_packets: one POST /org/{id}/packets/decode call of up to
25 advertisements. A 403 names the missing read-packets scope.
- Organization.decode_packets: takes any number of AES-CTR/AES-EAX
packets, dedupes identical advertisements, batches them, and returns
results aligned to the input (None where the cloud could not decrypt).
Packets outside the endpoint's 72h/2h window are answered None locally,
since one invalid item fails the whole batch. Also adds get_device().
- AesEaxPacket.raw keeps the service data byte for byte, as the endpoint
needs it.
- errors: HTTP 403/404/429 map to PermissionDeniedError, NotFoundError
and RateLimitError; raise_for_response clips oversized error bodies.
- ble decode: scans and streams cloud-decrypted rows, flushing every 25
packets or 2s and remembering each distinct advertisement's answer.
- ble validate: needs only --device-id. It passes when the cloud decodes
a nearby packet as that device, instead of polling retrieve_packets;
--key adds an informational local decrypt check.
- CLI cleanup: one _org_or_fail() helper for building the Organization,
and the decode table printer reuses _StreamingTablePrinter.
tests/fake_packets.py builds correctly encrypted CTR and EAX
advertisements for the new tests.
Contributor
|
Now integrated into #57; can be closed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds synchronous cloud decryption, so nearby packets can be attributed to devices without holding their keys.
cloud.decode_packets: onePOST /org/{id}/packets/decodecall of up to 25 advertisements. A 403 names the missingread-packetsscope.Organization.decode_packets: takes any number of AES-CTR/AES-EAX packets, dedupes identical advertisements, batches them, and returns results aligned to the input (Nonewhere the cloud could not decrypt). Packets outside the endpoint's 72h/2h window are answeredNonelocally, since one invalid item fails the whole batch. Also addsget_device().AesEaxPacket.rawkeeps the service data byte for byte, as the endpoint needs it.PermissionDeniedError,NotFoundErrorandRateLimitError;raise_for_responseclips oversized error bodies.ble decode: scans and streams cloud-decrypted rows, flushing every 25 packets or 2s and remembering each distinct advertisement's answer.ble validate: needs only--device-id. It passes when the cloud decodes a nearby packet as that device, instead of pollingretrieve_packets;--keyadds an informational local decrypt check._org_or_fail()helper for building theOrganization, and the decode table printer reuses_StreamingTablePrinter.tests/fake_packets.pybuilds correctly encrypted CTR and EAX advertisements for the new tests.Test plan
pytestruff check srchubblenetwork ble decode --timeout 30against real deviceshubblenetwork ble validate --device-id <id>against a nearby device