Auth

A class for generating the codes compatible with the Google Authenticator and similar TOTP clients. NOTE: A lot of the logic from this class has been borrowed from this class: https://www.idontplaydarts.com/wp-content/uploads/2011/07/ga.php_.txt
Methods Summary
public
# __construct( string $initKey = NULL )
Initialize the object and set up the lookup table Optionally the Initialization key
public
# buildLookup( )
Build the base32 lookup table
public
# getRange( )
Get the current "range" value
public
# setRange( int $range )
Set the "range" value
public
# setInitKey( string $key )
Set the initialization key for the object
public
# getInitKey( )
Get the current Initialization key
public
# setLookup( array $lookup )
Set the contents of the internal lookup table
public
# getLookup( )
Get the current lookup data set
public
# getRefresh( )
Get the number of seconds for code refresh currently set
public
# setRefresh( int $seconds )
Set the number of seconds to refresh codes
public
# getCodeLength( )
Get the current length for generated codes
public
# setCodeLength( int $length )
Set the length of the generated codes
public
# validateCode( string $code , string $initKey = NULL, string $timestamp = NULL, int $range = NULL )
Validate the given code
public
# generateOneTime( string $initKey = NULL, string $timestamp = NULL )
Generate a one-time code
public
# generateCode( int $length = 16 )
Generate a code/hash Useful for making Initialization codes
public
# generateTimestamp( )
Generate the timestamp for the calculation
public
# truncateHash( string $hash )
Truncate the given hash down to just what we need
public
# base32_decode( string $hash )
Base32 decoding function
public
# getQrCodeUrl( string $name , string $code )
Returns a URL to QR code for embedding the QR code