pyhubblenetwork 0.10.1__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/PKG-INFO +67 -2
  2. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/README.md +66 -1
  3. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/pyproject.toml +1 -1
  4. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/__init__.py +2 -1
  5. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/cli.py +221 -164
  6. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/crypto.py +63 -6
  7. pyhubblenetwork-0.12.0/src/hubblenetwork/detect.py +196 -0
  8. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/packets.py +3 -0
  9. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/sat.py +59 -0
  10. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_aes_eax.py +15 -0
  11. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_ble_validate.py +3 -104
  12. pyhubblenetwork-0.12.0/tests/test_detect.py +349 -0
  13. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_sat.py +80 -1
  14. pyhubblenetwork-0.12.0/tests/test_sat_decrypt.py +408 -0
  15. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_unencrypted.py +53 -0
  16. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/.gitignore +0 -0
  17. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/LICENSE +0 -0
  18. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/plugins/pyhubblenetwork/skills/hubble-ready-test/README.md +0 -0
  19. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/ble.py +0 -0
  20. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/cloud.py +0 -0
  21. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/device.py +0 -0
  22. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/errors.py +0 -0
  23. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/org.py +0 -0
  24. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/src/hubblenetwork/ready.py +0 -0
  25. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/__init__.py +0 -0
  26. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/conftest.py +0 -0
  27. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_cli_ctr_autodetect.py +0 -0
  28. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_cli_payload.py +0 -0
  29. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_cloud_integration.py +0 -0
  30. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_counter_eid.py +0 -0
  31. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_metrics.py +0 -0
  32. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_org_delete_device.py +0 -0
  33. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_register_device_cloud.py +0 -0
  34. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_register_device_validation.py +0 -0
  35. {pyhubblenetwork-0.10.1 → pyhubblenetwork-0.12.0}/tests/test_sat_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyhubblenetwork
3
- Version: 0.10.1
3
+ Version: 0.12.0
4
4
  Summary: Hubble SDK host-side tools
5
5
  Author-email: Paul Buckley <paul@hubble.com>
6
6
  License-Expression: Apache-2.0
@@ -37,6 +37,7 @@ Description-Content-Type: text/markdown
37
37
  - [Installation](#installation)
38
38
  - [Quick start](#quick-start)
39
39
  - [CLI usage](#cli-usage)
40
+ - [Validating a device end-to-end](#validating-a-device-end-to-end)
40
41
  - [Satellite scanning (PlutoSDR)](#satellite-scanning-plutosdr)
41
42
  - [Configuration](#configuration)
42
43
  - [Public API (summary)](#public-api-summary)
@@ -179,6 +180,46 @@ Commands that output packet data (`ble scan`, `ble detect`, `org get-packets`) s
179
180
 
180
181
  This applies to all output formats (tabular, json, csv).
181
182
 
183
+ ## Validating a device end-to-end
184
+
185
+ The `ble validate` command runs a full end-to-end health check on a single Hubble
186
+ device, confirming that everything from your credentials to the cloud backend is
187
+ wired up correctly. It is the quickest way to answer "is my device working?"
188
+
189
+ ```bash
190
+ hubblenetwork ble validate \
191
+ --key "a562a2f7e4c62bed52ab09633878f62b" \
192
+ --device-id "3f4b2c0c-2d43-4cbe-9c1f-0a4c2d59e2a1"
193
+ ```
194
+
195
+ The command performs these steps in order, stopping at the first failure:
196
+
197
+ 1. **Validates input formats** — the device key (hex or base64, 16- or 32-byte)
198
+ and the device ID (standard 8-4-4-4-12 UUID).
199
+ 2. **Loads credentials** — from `--org-id`/`--token` or the `HUBBLE_ORG_ID` and
200
+ `HUBBLE_API_TOKEN` environment variables.
201
+ 3. **Validates the organization credentials** against the backend.
202
+ 4. **Confirms the device is registered** in your organization.
203
+ 5. **Scans for BLE advertisements** from Hubble-compatible devices.
204
+ 6. **Decrypts a received packet** with the provided key and reports the detected
205
+ EID type (`UNIX_TIME` or `DEVICE_UPTIME`).
206
+ 7. **Ingests the packet** into the backend and **reads it back** to confirm the
207
+ full round trip succeeded.
208
+
209
+ ### Options
210
+
211
+ | Option | Description |
212
+ |--------|-------------|
213
+ | `--key`, `-k` | Device key, used to test packet encryption (required). Accepts hex or base64, 16- or 32-byte. |
214
+ | `--device-id`, `-d` | Device UUID, used to test the backend (required). |
215
+ | `--org-id` | Organization ID (defaults to the `HUBBLE_ORG_ID` env var). |
216
+ | `--token` | API token (defaults to the `HUBBLE_API_TOKEN` env var). |
217
+ | `--timeout`, `-t` | BLE scan timeout in seconds (default: 30). |
218
+
219
+ If a step fails, the command prints targeted debugging tips. A common cause of a
220
+ failed scan is a slow advertising interval combined with OS-level BLE scan
221
+ optimizations — simply running the command again often resolves it.
222
+
182
223
  ## Satellite scanning (PlutoSDR)
183
224
 
184
225
  The `sat` command group receives packets via a PlutoSDR SDR dongle. It runs a Docker container ([`ghcr.io/hubblenetwork/sdr-docker`](https://ghcr.io/hubblenetwork/sdr-docker)) that handles RF reception and decoding, then polls that container's HTTP API and streams decoded packets to stdout.
@@ -205,8 +246,20 @@ hubblenetwork sat scan -o json
205
246
 
206
247
  # Combine options
207
248
  hubblenetwork sat scan -o json --timeout 60 -n 20
249
+
250
+ # Decrypt payloads locally with a device key (hex or base64, 16 or 32 bytes)
251
+ hubblenetwork sat scan --key "a562a2f7e4c62bed52ab09633878f62b"
252
+
253
+ # Show packets the key can't decrypt too (adds a DECRYPT OK/FAIL column)
254
+ hubblenetwork sat scan --key "<key>" --show-failed-decryption
208
255
  ```
209
256
 
257
+ When `--key` is supplied, each packet's payload is decrypted locally using the
258
+ same AES-CTR scheme as BLE. Satellite packets always use the UNIX_TIME (day-based)
259
+ counter; `--days` controls how many days around each packet's timestamp are
260
+ searched (default 2). Packets the key cannot decrypt are hidden unless
261
+ `--show-failed-decryption` is given.
262
+
210
263
  The command automatically:
211
264
  1. Verifies Docker is available
212
265
  2. Pulls the latest PlutoSDR image (if not cached)
@@ -226,9 +279,21 @@ for pkt in sat.scan(timeout=60.0, poll_interval=2.0):
226
279
 
227
280
  # Or fetch the current packet buffer without managing the container yourself
228
281
  packets: list[SatellitePacket] = sat.fetch_packets()
282
+
283
+ # Decrypt a packet's payload locally (UNIX_TIME counter)
284
+ from hubblenetwork import decrypt_satellite
285
+
286
+ for pkt in sat.scan(timeout=60.0):
287
+ if pkt.auth_tag is not None:
288
+ plaintext = decrypt_satellite(
289
+ key, seq_no=pkt.seq_num, auth_tag=pkt.auth_tag,
290
+ encrypted_payload=pkt.payload, timestamp=pkt.timestamp,
291
+ )
292
+ if plaintext is not None:
293
+ print(pkt.device_id, plaintext)
229
294
  ```
230
295
 
231
- `SatellitePacket` fields: `device_id`, `seq_num`, `device_type`, `timestamp`, `rssi_dB`, `channel_num`, `freq_offset_hz`, `payload` (bytes).
296
+ `SatellitePacket` fields: `device_id`, `seq_num`, `device_type`, `timestamp`, `rssi_dB`, `channel_num`, `freq_offset_hz`, `payload` (bytes), `auth_tag` (bytes or `None`).
232
297
 
233
298
  ### Errors
234
299
 
@@ -14,6 +14,7 @@
14
14
  - [Installation](#installation)
15
15
  - [Quick start](#quick-start)
16
16
  - [CLI usage](#cli-usage)
17
+ - [Validating a device end-to-end](#validating-a-device-end-to-end)
17
18
  - [Satellite scanning (PlutoSDR)](#satellite-scanning-plutosdr)
18
19
  - [Configuration](#configuration)
19
20
  - [Public API (summary)](#public-api-summary)
@@ -156,6 +157,46 @@ Commands that output packet data (`ble scan`, `ble detect`, `org get-packets`) s
156
157
 
157
158
  This applies to all output formats (tabular, json, csv).
158
159
 
160
+ ## Validating a device end-to-end
161
+
162
+ The `ble validate` command runs a full end-to-end health check on a single Hubble
163
+ device, confirming that everything from your credentials to the cloud backend is
164
+ wired up correctly. It is the quickest way to answer "is my device working?"
165
+
166
+ ```bash
167
+ hubblenetwork ble validate \
168
+ --key "a562a2f7e4c62bed52ab09633878f62b" \
169
+ --device-id "3f4b2c0c-2d43-4cbe-9c1f-0a4c2d59e2a1"
170
+ ```
171
+
172
+ The command performs these steps in order, stopping at the first failure:
173
+
174
+ 1. **Validates input formats** — the device key (hex or base64, 16- or 32-byte)
175
+ and the device ID (standard 8-4-4-4-12 UUID).
176
+ 2. **Loads credentials** — from `--org-id`/`--token` or the `HUBBLE_ORG_ID` and
177
+ `HUBBLE_API_TOKEN` environment variables.
178
+ 3. **Validates the organization credentials** against the backend.
179
+ 4. **Confirms the device is registered** in your organization.
180
+ 5. **Scans for BLE advertisements** from Hubble-compatible devices.
181
+ 6. **Decrypts a received packet** with the provided key and reports the detected
182
+ EID type (`UNIX_TIME` or `DEVICE_UPTIME`).
183
+ 7. **Ingests the packet** into the backend and **reads it back** to confirm the
184
+ full round trip succeeded.
185
+
186
+ ### Options
187
+
188
+ | Option | Description |
189
+ |--------|-------------|
190
+ | `--key`, `-k` | Device key, used to test packet encryption (required). Accepts hex or base64, 16- or 32-byte. |
191
+ | `--device-id`, `-d` | Device UUID, used to test the backend (required). |
192
+ | `--org-id` | Organization ID (defaults to the `HUBBLE_ORG_ID` env var). |
193
+ | `--token` | API token (defaults to the `HUBBLE_API_TOKEN` env var). |
194
+ | `--timeout`, `-t` | BLE scan timeout in seconds (default: 30). |
195
+
196
+ If a step fails, the command prints targeted debugging tips. A common cause of a
197
+ failed scan is a slow advertising interval combined with OS-level BLE scan
198
+ optimizations — simply running the command again often resolves it.
199
+
159
200
  ## Satellite scanning (PlutoSDR)
160
201
 
161
202
  The `sat` command group receives packets via a PlutoSDR SDR dongle. It runs a Docker container ([`ghcr.io/hubblenetwork/sdr-docker`](https://ghcr.io/hubblenetwork/sdr-docker)) that handles RF reception and decoding, then polls that container's HTTP API and streams decoded packets to stdout.
@@ -182,8 +223,20 @@ hubblenetwork sat scan -o json
182
223
 
183
224
  # Combine options
184
225
  hubblenetwork sat scan -o json --timeout 60 -n 20
226
+
227
+ # Decrypt payloads locally with a device key (hex or base64, 16 or 32 bytes)
228
+ hubblenetwork sat scan --key "a562a2f7e4c62bed52ab09633878f62b"
229
+
230
+ # Show packets the key can't decrypt too (adds a DECRYPT OK/FAIL column)
231
+ hubblenetwork sat scan --key "<key>" --show-failed-decryption
185
232
  ```
186
233
 
234
+ When `--key` is supplied, each packet's payload is decrypted locally using the
235
+ same AES-CTR scheme as BLE. Satellite packets always use the UNIX_TIME (day-based)
236
+ counter; `--days` controls how many days around each packet's timestamp are
237
+ searched (default 2). Packets the key cannot decrypt are hidden unless
238
+ `--show-failed-decryption` is given.
239
+
187
240
  The command automatically:
188
241
  1. Verifies Docker is available
189
242
  2. Pulls the latest PlutoSDR image (if not cached)
@@ -203,9 +256,21 @@ for pkt in sat.scan(timeout=60.0, poll_interval=2.0):
203
256
 
204
257
  # Or fetch the current packet buffer without managing the container yourself
205
258
  packets: list[SatellitePacket] = sat.fetch_packets()
259
+
260
+ # Decrypt a packet's payload locally (UNIX_TIME counter)
261
+ from hubblenetwork import decrypt_satellite
262
+
263
+ for pkt in sat.scan(timeout=60.0):
264
+ if pkt.auth_tag is not None:
265
+ plaintext = decrypt_satellite(
266
+ key, seq_no=pkt.seq_num, auth_tag=pkt.auth_tag,
267
+ encrypted_payload=pkt.payload, timestamp=pkt.timestamp,
268
+ )
269
+ if plaintext is not None:
270
+ print(pkt.device_id, plaintext)
206
271
  ```
207
272
 
208
- `SatellitePacket` fields: `device_id`, `seq_num`, `device_type`, `timestamp`, `rssi_dB`, `channel_num`, `freq_offset_hz`, `payload` (bytes).
273
+ `SatellitePacket` fields: `device_id`, `seq_num`, `device_type`, `timestamp`, `rssi_dB`, `channel_num`, `freq_offset_hz`, `payload` (bytes), `auth_tag` (bytes or `None`).
209
274
 
210
275
  ### Errors
211
276
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pyhubblenetwork"
7
- version = "0.10.1"
7
+ version = "0.12.0"
8
8
  requires-python = ">=3.9"
9
9
  authors = [
10
10
  { name="Paul Buckley", email="paul@hubble.com" },
@@ -12,7 +12,7 @@ from . import sat
12
12
  from .packets import Location, EncryptedPacket, UnencryptedPacket, DecryptedPacket, SatellitePacket, AesEaxPacket, UnknownPacket
13
13
  from .device import Device
14
14
  from .org import Organization
15
- from .crypto import decrypt, decrypt_eax, UNIX_TIME, DEVICE_UPTIME
15
+ from .crypto import decrypt, decrypt_eax, decrypt_satellite, UNIX_TIME, DEVICE_UPTIME
16
16
  from .errors import InvalidCredentialsError
17
17
  from .cloud import Credentials, Environment
18
18
 
@@ -23,6 +23,7 @@ __all__ = [
23
23
  "sat",
24
24
  "decrypt",
25
25
  "decrypt_eax",
26
+ "decrypt_satellite",
26
27
  "UNIX_TIME",
27
28
  "DEVICE_UPTIME",
28
29
  "SatellitePacket",