PHP 클래스 Google2FA, TeamPass

More licences we sell, more products we develop in the future.
파일 보기 프로젝트 열기: nilsteampassnet/TeamPass 1 사용 예제들

공개 메소드들

메소드 설명
base32_decode ( $b32 ) Decodes a base32 string into a binary string.
generate_secret_key ( $length = 16 ) : string Generates a 16 digit secret key in base32 format
get_qr_code ( $username, $secret )
get_qr_code_url ( $username, $secret )
get_timestamp ( ) : integer Returns the current Unix Timestamp devided by the KEYREGENERATION period.
oath_hotp ( binary $key, integer $counter ) : string Takes the secret key and the timestamp and returns the one time password.
oath_truncate ( binary $hash ) : integer Extracts the OTP from the SHA1 hash.
verify_key ( string $b32seed, string $key, integer $window = 4, boolean $useTimeStamp = true ) : boolean Verifys a user inputted key against the current timestamp. Checks $window keys either side of the timestamp.

메소드 상세

base32_decode() 공개 메소드

Decodes a base32 string into a binary string.
public base32_decode ( $b32 )

generate_secret_key() 공개 메소드

Generates a 16 digit secret key in base32 format
public generate_secret_key ( $length = 16 ) : string
리턴 string

get_qr_code() 공개 메소드

public get_qr_code ( $username, $secret )

get_qr_code_url() 공개 메소드

public get_qr_code_url ( $username, $secret )

get_timestamp() 공개 메소드

Returns the current Unix Timestamp devided by the KEYREGENERATION period.
public get_timestamp ( ) : integer
리턴 integer

oath_hotp() 공개 메소드

Takes the secret key and the timestamp and returns the one time password.
public oath_hotp ( binary $key, integer $counter ) : string
$key binary - Secret key in binary form.
$counter integer - Timestamp as returned by get_timestamp.
리턴 string

oath_truncate() 공개 메소드

Extracts the OTP from the SHA1 hash.
public oath_truncate ( binary $hash ) : integer
$hash binary
리턴 integer

verify_key() 공개 메소드

Verifys a user inputted key against the current timestamp. Checks $window keys either side of the timestamp.
public verify_key ( string $b32seed, string $key, integer $window = 4, boolean $useTimeStamp = true ) : boolean
$b32seed string
$key string - User specified key
$window integer
$useTimeStamp boolean
리턴 boolean