Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct ($timeStep=30, $passCodeLength=6, $secretLength=10, $base32=null) | |
getPeriod ($time=null) | |
checkCode ($secret, $code) | |
getCode ($secret, $time=null) | |
getUrl ($user, $hostname, $secret) | |
generateSecret () | |
Fonctions membres protégées | |
hashToInt ($bytes, $start) | |
Attributs privés | |
$_passCodeLength = 6 | |
$_pinModulo | |
$_secretLength = 20 | |
$_timeStep = 30 | |
$_base32 = null | |
This class provides an RFC6238-compliant Time-based One Time Passwords, compatible with Google Authenticator (with PassCodeLength = 6 and TimePeriod = 30).
__construct | ( | $timeStep = 30 , |
|
$passCodeLength = 6 , |
|||
$secretLength = 10 , |
|||
$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.
int | $timeStep | The Time Step (in seconds). Use 30 to be compatible with Google Authenticator. |
int | $passCodeLength | The generated passcode length. Default: 6 digits. |
int | $secretLength | The length of the secret key. Default: 10 bytes (80 bits). |
Object | $base32 | The base32 en/decrypter |
checkCode | ( | $secret, | |
$code | |||
) |
Check is the given passcode $code is a valid TOTP generated using secret key $secret
string | $secret | The Base32-encoded secret key |
string | $code | The passcode to check |
Références $i.
generateSecret | ( | ) |
Generates a (semi-)random Secret Key for TOTP generation
getCode | ( | $secret, | |
$time = null |
|||
) |
Gets the TOTP passcode for a given secret key $secret and a given UNIX timestamp $time
string | $secret | The Base32-encoded secret key |
int | $time | UNIX timestamp |
Références $hash, et Joomla\Database\Query\$offset.
getPeriod | ( | $time = null | ) |
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.
int | null | $time | Timestamp |
getUrl | ( | $user, | |
$hostname, | |||
$secret | |||
) |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |