authenticateIfNeeded method
Authenticates accounts on a relay if we have a stored challenge. Call this when creating a new subscription with authenticateAs.
Implementation
void authenticateIfNeeded(String relayUrl, List<Account> accounts) {
final challenge = _lastChallengePerRelay[relayUrl];
if (challenge == null) {
Logger.log.t("No stored challenge for $relayUrl, skipping late auth");
return;
}
final relayConnectivity = globalState.relays[relayUrl];
if (relayConnectivity == null) {
Logger.log.w("Relay $relayUrl not found for late auth");
return;
}
Logger.log.d(
"Late AUTH for ${accounts.length} accounts on $relayUrl");
_authenticateAccounts(relayConnectivity, challenge, accounts.toSet());
}