Property | Type | Description | |
---|---|---|---|
$_codeLength |
Method | Description | |
---|---|---|
createSecret ( integer $secretLength = 16 ) : string | Create new secret. | |
getCode ( string $secret, integer | null $timeSlice = null ) : string | Calculate the code, with given secret and point in time. | |
getQRCodeGoogleUrl ( string $name, string $secret, string $title = null, array $params = [] ) : string | Get QR-Code URL for image, from google charts. | |
setCodeLength ( integer $length ) : PHPGangsta_GoogleAuthenticator | Set the code length, should be >=6. | |
verifyCode ( string $secret, string $code, integer $discrepancy = 1, integer | null $currentTimeSlice = null ) : boolean | Check if the code is correct. This will accept codes starting from $discrepancy*30sec ago to $discrepancy*30sec from now. |
Method | Description | |
---|---|---|
_base32Decode ( $secret ) : boolean | string | Helper class to decode base32. | |
_getBase32LookupTable ( ) : array | Get array with all 32 characters for decoding from/encoding to base32. |
Method | Description | |
---|---|---|
timingSafeEquals ( string $safeString, string $userString ) : boolean | A timing safe equals comparison more info here: http://blog.ircmaxell.com/2014/11/its-all-about-time.html. |
protected _base32Decode ( $secret ) : boolean | string | ||
$secret | ||
return | boolean | string |
protected _getBase32LookupTable ( ) : array | ||
return | array |
public createSecret ( integer $secretLength = 16 ) : string | ||
$secretLength | integer | |
return | string |
public setCodeLength ( integer $length ) : PHPGangsta_GoogleAuthenticator | ||
$length | integer | |
return | PHPGangsta_GoogleAuthenticator |
public verifyCode ( string $secret, string $code, integer $discrepancy = 1, integer | null $currentTimeSlice = null ) : boolean | ||
$secret | string | |
$code | string | |
$discrepancy | integer | This is the allowed time drift in 30 second units (8 means 4 minutes before or after) |
$currentTimeSlice | integer | null | time slice if we want use other that time() |
return | boolean |