feat(client): reloadAuth() wrapper
Some checks failed
Security / Security check (push) Failing after 1s

Studio + pilot apps can now trigger a hub-side TokenStore
swap without restarting the daemon:

  await client.reloadAuth();  // returns new token count

Throws when the new config is invalid; the existing store
stays in place server-side so a botched rotation can't lock
the operator out.

Bindings regenerated for the new
HubAdmin.ReloadAuth + ReloadAuthResponse + LoggedEvent
.caller_name proto additions.

dart analyze clean; dart test green (4 tests).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-29 18:40:20 +02:00
parent 023adcec31
commit db13bdb4a7
5 changed files with 137 additions and 2 deletions

View file

@ -188,6 +188,18 @@ class HubClient {
);
}
/// Re-read `auth.tokens:` from operator config + env vars
/// and atomically swap the hub's live token store. Used by
/// operators to rotate tokens without restarting the daemon.
/// Returns the new token count after the swap. Throws when
/// the new config is invalid; the existing store stays in
/// place in that case so a botched rotation can't lock the
/// operator out.
Future<int> reloadAuth() async {
final r = await _admin.reloadAuth(Empty());
return r.tokenCount;
}
/// Server-streaming audit-log subscription. The hub first
/// replays up to [backfill] historical events (oldest-last so
/// the receiver sees them in chronological order), then keeps