lockdown

abstract suspend fun lockdown(auth: LockdownAuth): AdminResult<Unit>(source)

Provision, unlock, or lock the device's storage lockdown (MESHTASTIC_LOCKDOWN hardened firmware builds only).

The device reports its current state via MeshEvent.LockdownStatusChanged — observe that to decide which LockdownAuth to send and to learn the outcome:

  • Provision / unlock: set LockdownAuth.passphrase (1–32 bytes). On success the device issues a session token bounded by LockdownAuth.boots_remaining (boot-count TTL, 0 = firmware default) and LockdownAuth.valid_until_epoch (absolute wall-clock expiry, 0 = no time limit).

  • Lock now: set LockdownAuth.lock_now = true (ignores the passphrase) to immediately revoke admin authorization and reboot into the locked state.

Local device only. The firmware consumes lockdown_auth inline on the direct phone link (BLE/serial/TCP) and wipes the passphrase from memory before it can reach the mesh/admin routing layer. Calling this on a forNode-scoped instance therefore returns AdminResult.Unauthorized rather than leaking a passphrase onto the mesh.

Fire-and-forget. AdminResult.Success means the request was queued onto the local link, not that the device accepted the passphrase — the device answers with a fresh MeshEvent.LockdownStatusChanged rather than a routing ACK. Returns AdminResult.NodeUnreachable if no session has been established yet.

Since

0.3.0

Parameters

auth

the lockdown command parameters