(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
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. It is allowed only when:
- 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.