Method |
Description |
|
__construct ( integer $timeStep = 30, integer $passCodeLength = 6, integer $secretLength = 10, Base32 $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. |
|
checkCode ( string $secret, string $code, integer $time = null ) : boolean |
Check is the given passcode $code is a valid TOTP generated using secret
key $secret |
|
generateSecret ( ) : string |
Generates a (semi-)random Secret Key for TOTP generation |
|
getCode ( string $secret, integer $time = null ) : string |
Gets the TOTP passcode for a given secret key $secret and a given UNIX
timestamp $time |
|
getPeriod ( integer | null $time = null ) : integer |
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. |
|
getUrl ( string $user, string $hostname, string $secret ) : string |
Returns a QR code URL for easy setup of TOTP apps like Google Authenticator |
|