Skip to content

feat(cli): register-device --claim mints a device claim and reports its claim_id - #54

Open
solidspark wants to merge 1 commit into
mainfrom
feat/register-device-claim
Open

solidspark wants to merge 1 commit into
mainfrom
feat/register-device-claim

Conversation

@solidspark

Copy link
Copy Markdown
Collaborator

Summary

  • hubblenetwork org register-device --claim sends device_claims: [{"new_claim_using_device_id": true}] on the provision request and prints the resulting claim_id.
  • --claim-destination-org <uuid> pins the minted claim's destination; using it without --claim is a usage error.
  • SDK: Organization.register_device(claim=True, claim_destination_org_id=...); Device gains a claim_id field.
  • A 403 for the missing can_create_device_claims entitlement is surfaced as Error: entitlement requirements not met (exit 1) instead of an "Unexpected error".

Note

The platform-api provision response never echoes a claim id. In new_claim_using_device_id mode the cloud names the claim after the device, so Device.claim_id is set to the device id client-side.

Test plan

  • New tests in tests/test_cli_register_device_claim.py, tests/test_register_device_cloud.py, tests/test_register_device_validation.py
  • pytest -m "not integration and not ble" — 671 passed
  • ruff check src clean

🤖 Generated with Claude Code

…ts claim_id

The provision endpoint accepts device_claims but never echoes a claim id
back; with new_claim_using_device_id the claim is named after the device, so
Device.claim_id is filled client-side. A 403 from the missing
can_create_device_claims entitlement is surfaced as
'entitlement requirements not met' rather than an unexpected error.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@solidspark
solidspark force-pushed the feat/register-device-claim branch from 1e2f36d to 70fd4ac Compare September 9, 2026 22:48
@buckleypaul

Copy link
Copy Markdown
Collaborator

IMO it makes more sense to have a new command for this rather than a flag given the different paths and intents as well as the expansion of what can be done with this.

Example potential set that matches the functionality of the backend:

hubblenetwork claim create      [-n <count>] [--destination-org <uuid>] [--token <token>]
                                [--encryption ...] [--counter-source ...] [-o table|json|csv]
hubblenetwork claim add-devices <id> -n <count> [--encryption ...] [-o ...]
hubblenetwork claim link        <id> <device-id>...
hubblenetwork claim unlink      <device-id>...

hubblenetwork claim list        [--outgoing|--incoming] [--status <s>] [-n <limit>] [-o ...]
hubblenetwork claim show        <id> [--token]

hubblenetwork claim redeem      <id> [--token] [--wait/--no-wait] [--timeout <s>]

hubblenetwork claim set         <id> [--destination-org <uuid>|--clear-destination] [--token <t>]
hubblenetwork claim delete      <id>

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.

2 participants