(app_id, device). Transitions are validated; invalid transitions throw InvalidStateTransition. The state is persisted alongside device_id so the SDK can resume across app restarts.
States
Allowed transitions
InvalidStateTransition.
Mapping to public API
Persistence
The current state is stored alongsidedevice_id, key alias, platform, registered_at, key_rotated_at, and clock_offset_ms.
Private key bytes are never persisted in app-managed storage — they live only in hardware.
Key invalidation detection (RFC §11.1)
The SDK transitionsregistered → keyInvalid automatically when the OS reports the key is no longer usable.
On detection:
- SDK emits
KeyInvalidatederror. - State transitions to
keyInvalid. - The next
registerDevice(appId)call wipes local state (keyInvalid → unregistered) and starts fresh.
State after resetDeviceIdentity
resetDeviceIdentity(appId) is the one-step path from any state back to unregistered. RFC §9.3 restricts when it’s allowed:
- Server explicitly instructs identity reset (e.g.
DEVICE_REVOKED). - User explicitly requests it (“sign out of all devices”).
- Key invalidation is detected and rotation is impossible.
- The hardware key is deleted (best-effort; on hardware failures the alias is abandoned).
device_idand metadata are cleared.- Next API call requires a full re-registration.
Related
- Registration — happy-path transitions.
- Errors —
KeyInvalidated,InvalidStateTransition, recovery paths. - Signing — only
registeredenables this.