deux.services¶
-
class
deux.services.
MultiFactorChallenge
(instance, challenge_type)[source]¶ A class that represents a supported challenge and has the ability to execute the challenge.
Parameters: - instance –
MultiFactorAuth
instance to use. - challenge_type – Challenge type being used for this object.
Raises: AssertionError – If
challenge_type
is not a supported challenge type.- instance –
-
deux.services.
generate_mfa_code
(bin_key, drift=0)[source]¶ Generates an MFA code based on the
bin_key
for the current timestamp offset by thedrift
.Parameters: - bin_key – The secret key to be converted into an MFA code
- drift – Number of time steps to shift the conversion.
-
deux.services.
verify_mfa_code
(bin_key, mfa_code)[source]¶ Verifies that the inputted
mfa_code
is a valid code for the given secret key. We check themfa_code
against the current time stamp as well as one time step before and after.Parameters: - bin_key – The secret key to verify the MFA code again.
- mfa_code – The code whose validity this function tests.