[lib][native] Automatically retry keyserverAuth during login/registration
Summary:
This addresses ENG-7661.
When keyserverAuth is called during login or registration, if it fails we want to immediately try again. This is to guard against a situation where we are vended an OTK that is invalid. While we think we've addressed all scenarios where OTKs can be invalid, it's possible that we will introduce some new scenarios in the future, and we've had sporadic reports of this (eg. ENG-7927).
On the other hand, when keyserverAuth is called by KeyserverConnectionHandler for auth with secondary keyservers, or for keyserver session recovery, we'll continue only trying once. For secondary keyserver auth we'll end up retrying after AUTH_RETRY_DELAY_MS anyways. And for keyserver session recovery, the recovery attempt is arguably already the second try.
Note – would normally put @kamil on this review since we came up with the idea together in a 1:1, but since he's out for the rest of this week, I'm asking @varun to review.
Depends on D11847
Test Plan:
- Force keyserver auth to fail with this patch
- Add some logs that get printed inside keyserver auth
- Test new registration flow and confirm that the logs get printed twice, but otherwise that the behavior is the same
Reviewers: varun
Reviewed By: varun
Subscribers: varun, inka, tomek, kamil
Differential Revision: https://phab.comm.dev/D11848