Acquire.Crypto._otp module

class OTP(secret=None)[source]

Bases: object

This class handles everything to do with obtaining and verifying a one-time-password

static decrypt(secret, key)[source]

Construct a OTP from the passed encrypted secret that will be decrypted with the passed private key

encrypt(key)[source]

This uses the passed public key to encrypt and return the secret

static extract_secret(provisioning_uri)[source]

Return the otpsecret extracted from the passed provisioning_url

generate()[source]

Generate and return the current OTP code

provisioning_uri(username, issuer='Acquire')[source]

Return the provisioning URI, assuming this secret is for the user called ‘username’ and is issued by ‘issuer’

secret()[source]

Return the otpsecret for this generator

verify(code, once_only=False)[source]

Verify that the passed code is correct. This raises an exception if the code is incorrect, or does nothing if the code is correct

If ‘once_only’ is True, then this will attempt to store global state to ensure that the passed code can be used only once.