ScreenPy PyOTP: A ScreenPy Extension¶
Not sure what ScreenPy is? Check out ScreenPy’s documentation first!
screenpy_pyotp
extends ScreenPy
by providing an Ability
which interacts with PyOTP.
This enables your Actors
to AuthenticateWith2FA
!
Currently, that’s all this extension does. It is expected that other extensions will make use of this ability in their own actions.
Extended API¶
screenpy_pyotp
provides an Ability.
Just an Ability.
But!
That ability can be used
by other extensions
to enable authenticating
through two-factor authentication tools.
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.