ServerReGrant typedef

ServerReGrant = Future<ServerConfig?> Function(ServerConfig stale)

Host-provided token re-grant for durable reconnect.

A marketplace server's credential is a short-lived per-user connectionToken baked into ServerConfig.transportConfig accessToken. When a connect attempt fails and the token may be stale, the manager calls this hook with the stale config; the host re-grants a fresh token (silently, via the marketplace session), persists it, and returns the refreshed ServerConfig. Returning null (or an unchanged token) means "no re-grant available" — the original failure surfaces unchanged.

Optional: when no hook is wired, connect/reconnect behave exactly as before (static token or no-auth). Only token-bearing servers whose host supplies a hook are affected — hand-typed URLs, discovered boards (tcp/ble/serial) and no-auth servers are untouched.

Implementation

typedef ServerReGrant = Future<ServerConfig?> Function(ServerConfig stale);