Skip to content

Feature/packet generation#32

Open
buckleypaul wants to merge 4 commits into
mainfrom
feature/packet-generation
Open

Feature/packet generation#32
buckleypaul wants to merge 4 commits into
mainfrom
feature/packet-generation

Conversation

@buckleypaul
Copy link
Copy Markdown
Collaborator

No description provided.

Add the ability to generate AES-CTR (v0) and AES-EAX (v2) Hubble BLE
advertisement packets locally from a key and payload — the inverse of the
existing decrypt path. Generated packets can optionally be posted to the
Hubble Cloud or printed as raw bytes for matching against hardware emissions.

SDK:
- encrypt(key, payload, *, time_counter, seq_no, counter_mode) — AES-CTR
- encrypt_eax(key, payload, *, counter, nonce_salt, period_exponent) — AES-EAX
- Both return EncryptedPacket so org.ingest_packet works for either protocol.
- _generate_ctr_eid helper mirrors firmware hubble_internal_device_id_get.
- EAX EID derivation matches decrypt_eax exactly (key_0 from counter=0) to
  guarantee byte-for-byte round-trip even at high effective counters.

CLI: hubblenetwork ble generate
- Flags: --key, --payload(/format), --counter-mode, --counter, --seq-no,
  --nonce-salt, --period-exponent, --ingest, --format breakdown|hex|json
- Dispatches by key length (32 → CTR, 16 → EAX) with mutually-exclusive
  flag validation per protocol.
- Three output formats: structured breakdown (default), raw hex, and JSON.

Tests: 44 new tests covering round-trip via decrypt/decrypt_eax, validation
paths, header layout, EID embedding, format dispatch, and the --ingest path
(with mocked Organization).

Spec: docs/superpowers/specs/2026-04-30-packet-generation-design.md
Plan: docs/superpowers/plans/2026-04-30-packet-generation.md
@buckleypaul buckleypaul force-pushed the feature/packet-generation branch from 0e4b73c to feb24f8 Compare April 30, 2026 23:13
The b"int-uptime-" prefix (11 bytes) plus 4 random bytes produced a
15-byte payload, exceeding MAX_CTR_PAYLOAD. Shortened to b"int-up-".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant