Class FOFEncryptTotp
	
	
This class provides an RFC6238-compliant Time-based One Time Passwords,
compatible with Google Authenticator (with PassCodeLength = 6 and TimePeriod =
30).
	 
	
		Methods summary
		
		
			| 
				 public 
				
				
				 | 
			#
			__construct( integer $timeStep = 30, integer $passCodeLength = 6, integer $secretLength = 10, Object $base32 = null )
				
Initialises an RFC6238-compatible TOTP generator. Please note that this class
does not implement the constraint in the last paragraph of §5.2 of RFC6238.
It's up to you to ensure that the same user/device does not retry validation
within the same Time Step. 
				
Initialises an RFC6238-compatible TOTP generator. Please note that this class
does not implement the constraint in the last paragraph of §5.2 of RFC6238.
It's up to you to ensure that the same user/device does not retry validation
within the same Time Step. Parameters
						$timeStepinteger- $timeStep The Time Step (in seconds). Use 30 to be compatible with Google
Authenticator.$passCodeLengthinteger- $passCodeLength The generated passcode length. Default: 6 digits.$secretLengthinteger- $secretLength The length of the secret key. Default: 10 bytes (80 bits).$base32Object- $base32 The base32 en/decrypter | 
		
			| 
				 public 
				integer
				
				 | 
			#
			getPeriod( integer|null $time = null )
				
Get the time period based on the $time timestamp and the Time Step defined.
If $time is skipped or set to null the current timestamp will be used. 
				
Get the time period based on the $time timestamp and the Time Step defined.
If $time is skipped or set to null the current timestamp will be used. Parameters
						$timeinteger|null- $time TimestampReturns
						integer- The time period since the UNIX Epoch
 | 
		
			| 
				 public 
				boolean
				
				 | 
			#
			checkCode( string $secret, string $code )
				
Check is the given passcode $code is a valid TOTP generated using secret key
$secret 
				
Check is the given passcode $code is a valid TOTP generated using secret key
$secret Parameters
						$secretstring- $secret The Base32-encoded secret key$codestring- $code The passcode to checkReturns
						boolean- True if the code is valid
 | 
		
			| 
				 public 
				string
				
				 | 
			#
			getCode( string $secret, integer $time = null )
				
Gets the TOTP passcode for a given secret key $secret and a given UNIX
timestamp $time 
				
Gets the TOTP passcode for a given secret key $secret and a given UNIX
timestamp $time Parameters
						$secretstring- $secret The Base32-encoded secret key$timeinteger- $time UNIX timestampReturns
						string
 | 
		
			| 
				 protected 
				string
				
				 | 
			#
			hashToInt( string $bytes, string $start )
				
Extracts a part of a hash as an integer 
				
Extracts a part of a hash as an integer Parameters
						$bytesstring- $bytes The hash$startstring- $start The char to start from (0 = first char)Returns
						string
 | 
		
			| 
				 public 
				string
				
				 | 
			#
			getUrl( string $user, string $hostname, string $secret )
				
Returns a QR code URL for easy setup of TOTP apps like Google
Authenticator 
				
Returns a QR code URL for easy setup of TOTP apps like Google
Authenticator Parameters
						$userstring- $user User$hostnamestring- $hostname Hostname$secretstring- $secret Secret stringReturns
						string
 | 
		
			| 
				 public 
				string
				
				 | 
			#
			generateSecret( )
				
Generates a (semi-)random Secret Key for TOTP generation 
				
Generates a (semi-)random Secret Key for TOTP generation Returns
						string
 | 
		
		Magic methods summary