Problem/Motivation
The TfaContext class is an auxiliary class to the TfaLoginForm, and is not used anywhere else in the module. The fact that the module even defines an interface for this internal class, which includes the constructor has even inspired an issue to make it a service (#3291024: Move TfaContext to a factory for overridability, and remove constructor from TfaContextInterface). That was denied, as this class is not mean to be part of the public API of the module.
However, as can be seen by #2930355: Password reset bypasses TFA, there is clearly a case for being able to share the code provided by TfaContext with other classes dealing with alternative ways to login to Drupal. So instead of adding all this code back into the TfaLoginForm, it will be kept as a trait which facilitates code sharing with similar classes. This trait is going to be marked as @internal, to make it clear that it is not part of the module's public API.
Comments
Comment #2
jcnventuraComment #4
jcnventura