Additional Abilities¶
ScreenPy PyOTP adds one additional Ability, which enables Actors to use PyOTP to authenticate with 2-factor authentication.
AuthenticateWith2FA¶
- class AuthenticateWith2FA(otp: pyotp.TOTP)¶
Use PyOTP to enable retrieval of tokens from a two-factor authenticator.
Examples:
Perry = AnActor.named("Perry")who_can( AuthenticateWith2FA.using_secret(2FA_SECRET) ) Perry = AnActor.named("Perry").who_can( AuthenticateWith2FA.using(pyotp_instance) )
- static using_secret(secret: str) AuthenticateWith2FA ¶
Create a TOTP instance with the given secret.
- Args:
- secret: the secret given by the 2FA service. You may need to
decode a QR code to get this secret.
- static using(otp: pyotp.TOTP) AuthenticateWith2FA ¶
Specify an already-created TOTP instance to provide tokens.
- to_get_token() str ¶
Get the current two-factor token to use as a one-time password.