mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 08:04:45 +00:00
On cold boot an AUTH-required kind:10050 DM-inbox relay usually sends its AUTH challenge before the account's own kind:10050 list has been fetched. AuthApprovalPolicy.classify reads the trusted (self-approved) relay set exactly once, so it classifies the user's OWN inbox relay as tier-2 and surfaces a manual `[Once][Always][Never]` banner. Nothing re-evaluates that pending decision when the kind:10050 list finally loads, so the user gets a spurious AUTH prompt for a relay that should have auto-signed. Extract the pending-approval set into a platform-agnostic commons/AuthApprovalRequests (add/resolve/cancelAll) and add autoApproveNowTrusted(): when the DM-inbox set updates, retroactively settle every pending prompt whose relay is now tier-1 with ONCE — sign this session, do not persist (trusted by identity, not an explicit grant). DesktopAuthCoordinator now delegates its pending set to AuthApprovalRequests and exposes onSelfApprovedRelaysChanged(); Main.kt drives it from DesktopAccountRelays.dmRelayList (the account's kind:10050 StateFlow). AuthApprovalRequestsTest reproduces the cold-boot race (red before the fix) and covers the resolve / cancelAll paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>