Appearance
Login / pair a device
This step is optional. A local Host works without ever pairing to a HiveCast account. Pair when you want this Device to appear in an account's Devices list, participate in a Space, or be reachable from a browser session signed into a HiveCast platform.
If you're just trying it out locally, skip to Install a package.
Two flavors of the same ceremony
| Form | Best for | Behaviour |
|---|---|---|
hivecast login --device --cloud <url> | Workstation users with a browser | Opens a browser to the cloud's OAuth surface, waits for approval |
hivecast connect <url> | Headless / scripted setups | Non-interactive; takes the cloud URL as a positional argument |
Both produce the same on-disk result: a <MATRIX_HOME>/credentials/hivecast-link.json and a heartbeat to the cloud's /_auth/host-link/heartbeat endpoint.
Browser-pair from a workstation
bash
hivecast login --device \
--cloud https://hivecast.ai \
--route-key alt.stories.ghost-stories.funny \
--home /tmp/matrix-homeWhat happens:
hivecast.mjs:1595-1635(runHiveCastLinkCommand) forwards the args tomx-cli loginwith--hivecastand--wait.mx-cliopens a browser tohttps://hivecast.ai/<route-key>/devices/pair?....- You sign into the HiveCast account in the browser.
- The cloud creates an enrollment, you approve it, the cloud redeems it.
- The local CLI persists the link record into
<MATRIX_HOME>/credentials/hivecast-link.jsonand exits zero.
The --route-key flag pre-claims a public Space-path. Per the v1 alias rules, this is the same as --space-path (target state); use --route-key today.
Headless connect
bash
hivecast connect https://hivecast.ai \
--route-key alt.stories.ghost-stories.funny \
--name "richard-laptop" \
--home /tmp/matrix-homeThe wrapper normalizes the positional URL to --cloud (normalizeConnectArgs in hivecast.mjs:1637-1662), then forwards to mx-cli login. The --device flag is added implicitly. The connect form fits scripted device-fleet enrollment.
Note:
--namesetshostName, the mutable human label. The stable management key (deviceSlug) is allocated bysystem-authfromhostNameonce, then stays put. See Glossary → Host name.
Setup-code form
If the Device is offline / behind a firewall, generate a setup code from the HiveCast Devices page and paste it:
bash
hivecast login --setup-code <code-from-devices-page> \
--cloud https://hivecast.ai \
--home /tmp/matrix-homeThis avoids the browser-pair round trip. Handy for IoT-style enrollments.
Verify the link
bash
hivecast whoami --home /tmp/matrix-homeShould print principal / Space / Device metadata. If "not linked," the pairing didn't complete.
bash
hivecast link-status --home /tmp/matrix-homeMore detailed: cloud reachability, last successful heartbeat, last error if any.
What's now on disk
After successful pairing, three files in <MATRIX_HOME>/credentials/ cooperate:
| File | Created by | Carries |
|---|---|---|
hivecast-install.json | hivecast install | installId (durable per-install) |
hivecast-link.json | hivecast login --device | hostId, hostName, deviceSlug, authorityRoot, principal/Space metadata, per-device NATS credentials |
host.json | hivecast install | local Host config (independent of cloud link) |
See CLI → hivecast login / whoami / logout for what each field means.
Per-device credentials
After pairing, system-auth issues a device-scoped NATS JWT credential to this Device. From WORKSTREAMS/product-launch/HIVECAST-DEVICE-ENROLLMENT-SPEC.md:
device-code and browser-pair exchanges now return device-scoped NATS JWT credentials from
system.auth; setup exchange writes those scoped credentials to the local Device credential files when available.
The principal account seed remains server-side. This Device cannot impersonate other Devices on the same account; revocation is per-Device.
Pairing to your own (non-hivecast.ai) cloud
The --cloud flag accepts any HiveCast-shaped endpoint. For self-hosted setups:
bash
hivecast login --device --cloud https://my-hivecast.example.com --route-key richardFor dev — pairing one local Host to a sibling local Host playing the platform role (per CLAUDE.md):
bash
hivecast login --device --cloud http://127.0.0.1:3100 --route-key dev-pair-testDisconnecting
| Command | Effect |
|---|---|
hivecast logout | Deletes hivecast-link.json locally. Cloud still considers the Device linked until heartbeat goes stale |
hivecast logout --revoke-cloud-link | Revokes the link on the cloud side too |
hivecast logout --all | --revoke-cloud-link PLUS clears hivecast-install.json (regenerates installId on next install) |
See CLI → hivecast login / whoami / logout.
Troubleshooting
If login hangs or errors:
- Check the cloud is reachable:
curl -fsS https://hivecast.ai/healthz - Check
<host-home>/logs/runtimes/RUNTIME-HOST-...-HOST-CONTROL.stderr.logfor heartbeat errors - See Troubleshooting → Device pairing failed
See also
- Cloud Account → Device pairing — full ceremony detail.
- Cloud Account → Security model — what credentials live where.
- CLI → hivecast login / whoami / logout — the wrapper-side reference.
Source:
projects/matrix-3/packages/hivecast/bin/hivecast.mjslines 1595-1635 (runHiveCastLinkCommand) and 1637-1662 (normalizeConnectArgs);WORKSTREAMS/product-launch/HIVECAST-DEVICE-ENROLLMENT-SPEC.md.