PHP Class OTPHP\TOTP

Inheritance: extends OTP, implements otphp\TOTPInterface
Show file Open project: spomky-labs/otphp Class Usage Examples

Public Methods

Method 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

Method 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 method

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 method

public at ( $timestamp )

getPeriod() public method

public getPeriod ( )

getProvisioningUri() public method

public getProvisioningUri ( )

now() public method

public now ( )

verify() public method

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