GoogleAuthenticatorLib
in package
implements
GoogleAuthenticatorInterface
Tags
Interfaces, Classes, Traits and Enums
Table of Contents
- $codePeriod : int
- $instanceTime : DateTimeInterface
- $passCodeLength : int
- $periodSize : int
- $pinModulo : int
- $secretLength : int
- __construct() : mixed
- checkCode() : bool
- generateSecret() : string
- getCode() : string
- NEXT_MAJOR: add the interface typehint to $time and remove deprecation.
- hashToInt() : int
Properties
$codePeriod
private
int
$codePeriod
$instanceTime
private
DateTimeInterface
$instanceTime
$passCodeLength
private
int
$passCodeLength
$periodSize
private
int
$periodSize
= 30
$pinModulo
private
int
$pinModulo
$secretLength
private
int
$secretLength
Methods
__construct()
public
__construct([int $passCodeLength = 6 ][, int $secretLength = 10 ][, DateTimeInterface|null $instanceTime = null ][, int $codePeriod = 30 ]) : mixed
Parameters
- $passCodeLength : int = 6
- $secretLength : int = 10
- $instanceTime : DateTimeInterface|null = null
- $codePeriod : int = 30
Return values
mixed —checkCode()
public
checkCode(string $secret, string $code[, int $discrepancy = 1 ]) : bool
Parameters
- $secret : string
- $code : string
- $discrepancy : int = 1
Return values
bool —generateSecret()
public
generateSecret() : string
Return values
string —getCode()
NEXT_MAJOR: add the interface typehint to $time and remove deprecation.
public
getCode(string $secret[, float|string|int|DateTimeInterface|null $time = null ]) : string
Parameters
- $secret : string
- $time : float|string|int|DateTimeInterface|null = null
Return values
string —hashToInt()
private
hashToInt(string $bytes, int $start) : int
Parameters
- $bytes : string
- $start : int