EnsureRemoteAdminSessionUseCase
Ensures a remote-admin session exists for the target node, dispatching a metadata request and awaiting a refreshed passkey if necessary.
Why this exists: the firmware embeds an 8-byte rotating passkey in every admin response and rejects admin traffic lacking a fresh key (firmware/src/modules/AdminModule.cpp:1460-1481). Before this use case the UI silently tunneled the user into a remote-admin screen that immediately failed if no metadata had been requested first.
Concurrency model:
One in-flight ensure per
destNum. Concurrent callers dedupe onto the sameDeferredso a double-tap doesn't blast two metadata requests at the radio.The refresh-flow subscription is established before the metadata request is dispatched to avoid losing the response on the inherently raceful
MutableSharedFlow.The
withTimeoutOrNullis a UX deadline only — late responses still update the durableSessionStatusflow that the UI observes, so a "Timeout" outcome here can self-heal in the chip without re-tapping.