PHP 클래스 PHPGangsta_GoogleAuthenticator

저자: Michael Kliewe
파일 보기 프로젝트 열기: phpgangsta/googleauthenticator 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_codeLength

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
_base32Decode ( $secret ) : boolean | string Helper class to decode base32.
_getBase32LookupTable ( ) : array Get array with all 32 characters for decoding from/encoding to base32.

비공개 메소드들

메소드 설명
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.

메소드 상세

_base32Decode() 보호된 메소드

Helper class to decode base32.
protected _base32Decode ( $secret ) : boolean | string
$secret
리턴 boolean | string

_getBase32LookupTable() 보호된 메소드

Get array with all 32 characters for decoding from/encoding to base32.
protected _getBase32LookupTable ( ) : array
리턴 array

createSecret() 공개 메소드

16 characters, randomly chosen from the allowed base32 characters.
public createSecret ( integer $secretLength = 16 ) : string
$secretLength integer
리턴 string

getCode() 공개 메소드

Calculate the code, with given secret and point in time.
public getCode ( string $secret, integer | null $timeSlice = null ) : string
$secret string
$timeSlice integer | null
리턴 string

getQRCodeGoogleUrl() 공개 메소드

Get QR-Code URL for image, from google charts.
public getQRCodeGoogleUrl ( string $name, string $secret, string $title = null, array $params = [] ) : string
$name string
$secret string
$title string
$params array
리턴 string

setCodeLength() 공개 메소드

Set the code length, should be >=6.
public setCodeLength ( integer $length ) : PHPGangsta_GoogleAuthenticator
$length integer
리턴 PHPGangsta_GoogleAuthenticator

verifyCode() 공개 메소드

Check if the code is correct. This will accept codes starting from $discrepancy*30sec ago to $discrepancy*30sec from now.
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()
리턴 boolean

프로퍼티 상세

$_codeLength 보호되어 있는 프로퍼티

protected $_codeLength