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:
  • instanceMultiFactorAuth instance to use.
  • challenge_type – Challenge type being used for this object.
Raises:

AssertionError – If challenge_type is not a supported challenge type.

generate_challenge()[source]

Generates and executes the challenge object based on the challenge type of this object.

deux.services.generate_key()[source]

Generates a key used for secret keys.

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 the drift.

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 the mfa_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.