We have a two-part login and registration process: first the identity service, then the authoritative keyserver.
Ideally, if the first part succeeds but the second part fails, we could cache the success of the first part, and recompute it if inputs change. But I scoped that work and determined we didn't have the cycles for it right now.
An easier, more immediate solution is to simply reset the state between attempts. We'll attempt to reset the state in two places:
- On the identity service we'll delete the CSAT, and in the case of registration delete the newly-created user entirely.
- On the client we'll unset the currentUserInfo through either an identityLogOut or deleteDiscardedIdentityAccount action, which will result in clearSensitiveData being called due to the user ID no longer matching the one stamped on the SQLite DB.
Note – would normally put @tomek and @inka on this review, but since they're out for the rest of this week, I'm asking @varun to review.