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’

verify(code)[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