Client Identity
Language
- Go.
Runtime Context
- Client local host identity detection and persistence.
Purpose
- Detects primary MAC/IP identity, generates device names, persists server-assigned runtime credentials, and loads those credentials for polling.
Key Files
packages/client/internal/identity/types.gopackages/client/internal/identity/detect.gopackages/client/internal/identity/store.gopackages/client/internal/identity/detect_test.gopackages/client/internal/identity/store_test.gopackages/client/cmd/nixstasis/register.gopackages/client/cmd/nixstasis/poll.gopackages/client/internal/config/config.go
Public Interfaces
- Types:
DeviceIdentityCredentialsStore
- Functions and methods:
GetPrimaryMACGetPrimaryIPGenerateDeviceNameNewStore(*Store).Load(*Store).LoadUUID(*Store).Save(*Store).SaveUUIDconfig.IdentityPath
Dependencies
Internal
internal/configinternal/transport
External
- Go standard library networking and filesystem APIs.
Client-Server Interaction Details
registerdetects MAC/IP and sends identity data toPOST /api/v1/devices/register.- Approved registration responses include an API token. The client stores UUID
and token together as JSON at
config.IdentityPath()with owner-only file permissions. - Legacy identity files that contain only a UUID are still readable, but runtime heartbeat, command-result, and command-payload requests require the stored API token once the device is approved.
pollloads stored credentials from/etc/nixstasis/idviaconfig.IdentityPath()before sending heartbeat requests.
Traceable references:
packages/client/cmd/nixstasis/register.go:28-93packages/client/cmd/nixstasis/poll.go:38-47packages/client/internal/identity/store.go:18-157packages/client/internal/config/config.go:116-119