PHP Class OTPHP\TOTP

Inheritance: extends OTP, implements otphp\TOTPInterface
Afficher le fichier Open project: spomky-labs/otphp Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( string $label, string | null $secret = null, integer $period = 30, string $digest = 'sha1', integer $digits = 6 ) TOTP constructor.
at ( $timestamp )
getPeriod ( )
getProvisioningUri ( )
now ( )
verify ( $otp, $timestamp = null, $window = null ) If no timestamp is provided, the OTP is verified at the actual timestamp {@inheritdoc}

Private Methods

Méthode Description
getTimestamp ( integer | null $timestamp ) : integer
setPeriod ( integer $period ) : self
timecode ( integer $timestamp ) : integer
verifyOtpWithWindow ( string $otp, integer $timestamp, integer $window ) : boolean

Method Details

__construct() public méthode

TOTP constructor.
public __construct ( string $label, string | null $secret = null, integer $period = 30, string $digest = 'sha1', integer $digits = 6 )
$label string
$secret string | null
$period integer
$digest string
$digits integer

at() public méthode

public at ( $timestamp )

getPeriod() public méthode

public getPeriod ( )

getProvisioningUri() public méthode

public getProvisioningUri ( )

now() public méthode

public now ( )

verify() public méthode

If no timestamp is provided, the OTP is verified at the actual timestamp {@inheritdoc}
public verify ( $otp, $timestamp = null, $window = null )